forked from VoxeLibre/VoxeLibre
Make item entities respect gravity setting
This commit is contained in:
parent
0b4ae22c21
commit
3cda40818c
|
@ -14,6 +14,10 @@ item_drop_settings.drop_single_item = false --if true, the drop control dro
|
||||||
|
|
||||||
item_drop_settings.follow_time = 1 -- how many seconds an item follows the player before giving up
|
item_drop_settings.follow_time = 1 -- how many seconds an item follows the player before giving up
|
||||||
|
|
||||||
|
local get_gravity = function()
|
||||||
|
return tonumber(minetest.setting_get("movement_gravity")) or 9.81
|
||||||
|
end
|
||||||
|
|
||||||
local check_pickup_achievements = function(object, player)
|
local check_pickup_achievements = function(object, player)
|
||||||
local itemname = ItemStack(object:get_luaentity().itemstring):get_name()
|
local itemname = ItemStack(object:get_luaentity().itemstring):get_name()
|
||||||
if minetest.get_item_group(itemname, "tree") ~= 0 then
|
if minetest.get_item_group(itemname, "tree") ~= 0 then
|
||||||
|
@ -307,7 +311,7 @@ core.register_entity(":__builtin:item", {
|
||||||
end
|
end
|
||||||
self.object:set_armor_groups({immortal = 1})
|
self.object:set_armor_groups({immortal = 1})
|
||||||
self.object:setvelocity({x = 0, y = 2, z = 0})
|
self.object:setvelocity({x = 0, y = 2, z = 0})
|
||||||
self.object:setacceleration({x = 0, y = -10, z = 0})
|
self.object:setacceleration({x = 0, y = -get_gravity(), z = 0})
|
||||||
self:set_item(self.itemstring)
|
self:set_item(self.itemstring)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -410,7 +414,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({x = newv.x, y = -0.22, z = newv.z})
|
self.object:setvelocity({x = newv.x, y = -0.22, z = newv.z})
|
||||||
|
|
||||||
self.object:setacceleration({x = 0, y = -10, z = 0})
|
self.object:setacceleration({x = 0, y = -get_gravity(), z = 0})
|
||||||
self.physical_state = true
|
self.physical_state = true
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
physical = true
|
physical = true
|
||||||
|
@ -445,7 +449,7 @@ core.register_entity(":__builtin:item", {
|
||||||
else
|
else
|
||||||
if not self.physical_state then
|
if not self.physical_state then
|
||||||
self.object:setvelocity({x = 0, y = 0, z = 0})
|
self.object:setvelocity({x = 0, y = 0, z = 0})
|
||||||
self.object:setacceleration({x = 0, y = -10, z = 0})
|
self.object:setacceleration({x = 0, y = -get_gravity(), z = 0})
|
||||||
self.physical_state = true
|
self.physical_state = true
|
||||||
self.object:set_properties({physical = true})
|
self.object:set_properties({physical = true})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue