1
0
mirror of https://github.com/SmallJoker/minetest-u_skinsdb.git synced 2024-11-16 07:00:18 +01:00

first commit

This commit is contained in:
dmonty2 2014-03-16 22:26:58 -07:00
parent 5e58108006
commit 62be356cab
617 changed files with 679 additions and 0 deletions

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)
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)
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)
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 = "Ladyvioletkitty",
author = "lordphoenixmh",
comment = "CC BY 4.0",

View File

@ -0,0 +1,3 @@
name = "4&deg;district",
author = "Ferdi Napoli",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Chop",
author = "Ferdi Napoli",
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 = "Semmett9",
author = "Infinatum",
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 = "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 = "John",
author = "Evergreen",
comment = "CC BY-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 = "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 = "rotor112",
author = "rotor112",
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 = "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 = "https://dl.dropbox.com/s/cs0vhq8kkzpcvre/santa.zip?dl=1",
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 = "Older Man Sam",
author = "philipbenr",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "Army",
author = "Ragnar",
comment = "CC BY-NC-SA 4.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 = "Mcc457",
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 = "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 = "G-Robo v5000",
author = "philipbenr",
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 = "jojoa1997",
author = "jojoa1997",
comment = "CC BY-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 = "Sdzen",
author = "sdzen",
comment = "CC BY-SA 3.0",

View File

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

View File

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

View File

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

View File

@ -0,0 +1,3 @@
name = "Demon Farmer Sam (ray8888 server)",
author = "sdzen",
comment = "CC BY-SA 3.0",

View File

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

View File

@ -0,0 +1,3 @@
name = "Interstella 5555 guitarist",
author = "philipbenr",
comment = "CC BY-SA 3.0",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,3 @@
name = "Natsu (Fairy Tail)",
author = "philipbenr",
comment = "CC BY-SA 3.0",

View File

@ -0,0 +1,3 @@
name = "My younger Brother",
author = "philipbenr",
comment = "CC BY-SA 3.0",

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