Initial commit

master
Juraj Vajda 2016-10-08 15:45:24 +02:00
commit 7b04220d98
1763 changed files with 2074 additions and 0 deletions

20
README Normal file
View File

@ -0,0 +1,20 @@
minetest-u_skins
================
Skins mod for minetest unified_inventory by Dean Montgomery - feel free to merge it into skinsdb or unified_inventory git.
Requires latest unified_inventory from:
https://github.com/minetest-technic/unified_inventory
This is the "u_skindb" branch, it is ment to download the skins from addi's skin database (http://minetest.fensta.bplaced.net).
To re-download the latest skins you may want to run:
"./update_from_db.py" OR
"./update_from_db2.py"
script, then "./generate_previews.sh" before using the mod.
Credits:
MirceaKitsune (WTFPL) + bundled script by Zeg9 (WTFPL too):
skin_previews.blend
RealyBadAngel unified_inventory and Zeg9 skinsdb

48
generate_previews.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
# This script is used to generate the previews needed by the mod
# It requires blender with the latest python API (2.6x is tested)
# A script that works with older blenders and, maybe, without python, is available in older commits.
# This script can also use pngcrush and imagemagick to reduce output size,
# please enable them if you want to push to the git repository of the mod.
# Pngcrush output will be written to .previews/pngcrush_output
# Warning: any file in .previews/ and u_skins/textures might be deleted without asking.
PNGCRUSH=true
IMAGEMAGICK=true
cd .previews
rm ../u_skins/textures/*_preview*.png # Remove all previous previews
blender -b skin_previews.blend --python-text "Generate previews" > /dev/null
if $IMAGEMAGICK
then echo "Stripping metadata from generated files..."
else echo "Moving files..."
fi
rm -rf output # remove my output
mkdir -p output
for i in blender_out/character_*_00.png;
do
out_name=$(basename $i | sed -e 's/_00.png//g')
out_file=output/"$out_name"_preview.png
if $IMAGEMAGICK
then
convert -strip $i $out_file
else
mv $i $out_file
fi
done
for i in blender_out/character_*_01.png;
do
out_name=$(basename $i | sed -e 's/_01.png//g')
out_file=output/"$out_name"_preview_back.png
if $IMAGEMAGICK
then
convert -strip $i $out_file
else
mv $i $out_file
fi
done
if $PNGCRUSH
then
echo "Running pngcrush..."
pngcrush -d ../u_skins/textures/ output/*_preview*.png 2> pngcrush_output
else mv output/*_preview*.png ../u_skins/textures/
fi
echo "Done !"

0
modpack.txt Normal file
View File

59
set_meta.sh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
SPRITES=$(find -regextype sed -regex '.*/player_[0-9]\{1,\}.png' | sort -V)
MODELS=$(find -regextype sed -regex '.*/character_[0-9]\{1,\}.png' | sort -V)
function ask_for_meta {
convert $2 -scale 100x200 /tmp/skins_set_meta
SNAME=$(basename $1)
SNAME=${SNAME%.*}
METAFILE=u_skins/meta/$SNAME.txt
FORCE=$3
if $FORCE || ! [ -f $METAFILE ]
then
echo $METAFILE
YADOUT=$(yad --form --image=/tmp/skins_set_meta --field $SNAME:LBL --field=Name --field=Author --field=Description --field=Comment)
if [ -z "$YADOUT" ]; then exit; fi # canceled
OIFS="$IFS"
IFS='|'
read -a VALUES <<< "$YADOUT"
IFS="$OIFS"
NAME=${VALUES[1]}
AUTHOR=${VALUES[2]}
DESCRIPTION=${VALUES[3]}
COMMENT=${VALUES[4]}
if [ -n "$NAME" ] && [ -n "$AUTHOR" ]
then
echo -n > $METAFILE # clear it
echo 'name = "'$NAME'",' >> $METAFILE
echo 'author = "'$AUTHOR'",' >> $METAFILE
# only write description and comment if they are specified
if [ -n "$DESCRIPTION" ]
then
echo 'description = "'$DESCRIPTION'",' >> $METAFILE
fi
if [ -n "$COMMENT" ]
then
echo 'comment = "'$COMMENT'",' >> $METAFILE
fi
echo "Saved !"
fi
fi
}
if [ -z $1 ]
then
for i in $SPRITES
do
ask_for_meta $i $i false
done
for i in $MODELS
do
ask_for_meta $i ${i%.*}_preview.png false
done
else
if [ -f ${1%.*}_preview.png ]
then
ask_for_meta $1 ${1%.*}_preview.png true
else
ask_for_meta $1 $1 true
fi
fi
rm /tmp/skins_set_meta

3
u_skins/depends.txt Normal file
View File

@ -0,0 +1,3 @@
unified_inventory
default
simple_skins?

175
u_skins/init.lua Normal file
View File

