mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-10 01:13:57 +01:00
Fix indentation and coding style
This commit is contained in:
parent
95aac90b67
commit
27f3a8ab31
37
tubes.lua
37
tubes.lua
@ -226,7 +226,7 @@ local inv_texture="pipeworks_tube_inv.png"
|
|||||||
|
|
||||||
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment", plain_textures, noctr_textures, end_textures, short_texture, inv_texture)
|
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment", plain_textures, noctr_textures, end_textures, short_texture, inv_texture)
|
||||||
|
|
||||||
|
if pipeworks.enable_mese_tube then
|
||||||
local mese_noctr_textures = {"pipeworks_mese_tube_noctr_1.png","pipeworks_mese_tube_noctr_2.png","pipeworks_mese_tube_noctr_3.png",
|
local mese_noctr_textures = {"pipeworks_mese_tube_noctr_1.png","pipeworks_mese_tube_noctr_2.png","pipeworks_mese_tube_noctr_3.png",
|
||||||
"pipeworks_mese_tube_noctr_4.png","pipeworks_mese_tube_noctr_5.png","pipeworks_mese_tube_noctr_6.png"}
|
"pipeworks_mese_tube_noctr_4.png","pipeworks_mese_tube_noctr_5.png","pipeworks_mese_tube_noctr_6.png"}
|
||||||
local mese_plain_textures = {"pipeworks_mese_tube_plain_1.png","pipeworks_mese_tube_plain_2.png","pipeworks_mese_tube_plain_3.png",
|
local mese_plain_textures = {"pipeworks_mese_tube_plain_1.png","pipeworks_mese_tube_plain_2.png","pipeworks_mese_tube_plain_3.png",
|
||||||
@ -235,12 +235,10 @@ local mese_end_textures={"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.
|
|||||||
"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png"}
|
"pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png","pipeworks_mese_tube_end.png"}
|
||||||
local mese_short_texture = "pipeworks_mese_tube_short.png"
|
local mese_short_texture = "pipeworks_mese_tube_short.png"
|
||||||
local mese_inv_texture = "pipeworks_mese_tube_inv.png"
|
local mese_inv_texture = "pipeworks_mese_tube_inv.png"
|
||||||
|
|
||||||
if pipeworks.enable_mese_tube then
|
|
||||||
pipeworks.register_tube("pipeworks:mese_tube", "Mese pneumatic tube segment", mese_plain_textures, mese_noctr_textures,
|
pipeworks.register_tube("pipeworks:mese_tube", "Mese pneumatic tube segment", mese_plain_textures, mese_noctr_textures,
|
||||||
mese_end_textures, mese_short_texture, mese_inv_texture,
|
mese_end_textures, mese_short_texture, mese_inv_texture,
|
||||||
{tube = {can_go = function(pos, node, velocity, stack)
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
tbl={}
|
local tbl = {}
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local found = false
|
local found = false
|
||||||
@ -299,6 +297,7 @@ if pipeworks.enable_mese_tube then
|
|||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local i
|
local i
|
||||||
|
if fields.quit then return end
|
||||||
for key, _ in pairs(fields) do i = key end
|
for key, _ in pairs(fields) do i = key end
|
||||||
if i == nil then return end
|
if i == nil then return end
|
||||||
i = string.sub(i,-1)
|
i = string.sub(i,-1)
|
||||||
@ -329,7 +328,7 @@ if pipeworks.enable_mese_tube then
|
|||||||
meta:set_string("formspec", frm)
|
meta:set_string("formspec", frm)
|
||||||
end,
|
end,
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return (inv:is_empty("line1") and inv:is_empty("line2") and inv:is_empty("line3") and
|
return (inv:is_empty("line1") and inv:is_empty("line2") and inv:is_empty("line3") and
|
||||||
inv:is_empty("line4") and inv:is_empty("line5") and inv:is_empty("line6"))
|
inv:is_empty("line4") and inv:is_empty("line5") and inv:is_empty("line6"))
|
||||||
@ -338,11 +337,9 @@ if pipeworks.enable_mese_tube then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_detector_tube then
|
if pipeworks.enable_detector_tube then
|
||||||
|
|
||||||
local detector_plain_textures = {"pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png",
|
local detector_plain_textures = {"pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png",
|
||||||
"pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png"}
|
"pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png"}
|
||||||
local detector_inv_texture = "pipeworks_detector_tube_inv.png"
|
local detector_inv_texture = "pipeworks_detector_tube_inv.png"
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:detector_tube_on", "Detector tube segment on (you hacker you)", detector_plain_textures, noctr_textures,
|
pipeworks.register_tube("pipeworks:detector_tube_on", "Detector tube segment on (you hacker you)", detector_plain_textures, noctr_textures,
|
||||||
end_textures, short_texture, detector_inv_texture,
|
end_textures, short_texture, detector_inv_texture,
|
||||||
{tube = {can_go = function(pos, node, velocity, stack)
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
@ -354,7 +351,7 @@ if pipeworks.enable_detector_tube then
|
|||||||
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
||||||
end},
|
end},
|
||||||
groups = {mesecon = 2, not_in_creative_inventory = 1},
|
groups = {mesecon = 2, not_in_creative_inventory = 1},
|
||||||
drop="pipeworks:detector_tube_off_000000",
|
drop = "pipeworks:detector_tube_off_1",
|
||||||
mesecons = {receptor = {state = "on",
|
mesecons = {receptor = {state = "on",
|
||||||
rules = pipeworks.mesecons_rules}},
|
rules = pipeworks.mesecons_rules}},
|
||||||
item_exit = function(pos)
|
item_exit = function(pos)
|
||||||
@ -374,7 +371,6 @@ if pipeworks.enable_detector_tube then
|
|||||||
local name = minetest.get_node(pos).name
|
local name = minetest.get_node(pos).name
|
||||||
minetest.after(0.1, minetest.registered_nodes[name].item_exit,pos)
|
minetest.after(0.1, minetest.registered_nodes[name].item_exit,pos)
|
||||||
end})
|
end})
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:detector_tube_off", "Detector tube segment", detector_plain_textures, noctr_textures,
|
pipeworks.register_tube("pipeworks:detector_tube_off", "Detector tube segment", detector_plain_textures, noctr_textures,
|
||||||
end_textures, short_texture, detector_inv_texture,
|
end_textures, short_texture, detector_inv_texture,
|
||||||
{tube = {can_go = function(pos, node, velocity, stack)
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
@ -389,6 +385,7 @@ if pipeworks.enable_detector_tube then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if pipeworks.enable_conductor_tube then
|
||||||
local conductor_plain_textures = {"pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png",
|
local conductor_plain_textures = {"pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png",
|
||||||
"pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png"}
|
"pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png", "pipeworks_conductor_tube_plain.png"}
|
||||||
local conductor_noctr_textures = {"pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png",
|
local conductor_noctr_textures = {"pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png", "pipeworks_conductor_tube_noctr.png",
|
||||||
@ -405,7 +402,6 @@ local conductor_on_noctr_textures={"pipeworks_conductor_tube_on_noctr.png","pipe
|
|||||||
local conductor_on_end_textures = {"pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png",
|
local conductor_on_end_textures = {"pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png",
|
||||||
"pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png"}
|
"pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png", "pipeworks_conductor_tube_on_end.png"}
|
||||||
|
|
||||||
if pipeworks.enable_conductor_tube then
|
|
||||||
pipeworks.register_tube("pipeworks:conductor_tube_off", "Conductor tube segment", conductor_plain_textures, conductor_noctr_textures,
|
pipeworks.register_tube("pipeworks:conductor_tube_off", "Conductor tube segment", conductor_plain_textures, conductor_noctr_textures,
|
||||||
conductor_end_textures, conductor_short_texture, conductor_inv_texture,
|
conductor_end_textures, conductor_short_texture, conductor_inv_texture,
|
||||||
{groups = {mesecon = 2},
|
{groups = {mesecon = 2},
|
||||||
@ -417,13 +413,14 @@ if pipeworks.enable_conductor_tube then
|
|||||||
pipeworks.register_tube("pipeworks:conductor_tube_on", "Conductor tube segment on (you hacker you)", conductor_on_plain_textures, conductor_on_noctr_textures,
|
pipeworks.register_tube("pipeworks:conductor_tube_on", "Conductor tube segment on (you hacker you)", conductor_on_plain_textures, conductor_on_noctr_textures,
|
||||||
conductor_on_end_textures, conductor_short_texture, conductor_inv_texture,
|
conductor_on_end_textures, conductor_short_texture, conductor_inv_texture,
|
||||||
{groups = {mesecon = 2, not_in_creative_inventory = 1},
|
{groups = {mesecon = 2, not_in_creative_inventory = 1},
|
||||||
drop="pipeworks:conductor_tube_off_000000",
|
drop = "pipeworks:conductor_tube_off_1",
|
||||||
mesecons = {conductor = {state = "on",
|
mesecons = {conductor = {state = "on",
|
||||||
rules = pipeworks.mesecons_rules,
|
rules = pipeworks.mesecons_rules,
|
||||||
offstate = "pipeworks:conductor_tube_off_#id"}}
|
offstate = "pipeworks:conductor_tube_off_#id"}}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if pipeworks.enable_accelerator_tube then
|
||||||
local accelerator_noctr_textures = {"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png",
|
local accelerator_noctr_textures = {"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png",
|
||||||
"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png"}
|
"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png"}
|
||||||
local accelerator_plain_textures = {"pipeworks_accelerator_tube_plain.png" ,"pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png",
|
local accelerator_plain_textures = {"pipeworks_accelerator_tube_plain.png" ,"pipeworks_accelerator_tube_plain.png", "pipeworks_accelerator_tube_plain.png",
|
||||||
@ -433,7 +430,6 @@ local accelerator_end_textures={"pipeworks_accelerator_tube_end.png","pipeworks_
|
|||||||
local accelerator_short_texture = "pipeworks_accelerator_tube_short.png"
|
local accelerator_short_texture = "pipeworks_accelerator_tube_short.png"
|
||||||
local accelerator_inv_texture = "pipeworks_accelerator_tube_inv.png"
|
local accelerator_inv_texture = "pipeworks_accelerator_tube_inv.png"
|
||||||
|
|
||||||
if pipeworks.enable_accelerator_tube then
|
|
||||||
pipeworks.register_tube("pipeworks:accelerator_tube", "Accelerator pneumatic tube segment", accelerator_plain_textures,
|
pipeworks.register_tube("pipeworks:accelerator_tube", "Accelerator pneumatic tube segment", accelerator_plain_textures,
|
||||||
accelerator_noctr_textures, accelerator_end_textures, accelerator_short_texture, accelerator_inv_texture,
|
accelerator_noctr_textures, accelerator_end_textures, accelerator_short_texture, accelerator_inv_texture,
|
||||||
{tube = {can_go = function(pos, node, velocity, stack)
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
@ -444,6 +440,7 @@ if pipeworks.enable_accelerator_tube then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if pipeworks.enable_crossing_tube then
|
if pipeworks.enable_crossing_tube then
|
||||||
|
-- FIXME: The textures are not the correct ones
|
||||||
pipeworks.register_tube("pipeworks:crossing_tube", "Crossing tube segment", accelerator_plain_textures,
|
pipeworks.register_tube("pipeworks:crossing_tube", "Crossing tube segment", accelerator_plain_textures,
|
||||||
accelerator_noctr_textures, accelerator_end_textures, accelerator_short_texture, accelerator_inv_texture,
|
accelerator_noctr_textures, accelerator_end_textures, accelerator_short_texture, accelerator_inv_texture,
|
||||||
{tube = {can_go = function(pos, node, velocity, stack)
|
{tube = {can_go = function(pos, node, velocity, stack)
|
||||||
@ -452,6 +449,7 @@ if pipeworks.enable_crossing_tube then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if pipeworks.enable_sand_tube then
|
||||||
local sand_noctr_textures = {"pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png",
|
local sand_noctr_textures = {"pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png",
|
||||||
"pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png"}
|
"pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png", "pipeworks_sand_tube_noctr.png"}
|
||||||
local sand_plain_textures = {"pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png",
|
local sand_plain_textures = {"pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png", "pipeworks_sand_tube_plain.png",
|
||||||
@ -461,12 +459,13 @@ local sand_end_textures={"pipeworks_sand_tube_end.png","pipeworks_sand_tube_end.
|
|||||||
local sand_short_texture = "pipeworks_sand_tube_short.png"
|
local sand_short_texture = "pipeworks_sand_tube_short.png"
|
||||||
local sand_inv_texture = "pipeworks_sand_tube_inv.png"
|
local sand_inv_texture = "pipeworks_sand_tube_inv.png"
|
||||||
|
|
||||||
if pipeworks.enable_sand_tube then
|
|
||||||
pipeworks.register_tube("pipeworks:sand_tube", "Sand pneumatic tube segment", sand_plain_textures, sand_noctr_textures, sand_end_textures,
|
pipeworks.register_tube("pipeworks:sand_tube", "Sand pneumatic tube segment", sand_plain_textures, sand_noctr_textures, sand_end_textures,
|
||||||
sand_short_texture, sand_inv_texture,
|
sand_short_texture, sand_inv_texture,
|
||||||
{groups = {sand_tube = 1}})
|
{groups = {sand_tube = 1}})
|
||||||
|
|
||||||
minetest.register_abm({nodenames={"group:sand_tube"},interval=1,chance=1,
|
minetest.register_abm({nodenames = {"group:sand_tube"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
for _, object in ipairs(minetest.get_objects_inside_radius(pos, 2)) do
|
for _, object in ipairs(minetest.get_objects_inside_radius(pos, 2)) do
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
@ -484,6 +483,7 @@ if pipeworks.enable_sand_tube then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if pipeworks.enable_mese_sand_tube then
|
||||||
local mese_sand_noctr_textures = {"pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png",
|
local mese_sand_noctr_textures = {"pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png",
|
||||||
"pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png"}
|
"pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png", "pipeworks_mese_sand_tube_noctr.png"}
|
||||||
local mese_sand_plain_textures = {"pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png",
|
local mese_sand_plain_textures = {"pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png", "pipeworks_mese_sand_tube_plain.png",
|
||||||
@ -493,9 +493,8 @@ local mese_sand_end_textures={"pipeworks_mese_sand_tube_end.png","pipeworks_mese
|
|||||||
local mese_sand_short_texture = "pipeworks_mese_sand_tube_short.png"
|
local mese_sand_short_texture = "pipeworks_mese_sand_tube_short.png"
|
||||||
local mese_sand_inv_texture = "pipeworks_mese_sand_tube_inv.png"
|
local mese_sand_inv_texture = "pipeworks_mese_sand_tube_inv.png"
|
||||||
|
|
||||||
if pipeworks.enable_mese_sand_tube then
|
pipeworks.register_tube("pipeworks:mese_sand_tube", "Mese sand pneumatic tube segment", mese_sand_plain_textures, mese_sand_noctr_textures,
|
||||||
pipeworks.register_tube("pipeworks:mese_sand_tube","Mese sand pneumatic tube segment",mese_sand_plain_textures,mese_sand_noctr_textures,mese_sand_end_textures,
|
mese_sand_end_textures, mese_sand_short_texture,mese_sand_inv_texture,
|
||||||
mese_sand_short_texture,mese_sand_inv_texture,
|
|
||||||
{groups = {mese_sand_tube = 1},
|
{groups = {mese_sand_tube = 1},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
@ -527,7 +526,9 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
return objs
|
return objs
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_abm({nodenames={"group:mese_sand_tube"},interval=1,chance=1,
|
minetest.register_abm({nodenames = {"group:mese_sand_tube"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
for _,object in ipairs(get_objects_with_square_radius(pos, minetest.env:get_meta(pos):get_int("dist"))) do
|
for _,object in ipairs(get_objects_with_square_radius(pos, minetest.env:get_meta(pos):get_int("dist"))) do
|
||||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == "__builtin:item" then
|
||||||
|
Loading…
Reference in New Issue
Block a user