mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 06:11:47 +02:00
Removed whitespaces
This commit is contained in:
@ -238,24 +238,24 @@ local function upgrade_autocrafter(pos, meta)
|
||||
end
|
||||
|
||||
minetest.register_node("pipeworks:autocrafter", {
|
||||
description = "Autocrafter",
|
||||
drawtype = "normal",
|
||||
tiles = {"pipeworks_autocrafter.png"},
|
||||
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
||||
description = "Autocrafter",
|
||||
drawtype = "normal",
|
||||
tiles = {"pipeworks_autocrafter.png"},
|
||||
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
||||
tube = {insert_object = function(pos, node, stack, direction)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local added = inv:add_item("src", stack)
|
||||
after_inventory_change(pos)
|
||||
return added
|
||||
end,
|
||||
end,
|
||||
can_insert = function(pos, node, stack, direction)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:room_for_item("src", stack)
|
||||
end,
|
||||
input_inventory = "dst",
|
||||
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1}},
|
||||
end,
|
||||
input_inventory = "dst",
|
||||
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1}},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
@ -282,7 +282,7 @@ minetest.register_node("pipeworks:autocrafter", {
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return (inv:is_empty("src") and inv:is_empty("dst"))
|
||||
end,
|
||||
end,
|
||||
after_place_node = pipeworks.scan_for_tube_objects,
|
||||
after_dig_node = function(pos)
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
|
@ -67,10 +67,10 @@ for s in ipairs(states) do
|
||||
drop = "pipeworks:pump_off",
|
||||
mesecons = {effector = {
|
||||
action_on = function (pos, node)
|
||||
minetest.add_node(pos,{name="pipeworks:pump_on", param2 = node.param2})
|
||||
minetest.add_node(pos,{name="pipeworks:pump_on", param2 = node.param2})
|
||||
end,
|
||||
action_off = function (pos, node)
|
||||
minetest.add_node(pos,{name="pipeworks:pump_off", param2 = node.param2})
|
||||
minetest.add_node(pos,{name="pipeworks:pump_off", param2 = node.param2})
|
||||
end
|
||||
}},
|
||||
on_punch = function(pos, node, puncher)
|
||||
@ -78,7 +78,7 @@ for s in ipairs(states) do
|
||||
minetest.add_node(pos, { name = "pipeworks:pump_"..states[3-s], param2 = fdir })
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("pipeworks:valve_"..states[s].."_empty", {
|
||||
description = "Valve",
|
||||
drawtype = "mesh",
|
||||
@ -107,10 +107,10 @@ for s in ipairs(states) do
|
||||
drop = "pipeworks:valve_off_empty",
|
||||
mesecons = {effector = {
|
||||
action_on = function (pos, node)
|
||||
minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
|
||||
minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
|
||||
end,
|
||||
action_off = function (pos, node)
|
||||
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
|
||||
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
|
||||
end
|
||||
}},
|
||||
on_punch = function(pos, node, puncher)
|
||||
@ -148,10 +148,10 @@ minetest.register_node("pipeworks:valve_on_loaded", {
|
||||
drop = "pipeworks:valve_off_empty",
|
||||
mesecons = {effector = {
|
||||
action_on = function (pos, node)
|
||||
minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
|
||||
minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
|
||||
end,
|
||||
action_off = function (pos, node)
|
||||
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
|
||||
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
|
||||
end
|
||||
}},
|
||||
on_punch = function(pos, node, puncher)
|
||||
@ -284,7 +284,7 @@ minetest.register_node("pipeworks:entry_panel_empty", {
|
||||
collision_box = panel_cbox,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local playername = placer:get_player_name()
|
||||
if not minetest.is_protected(pointed_thing.under, playername)
|
||||
if not minetest.is_protected(pointed_thing.under, playername)
|
||||
and not minetest.is_protected(pointed_thing.above, playername) then
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
|
||||
@ -376,7 +376,7 @@ minetest.register_node("pipeworks:flow_sensor_empty", {
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
if mesecon then
|
||||
mesecon.receptor_off(pos, rules)
|
||||
mesecon.receptor_off(pos, rules)
|
||||
end
|
||||
end,
|
||||
selection_box = {
|
||||
@ -415,7 +415,7 @@ minetest.register_node("pipeworks:flow_sensor_loaded", {
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
if mesecon then
|
||||
mesecon.receptor_on(pos, rules)
|
||||
mesecon.receptor_on(pos, rules)
|
||||
end
|
||||
end,
|
||||
selection_box = {
|
||||
@ -522,7 +522,7 @@ minetest.register_node("pipeworks:fountainhead", {
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
if mesecon then
|
||||
mesecon.receptor_on(pos, rules)
|
||||
mesecon.receptor_on(pos, rules)
|
||||
end
|
||||
end,
|
||||
selection_box = {
|
||||
@ -553,7 +553,7 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
|
||||
end,
|
||||
on_construct = function(pos)
|
||||
if mesecon then
|
||||
mesecon.receptor_on(pos, rules)
|
||||
mesecon.receptor_on(pos, rules)
|
||||
end
|
||||
end,
|
||||
selection_box = {
|
||||
|
@ -46,8 +46,8 @@ pipeworks.check_for_inflows = function(pos,node)
|
||||
source = {x=coords[i].x,y=coords[i].y,z=coords[i].z}
|
||||
end
|
||||
end
|
||||
if newnode then
|
||||
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
||||
if newnode then
|
||||
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
||||
minetest.get_meta(pos):set_string("source",minetest.pos_to_string(source))
|
||||
end
|
||||
end
|
||||
@ -61,15 +61,15 @@ pipeworks.check_sources = function(pos,node)
|
||||
newnode = string.gsub(node.name,"loaded","empty")
|
||||
end
|
||||
|
||||
if newnode then
|
||||
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
||||
if newnode then
|
||||
minetest.add_node(pos,{name=newnode, param2 = node.param2})
|
||||
minetest.get_meta(pos):set_string("source","")
|
||||
end
|
||||
end
|
||||
|
||||
pipeworks.spigot_check = function(pos, node)
|
||||
local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
|
||||
if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
|
||||
if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
|
||||
local spigotname = minetest.get_node(pos).name
|
||||
local fdir=node.param2
|
||||
local check = {
|
||||
@ -99,7 +99,7 @@ end
|
||||
|
||||
pipeworks.fountainhead_check = function(pos, node)
|
||||
local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
|
||||
if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then
|
||||
if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then
|
||||
local fountainhead_name = minetest.get_node(pos).name
|
||||
local near_node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||
if near_node and string.find(near_node.name, "_loaded") then
|
||||
|
@ -77,7 +77,7 @@ local function go_next(pos, velocity, stack)
|
||||
if not next_positions[1] then
|
||||
return false, nil
|
||||
end
|
||||
|
||||
|
||||
local n = (cmeta:get_int("tubedir") % (#next_positions)) + 1
|
||||
if pipeworks.enable_cyclic_mode then
|
||||
cmeta:set_int("tubedir", n)
|
||||
@ -182,7 +182,7 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
||||
self.itemstring = itemstring
|
||||
self.item_entity = self:add_attached_entity("pipeworks:tubed_item", itemstring)
|
||||
end,
|
||||
|
||||
|
||||
set_color = function(self, color)
|
||||
if self.color == color then
|
||||
return
|
||||
@ -204,13 +204,13 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
||||
self.start_pos = vector.round(pos)
|
||||
self:setpos(pos)
|
||||
end
|
||||
|
||||
|
||||
local pos = self:getpos()
|
||||
local stack = ItemStack(self.itemstring)
|
||||
local drop_pos
|
||||
|
||||
|
||||
local velocity = self:getvelocity()
|
||||
|
||||
|
||||
local moved = false
|
||||
local speed = math.abs(velocity.x + velocity.y + velocity.z)
|
||||
if speed == 0 then
|
||||
@ -218,12 +218,12 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
||||
moved = true
|
||||
end
|
||||
local vel = {x = velocity.x / speed, y = velocity.y / speed, z = velocity.z / speed, speed = speed}
|
||||
|
||||
|
||||
if vector.distance(pos, self.start_pos) >= 1 then
|
||||
self.start_pos = vector.add(self.start_pos, vel)
|
||||
moved = true
|
||||
end
|
||||
|
||||
|
||||
minetest.load_position(self.start_pos)
|
||||
local node = minetest.get_node(self.start_pos)
|
||||
if moved and minetest.get_item_group(node.name, "tubedevice_receiver") == 1 then
|
||||
@ -242,18 +242,18 @@ luaentity.register_entity("pipeworks:tubed_item", {
|
||||
self:set_item(leftover:to_string())
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
if moved then
|
||||
local found_next, new_velocity = go_next(self.start_pos, velocity, stack) -- todo: color
|
||||
if not found_next then
|
||||
drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air")
|
||||
if drop_pos then
|
||||
if drop_pos then
|
||||
minetest.item_drop(stack, "", drop_pos)
|
||||
self:remove()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if new_velocity and not vector.equals(velocity, new_velocity) then
|
||||
self:setpos(self.start_pos)
|
||||
self:setvelocity(new_velocity)
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
if not minetest.get_modpath("auto_tree_tap") and
|
||||
if not minetest.get_modpath("auto_tree_tap") and
|
||||
minetest.get_modpath("technic") then
|
||||
|
||||
minetest.register_abm({
|
||||
@ -37,10 +37,10 @@ if not minetest.get_modpath("auto_tree_tap") and
|
||||
after_place_node = function (pos, placer)
|
||||
pipeworks.scan_for_tube_objects(pos, placer)
|
||||
local placer_pos = placer:getpos()
|
||||
|
||||
|
||||
--correct for the player's height
|
||||
if placer:is_player() then placer_pos.y = placer_pos.y + 1.5 end
|
||||
|
||||
|
||||
--correct for 6d facedir
|
||||
if placer_pos then
|
||||
local dir = {
|
||||
|
@ -194,7 +194,7 @@ local entitydef_default = {
|
||||
end
|
||||
end,
|
||||
getvelocity = function(self)
|
||||
return vector.new(self._velocity)
|
||||
return vector.new(self._velocity)
|
||||
end,
|
||||
setvelocity = function(self, velocity)
|
||||
self._velocity = vector.new(velocity)
|
||||
@ -268,7 +268,7 @@ function luaentity.add_entity(pos, name)
|
||||
_acceleration = {x = 0, y = 0, z = 0},
|
||||
_attached_entities = {},
|
||||
}
|
||||
|
||||
|
||||
local prototype = luaentity.registered_entities[name]
|
||||
setmetatable(entity, prototype) -- Default to prototype for other methods
|
||||
luaentity.entities[index] = entity
|
||||
|
@ -34,7 +34,7 @@ pipeworks.tube_frontstub = {
|
||||
|
||||
pipeworks.tube_backstub = {
|
||||
{ -9/64, -9/64, -9/64, 9/64, 9/64, 32/64 }, -- tube segment against -Z face
|
||||
}
|
||||
}
|
||||
|
||||
pipeworks.tube_boxes = {pipeworks.tube_leftstub, pipeworks.tube_rightstub, pipeworks.tube_bottomstub, pipeworks.tube_topstub, pipeworks.tube_frontstub, pipeworks.tube_backstub}
|
||||
|
||||
|
@ -9,7 +9,7 @@ local vti = {4, 3, 2, 1, 6, 5}
|
||||
local cconnects = {{}, {1}, {1, 2}, {1, 3}, {1, 3, 5}, {1, 2, 3}, {1, 2, 3, 5}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 6}}
|
||||
for index, connects in ipairs(cconnects) do
|
||||
local outsel = {}
|
||||
|
||||
|
||||
local jx = 0
|
||||
local jy = 0
|
||||
local jz = 0
|
||||
@ -28,7 +28,7 @@ for index, connects in ipairs(cconnects) do
|
||||
local v = connects[1]
|
||||
v = v-1 + 2*(v%2) -- Opposite side
|
||||
end
|
||||
|
||||
|
||||
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
|
||||
local pipedesc = "Pipe segement".." "..dump(connects).."... You hacker, you."
|
||||
local image = nil
|
||||
@ -38,11 +38,11 @@ for index, connects in ipairs(cconnects) do
|
||||
pipedesc = "Pipe segment"
|
||||
image = "pipeworks_pipe_inv.png"
|
||||
end
|
||||
|
||||
|
||||
local outimg_e = { "pipeworks_pipe_plain.png" }
|
||||
local outimg_l = { "pipeworks_pipe_plain.png" }
|
||||
|
||||
if index == 3 then
|
||||
if index == 3 then
|
||||
outimg_e = { "pipeworks_pipe_3_empty.png" }
|
||||
outimg_l = { "pipeworks_pipe_3_loaded.png" }
|
||||
end
|
||||
@ -82,7 +82,7 @@ for index, connects in ipairs(cconnects) do
|
||||
pipeworks.scan_for_pipe_objects(pos)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1}
|
||||
|
||||
minetest.register_node("pipeworks:pipe_"..index.."_loaded", {
|
||||
@ -112,7 +112,7 @@ for index, connects in ipairs(cconnects) do
|
||||
pipeworks.scan_for_pipe_objects(pos)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
table.insert(pipes_empty_nodenames, "pipeworks:pipe_"..index.."_empty")
|
||||
table.insert(pipes_full_nodenames, "pipeworks:pipe_"..index.."_loaded")
|
||||
end
|
||||
@ -206,7 +206,7 @@ minetest.register_abm({
|
||||
nodenames = {"pipeworks:spigot","pipeworks:spigot_pouring"},
|
||||
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)
|
||||
pipeworks.spigot_check(pos,node)
|
||||
end
|
||||
})
|
||||
@ -215,7 +215,7 @@ minetest.register_abm({
|
||||
nodenames = {"pipeworks:fountainhead","pipeworks:fountainhead_pouring"},
|
||||
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)
|
||||
pipeworks.fountainhead_check(pos,node)
|
||||
end
|
||||
})
|
||||
|
@ -173,7 +173,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
||||
if mode == ":" then
|
||||
minetest.chat_send_player(sender_name, "Sorry, channel '"..new_channel.."' is reserved for exclusive use by "..name)
|
||||
return
|
||||
|
||||
|
||||
--channels starting with '[name];' can be used by other players, but cannot be received from
|
||||
elseif mode == ";" and (fields.cr1 or (can_receive ~= 0 and not fields.cr0)) then
|
||||
minetest.chat_send_player(sender_name, "Sorry, receiving from channel '"..new_channel.."' is reserved for "..name)
|
||||
|
@ -1,6 +1,6 @@
|
||||
minetest.register_node("pipeworks:trashcan", {
|
||||
description = "Trash Can",
|
||||
drawtype = "normal",
|
||||
description = "Trash Can",
|
||||
drawtype = "normal",
|
||||
tiles = {
|
||||
"pipeworks_trashcan_bottom.png",
|
||||
"pipeworks_trashcan_bottom.png",
|
||||
@ -8,15 +8,15 @@ minetest.register_node("pipeworks:trashcan", {
|
||||
"pipeworks_trashcan_side.png",
|
||||
"pipeworks_trashcan_side.png",
|
||||
"pipeworks_trashcan_side.png",
|
||||
},
|
||||
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
||||
},
|
||||
groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
|
||||
tube = {
|
||||
insert_object = function(pos, node, stack, direction)
|
||||
return ItemStack("")
|
||||
end,
|
||||
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
|
||||
priority = 1, -- Lower than anything else
|
||||
},
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
@ -31,7 +31,7 @@ minetest.register_node("pipeworks:trashcan", {
|
||||
"list[current_player;main;0,3;8,4;]")
|
||||
meta:set_string("infotext", "Trash Can")
|
||||
meta:get_inventory():set_size("trash", 1)
|
||||
end,
|
||||
end,
|
||||
after_place_node = pipeworks.after_place,
|
||||
after_dig_node = pipeworks.after_dig,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
|
@ -38,11 +38,11 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
||||
local outboxes = {}
|
||||
local outsel = {}
|
||||
local outimgs = {}
|
||||
|
||||
|
||||
for i = 1, 6 do
|
||||
outimgs[vti[i]] = plain[i]
|
||||
end
|
||||
|
||||
|
||||
for _, v in ipairs(connects) do
|
||||
table.extend(outboxes, pipeworks.tube_boxes[v])
|
||||
table.insert(outsel, pipeworks.tube_selectboxes[v])
|
||||
@ -73,10 +73,10 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
||||
outsel = { -24/64, -10/64, -10/64, 24/64, 10/64, 10/64 }
|
||||
wscale = {x = 1, y = 1, z = 0.01}
|
||||
end
|
||||
|
||||
|
||||
local rname = string.format("%s_%s", name, tname)
|
||||
table.insert(tubenodes, rname)
|
||||
|
||||
|
||||
local nodedef = {
|
||||
description = tubedesc,
|
||||
drawtype = "nodebox",
|
||||
@ -112,7 +112,7 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
||||
if style == "6d" then
|
||||
nodedef.paramtype2 = "facedir"
|
||||
end
|
||||
|
||||
|
||||
if special == nil then special = {} end
|
||||
|
||||
for key, value in pairs(special) do
|
||||
|
Reference in New Issue
Block a user