@ -0,0 +1,175 @@
-- Unified Skins for Minetest - based modified Bags from unfied_inventory and skins from inventory_plus
-- Copyright (c) 2012 cornernote, Dean Montgomery
-- License: GPLv3
u_skins = {}
u_skins.modpath = minetest.get_modpath("u_skins")
u_skins.file = minetest.get_worldpath().."/u_skins.mt"
u_skins.default = "character_1"
u_skins.pages = {}
u_skins.u_skins = {}
u_skins.file_save = false
u_skins.simple_skins = false
-- ( Deprecated
u_skins.type = { SPRITE=0, MODEL=1, ERROR=99 }
u_skins.get_type = function(texture)
if not u_skins.is_skin(texture) then
return u_skins.type.ERROR
end
return u_skins.type.MODEL
end
-- )
u_skins.is_skin = function(texture)
if not texture then
return false
end
if not u_skins.meta[texture] then
return false
end
return true
end
dofile(u_skins.modpath.."/skinlist.lua")
dofile(u_skins.modpath.."/players.lua")
if rawget(_G, "skins") then
u_skins.simple_skins = true
end
u_skins.update_player_skin = function(player)
local name = player:get_player_name()
if u_skins.simple_skins and u_skins.u_skins[name] == u_skins.default then
return
end
if not u_skins.is_skin(u_skins.u_skins[name]) then
u_skins.u_skins[name] = u_skins.default
end
player:set_properties({
textures = {u_skins.u_skins[name]..".png"},
})
end
-- Display Current Skin
unified_inventory.register_page("u_skins", {
get_formspec = function(player)
local name = player:get_player_name()
if not u_skins.is_skin(u_skins.u_skins[name]) then
u_skins.u_skins[name] = u_skins.default
end
local formspec = ("background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
.."image[0,.75;1,2;"..u_skins.u_skins[name].."_preview.png]"
.."label[6,.5;Raw texture:]"
.."image[6,1;2,1;"..u_skins.u_skins[name]..".png]")
local meta = u_skins.meta[u_skins.u_skins[name]]
if meta then
if meta.name ~= "" then
formspec = formspec.."label[2,.5;Name: "..minetest.formspec_escape(meta.name).."]"
end
if meta.author ~= "" then
formspec = formspec.."label[2,1;Author: "..minetest.formspec_escape(meta.author).."]"
end
if meta.license ~= "" then
formspec = formspec.."label[2,1.5;License: "..minetest.formspec_escape(meta.license).."]"
end
if meta.description ~= "" then --what's that??
formspec = formspec.."label[2,2;Description: "..minetest.formspec_escape(meta.description).."]"
end
end
local page = 0
if u_skins.pages[name] then
page = u_skins.pages[name]
end
formspec = formspec .. "button[.75,3;6.5,.5;u_skins_page$"..page..";Change]"
return {formspec=formspec}
end,
})
unified_inventory.register_button("u_skins", {
type = "image",
image = "u_skins_button.png",
})
-- Create all of the skin-picker pages.
u_skins.generate_pages = function(texture)
local page = 0
local pages = {}
for i, skin in ipairs(u_skins.list) do
local p_index = (i - 1) % 16
if p_index == 0 then
page = page + 1
pages[page] = {}
end
pages[page][p_index + 1] = {i, skin}
end
local total_pages = page
page = 1
for page, arr in ipairs(pages) do
local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
local y = -0.1
for i, skin in ipairs(arr) do
local x = (i - 1) % 8
if i > 1 and x == 0 then
y = 1.8
end
formspec = (formspec.."image_button["..x..","..y..";1,2;"..
skin[2].."_preview.png;u_skins_set$"..skin[1]..";]"..
"tooltip[u_skins_set$"..skin[1]..";"..u_skins.meta[skin[2]].name.."]")
end
local page_prev = page - 2
local page_next = page
if page_prev < 0 then
page_prev = total_pages - 1
end
if page_next >= total_pages then
page_next = 0
end
formspec = (formspec
.."button[0,3.8;1,.5;u_skins_page$"..page_prev..";<<]"
.."button[.75,3.8;6.5,.5;u_skins_null;Page "..page.."/"..total_pages.."]"
.."button[7,3.8;1,.5;u_skins_page$"..page_next..";>>]")
unified_inventory.register_page("u_skins_page$"..(page - 1), {
get_formspec = function(player)
return {formspec=formspec}
end
})
end
end
-- click button handlers
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.u_skins then
unified_inventory.set_inventory_formspec(player, "craft")
return
end
for field, _ in pairs(fields) do
local current = string.split(field, "$", 2)
if current[1] == "u_skins_set" then
u_skins.u_skins[player:get_player_name()] = u_skins.list[tonumber(current[2])]
u_skins.update_player_skin(player)
u_skins.file_save = true
unified_inventory.set_inventory_formspec(player, "u_skins")
elseif current[1] == "u_skins_page" then
u_skins.pages[player:get_player_name()] = current[2]
unified_inventory.set_inventory_formspec(player, "u_skins_page$"..current[2])
end
end
end)
-- Change skin on join - reset if invalid
minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
if not u_skins.is_skin(u_skins.u_skins[player_name]) then
u_skins.u_skins[player_name] = u_skins.default
end
u_skins.update_player_skin(player)
end)
u_skins.generate_pages()
u_skins.load_players()

