MineClone2/mods/PLAYER/mcl_skins/README.md

119 lines
3.7 KiB
Markdown
Raw Normal View History

2022-09-06 19:51:43 +02:00
# Mineclone Skins
2022-08-29 20:09:00 +02:00
This mod allows advanced skin customization.
Use the /skin command to open the skin configuration screen.
2023-04-29 19:27:56 +02:00
To include custom skins in MineClone2, please download [mcl_custom_skins](https://git.minetest.land/mineclone2/mcl_custom_skins)
2022-08-29 20:09:00 +02:00
## License
2019-03-05 10:40:37 +01:00
Code under MIT license
2023-04-29 19:27:56 +02:00
Author: MrRar
2022-08-29 20:09:00 +02:00
See image_credits.txt for image licensing.
## API
### `mcl_skins.register_item(item)`
Register a skin item. `item` is a table with item properties listed below.
### Item properties
2023-04-27 05:01:37 +02:00
2022-08-29 20:09:00 +02:00
`type`
Set the item type. Valid values are: "base", "footwear", "eye", "mouth", "bottom", "top", "hair", "headwear"
`texture`
Set to the image file that will be used. If this property is omitted "blank.png" is used.
`mask`
Set the color mask texture. Coloring is only applied to non transparent areas of the texture.
Coloring only works for "base", "bottom, "top", and "hair".
`preview_rotation`
A table containing properties x and y. x and y represent the x and y rotation of the item preview.
2023-05-18 19:48:41 +02:00
`template2`
If set to true the item will be default for female template.
2022-08-29 20:09:00 +02:00
2023-05-18 19:48:41 +02:00
`template1`
If set to true the item will be default for male template.
2022-08-29 20:09:00 +02:00
2023-04-27 05:01:37 +02:00
`rank`
This property is used to change the application order of the skin item when applied to a player.
The default ranks for each item type are:
base: 10
footwear: 20
eye: 30
mouth: 40
bottom: 50
top: 60
hair: 70
headwear: 80
2022-08-29 20:09:00 +02:00
2023-04-27 05:01:37 +02:00
Lower ranks are applied to the player first and can thus be covered by higher rank items.
2023-05-18 19:48:41 +02:00
### `mcl_skins.show_formspec(player, active_tab, page_num)`
2022-08-29 20:09:00 +02:00
Show the skin configuration screen.
2023-05-18 19:48:41 +02:00
2022-08-29 20:09:00 +02:00
`player` is a player ObjectRef.
2023-05-18 19:48:41 +02:00
`active_tab` is the tab that will be displayed. This parameter is optional.
Can be one of: "arm", "base", "footwear", "eye", "mouth", "bottom", "top", "hair", "headwear"
`page_num` The page number to display of there are multiple pages of items.
This parameter is optional. Must be a number. If it is not a valid page number the closest page number will be shown.
2022-09-06 19:51:43 +02:00
### `mcl_skins.get_skin_list()`
This function is used by mods that want a list of skins to register nodes that use the player skin as a texture.
Returns an array of tables containing information about each skin.
Each table contains the following properties:
`id`: A string representing the node ID. A node can be registered using this node ID.
2023-04-27 05:01:37 +02:00
2022-09-06 19:51:43 +02:00
`texture`: A texture string that can be used in the node defintion.
2023-04-27 05:01:37 +02:00
2022-09-06 19:51:43 +02:00
`slim_arms`: A boolean value. If true, this texture is used with the "female" player mesh. Otherwise the regular mesh is to be used.
### `mcl_skins.get_node_id_by_player(player)`
`player` is a player ObjectRef.
Returns a string node ID based on players current skin for use by mods that want to register nodes that use the player skin.
2022-08-29 20:09:00 +02:00
### `mcl_skins.save(player)`
Save player skin. `player` is a player ObjectRef.
### `mcl_skins.update_player_skin(player)`
Update a player based on skin data in mcl_skins.players.
`player` is a player ObjectRef.
### `mcl_skins.base_color`
A table of ColorSpec integers that the player can select to color the base item.
These colors are separate from `mcl_skins.color` because some mods register two nodes per base color so the amount of base colors needs to be limited.
### `mcl_skins.color`
A table of ColorSpec integers that the player can select to color colorable skin items.
2023-04-27 05:01:37 +02:00
### `mcl_skins.player_skins`
2022-09-06 19:51:43 +02:00
A table mapped by player ObjectRef containing tables holding the player's selected skin items and colors.
2022-08-29 20:09:00 +02:00
Only stores skin information for logged in users.
2023-04-27 05:01:37 +02:00
### `mcl_skins.compile_skin(skin)`
2022-08-29 20:09:00 +02:00
`skin` is a table with skin item properties.
Returns an image string.
2023-04-27 05:01:37 +02:00
### `mcl_skins.register_simple_skin(skin)`
`skin` is a table with the following properties:
`texture`
The texture of the skin.
`slim_arms`
A boolean value. If set to true, the slim armed player mesh will be used with this skin.