2017-06-21 21:24:41 +02:00
# Skinsdb Interface
## skins.get_player_skin(player)
2018-05-13 00:37:19 +02:00
Return the skin object assigned to the player. Returns default if nothing assigned
2017-06-21 21:24:41 +02:00
## skins.assign_player_skin(player, skin)
2018-05-13 00:37:19 +02:00
Check if allowed and assign the skin for the player without visual updates. The "skin" parameter could be the skin key or the skin object
2018-02-13 22:02:22 +01:00
Returns false if skin is not valid or applicable to player
2017-06-21 21:24:41 +02:00
## skins.update_player_skin(player)
Update selected skin visuals on player
## skins.set_player_skin(player, skin)
2018-05-13 00:37:19 +02:00
Function for external usage on skin selection. This function assign the skin, call the skin:set_skin(player) hook to update dynamic skins, then update the visuals
2017-06-21 21:24:41 +02:00
2018-04-15 01:09:38 +02:00
## skins.get_skin_format(file)
Returns the skin format version ("1.0" or "1.8"). File is an open file handle to the texture file
2017-06-21 21:24:41 +02:00
## skins.get_skinlist(assignment, select_unassigned)
2018-01-07 19:09:52 +01:00
Obsolete - use get_skinlist_for_player() or get_skinlist_with_meta() instead
2017-06-21 21:24:41 +02:00
2018-01-07 19:09:52 +01:00
## skins.get_skinlist_for_player(playername)
Get all allowed skins for player. All public and all player's private skins. If playername not given only public skins returned
2017-06-21 21:24:41 +02:00
2018-01-07 19:09:52 +01:00
## skins.get_skinlist_with_meta(key, value)
Get all skins with metadata key is set to value. Example:
skins.get_skinlist_with_meta("playername", playername) - Get all private skins (w.o. public) for playername
2017-06-21 21:24:41 +02:00
## skins.new(key, object)
Create and register a new skin object for given key
- key: Unique skins key, like "character_1"
- object: Optional. Could be a prepared object with redefinitions
## skins.get(key)
Get existing skin object
HINT: During build-up phase maybe the next statement is usefull
```
local skin = skins.get(name) or skins.new(name)
```
# Skin object
## skin:get_key()
Get the unique skin key
## skin:set_texture(texture)
Set the skin texture - usually at the init time only
## skin:get_texture()
Get the skin texture for any reason. Note to apply them the skin:set_skin() should be used
Could be redefined for dynamic texture generation
## skin:set_preview(texture)
Set the skin preview - usually at the init time only
## skin:get_preview()
Get the skin preview
Could be redefined for dynamic preview texture generation
## skin:set_skin(player)
2018-05-13 00:37:19 +02:00
Hook for dynamic skins updates on select. Is called in skins.set_player_skin()
In skinsdb the default implementation for this function is empty.
2018-04-15 01:09:38 +02:00
skin:apply_skin_to_player(player)
2018-05-13 00:37:19 +02:00
Apply the skin to the player. Called in skins.update_player_skin() to update visuals
2017-06-21 21:24:41 +02:00
## skin:set_meta(key, value)
Add a meta information to the skin object
Note: the information is not stored, therefore should be filled each time during skins registration
## skin:get_meta(key)
2018-01-07 20:30:27 +01:00
The next metadata keys are filled or/and used interally in skinsdb framework
2017-06-21 21:24:41 +02:00
- name - A name for the skin
- author - The skin author
- license - THe skin texture license
2018-01-07 14:50:22 +01:00
- assignment - (obsolete) is "player:playername" in case the skin is assigned to be privat for a player
2018-01-07 19:09:52 +01:00
- playername - Player assignment for private skin. Set false for skins not usable by all players (like NPC-Skins), true or nothing for all player skins
2018-01-07 20:30:27 +01:00
- in_inventory_list - If set to false the skin is not visible in inventory skins selection but can be still applied to the player
- _sort_id - Thi skins lists are sorted by this field for output (internal key)
2017-06-21 21:24:41 +02:00
## skin:get_meta_string(key)
Same as get_meta() but does return "" instead of nil if the meta key does not exists
2018-01-07 14:50:22 +01:00
## skin:is_applicable_for_player(playername)
2018-01-07 19:09:52 +01:00
Returns whether this skin is applicable for player "playername" or not, like private skins