Added a check against constant reading of the array if the player is not on the server.
Some checks are pending
luacheck / luacheck (push) Waiting to run
Some checks are pending
luacheck / luacheck (push) Waiting to run
This commit is contained in:
parent
a094097b5e
commit
2111a21f68
@ -352,40 +352,49 @@ local move_entities_globalstep_part2 = function(dtime)
|
||||
if not luaentity.entities then
|
||||
luaentity.entities = read_entities()
|
||||
end
|
||||
--minetest.log("action", "Dump: " .. dump(luaentity.entities))
|
||||
for _, entity in pairs(luaentity.entities) do
|
||||
local master = entity._attached_entities_master
|
||||
local master_def = master and entity._attached_entities[master]
|
||||
local master_entity = master_def and master_def.entity
|
||||
local master_entity_pos = master_entity and master_entity:get_pos()
|
||||
if master_entity_pos then
|
||||
entity._pos = vector.subtract(master_entity_pos, master_def.offset)
|
||||
entity._velocity = master_entity:get_velocity()
|
||||
entity._acceleration = master_entity:get_acceleration()
|
||||
else
|
||||
entity._velocity = entity._velocity or vector.new(0,0,0)
|
||||
entity._acceleration = entity._acceleration or vector.new(0,0,0)
|
||||
entity._pos = vector.add(vector.add(
|
||||
entity._pos,
|
||||
vector.multiply(entity._velocity, dtime)),
|
||||
vector.multiply(entity._acceleration, 0.5 * dtime * dtime))
|
||||
entity._velocity = vector.add(
|
||||
entity._velocity,
|
||||
vector.multiply(entity._acceleration, dtime))
|
||||
end
|
||||
if master and not master_entity_pos then -- The entity has somehow been cleared
|
||||
if pipeworks.delete_item_on_clearobject then
|
||||
entity:remove()
|
||||
else
|
||||
entity:_remove_attached(master)
|
||||
entity:_add_loaded()
|
||||
if entity.on_step then
|
||||
entity:on_step(dtime)
|
||||
--minetest.log("action", "entity " .. type(entity.owner))
|
||||
if entity.owner ~= nil then
|
||||
local object = minetest.env:get_player_by_name(entity.owner)
|
||||
if object then
|
||||
--minetest.chat_send_all("online: " .. dump(entity.owner))
|
||||
--minetest.log("action", "pipeworks: активная передача по трубам игрок в сети: " .. entity.owner)
|
||||
local master = entity._attached_entities_master
|
||||
local master_def = master and entity._attached_entities[master]
|
||||
local master_entity = master_def and master_def.entity
|
||||
local master_entity_pos = master_entity and master_entity:get_pos()
|
||||
if master_entity_pos then
|
||||
entity._pos = vector.subtract(master_entity_pos, master_def.offset)
|
||||
entity._velocity = master_entity:get_velocity()
|
||||
entity._acceleration = master_entity:get_acceleration()
|
||||
else
|
||||
entity._velocity = entity._velocity or vector.new(0,0,0)
|
||||
entity._acceleration = entity._acceleration or vector.new(0,0,0)
|
||||
entity._pos = vector.add(vector.add(
|
||||
entity._pos,
|
||||
vector.multiply(entity._velocity, dtime)),
|
||||
vector.multiply(entity._acceleration, 0.5 * dtime * dtime))
|
||||
entity._velocity = vector.add(
|
||||
entity._velocity,
|
||||
vector.multiply(entity._acceleration, dtime))
|
||||
end
|
||||
if master and not master_entity_pos then -- The entity has somehow been cleared
|
||||
if pipeworks.delete_item_on_clearobject then
|
||||
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
|
||||
else
|
||||
entity:_add_loaded()
|
||||
if entity.on_step then
|
||||
entity:on_step(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user