15
u_skins/meta.lua Normal file
View File

@ -0,0 +1,15 @@
u_skins.meta = {}
for _, i in ipairs(u_skins.list) do
u_skins.meta[i] = {}
local f = io.open(u_skins.modpath.."/meta/"..i..".txt")
local data = nil
if f then
data = minetest.deserialize("return {"..f:read('*all').."}")
f:close()
end
data = data or {}
u_skins.meta[i].name = data.name or ""
u_skins.meta[i].author = data.author or ""
u_skins.meta[i].description = data.description or nil
u_skins.meta[i].comment = data.comment or nil
end

View File

@ -0,0 +1,3 @@
Sam 0
Jordach
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Tuxedo Sam
Jordach
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Franklin
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Trevor
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Bart Simpson
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Creeper
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
War Machine
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Gangnam Style
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Sonic The Hedgehog
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Charizard
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Scarlet Spider-man
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Ferdi Napoli
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Semmett9
Infinatum
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Finn The Adventured
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Jake
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Ferdi Napoli Reserve
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Joker
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Bleau Steve
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Deadpool Bleau
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Seth Rollins
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Daffy Duck
LuxAtheris
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
DareDevil
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Clone
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
John
Evergreen
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Banana Guy
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Rubber
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Gothic Sam
GingerHunter797
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Tails
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Aguia Explorer
Davizinho
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Toad
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
oOChainLynxOo
oOChainLynxOo
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
amazing spiderman
mateus
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
black spiderman
mateus
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Sam Mese Tee
oOChainLynxOo
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
rotor112
rotor112
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Jesus
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Wires
Geopbyte
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Vector
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Fire Mario
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
skin minecraft
lestouem
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
santa
jordan4ibanez
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
PenguinDad
PenguinDad
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
New Ferdi Napoli Skin
Ferdi Napoli
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Jan
Jan
CC BY 4.0

View File

@ -0,0 +1,3 @@
PilzAdam
PilzAdam
CC BY 4.0

View File

@ -0,0 +1,3 @@
Older Man Sam
philipbenr
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Renan123
sou o melhor
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
PenguinDad with Cape
PenguinDad
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Adarqet
Adarqet
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Adarqet(Cape)
Adarqet
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
wither
mario alberto
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Cywalk Sam
w_laenger
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
rantathe
ranta
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
ranta mk 2
ranta
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
gta
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
CC BY 3.0

View File

@ -0,0 +1,3 @@
DJ Gangstar
hansuke123
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
G-Robo v5000
philipbenr
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Blue Tron Man
Novacain
CC BY 3.0

View File

@ -0,0 +1,3 @@
killer man
hansuke123
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
agent slender
krauserlee
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
DJ Gangstar on the cape
hansuke123
CC BY-NC-SA 4.0

View File

@ -0,0 +1,3 @@
Steve on the a creeper head
hansuke123
CC BY 4.0

View File

@ -0,0 +1,3 @@
Calinou
Calinou
CC BY-SA 4.0

View File

@ -0,0 +1,3 @@
EnderMan
Eu
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Finnzzin
Jo&atilde;o Neto
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Golden Knight
Nero3605
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
wheat farmer
addi
CC BY 3.0

View File

@ -0,0 +1,3 @@
jojoa1997
jojoa1997
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Jovens
Ailton Junior
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
one of my favourite skins
w_laenger
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Mammu
hansuke123
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Enderman
hansuke123
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
DanTDM
hansuke123
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Gangstar Herobrine
hansuke123
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Zombie Boss
hansuke123
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Esteban
Esteban
CC BY-NC-SA 4.0

View File

@ -0,0 +1,3 @@
Bajancanadian
bajanhgk
CC BY 4.0

View File

@ -0,0 +1,3 @@
boy
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Zenohelds default player
sdzen
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Dead pool
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
cool guy
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Cryotic
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Altier
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Sasuke
Bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Iron patriot
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Iron spider
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Spider man
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
War machine
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Dante
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Sdzen
sdzen
CC BY-SA 3.0

View File

@ -0,0 +1,3 @@
Naruto kuiby
bajanhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Blue iron man
bajnhgk
CC BY-NC-SA 3.0

View File

@ -0,0 +1,3 @@
Pewdiepie
bajanhgk
CC BY-NC-SA 3.0

Some files were not shown because too many files have changed in this diff Show More