mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-12 11:00:25 +01:00
Update pipeworks
This commit is contained in:
parent
a4c3c59b07
commit
659a2e5463
@ -18,3 +18,5 @@ pipeworks.enable_mese_sand_tube = true
|
|||||||
pipeworks.enable_one_way_tube = true
|
pipeworks.enable_one_way_tube = true
|
||||||
pipeworks.enable_priority_tube = true
|
pipeworks.enable_priority_tube = true
|
||||||
pipeworks.enable_cyclic_mode = true
|
pipeworks.enable_cyclic_mode = true
|
||||||
|
|
||||||
|
pipeworks.delete_item_on_clearobject = true
|
@ -55,6 +55,7 @@ local function go_next(pos, velocity, stack)
|
|||||||
end
|
end
|
||||||
for _, vect in ipairs(can_go) do
|
for _, vect in ipairs(can_go) do
|
||||||
local npos = vector.add(pos, vect)
|
local npos = vector.add(pos, vect)
|
||||||
|
minetest.load_position(npos)
|
||||||
local node = minetest.get_node(npos)
|
local node = minetest.get_node(npos)
|
||||||
local reg_node = minetest.registered_nodes[node.name]
|
local reg_node = minetest.registered_nodes[node.name]
|
||||||
if reg_node then
|
if reg_node then
|
||||||
|
@ -149,8 +149,8 @@ local entitydef_default = {
|
|||||||
_remove_attached = function(self, index)
|
_remove_attached = function(self, index)
|
||||||
local master = self._attached_entities_master
|
local master = self._attached_entities_master
|
||||||
local entity = self._attached_entities[index]
|
local entity = self._attached_entities[index]
|
||||||
local ent = entity.entity
|
local ent = entity and entity.entity
|
||||||
entity.entity = nil
|
if entity then entity.entity = nil end
|
||||||
if index == master then
|
if index == master then
|
||||||
self:_detach_all()
|
self:_detach_all()
|
||||||
local newmaster
|
local newmaster
|
||||||
@ -315,10 +315,11 @@ minetest.register_globalstep(function(dtime)
|
|||||||
end
|
end
|
||||||
for id, entity in pairs(luaentity.entities) do
|
for id, entity in pairs(luaentity.entities) do
|
||||||
local master = entity._attached_entities_master
|
local master = entity._attached_entities_master
|
||||||
if master then
|
local master_def = master and entity._attached_entities[master]
|
||||||
local master_def = entity._attached_entities[master]
|
local master_entity = master_def and master_def.entity
|
||||||
local master_entity = master_def.entity
|
local master_entity_pos = master_entity and master_entity:getpos()
|
||||||
entity._pos = vector.subtract(master_entity:getpos(), master_def.offset)
|
if master_entity_pos then
|
||||||
|
entity._pos = vector.subtract(master_entity_pos, master_def.offset)
|
||||||
entity._velocity = master_entity:getvelocity()
|
entity._velocity = master_entity:getvelocity()
|
||||||
entity._acceleration = master_entity:getacceleration()
|
entity._acceleration = master_entity:getacceleration()
|
||||||
else
|
else
|
||||||
@ -330,9 +331,21 @@ minetest.register_globalstep(function(dtime)
|
|||||||
entity._velocity,
|
entity._velocity,
|
||||||
vector.multiply(entity._acceleration, dtime))
|
vector.multiply(entity._acceleration, dtime))
|
||||||
end
|
end
|
||||||
entity:_add_loaded()
|
if master and not master_entity_pos then -- The entity has somehow been cleared
|
||||||
if entity.on_step then
|
if pipeworks.delete_item_on_clearobject then
|
||||||
entity:on_step(dtime)
|
entity:remove()
|
||||||
|
else
|
||||||
|
entity:_remove_attached(master)
|
||||||
|
entity:_add_loaded()
|
||||||
|
if entity.on_step then
|
||||||
|
entity:on_step(dtime)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
entity:_add_loaded()
|
||||||
|
if entity.on_step then
|
||||||
|
entity:on_step(dtime)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user