first commit
22
README.md
@ -1,2 +1,20 @@
|
||||
player_hash_skin
|
||||
================
|
||||
Player Hash Skin Mod for Minetest
|
||||
====================================
|
||||
|
||||
This mod calculates a hash code of a player's name and chooses a texture for him according to this hash code.
|
||||
There are 8 skins as default, you can change them by replacing <integer>.png with the skin you want (rename it to <integer>.png).
|
||||
If you want more than 8 skins, change line 10 in init.lua:
|
||||
hash = hash%8 to hash = hash%<count of skins>
|
||||
and add additional skins to the textures folder.
|
||||
|
||||
Original Author:
|
||||
-----------------------
|
||||
Hiradur
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
WTFPL
|
||||
|
||||
License of textures:
|
||||
--------------------------------
|
||||
WTFPL
|
||||
|
17
README.txt
Normal file
@ -0,0 +1,17 @@
|
||||
Player Hash Skin Mod for Minetest
|
||||
====================================
|
||||
|
||||
This mod calculates a hash code of a player's name and chooses a texture for him according to this hash code.
|
||||
There are 8 skins as default, you can change them by replacing <integer>.png with the skin you want (rename it to <integer>.png).
|
||||
If you want more than 8 skins, change line 10 in init.lua:
|
||||
hash = hash%8 to hash = hash%<count of skins>
|
||||
and add additional skins to the textures folder.
|
||||
|
||||
|
||||
License of source code:
|
||||
-----------------------
|
||||
WTFPL, original author: Hiradur
|
||||
|
||||
License of textures:
|
||||
--------------------------------
|
||||
CC-BY-SA 3.0, original author: Jordach
|
1
depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
19
init.lua
Normal file
@ -0,0 +1,19 @@
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
local len = string.len(name)
|
||||
local hash = 0
|
||||
|
||||
for i = 1, len, 1 do
|
||||
hash = hash+(string.byte(name,i))
|
||||
end
|
||||
|
||||
hash = hash%8
|
||||
|
||||
local filename = minetest.get_modpath("player_hash_skin").."/textures/"..hash
|
||||
local f = io.open(filename..".png")
|
||||
|
||||
if f then
|
||||
f:close()
|
||||
default.player_set_textures(player, {string.format("%i.png", hash)})
|
||||
end
|
||||
end)
|
BIN
textures/0.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
textures/1.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
textures/2.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
textures/3.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
textures/4.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
textures/5.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
textures/6.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
textures/7.png
Normal file
After Width: | Height: | Size: 1.9 KiB |