1
0
Fork 0

Fix unwanted group table changes in fences API

objects
Wuzzy 2017-03-01 02:04:55 +01:00
parent 9595377011
commit c695cf2fec
1 changed files with 16 additions and 13 deletions

View File

@ -21,9 +21,10 @@ local cz2 = {-2/16, -1/2+6/16, 2/16, 2/16, 1, 1/2} --unten(quer) z
mcl_fences = {} mcl_fences = {}
mcl_fences.register_fence = function(id, fence_name, texture, groups, hardness, blast_resistance, connects_to, sounds) mcl_fences.register_fence = function(id, fence_name, texture, groups, hardness, blast_resistance, connects_to, sounds)
if groups == nil then groups = {} end local cgroups = table.copy(groups)
groups.fence = 1 if cgroups == nil then cgroups = {} end
groups.deco_block = 1 cgroups.fence = 1
cgroups.deco_block = 1
if connects_to == nil then connects_to = {} end if connects_to == nil then connects_to = {} end
local fence_id = minetest.get_current_modname()..":"..id local fence_id = minetest.get_current_modname()..":"..id
table.insert(connects_to, "group:solid") table.insert(connects_to, "group:solid")
@ -36,7 +37,7 @@ mcl_fences.register_fence = function(id, fence_name, texture, groups, hardness,
wield_image = "mcl_fences_fence_mask.png^" .. texture .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126", wield_image = "mcl_fences_fence_mask.png^" .. texture .. "^mcl_fences_fence_mask.png^[makealpha:255,126,126",
paramtype = "light", paramtype = "light",
is_ground_content = false, is_ground_content = false,
groups = groups, groups = cgroups,
stack_max = 64, stack_max = 64,
sunlight_propagates = true, sunlight_propagates = true,
drawtype = "nodebox", drawtype = "nodebox",
@ -105,12 +106,13 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
meta2:set_int("state", state2) meta2:set_int("state", state2)
end end
if groups == nil then groups = {} end local cgroups = table.copy(groups)
groups.fence_gate = 1 if cgroups == nil then cgroups = {} end
groups.deco_block = 1 cgroups.fence_gate = 1
cgroups.deco_block = 1
groups.mesecon_effector_on = 1 cgroups.mesecon_effector_on = 1
groups.fence_gate = 1 cgroups.fence_gate = 1
minetest.register_node(open_gate_id, { minetest.register_node(open_gate_id, {
tiles = {texture}, tiles = {texture},
paramtype = "light", paramtype = "light",
@ -120,7 +122,7 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
is_ground_content = false, is_ground_content = false,
sunlight_propagates = true, sunlight_propagates = true,
walkable = true, walkable = true,
groups = groups, groups = cgroups,
drop = gate_id, drop = gate_id,
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
@ -155,8 +157,9 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
_mcl_hardness = hardness, _mcl_hardness = hardness,
}) })
groups.mesecon_effector_on = nil local cgroups_closed = table.copy(cgroups)
groups.mesecon_effector_off = nil cgroups_closed.mesecon_effector_on = nil
cgroups_closed.mesecon_effector_off = nil
minetest.register_node(gate_id, { minetest.register_node(gate_id, {
description = fence_gate_name, description = fence_gate_name,
tiles = {texture}, tiles = {texture},
@ -168,7 +171,7 @@ mcl_fences.register_fence_gate = function(id, fence_gate_name, texture, groups,
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
walkable = true, walkable = true,
groups = groups, groups = cgroups_closed,
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {
type = "fixed", type = "fixed",