Better patch for beds mod

master
Jordan Irwin 2021-07-21 14:59:52 -07:00
parent 91da7f68d7
commit eb35c88014
2 changed files with 10 additions and 3 deletions

View File

@ -699,7 +699,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[patch.amber]: https://github.com/AntumMT/mod-amber/tree/39b852a
[patch.atm]: https://github.com/AntumMT/mod-atm/tree/2ab0e78
[patch.away]: https://github.com/AntumMT/mod-away/tree/3b0bf9e
[patch.beds]: https://github.com/AntumMT/mod-beds/commit/56b1cc5
[patch.beds]: https://github.com/AntumMT/mod-beds/commit/88155ca
[patch.boats2]: https://github.com/AntumMT/mod-boats2/tree/9b2bcb7
[patch.bridges]: https://github.com/AntumMT/mod-bridges/tree/ba8f71a
[patch.christmas]: https://github.com/AntumMT/mod-christmas/tree/50bda80

View File

@ -221,6 +221,11 @@ end
-- Public Methods --
--------------------
local default_transforms = {
sitting = { yaw = 7.9, pos = { x = 0, y = 0.1, z = 0 }, off = -7 },
laying = { yaw = 7.9, pos = { x = 0.5, y = 0.1, z = 0 }, off = -13 },
}
beds.sit_down = function ( name, pos )
if player_states[ name ] or default.player_attached[ name ] then return end
@ -231,7 +236,8 @@ beds.sit_down = function ( name, pos )
if not transforms or not transforms.sitting then return end -- quick sanity check for properties
-- prevent the player from sitting on air
apply_physics_override( pos, player, transforms.sitting[ node.param2 ] or transforms.sitting[ 1 ] )
apply_physics_override( pos, player, transforms.sitting[ node.param2 ]
or default_transforms.sitting )
default.player_set_animation( player, "sit", 30 )
default.player_attached[ name ] = true
@ -249,7 +255,8 @@ beds.lay_down = function ( name, pos )
if not transforms or not transforms.laying then return end -- quick sanity check for properties
-- prevent the player from sitting on air
apply_physics_override( pos, player, transforms.laying[ node.param2 ] or transforms.laying[ 1 ] )
apply_physics_override( pos, player, transforms.laying[ node.param2 ]
or default_transforms.laying )
default.player_set_animation( player, "lay", 0 )
default.player_attached[ name ] = true