diff --git a/Readme.md b/Readme.md index b97d964..a6e2651 100644 --- a/Readme.md +++ b/Readme.md @@ -57,6 +57,13 @@ The following tool textures (within the `textures/tools` folder) have been creat * Picking SkinDB skins for yourself or as Epidermis base textures * Upload to SkinDB +## Supported Games + +* [x] [Minetest Game](https://github.com/minetest/minetest_game) and most derivatives (`player_api` support) +* [x] [NodeCore](https://gitlab.com/sztest/nodecore) + +Other games are likely to work too. Try it and see. + ## Comparison ### 2D Texture Painting Mods @@ -164,7 +171,6 @@ Automatically sync with SkinDB at startup, continue syncing during game ## Possible future features -- [ ] NodeCore support - [ ] 3D armor support - [ ] Restart server if a certain amount of dynamic texture data has been reached (100 MB?) - [ ] Paintable transportability (as items?) & trashability diff --git a/mod.conf b/mod.conf index 79ec965..198de02 100644 --- a/mod.conf +++ b/mod.conf @@ -1,7 +1,7 @@ name = epidermis description = Feature-fledged skin (painting) mod depends = modlib, moblib -optional_depends = player_api +optional_depends = player_api, nc_player_model, nc_skins author = appguru(eu) license = MIT min_minetest_version = 5.4 \ No newline at end of file diff --git a/skin.lua b/skin.lua index b1b0911..d165764 100644 --- a/skin.lua +++ b/skin.lua @@ -1,4 +1,5 @@ local player_api = rawget(_G, "player_api") +local nodecore = rawget(_G, "nodecore") local function get_textures(player) if player_api then @@ -32,7 +33,18 @@ function epidermis.get_skin(player) return get_texture(player, skin_texture_index) end +local nc_skins = {} +if nodecore then + local player_skin = nodecore.player_skin + function nodecore.player_skin(player, ...) + return nc_skins[player:get_player_name()] or player_skin(player, ...) + end +end function epidermis.set_skin(player, skin) + if nodecore then + nc_skins[player:get_player_name()] = skin + return + end set_texture(player, skin_texture_index, skin) end @@ -43,10 +55,23 @@ function epidermis.get_model(player) return player:get_properties().mesh end +local nc_models = {} +if nodecore then + local player_visuals_base = nodecore.player_visuals_base + function nodecore.player_visuals_base(player) + local visuals = player_visuals_base(player) + visuals.mesh = nc_models[player:get_player_name()] or visuals.mesh + return visuals + end +end function epidermis.set_model(player, model) if player_api then player_api.set_model(player, model) return end + if nodecore then + nc_models[player:get_player_name()] = model + return + end player:set_properties{mesh = model} end \ No newline at end of file