mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-09 17:03:58 +01:00
Revert "fix multiple crash points if luaentity.entities or values returned from"
This reverts commit d0952a97fcff08328328d05f630d2b0036a48163.
This commit is contained in:
parent
d0952a97fc
commit
dada8474fe
@ -6,7 +6,6 @@ function pipeworks.tube_inject_item(pos, start_pos, velocity, item)
|
|||||||
-- Take item in any format
|
-- Take item in any format
|
||||||
local stack = ItemStack(item)
|
local stack = ItemStack(item)
|
||||||
local obj = luaentity.add_entity(pos, "pipeworks:tubed_item")
|
local obj = luaentity.add_entity(pos, "pipeworks:tubed_item")
|
||||||
if not obj then return end
|
|
||||||
obj:set_item(stack:to_string())
|
obj:set_item(stack:to_string())
|
||||||
obj.start_pos = vector.new(start_pos)
|
obj.start_pos = vector.new(start_pos)
|
||||||
obj:setvelocity(velocity)
|
obj:setvelocity(velocity)
|
||||||
|
@ -22,7 +22,6 @@ end
|
|||||||
|
|
||||||
local function read_entities()
|
local function read_entities()
|
||||||
local t = read_file()
|
local t = read_file()
|
||||||
if not t then return end
|
|
||||||
for _, entity in pairs(t) do
|
for _, entity in pairs(t) do
|
||||||
setmetatable(entity, luaentity.registered_entities[entity.name])
|
setmetatable(entity, luaentity.registered_entities[entity.name])
|
||||||
end
|
end
|
||||||
@ -30,7 +29,6 @@ local function read_entities()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function write_entities()
|
local function write_entities()
|
||||||
if not luaentity.entities then return end
|
|
||||||
for _, entity in pairs(luaentity.entities) do
|
for _, entity in pairs(luaentity.entities) do
|
||||||
setmetatable(entity, nil)
|
setmetatable(entity, nil)
|
||||||
for _, attached in pairs(entity._attached_entities) do
|
for _, attached in pairs(entity._attached_entities) do
|
||||||
@ -253,7 +251,6 @@ end
|
|||||||
-- end
|
-- end
|
||||||
|
|
||||||
function luaentity.add_entity(pos, name)
|
function luaentity.add_entity(pos, name)
|
||||||
if not luaentity.entities then return end
|
|
||||||
local index = luaentity.entities_index
|
local index = luaentity.entities_index
|
||||||
while luaentity.entities[index] do
|
while luaentity.entities[index] do
|
||||||
index = index + 1
|
index = index + 1
|
||||||
@ -284,7 +281,6 @@ end
|
|||||||
|
|
||||||
-- todo: check if remove in get_staticdata works
|
-- todo: check if remove in get_staticdata works
|
||||||
function luaentity.get_staticdata(self)
|
function luaentity.get_staticdata(self)
|
||||||
if not luaentity.entities then return end
|
|
||||||
local parent = luaentity.entities[self.parent_id]
|
local parent = luaentity.entities[self.parent_id]
|
||||||
if parent and parent._remove_attached then
|
if parent and parent._remove_attached then
|
||||||
parent:_remove_attached(self.attached_id)
|
parent:_remove_attached(self.attached_id)
|
||||||
@ -299,7 +295,6 @@ function luaentity.on_activate(self, staticdata)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function luaentity.get_objects_inside_radius(pos, radius)
|
function luaentity.get_objects_inside_radius(pos, radius)
|
||||||
if not luaentity.entities then return end
|
|
||||||
local objects = {}
|
local objects = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
for id, entity in pairs(luaentity.entities) do
|
for id, entity in pairs(luaentity.entities) do
|
||||||
@ -314,7 +309,6 @@ minetest.register_globalstep(function(dtime)
|
|||||||
if not luaentity.entities then
|
if not luaentity.entities then
|
||||||
luaentity.entities = read_entities()
|
luaentity.entities = read_entities()
|
||||||
end
|
end
|
||||||
if not luaentity.entities then return 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
|
if master then
|
||||||
|
Loading…
Reference in New Issue
Block a user