Player API: Apply model default textures when passing nil to 'set_textures'
authordanielmeek32 <danielmeek32@users.noreply.github.com>
Sun, 30 Jul 2017 18:18:12 +0000 (19:18 +0100)
committerparamat <mat.gregory@virginmedia.com>
Sun, 6 Aug 2017 00:53:53 +0000 (01:53 +0100)
mods/player_api/api.lua

index 9dd33eee78cebb05a054772ee5df0e6a7cb80ad3..21509210e8bf382fe0bef93af976d3cc2f6bf9aa 100644 (file)
@@ -58,8 +58,10 @@ end
 
 function player_api.set_textures(player, textures)
        local name = player:get_player_name()
-       player_textures[name] = textures
-       player:set_properties({textures = 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,})
 end
 
 function player_api.set_animation(player, anim_name, speed)