1
0
Fork 0

Fix item flying after moving out of liquid

objects
Wuzzy 2017-06-10 20:56:53 +02:00
parent 1a7b455fd2
commit b153104d24
1 changed files with 7 additions and 7 deletions

View File

@ -28,8 +28,8 @@ local check_pickup_achievements = function(object, player)
end end
end end
local enable_physics = function(object, luaentity) local enable_physics = function(object, luaentity, ignore_check)
if luaentity.physical_state == false then if luaentity.physical_state == false or ignore_check == true then
luaentity.physical_state = true luaentity.physical_state = true
object:set_properties({ object:set_properties({
physical = true physical = true
@ -39,8 +39,8 @@ local enable_physics = function(object, luaentity)
end end
end end
local disable_physics = function(object, luaentity, reset_movement) local disable_physics = function(object, luaentity, ignore_check, reset_movement)
if luaentity.physical_state == true then if luaentity.physical_state == true or ignore_check == true then
luaentity.physical_state = false luaentity.physical_state = false
object:set_properties({ object:set_properties({
physical = false physical = false
@ -96,7 +96,7 @@ minetest.register_globalstep(function(dtime)
vec = vector.add(opos, vector.divide(vec, 2)) vec = vector.add(opos, vector.divide(vec, 2))
object:moveto(vec) object:moveto(vec)
disable_physics(object, object:get_luaentity(), false) disable_physics(object, object:get_luaentity(), false, false)
--fix eternally falling items --fix eternally falling items
minetest.after(0, function(object) minetest.after(0, function(object)
@ -487,7 +487,7 @@ core.register_entity(":__builtin:item", {
self.object:setacceleration({x = 0, y = 0, z = 0}) self.object:setacceleration({x = 0, y = 0, z = 0})
self.object:setvelocity(newv) self.object:setvelocity(newv)
disable_physics(self.object, self, false) disable_physics(self.object, self, false, false)
if shootdir.y == 0 then if shootdir.y == 0 then
self._force = newv self._force = newv
@ -551,7 +551,7 @@ core.register_entity(":__builtin:item", {
elseif self._flowing == true then elseif self._flowing == true then
-- Disable flowing physics if not on/in flowing liquid -- Disable flowing physics if not on/in flowing liquid
self._flowing = false self._flowing = false
enable_physics(self.object, self) enable_physics(self.object, self, true)
return return
end end