forked from VoxeLibre/VoxeLibre
fork update #10
|
@ -808,11 +808,17 @@ minetest.register_entity(":__builtin:item", {
|
||||||
if total_count > max_count then
|
if total_count > max_count then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
-- Merge the remote stack into this one
|
|
||||||
|
|
||||||
-- local pos = object:get_pos()
|
-- Merge the remote stack into this one
|
||||||
-- pos.y = pos.y + ((total_count - count) / max_count) * 0.15
|
local self_pos = self.object:get_pos()
|
||||||
-- self.object:move_to(pos)
|
local pos = object:get_pos()
|
||||||
|
|
||||||
|
--local y = pos.y + ((total_count - count) / max_count) * 0.15
|
||||||
|
local x_diff = (self_pos.x - pos.x) / 2
|
||||||
|
local z_diff = (self_pos.z - pos.z) / 2
|
||||||
|
|
||||||
|
local new_pos = vector.offset(pos, x_diff, 0, z_diff)
|
||||||
|
self.object:move_to(new_pos)
|
||||||
|
|
||||||
self.age = 0 -- Handle as new entity
|
self.age = 0 -- Handle as new entity
|
||||||
own_stack:set_count(total_count)
|
own_stack:set_count(total_count)
|
||||||
|
@ -833,6 +839,7 @@ minetest.register_entity(":__builtin:item", {
|
||||||
self.object:set_acceleration(vector.zero())
|
self.object:set_acceleration(vector.zero())
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.age = self.age + dtime
|
self.age = self.age + dtime
|
||||||
if self._collector_timer then
|
if self._collector_timer then
|
||||||
self._collector_timer = self._collector_timer + dtime
|
self._collector_timer = self._collector_timer + dtime
|
||||||
|
@ -862,6 +869,9 @@ minetest.register_entity(":__builtin:item", {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if self.is_clock then
|
if self.is_clock then
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
textures = { "mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame) }
|
textures = { "mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame) }
|
||||||
|
@ -911,14 +921,13 @@ minetest.register_entity(":__builtin:item", {
|
||||||
local is_on_floor = def and (def.walkable
|
local is_on_floor = def and (def.walkable
|
||||||
and not def.groups.slippery and v.y == 0)
|
and not def.groups.slippery and v.y == 0)
|
||||||
|
|
||||||
if not minetest.registered_nodes[nn]
|
if not minetest.registered_nodes[nn] or is_floating or is_on_floor then
|
||||||
or is_floating or is_on_floor then
|
|
||||||
local own_stack = ItemStack(self.object:get_luaentity().itemstring)
|
local own_stack = ItemStack(self.object:get_luaentity().itemstring)
|
||||||
-- Merge with close entities of the same item
|
-- Merge with close entities of the same item
|
||||||
for _, object in pairs(minetest.get_objects_inside_radius(p, 0.8)) do
|
for _, object in pairs(minetest.get_objects_inside_radius(p, 0.8)) do
|
||||||
local obj = object:get_luaentity()
|
local obj = object:get_luaentity()
|
||||||
if obj and obj.name == "__builtin:item"
|
if obj and obj.name == "__builtin:item" and obj.physical_state == false then
|
||||||
and obj.physical_state == false then
|
|
||||||
if self:try_merge_with(own_stack, object, obj) then
|
if self:try_merge_with(own_stack, object, obj) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue