mirror of
https://github.com/HybridDog/builtin_item.git
synced 2024-12-22 17:00:27 +01:00
Bugfix in pushing items of water
This commit is contained in:
parent
c9ef93e758
commit
60b15341fa
9
init.lua
9
init.lua
@ -126,14 +126,15 @@ minetest.register_entity(":__builtin:item", {
|
|||||||
|
|
||||||
local vec = get_flowing_dir(self)
|
local vec = get_flowing_dir(self)
|
||||||
if vec then
|
if vec then
|
||||||
|
local v = self.object:getvelocity()
|
||||||
if vec and vec.x-p.x > 0 then
|
if vec and vec.x-p.x > 0 then
|
||||||
self.object:setvelocity({x=0.5,y=0,z=0})
|
self.object:setvelocity({x=0.5,y=v.y,z=0})
|
||||||
elseif vec and vec.x-p.x < 0 then
|
elseif vec and vec.x-p.x < 0 then
|
||||||
self.object:setvelocity({x=-0.5,y=0,z=0})
|
self.object:setvelocity({x=-0.5,y=v.y,z=0})
|
||||||
elseif vec and vec.z-p.z > 0 then
|
elseif vec and vec.z-p.z > 0 then
|
||||||
self.object:setvelocity({x=0,y=0,z=0.5})
|
self.object:setvelocity({x=0,y=v.y,z=0.5})
|
||||||
elseif vec and vec.z-p.z < 0 then
|
elseif vec and vec.z-p.z < 0 then
|
||||||
self.object:setvelocity({x=0,y=0,z=-0.5})
|
self.object:setvelocity({x=0,y=v.y,z=-0.5})
|
||||||
end
|
end
|
||||||
self.object:setacceleration({x=0, y=-10, z=0})
|
self.object:setacceleration({x=0, y=-10, z=0})
|
||||||
self.physical_state = true
|
self.physical_state = true
|
||||||
|
Loading…
Reference in New Issue
Block a user