Skip to content
Permalink
Browse files

Fix deprecated get_player_velocity and set_physics_override calls (#2770

)
  • Loading branch information
SmallJoker committed Nov 4, 2020
1 parent 720d4c8 commit 331bbae058a761419d50b3850c88694da263b83b
Showing with 4 additions and 5 deletions.
  1. +3 −4 mods/beds/functions.lua
  2. +1 −1 mods/tnt/init.lua
@@ -75,7 +75,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0})
player:set_look_horizontal(math.random(1, 180) / 100)
player_api.player_attached[name] = false
player:set_physics_override(1, 1, 1)
player:set_physics_override({speed = 1, jump = 1, gravity = 1})
hud_flags.wielditem = true
player_api.set_animation(player, "stand" , 30)

@@ -91,7 +91,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
end

-- Check if player is moving
if vector.length(player:get_player_velocity()) > 0.001 then
if vector.length(player:get_velocity()) > 0.001 then
minetest.chat_send_player(name, S("You have to stop moving before going to bed!"))
return false
end
@@ -112,7 +112,7 @@ local function lay_down(player, pos, bed_pos, state, skip)
y = bed_pos.y + 0.07,
z = bed_pos.z + dir.z / 2
}
player:set_physics_override(0, 0, 0)
player:set_physics_override({speed = 0, jump = 0, gravity = 0})
player:set_pos(p)
player_api.player_attached[name] = true
hud_flags.wielditem = false
@@ -284,4 +284,3 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
end)

@@ -165,7 +165,7 @@ local function entity_physics(pos, radius, drops)
if obj:is_player() then
local dir = vector.normalize(vector.subtract(obj_pos, pos))
local moveoff = vector.multiply(dir, 2 / dist * radius)
obj:add_player_velocity(moveoff)
obj:add_velocity(moveoff)

obj:set_hp(obj:get_hp() - damage)
else

0 comments on commit 331bbae

Please sign in to comment.
You can’t perform that action at this time.