mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -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
|
end
|
||||||
local model = models[model_name]
|
local model = models[model_name]
|
||||||
if model then
|
if model then
|
||||||
player:set_properties{
|
player:set_properties({
|
||||||
mesh = model_name,
|
mesh = model_name,
|
||||||
textures = player_data.textures or model.textures,
|
textures = player_data.textures or model.textures,
|
||||||
visual = "mesh",
|
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},
|
collisionbox = model.collisionbox or {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||||
stepheight = model.stepheight or 0.6,
|
stepheight = model.stepheight or 0.6,
|
||||||
eye_height = model.eye_height or 1.47,
|
eye_height = model.eye_height or 1.47,
|
||||||
}
|
})
|
||||||
local animations = model.animations
|
local animations = model.animations
|
||||||
player:set_local_animation(
|
player:set_local_animation(
|
||||||
animations.stand,
|
animations.stand,
|
||||||
|
@ -77,14 +77,14 @@ function player_api.set_model(player, model_name)
|
||||||
)
|
)
|
||||||
player_api.set_animation(player, "stand")
|
player_api.set_animation(player, "stand")
|
||||||
else
|
else
|
||||||
player:set_properties{
|
player:set_properties({
|
||||||
textures = {"player.png", "player_back.png"},
|
textures = {"player.png", "player_back.png"},
|
||||||
visual = "upright_sprite",
|
visual = "upright_sprite",
|
||||||
visual_size = {x = 1, y = 2},
|
visual_size = {x = 1, y = 2},
|
||||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||||
stepheight = 0.6,
|
stepheight = 0.6,
|
||||||
eye_height = 1.625,
|
eye_height = 1.625,
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
player_data.model = model_name
|
player_data.model = model_name
|
||||||
end
|
end
|
||||||
|
@ -94,7 +94,7 @@ function player_api.set_textures(player, textures)
|
||||||
local model = models[player_data.model]
|
local model = models[player_data.model]
|
||||||
local new_textures = model and model.textures or textures
|
local new_textures = model and model.textures or textures
|
||||||
player_data.textures = new_textures
|
player_data.textures = new_textures
|
||||||
player:set_properties{textures = new_textures}
|
player:set_properties({textures = new_textures})
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_api.set_animation(player, anim_name, speed)
|
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)
|
player:set_animation(anim, speed, animation_blend)
|
||||||
-- reference comparison for tables works because register_model ensures same references for same collisionboxes
|
-- 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
|
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,
|
collisionbox = anim.collisionbox or model.collisionbox,
|
||||||
eye_height = anim.eye_height or model.eye_height
|
eye_height = anim.eye_height or model.eye_height
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue