diff --git a/DOCS.md b/DOCS.md index dfb13ce..1e6f078 100644 --- a/DOCS.md +++ b/DOCS.md @@ -16,22 +16,35 @@ TODO: documentare comandi? Se sì, qui e basta o anche nel README? ## 1 Skins -(TODO, check the README for now) +A skin is a table with the following fields: +```yaml +skinID: + name: + description: + texture: + hint: (optional, default "(locked)") + model: (optional, default none) + tier: (optional, default 1) + author: (optional, default "???") +``` + +Check the README to know how to add new skins ## 2 API TODO: spiega ### 2.1 Skins handlers -* `collectible_skins.unlock_skin(p_name, skin_ID)`: unlock skin with ID `skin_ID` for `p_name` +* `collectible_skins.unlock_skin(p_name, skin_ID)`: unlock skin with ID `skin_ID` for `p_name` * `collectible_skins.remove_skin(p_name, skin_ID)`: remove skin with ID `skin_ID` from `p_name` ### 2.2 Utils * `collectible_skins.is_skin_unlocked(p_name, skin_ID)`: returns whether `p_name` has the skin with ID `skin_ID`, as a boolean ### 2.3 Getters -* `collectible_skins.get_skins()`: returns a table with all the loaded skins, with their IDs as a key and the skin as a value +* `collectible_skins.get_skins()`: returns a table with all the loaded skins, with their IDs as a key and the skin as a value * `collectible_skins.get_skin(skin_ID)`: returns the skin corresponding to `skin_ID`, if any +* `collectible_skins.get_portrait(skin)`: returns the portrait associated to the skin, if any * `collectible_skins.get_player_skin(p_name)`: returns the skin that `p_name` has currently equipped * `collectible_skins.get_player_skin_ID(p_name)`: returns the ID of the skin that `p_name` has currently equipped diff --git a/src/api.lua b/src/api.lua index 4719940..d5c9ad3 100644 --- a/src/api.lua +++ b/src/api.lua @@ -251,6 +251,12 @@ end +function collectible_skins.get_portrait(skin) + return "([combine:24x24:0,0=" .. skin.texture .. "^[mask:skins_portraitmask.png)" +end + + + function collectible_skins.get_player_skin(p_name) return loaded_skins[equipped_skin[p_name]] end diff --git a/textures/skins_portraitmask.png b/textures/skins_portraitmask.png new file mode 100644 index 0000000..d75b239 Binary files /dev/null and b/textures/skins_portraitmask.png differ