mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-01 06:51:10 +01:00
Fix sloped power,activator and detector rails, remove debug print
This commit is contained in:
parent
b0fff9f3e9
commit
fba49df2f0
2 changed files with 54 additions and 16 deletions
|
@ -149,7 +149,6 @@ function DEFAULT_CART_DEF:_mcl_entity_invs_load_items()
|
||||||
end
|
end
|
||||||
function DEFAULT_CART_DEF:_mcl_entity_invs_save_items(items)
|
function DEFAULT_CART_DEF:_mcl_entity_invs_save_items(items)
|
||||||
local staticdata = self._staticdata
|
local staticdata = self._staticdata
|
||||||
print("Saving entity inventory items="..dump(items))
|
|
||||||
staticdata.inventory = table.copy(items)
|
staticdata.inventory = table.copy(items)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -261,11 +261,12 @@ function mod.register_straight_rail(base_name, tiles, def)
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Sloped variant
|
-- Sloped variant
|
||||||
mod.register_rail_sloped(base_name.."_sloped", table_merge(table.copy(base_def),{
|
mod.register_rail_sloped(base_name.."_sloped", table_merge(table.copy(sloped_def),{
|
||||||
description = S("Sloped Rail"), -- Temporary name to make debugging easier
|
description = S("Sloped Rail"), -- Temporary name to make debugging easier
|
||||||
_mcl_minecarts = {
|
_mcl_minecarts = {
|
||||||
get_next_dir = rail_dir_sloped,
|
get_next_dir = rail_dir_sloped,
|
||||||
},
|
},
|
||||||
|
mesecons = def.mesecons_sloped,
|
||||||
tiles = { tiles[1] },
|
tiles = { tiles[1] },
|
||||||
_mcl_minecarts = {
|
_mcl_minecarts = {
|
||||||
railtype = "sloped",
|
railtype = "sloped",
|
||||||
|
@ -448,6 +449,14 @@ mod.register_straight_rail("mcl_minecarts:golden_rail_v2",{ "mcl_minecarts_rail_
|
||||||
rules = rail_rules_long,
|
rules = rail_rules_long,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mesecons_sloped = {
|
||||||
|
conductor = {
|
||||||
|
state = mesecon.state.off,
|
||||||
|
offstate = "mcl_minecarts:golden_rail_v2_sloepd",
|
||||||
|
onstate = "mcl_minecarts:golden_rail_v2_on_sloped",
|
||||||
|
rules = rail_rules_long,
|
||||||
|
},
|
||||||
|
},
|
||||||
drop = "mcl_minecarts:golden_rail_v2",
|
drop = "mcl_minecarts:golden_rail_v2",
|
||||||
craft = {
|
craft = {
|
||||||
output = "mcl_minecarts:golden_rail_v2 6",
|
output = "mcl_minecarts:golden_rail_v2 6",
|
||||||
|
@ -475,6 +484,14 @@ mod.register_straight_rail("mcl_minecarts:golden_rail_v2_on",{ "mcl_minecarts_ra
|
||||||
rules = rail_rules_long,
|
rules = rail_rules_long,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mesecons_sloped = {
|
||||||
|
conductor = {
|
||||||
|
state = mesecon.state.on,
|
||||||
|
offstate = "mcl_minecarts:golden_rail_v2_sloped",
|
||||||
|
onstate = "mcl_minecarts:golden_rail_v2_on_sloped",
|
||||||
|
rules = rail_rules_long,
|
||||||
|
},
|
||||||
|
},
|
||||||
drop = "mcl_minecarts:golden_rail_v2",
|
drop = "mcl_minecarts:golden_rail_v2",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -492,6 +509,14 @@ mod.register_straight_rail("mcl_minecarts:activator_rail_v2", {"mcl_minecarts_ra
|
||||||
rules = rail_rules_long,
|
rules = rail_rules_long,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mesecons_sloped = {
|
||||||
|
conductor = {
|
||||||
|
state = mesecon.state.off,
|
||||||
|
offstate = "mcl_minecarts:activator_rail_v2_sloped",
|
||||||
|
onstate = "mcl_minecarts:activator_rail_v2_on_sloped",
|
||||||
|
rules = rail_rules_long,
|
||||||
|
},
|
||||||
|
},
|
||||||
craft = {
|
craft = {
|
||||||
output = "mcl_minecarts:activator_rail_v2 6",
|
output = "mcl_minecarts:activator_rail_v2 6",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -503,6 +528,16 @@ mod.register_straight_rail("mcl_minecarts:activator_rail_v2", {"mcl_minecarts_ra
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Activator rail (on)
|
-- Activator rail (on)
|
||||||
|
local function activator_rail_action_on(pos, node)
|
||||||
|
local pos2 = { x = pos.x, y =pos.y + 1, z = pos.z }
|
||||||
|
local objs = minetest.get_objects_inside_radius(pos2, 1)
|
||||||
|
for _, o in pairs(objs) do
|
||||||
|
local l = o:get_luaentity()
|
||||||
|
if l and string.sub(l.name, 1, 14) == "mcl_minecarts:" and l.on_activate_by_rail then
|
||||||
|
l:on_activate_by_rail()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
mod.register_straight_rail("mcl_minecarts:activator_rail_v2_on", {"mcl_minecarts_rail_activator_powered.png"},{
|
mod.register_straight_rail("mcl_minecarts:activator_rail_v2_on", {"mcl_minecarts_rail_activator_powered.png"},{
|
||||||
_doc_items_create_entry = false,
|
_doc_items_create_entry = false,
|
||||||
groups = {
|
groups = {
|
||||||
|
@ -517,16 +552,20 @@ mod.register_straight_rail("mcl_minecarts:activator_rail_v2_on", {"mcl_minecarts
|
||||||
},
|
},
|
||||||
effector = {
|
effector = {
|
||||||
-- Activate minecarts
|
-- Activate minecarts
|
||||||
action_on = function(pos, node)
|
action_on = activator_rail_action_on,
|
||||||
local pos2 = { x = pos.x, y =pos.y + 1, z = pos.z }
|
},
|
||||||
local objs = minetest.get_objects_inside_radius(pos2, 1)
|
|
||||||
for _, o in pairs(objs) do
|
},
|
||||||
local l = o:get_luaentity()
|
mesecons_sloped = {
|
||||||
if l and string.sub(l.name, 1, 14) == "mcl_minecarts:" and l.on_activate_by_rail then
|
conductor = {
|
||||||
l:on_activate_by_rail()
|
state = mesecon.state.on,
|
||||||
end
|
offstate = "mcl_minecarts:activator_rail_v2_sloped",
|
||||||
end
|
onstate = "mcl_minecarts:activator_rail_v2_on_sloped",
|
||||||
end,
|
rules = rail_rules_long,
|
||||||
|
},
|
||||||
|
effector = {
|
||||||
|
-- Activate minecarts
|
||||||
|
action_on = activator_rail_action_on,
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue