1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-28 04:40:22 +02:00

Player_api: Various maintenance (#2737)

Clear 'player_sneak' and 'player_api.player_attached' table values
when player leaves.
Remove unnecessary commas and whitespace.
Fix table name in 'game_api.txt'.
Clean up documentation in 'game_api.txt'.
This commit is contained in:
Paramat
2020-09-09 18:11:25 +01:00
committed by GitHub
parent 268f869e67
commit 8d0fb34fb0
3 changed files with 31 additions and 27 deletions

View File

@ -68,7 +68,7 @@ function player_api.set_textures(player, textures)
local model = models[player_model[name]]
local model_textures = model and model.textures or nil
player_textures[name] = textures or model_textures
player:set_properties({textures = textures or model_textures,})
player:set_properties({textures = textures or model_textures})
end
function player_api.set_animation(player, anim_name, speed)
@ -90,6 +90,8 @@ minetest.register_on_leaveplayer(function(player)
player_model[name] = nil
player_anim[name] = nil
player_textures[name] = nil
player_sneak[name] = nil
player_api.player_attached[name] = nil
end)
-- Localize for better performance.

View File

@ -5,7 +5,7 @@ dofile(minetest.get_modpath("player_api") .. "/api.lua")
-- Default player appearance
player_api.register_model("character.b3d", {
animation_speed = 30,
textures = {"character.png", },
textures = {"character.png"},
animations = {
-- Standard animations.
stand = {x = 0, y = 79},