mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-20 22:33:16 -04:00
Merge branch 'playerapi_redo' of https://github.com/appgurueu/minetest_game into playerapi_redo
This commit is contained in:
commit
cc57126bce
1 changed files with 7 additions and 7 deletions
|
@ -58,7 +58,7 @@ function player_api.set_model(player, model_name)
|
|||
end
|
||||
local model = models[model_name]
|
||||
if model then
|
||||
player:set_properties{
|
||||
player:set_properties({
|
||||
mesh = model_name,
|
||||
textures = player_data.textures or model.textures,
|
||||
visual = "mesh",
|
||||
|
@ -66,7 +66,7 @@ function player_api.set_model(player, model_name)
|
|||
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
stepheight = model.stepheight or 0.6,
|
||||
eye_height = model.eye_height or 1.47,
|
||||
}
|
||||
})
|
||||
local animations = model.animations
|
||||
player:set_local_animation(
|
||||
animations.stand,
|
||||
|
@ -77,14 +77,14 @@ function player_api.set_model(player, model_name)
|
|||
)
|
||||
player_api.set_animation(player, "stand")
|
||||
else
|
||||
player:set_properties{
|
||||
player:set_properties({
|
||||
textures = {"player.png", "player_back.png"},
|
||||
visual = "upright_sprite",
|
||||
visual_size = {x = 1, y = 2},
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||
stepheight = 0.6,
|
||||
eye_height = 1.625,
|
||||
}
|
||||
})
|
||||
end
|
||||
player_data.model = model_name
|
||||
end
|
||||
|
@ -94,7 +94,7 @@ function player_api.set_textures(player, textures)
|
|||
local model = models[player_data.model]
|
||||
local new_textures = model and model.textures or textures
|
||||
player_data.textures = new_textures
|
||||
player:set_properties{textures = new_textures}
|
||||
player:set_properties({textures = new_textures})
|
||||
end
|
||||
|
||||
function player_api.set_animation(player, anim_name, speed)
|
||||
|
@ -114,10 +114,10 @@ function player_api.set_animation(player, anim_name, speed)
|
|||
player:set_animation(anim, speed, animation_blend)
|
||||
-- reference comparison for tables works because register_model ensures same references for same collisionboxes
|
||||
if previous_anim.eye_height ~= anim.eye_height or previous_anim.collisionbox ~= anim.collisionbox then
|
||||
player:set_properties{
|
||||
player:set_properties({
|
||||
collisionbox = anim.collisionbox or model.collisionbox,
|
||||
eye_height = anim.eye_height or model.eye_height
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue