Minetest_game: Skins

Created on 4 Dec 2017  路  9Comments  路  Source: minetest/minetest_game

Add a simple skins mod

Feature

All 9 comments

WIP PR #1967

Is it worth discussing which skins to add into the game?

Probably some shirt color & skin tone variations of Sam/Samantha.

No it's not worth dicussing, it would be unbearable bikeshedding.
I'll add what i think is suitable, then other devs can add more, so we have a really big choice.

I made it halfway there to making a databased skins mod but I encountered this issue in the engine. Until we can actually make dynamic textures properly I don't think built-in skins are worth it.

Some ideas from my site:

I think some of the skins handling should be implemented to the new player_api mod, in same way like model. The API enhancement should be usable for all skins provider mods. Maybe the simplest skins provider https://github.com/PilzAdam/player_textures/blob/master/init.lua, should be in player_api, but as function overridable by other mods.

This enhancments I see to the player_api (pseudo-code):

player_api.registered_skins = {}
function player_api.register_skin(skin_name, def)
function player_api.set_skin(player, skin_name)
function player_api.get_initial_skin(player) return player_"playername" or "sam" end

The skin definition is at least

{
   textures = {}, -- the skins textures for model
   model_name = 'model_name', -- the model to be used for the skin
   on_set_hook = function(player), -- optional
   -- additional optional data supported, if needed for skins provider mods
}

next functionality should be in player_api mod

  • Adjust model if skin is selected
  • call on_set_hook if defined before setting model and textures (allow dynamically skins definition)
  • Store current assigned skin to player metadata
  • on_joinplayer call the set_skin with selected skin from metadata (including on_set_hook dynamic call)
  • on_newplayer (or on_join player if no selected skin found) - call function player_api.get_initial_skin to get initial skin before setting them. The method could be redefined by other skins mod.
  • of course at least the "sam" skin, maybe an second female skin too?

Additional idea: instead of hard-coded "sam" or 1:1 port of https://github.com/PilzAdam/player_textures/blob/master/init.lua as initial skins, just check if player_api.registered_skins["player_"..playername] then .... else "sam" + and also check initially the textures folder for provided skins.

I plan to start to work on proposed changes on player_api and start a new mod called spsp (=Simple Player Skins Provider) with next functionalities:

  • Read "textures" folder and register all skins in player_api
  • User "player_"..playername Skin as default for player if such skin registered and no other skin assigned
  • Chat command to list skins and assign skin to player. Player cannot set skin byself because I do not implement any "private/public/wardrobe/???" skin authority concept to player_api or spsp. Just the server owner is allowed to do whatever like, so server privilege required

i think this concept is basic enough and enhanceable by external skins provider mods like skinsdb trough defined API.

Initial version https://github.com/minetest/minetest_game/compare/master...bell07:player_api_skins_spsp open for discussion.

The version contains the player_api draft changes at the first, for discussion. Based on this changes I implement spsp-mod mentioned above ...

Note the "upright_sprite" is now an registered skin, that means useable in parallel to Sam (for different users), if re-assignment possible by chat command ;-)

PR #2122 is open for discussion

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sofar picture sofar  路  5Comments

HybridDog picture HybridDog  路  4Comments

Wuzzy2 picture Wuzzy2  路  4Comments

stujones11 picture stujones11  路  4Comments

TekhnaeRaav picture TekhnaeRaav  路  5Comments