forked from Mineclonia/Mineclonia
Merge pull request 'ITEMS/REDSTONE/mcl_comparators: Fix redstone comparator flooding crash' (#284) from fix-comparator-cauldron-water-crash into master
Reviewed-on: Mineclonia/Mineclonia#284 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
8810a24ce0
|
@ -43,14 +43,20 @@ end
|
||||||
|
|
||||||
local comparator_activate = function(pos, node)
|
local comparator_activate = function(pos, node)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
minetest.swap_node(pos, { name = def.comparator_onstate, param2 = node.param2 })
|
local onstate = def.comparator_onstate
|
||||||
|
if onstate then
|
||||||
|
minetest.swap_node(pos, { name = onstate, param2 = node.param2 })
|
||||||
|
end
|
||||||
minetest.after(0.1, comparator_turnon , {pos = pos, node = node})
|
minetest.after(0.1, comparator_turnon , {pos = pos, node = node})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local comparator_deactivate = function(pos, node)
|
local comparator_deactivate = function(pos, node)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
minetest.swap_node(pos, { name = def.comparator_offstate, param2 = node.param2 })
|
local offstate = def.comparator_offstate
|
||||||
|
if offstate then
|
||||||
|
minetest.swap_node(pos, { name = offstate, param2 = node.param2 })
|
||||||
|
end
|
||||||
minetest.after(0.1, comparator_turnoff, {pos = pos, node = node})
|
minetest.after(0.1, comparator_turnoff, {pos = pos, node = node})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -532,6 +532,11 @@ local function dir_to_rotation(dir)
|
||||||
return "0"
|
return "0"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_structures.generate_test_structure_comparator = function(pos, rotation, pr)
|
||||||
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_comparator.mts"
|
||||||
|
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
|
||||||
|
end
|
||||||
|
|
||||||
mcl_structures.generate_test_structure_fireproof = function(pos, rotation, pr)
|
mcl_structures.generate_test_structure_fireproof = function(pos, rotation, pr)
|
||||||
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_fireproof.mts"
|
local path = minetest.get_modpath("mcl_structures").."/schematics/mcl_structures_test_structure_fireproof.mts"
|
||||||
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
|
mcl_structures.place_schematic(pos, path, rotation, nil, true, nil, nil, pr)
|
||||||
|
@ -539,7 +544,7 @@ end
|
||||||
|
|
||||||
-- Debug command
|
-- Debug command
|
||||||
minetest.register_chatcommand("spawnstruct", {
|
minetest.register_chatcommand("spawnstruct", {
|
||||||
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_fireproof",
|
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_portal_shrine | test_structure_comparator | test_structure_fireproof",
|
||||||
description = S("Generate a pre-defined structure near your position."),
|
description = S("Generate a pre-defined structure near your position."),
|
||||||
privs = {debug = true},
|
privs = {debug = true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
@ -573,6 +578,8 @@ minetest.register_chatcommand("spawnstruct", {
|
||||||
mcl_structures.generate_end_exit_portal(pos, rot, pr)
|
mcl_structures.generate_end_exit_portal(pos, rot, pr)
|
||||||
elseif param == "end_portal_shrine" then
|
elseif param == "end_portal_shrine" then
|
||||||
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
|
||||||
|
elseif param == "test_structure_comparator" then
|
||||||
|
mcl_structures.generate_test_structure_comparator(pos, rot, pr)
|
||||||
elseif param == "test_structure_fireproof" then
|
elseif param == "test_structure_fireproof" then
|
||||||
mcl_structures.generate_test_structure_fireproof(pos, rot, pr)
|
mcl_structures.generate_test_structure_fireproof(pos, rot, pr)
|
||||||
elseif param == "" then
|
elseif param == "" then
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue