Place unloaded flying blocks to dest pos
This commit is contained in:
parent
c83da97df5
commit
2b541d0197
@ -3,7 +3,7 @@
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2020-2021 Joachim Stolberg
|
||||
Copyright (C) 2020-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
@ -308,18 +308,7 @@ local function detach_objects(pos, self)
|
||||
self.players = {}
|
||||
end
|
||||
|
||||
local function entity_to_node(pos, obj)
|
||||
local self = obj:get_luaentity()
|
||||
if self then
|
||||
local name = self.item_name or "air"
|
||||
local param2 = self.param2 or 0
|
||||
local metadata = self.metadata or {}
|
||||
detach_objects(pos, self)
|
||||
if self.base_pos then
|
||||
local nvm = techage.get_nvm(self.base_pos)
|
||||
nvm.running = nil
|
||||
end
|
||||
minetest.after(0.1, obj.remove, obj)
|
||||
local function set_node(pos, name, param2, metadata)
|
||||
local node = minetest.get_node(pos)
|
||||
local ndef1 = minetest.registered_nodes[name]
|
||||
local ndef2 = minetest.registered_nodes[node.name]
|
||||
@ -341,6 +330,21 @@ local function entity_to_node(pos, obj)
|
||||
elseif ndef1 then
|
||||
minetest.add_item(pos, ItemStack(name))
|
||||
end
|
||||
end
|
||||
|
||||
local function entity_to_node(pos, obj)
|
||||
local self = obj:get_luaentity()
|
||||
if self then
|
||||
local name = self.item_name or "air"
|
||||
local param2 = self.param2 or 0
|
||||
local metadata = self.metadata or {}
|
||||
detach_objects(pos, self)
|
||||
if self.base_pos then
|
||||
local nvm = techage.get_nvm(self.base_pos)
|
||||
nvm.running = nil
|
||||
end
|
||||
minetest.after(0.1, obj.remove, obj)
|
||||
set_node(pos, name, param2, metadata)
|
||||
end
|
||||
end
|
||||
|
||||
@ -468,6 +472,12 @@ minetest.register_entity("techage:move_item", {
|
||||
},
|
||||
|
||||
get_staticdata = function(self)
|
||||
if self.start_pos and self.dest_pos then
|
||||
local pos = vector.round(self.object:get_pos())
|
||||
if not vector.equals(pos, self.start_pos) and not vector.equals(pos, self.dest_pos) then
|
||||
set_node(self.dest_pos, self.item_name, self.param2, self.metadata or {})
|
||||
end
|
||||
end
|
||||
return minetest.serialize({
|
||||
item_name = self.item_name,
|
||||
param2 = self.param2,
|
||||
|
Loading…
Reference in New Issue
Block a user