blockgame/mods/bg_player/util_misc.lua
trans_soup 1aecdeb752 refactor: create general player interface.
create utility function for acting on player properties, and refactor
code for running and step height to make use of this.
2023-10-13 08:48:11 +02:00

20 lines
377 B
Lua

local function handle_player (player, fn)
local data = {}
data.control = player:get_player_control()
data.properties = player:get_properties()
data.physics = player:get_physics_override()
local result = fn(player, data)
player:set_properties(data.properties)
player:set_physics_override(data.physics)
return result
end
return {
handle_player = handle_player,
}