Compare commits

...

5 Commits

Author SHA1 Message Date
Juraj Vajda 7fddb46c24 db updated and added gitignore 2016-10-20 00:19:14 +02:00
Juraj Vajda 8dea2db164 remove compiled files 2016-10-20 00:17:10 +02:00
Juraj Vajda a6e21e48d3 generate preview and copy them to the right directory 2016-10-08 17:54:05 +02:00
Juraj Vajda dff93f9e0a generate preview and copy them to the right directory 2016-10-08 17:23:48 +02:00
Juraj Vajda 9ead62281a working copy and udated db 2016-10-08 16:51:16 +02:00
3241 changed files with 2866 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
blender_out
output
pngcrush_output

Binary file not shown.

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

2
u_skins/depends.txt Normal file
View File

@ -0,0 +1,2 @@
unified_inventory?
default

151
u_skins/init.lua Normal file
View File

@ -0,0 +1,151 @@
-- 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.type = { SPRITE=0, MODEL=1 }
u_skins.pages = {}
u_skins.u_skins = {}
u_skins.get_type = function(texture)
if not texture then return end
if string.sub(texture,0,string.len("character")) == "character" then
return u_skins.type.MODEL
end
if string.sub(texture,0,string.len("player")) == "player" then
return u_skins.type.SPRITE
end
end
u_skins.modpath = minetest.get_modpath("u_skins")
dofile(u_skins.modpath.."/skinlist.lua")
dofile(u_skins.modpath.."/meta.lua")
dofile(u_skins.modpath.."/players.lua")
u_skins.update_player_skin = function(player)
local name = player:get_player_name()
if u_skins.get_type(u_skins.u_skins[name]) == u_skins.type.SPRITE then
player:set_properties({
visual = "upright_sprite",
textures = {u_skins.u_skins[name]..".png",u_skins.u_skins[name].."_back.png"},
visual_size = {x=1, y=2},
})
elseif u_skins.get_type(u_skins.u_skins[name]) == u_skins.type.MODEL then
player:set_properties({
visual = "mesh",
textures = {u_skins.u_skins[name]..".png"},
visual_size = {x=1, y=1},
})
end
u_skins.save()
end
-- Display Current Skin
unified_inventory.register_page("u_skins", {
get_formspec = function(player)
local name = player:get_player_name()
local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
if u_skins.get_type(u_skins.u_skins[name]) == u_skins.type.MODEL then
formspec = formspec
.. "image[0,.75;1,2;"..u_skins.u_skins[name].."_preview.png]"
.. "image[1,.75;1,2;"..u_skins.u_skins[name].."_preview_back.png]"
.. "label[6,.5;Raw texture:]"
.. "image[6,1;2,1;"..u_skins.u_skins[name]..".png]"
else
formspec = formspec
.. "image[0,.75;1,2;"..u_skins.u_skins[name]..".png]"
.. "image[1,.75;1,2;"..u_skins.u_skins[name].."_back.png]"
end
local meta = u_skins.meta[u_skins.u_skins[name]]
if meta then
if meta.name then
formspec = formspec .. "label[2,.5;Name: "..meta.name.."]"
end
if meta.author then
formspec = formspec .. "label[2,1;Author: "..meta.author.."]"
end
if meta.description then
formspec = formspec .. "label[2,1.5;"..meta.description.."]"
end
if meta.comment then
formspec = formspec .. 'label[2,2;"'..meta.comment..'"]'
end
end
formspec = formspec .. "button[.75,3;6.5,.5;u_skins_page_0;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.
for x = 0, math.floor(#u_skins.list/16+1) do
unified_inventory.register_page("u_skins_page_"..x, {
get_formspec = function(player)
local page = u_skins.pages[player:get_player_name()]
if page == nil then page = 0 end
local formspec = "background[0.06,0.99;7.92,7.52;ui_misc_form.png]"
local index = 0
local skip = 0 -- Skip u_skins, used for pages
-- skin thumbnails
for i, skin in ipairs(u_skins.list) do
if skip < page*16 then skip = skip + 1 else
if index < 16 then
formspec = formspec .. "image_button["..(index%8)..","..((math.floor(index/8))*2)..";1,2;"..skin
if u_skins.get_type(skin) == u_skins.type.MODEL then
formspec = formspec .. "_preview"
end
formspec = formspec .. ".png;u_skins_set_"..i..";]"
end
index = index +1
end
end
-- prev next page buttons
if page > 0 then
formspec = formspec .. "button[0,4;1,.5;u_skins_page_"..(page-1)..";<<]"
else
formspec = formspec .. "button[0,4;1,.5;u_skins_page_"..page..";<<]"
end
formspec = formspec .. "button[.75,4;6.5,.5;u_skins_page_"..page..";Page "..(page+1).."/"..math.floor(#u_skins.list/16+1).."]" -- a button is used so text is centered
if index > 16 then
formspec = formspec .. "button[7,4;1,.5;u_skins_page_"..(page+1)..";>>]"
else
formspec = formspec .. "button[7,4;1,.5;u_skins_page_"..page..";>>]"
end
return {formspec=formspec}
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")
end
for field, _ in pairs(fields) do
if string.sub(field,0,string.len("u_skins_set_")) == "u_skins_set_" then
u_skins.u_skins[player:get_player_name()] = u_skins.list[tonumber(string.sub(field,string.len("u_skins_set_")+1))]
u_skins.update_player_skin(player)
unified_inventory.set_inventory_formspec(player,"u_skins")
end
if string.sub(field,0,string.len("u_skins_page_")) == "u_skins_page_" then
u_skins.pages[player:get_player_name()] = tonumber(string.sub(field,string.len("u_skins_page_")+1))
unified_inventory.set_inventory_formspec(player,"u_skins_page_"..u_skins.pages[player:get_player_name()])
end
end
end)
-- set defaults
minetest.register_on_joinplayer(function(player)
if not u_skins.u_skins[player:get_player_name()] then
u_skins.u_skins[player:get_player_name()] = "character_1"
end
u_skins.update_player_skin(player)
end)

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 @@
name = "Sam 0",
author = "Jordach",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Tuxedo Sam",
author = "Jordach",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Franklin",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Trevor",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Bart Simpson",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Creeper",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "War Machine",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Gangnam Style",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Sonic The Hedgehog",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Charizard",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Scarlet Spider-man",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Ferdi Napoli",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Semmett9",
author = "Infinatum",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Finn The Adventured",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Jake",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Ferdi Napoli Reserve",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Joker",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Bleau Steve",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Deadpool Bleau",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Seth Rollins",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Daffy Duck",
author = "LuxAtheris",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "DareDevil",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Clone",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "John",
author = "Evergreen",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Banana Guy",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Rubber",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Gothic Sam",
author = "GingerHunter797",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Tails",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Aguia Explorer",
author = "Davizinho",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Toad",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "oOChainLynxOo",
author = "oOChainLynxOo",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "amazing spiderman",
author = "mateus",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "black spiderman",
author = "mateus",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Sam Mese Tee",
author = "oOChainLynxOo",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "rotor112",
author = "rotor112",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Jesus",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Wires",
author = "Geopbyte",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Vector",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Fire Mario",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "skin minecraft",
author = "lestouem",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "santa",
author = "jordan4ibanez",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "PenguinDad",
author = "PenguinDad",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "New Ferdi Napoli Skin",
author = "Ferdi Napoli",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Jan",
author = "Jan",
comment = "CC BY 4.0",

View File

@ -0,0 +1,3 @@
name = "PilzAdam",
author = "PilzAdam",
comment = "CC BY 4.0",

View File

@ -0,0 +1,3 @@
name = "Older Man Sam",
author = "philipbenr",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Renan123",
author = "sou o melhor",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "PenguinDad with Cape",
author = "PenguinDad",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Adarqet",
author = "Adarqet",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Adarqet(Cape)",
author = "Adarqet",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "wither",
author = "mario alberto",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Cywalk Sam",
author = "w_laenger",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "rantathe",
author = "ranta",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "ranta mk 2",
author = "ranta",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "gta",
author = "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv",
comment = "CC BY 3.0",

View File

@ -0,0 +1,3 @@
name = "DJ Gangstar",
author = "hansuke123",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "G-Robo v5000",
author = "philipbenr",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Blue Tron Man",
author = "Novacain",
comment = "CC BY 3.0",

View File

@ -0,0 +1,3 @@
name = "killer man",
author = "hansuke123",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "agent slender",
author = "krauserlee",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "DJ Gangstar on the cape",
author = "hansuke123",
comment = "CC BY-NC-SA 4.0",

View File

@ -0,0 +1,3 @@
name = "Steve on the a creeper head",
author = "hansuke123",
comment = "CC BY 4.0",

View File

@ -0,0 +1,3 @@
name = "Calinou",
author = "Calinou",
comment = "CC BY-SA 4.0",

View File

@ -0,0 +1,3 @@
name = "EnderMan",
author = "Eu",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Finnzzin",
author = "Jo&atilde;o Neto",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Golden Knight",
author = "Nero3605",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "wheat farmer",
author = "addi",
comment = "CC BY 3.0",

View File

@ -0,0 +1,3 @@
name = "jojoa1997",
author = "jojoa1997",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Jovens",
author = "Ailton Junior",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "one of my favourite skins",
author = "w_laenger",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Mammu",
author = "hansuke123",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Enderman",
author = "hansuke123",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "DanTDM",
author = "hansuke123",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Gangstar Herobrine",
author = "hansuke123",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Zombie Boss",
author = "hansuke123",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Esteban",
author = "Esteban",
comment = "CC BY-NC-SA 4.0",

View File

@ -0,0 +1,3 @@
name = "Bajancanadian",
author = "bajanhgk",
comment = "CC BY 4.0",

View File

@ -0,0 +1,3 @@
name = "boy",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Zenohelds default player",
author = "sdzen",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Dead pool",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "cool guy",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Cryotic",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Altier",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Sasuke",
author = "Bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Iron patriot",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Iron spider",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Spider man",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "War machine",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Dante",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Sdzen",
author = "sdzen",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Naruto kuiby",
author = "bajanhgk",
comment = "CC BY-NC-SA 3.0",

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