mirror of
https://github.com/minetest-mods/technic.git
synced 2025-02-23 07:10:19 +01:00
Machine conduct digilines downwards (#49)
* Custom digiline rules for machines * Add custom digiline receptor and effector rules for machines * technic.digiline.rules must be always available, even if digilines is disabled Co-authored-by: SX <sx@minetest>
This commit is contained in:
parent
f99148f2c4
commit
c8e5e800e8
@ -172,8 +172,12 @@ local mesecons = {
|
||||
}
|
||||
|
||||
local digiline_def = {
|
||||
receptor = {action = function() end},
|
||||
receptor = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function() end
|
||||
},
|
||||
effector = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function(pos, node, channel, msg)
|
||||
local meta = minetest.get_meta(pos)
|
||||
if channel ~= meta:get_string("channel") then
|
||||
@ -203,7 +207,7 @@ local digiline_def = {
|
||||
return
|
||||
end
|
||||
if msg.command == "get" then
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel, {
|
||||
digilines.receptor_send(pos, technic.digilines.rules, channel, {
|
||||
enabled = meta:get_int("enabled"),
|
||||
range = meta:get_int("range"),
|
||||
shape = meta:get_int("shape")
|
||||
|
@ -1,5 +1,19 @@
|
||||
local path = technic.modpath.."/machines"
|
||||
|
||||
technic.digilines = {
|
||||
rules = {
|
||||
-- digilines.rules.default
|
||||
{x= 1,y= 0,z= 0},{x=-1,y= 0,z= 0}, -- along x beside
|
||||
{x= 0,y= 0,z= 1},{x= 0,y= 0,z=-1}, -- along z beside
|
||||
{x= 1,y= 1,z= 0},{x=-1,y= 1,z= 0}, -- 1 node above along x diagonal
|
||||
{x= 0,y= 1,z= 1},{x= 0,y= 1,z=-1}, -- 1 node above along z diagonal
|
||||
{x= 1,y=-1,z= 0},{x=-1,y=-1,z= 0}, -- 1 node below along x diagonal
|
||||
{x= 0,y=-1,z= 1},{x= 0,y=-1,z=-1}, -- 1 node below along z diagonal
|
||||
-- added rules for digi cable
|
||||
{x = 0, y = -1, z = 0}, -- along y below
|
||||
}
|
||||
}
|
||||
|
||||
dofile(path.."/register/init.lua")
|
||||
|
||||
-- Tiers
|
||||
|
@ -358,8 +358,12 @@ function technic.register_battery_box(data)
|
||||
end
|
||||
end,
|
||||
digiline = {
|
||||
receptor = {action = function() end},
|
||||
receptor = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function() end
|
||||
},
|
||||
effector = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function(pos, node, channel, msg)
|
||||
if msg ~= "GET" and msg ~= "get" then
|
||||
return
|
||||
@ -369,7 +373,7 @@ function technic.register_battery_box(data)
|
||||
return
|
||||
end
|
||||
local inv = meta:get_inventory()
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel, {
|
||||
digilines.receptor_send(pos, technic.digilines.rules, channel, {
|
||||
demand = meta:get_int(tier.."_EU_demand"),
|
||||
supply = meta:get_int(tier.."_EU_supply"),
|
||||
input = meta:get_int(tier.."_EU_input"),
|
||||
|
@ -69,8 +69,12 @@ local mesecons = {
|
||||
|
||||
|
||||
local digiline_def = {
|
||||
receptor = {action = function() end},
|
||||
receptor = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function() end
|
||||
},
|
||||
effector = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function(pos, node, channel, msg)
|
||||
if type(msg) ~= "string" then
|
||||
return
|
||||
@ -81,7 +85,7 @@ local digiline_def = {
|
||||
end
|
||||
msg = msg:lower()
|
||||
if msg == "get" then
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel, {
|
||||
digilines.receptor_send(pos, technic.digilines.rules, channel, {
|
||||
enabled = meta:get_int("enabled"),
|
||||
power = meta:get_int("power"),
|
||||
mesecon_mode = meta:get_int("mesecon_mode")
|
||||
|
@ -69,8 +69,12 @@ minetest.register_node("technic:switching_station",{
|
||||
end,
|
||||
mesecons = mesecon_def,
|
||||
digiline = {
|
||||
receptor = {action = function() end},
|
||||
receptor = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function() end
|
||||
},
|
||||
effector = {
|
||||
rules = technic.digilines.rules,
|
||||
action = function(pos, node, channel, msg)
|
||||
if msg ~= "GET" and msg ~= "get" then
|
||||
return
|
||||
@ -79,7 +83,7 @@ minetest.register_node("technic:switching_station",{
|
||||
if channel ~= meta:get_string("channel") then
|
||||
return
|
||||
end
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel, {
|
||||
digilines.receptor_send(pos, technic.digilines.rules, channel, {
|
||||
supply = meta:get_int("supply"),
|
||||
demand = meta:get_int("demand")
|
||||
})
|
||||
@ -367,7 +371,7 @@ technic.switching_station_run = function(pos)
|
||||
if PR_eu_supply ~= meta:get_int("supply") or
|
||||
RE_eu_demand ~= meta:get_int("demand") then
|
||||
local channel = meta:get_string("channel")
|
||||
digilines.receptor_send(pos, digilines.rules.default, channel, {
|
||||
digilines.receptor_send(pos, technic.digilines.rules, channel, {
|
||||
supply = PR_eu_supply,
|
||||
demand = RE_eu_demand
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user