From 556cacf03852d76e78f194a938f6b011a469ee08 Mon Sep 17 00:00:00 2001 From: Zughy Date: Wed, 12 Jan 2022 01:22:10 +0100 Subject: [PATCH] fixes --- game_api.txt | 2 +- mods/player_api/api.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/game_api.txt b/game_api.txt index f268713e..add34c23 100644 --- a/game_api.txt +++ b/game_api.txt @@ -466,7 +466,7 @@ The player API can register player models and update the player's appearance. * Sets a player texture * `player`: PlayerRef * `texture`: texture filename - * `texture_ID`: the ID of the texture to change. If nil, default is `1` + * `index`: the index of the texture to change. If nil, default is `1` * `player_api.get_animation(player)` * Returns a table containing fields `model`, `textures` and `animation` diff --git a/mods/player_api/api.lua b/mods/player_api/api.lua index 05d66fe3..0c155752 100644 --- a/mods/player_api/api.lua +++ b/mods/player_api/api.lua @@ -71,10 +71,10 @@ function player_api.set_textures(player, textures) player:set_properties({textures = textures or model_textures}) end -function player_api.set_texture(player, texture, texture_ID) - local ID = not texture_ID and 1 or texture_ID +function player_api.set_texture(player, texture, index) local new_textures = player:get_properties().textures - new_textures[ID] = texture + index = index or 1 + new_textures[index] = texture player:set_properties({textures = new_textures}) end