Version MFF.
85
generate_previews.py
Executable file
@ -0,0 +1,85 @@
|
|||||||
|
#!/bin/env python2
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
import sys, os, subprocess
|
||||||
|
from os import listdir
|
||||||
|
from os.path import isfile, join, sep
|
||||||
|
|
||||||
|
def eprint(*args, **kwargs):
|
||||||
|
print(*args, file=sys.stderr, **kwargs)
|
||||||
|
|
||||||
|
def which(program):
|
||||||
|
import os
|
||||||
|
def is_exe(fpath):
|
||||||
|
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||||
|
|
||||||
|
fpath, fname = os.path.split(program)
|
||||||
|
if fpath:
|
||||||
|
if is_exe(program):
|
||||||
|
return program
|
||||||
|
else:
|
||||||
|
for path in os.environ["PATH"].split(os.pathsep):
|
||||||
|
path = path.strip('"')
|
||||||
|
exe_file = os.path.join(path, program)
|
||||||
|
if is_exe(exe_file):
|
||||||
|
return exe_file
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
|
from PIL import Image
|
||||||
|
except ImportError:
|
||||||
|
eprint("Could not import PIL, is it installed ?")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
uskins_path = "u_skins"
|
||||||
|
meta_path = join(uskins_path, "meta")
|
||||||
|
textures_path = join(uskins_path, "textures")
|
||||||
|
pngcrush = which('pngcrush')
|
||||||
|
optipng = which('optipng')
|
||||||
|
|
||||||
|
def process_copies(src, dst, copies):
|
||||||
|
for copy in copies:
|
||||||
|
srcrect = copy[0]
|
||||||
|
dstrect = copy[1]
|
||||||
|
flip = copy[2] if len(copy) > 2 else None
|
||||||
|
region = src.crop(srcrect)
|
||||||
|
if flip is not None:
|
||||||
|
region = region.transpose(flip)
|
||||||
|
dst.paste(region, dstrect)
|
||||||
|
|
||||||
|
def make_preview(src, dst):
|
||||||
|
skin = Image.open(src)
|
||||||
|
preview = Image.new('RGBA', (16, 32))
|
||||||
|
process_copies(skin, preview, [
|
||||||
|
[(8, 8, 16, 16), (4, 0)], # Head
|
||||||
|
[(44, 20, 48, 32), (0, 8)], # Left arm
|
||||||
|
[(44, 20, 48, 32), (12, 8), Image.FLIP_LEFT_RIGHT], # Right arm
|
||||||
|
[(20, 20, 28, 32), (4, 8)], # Body
|
||||||
|
[(4, 20, 8, 32), (4, 20)], # Left leg
|
||||||
|
[(4, 20, 8, 32), (8, 20), Image.FLIP_LEFT_RIGHT], # Right leg
|
||||||
|
])
|
||||||
|
overlay = Image.new('RGBA', (16, 32))
|
||||||
|
process_copies(skin, overlay, [
|
||||||
|
[(40, 8, 48, 16), (4, 0)], # Head
|
||||||
|
])
|
||||||
|
preview = Image.alpha_composite(preview, overlay)
|
||||||
|
preview.save(dst)
|
||||||
|
if optipng is not None:
|
||||||
|
p = subprocess.Popen([optipng, '-o7', '-quiet', dst])
|
||||||
|
p.wait()
|
||||||
|
elif pngcrush is not None:
|
||||||
|
p = subprocess.Popen([pngcrush, '-ow', '-s', dst])
|
||||||
|
p.wait()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
metas = [f for f in listdir(meta_path) if
|
||||||
|
isfile(join(meta_path, f)) and
|
||||||
|
f.endswith(".txt")]
|
||||||
|
for meta in metas:
|
||||||
|
f = open(join(meta_path, meta), 'r')
|
||||||
|
metadata = f.read().splitlines()
|
||||||
|
f.close()
|
||||||
|
skin = meta[:-4]
|
||||||
|
print("Processing {} \"{}\" by {} ({})...".format(skin, metadata[0], metadata[1], metadata[2]))
|
||||||
|
make_preview(join(textures_path, skin + ".png"), join(textures_path, skin + "_preview.png"))
|
0
modpack.txt
Normal file → Executable file
0
u_skins/depends.txt
Normal file → Executable file
7
u_skins/init.lua
Normal file → Executable file
@ -84,6 +84,8 @@ unified_inventory.register_page("u_skins", {
|
|||||||
unified_inventory.register_button("u_skins", {
|
unified_inventory.register_button("u_skins", {
|
||||||
type = "image",
|
type = "image",
|
||||||
image = "u_skins_button.png",
|
image = "u_skins_button.png",
|
||||||
|
tooltip = "Skin inventory",
|
||||||
|
show_with = false, -- modif MFF (Crabman 30/06/2015)
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Create all of the skin-picker pages.
|
-- Create all of the skin-picker pages.
|
||||||
@ -109,8 +111,9 @@ u_skins.generate_pages = function(texture)
|
|||||||
if i > 1 and x == 0 then
|
if i > 1 and x == 0 then
|
||||||
y = 1.8
|
y = 1.8
|
||||||
end
|
end
|
||||||
formspec = (formspec.."image_button["..x..","..y..";1,2;"
|
formspec = (formspec.."image_button["..x..","..y..";1,2;"..
|
||||||
..skin[2].."_preview.png;u_skins_set$"..skin[1]..";]")
|
skin[2].."_preview.png;u_skins_set$"..skin[1]..";]"..
|
||||||
|
"tooltip[u_skins_set$"..skin[1]..";"..u_skins.meta[skin[2]].name.."]")
|
||||||
end
|
end
|
||||||
local page_prev = page - 2
|
local page_prev = page - 2
|
||||||
local page_next = page
|
local page_next = page
|
||||||
|
15
u_skins/meta.lua
Executable 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
|
2
u_skins/meta/character_1.txt
Normal file → Executable file
@ -1,3 +1,3 @@
|
|||||||
Sam 0
|
Sam II
|
||||||
Jordach
|
Jordach
|
||||||
CC BY-SA 3.0
|
CC BY-SA 3.0
|
3
u_skins/meta/character_10.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
lordphoenixmh
|
||||||
|
lordphoenixmh
|
||||||
|
CC BY 4.0
|
3
u_skins/meta/character_11.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Ladyvioletkitty
|
||||||
|
lordphoenixmh
|
||||||
|
CC BY 4.0
|
3
u_skins/meta/character_12.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Jaded Bow
|
||||||
|
jadedtest
|
||||||
|
CC BY 4.0
|
3
u_skins/meta/character_13.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Trevor
|
||||||
|
Ferdi Napoli
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_14.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
ranta mk 2
|
||||||
|
ranta
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_15.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Mammu
|
||||||
|
hansuke123
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_16.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Sasuke
|
||||||
|
Bajanhgk
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_17.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Hunky Simon with Jacket
|
||||||
|
Andromeda
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_18.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Jayne
|
||||||
|
Andromeda
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_19.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Red-brown-shirt-dude
|
||||||
|
Krock
|
||||||
|
CC BY-SA 4.0
|
4
u_skins/meta/character_2.txt
Normal file → Executable file
@ -1,3 +1,3 @@
|
|||||||
Sam I
|
Azou
|
||||||
Jordach
|
Azeddine
|
||||||
CC BY-SA 3.0
|
CC BY-SA 3.0
|
3
u_skins/meta/character_20.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
ColerArt26
|
||||||
|
Colerart_26
|
||||||
|
CC BY-SA 4.0
|
3
u_skins/meta/character_21.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
BrightGirl
|
||||||
|
Malarif
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_22.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
take bake the night studant
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_23.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
dwarf from lottmob
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_24.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Pirate girl
|
||||||
|
Misty
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_25.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
elf from lottmob
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_26.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
gondor guard from lottmob
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_27.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
hobbit from lottmob
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_28.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
rohan guard from lottmob
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_29.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
npc trader from mobf
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_3.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Older Man Sam
|
||||||
|
philipbenr
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_30.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Adventer girl
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_31.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Adventurer
|
||||||
|
XSuperSaintX
|
||||||
|
CC BY 3.0
|
3
u_skins/meta/character_32.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Builder
|
||||||
|
Jyrgenf
|
||||||
|
CC BY 3.0
|
3
u_skins/meta/character_33.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Orange
|
||||||
|
Wuzzy
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_34.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
thewillyrex
|
||||||
|
edwar masterchieft
|
||||||
|
CC BY-SA 4.0
|
3
u_skins/meta/character_35.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
war-sloop
|
||||||
|
ange_black69
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_36.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
test
|
||||||
|
addi
|
||||||
|
CC 0 (1.0)
|
3
u_skins/meta/character_37.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Tree
|
||||||
|
Evergreen
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_38.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
jojoa1997 2
|
||||||
|
jojoa1997
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_39.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
RockerLuke skin
|
||||||
|
RockerLuke
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_4.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Summer Sam
|
||||||
|
philipbenr
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_40.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Tails
|
||||||
|
Ferdi Napoli
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_41.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Adventer girl
|
||||||
|
lovehart
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_5.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Samantha I
|
||||||
|
philipbenr
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_6.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Summer
|
||||||
|
lizzie
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/character_7.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
lisa
|
||||||
|
hansuke123
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_8.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Hobo/Homeless person
|
||||||
|
Minetestian
|
||||||
|
CC BY-SA 3.0
|
3
u_skins/meta/character_9.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
manoel1500
|
||||||
|
manoel1500
|
||||||
|
CC BY-NC-SA 3.0
|
3
u_skins/meta/mff_character_1.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
aquaman
|
||||||
|
|
||||||
|
GPL3
|
3
u_skins/meta/mff_character_2.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Matrix
|
||||||
|
Obani
|
||||||
|
GPL3
|
3
u_skins/meta/mff_character_3.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Cyclède
|
||||||
|
|
||||||
|
GPL3
|
3
u_skins/meta/mff_character_4.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
mystic
|
||||||
|
|
||||||
|
GPL3
|
3
u_skins/meta/mff_character_5.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Obani
|
||||||
|
Obani
|
||||||
|
GPL3
|
3
u_skins/meta/mff_character_6.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
strangekiller
|
||||||
|
|
||||||
|
GPL3
|
3
u_skins/meta/mff_character_7.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
walkingdead
|
||||||
|
|
||||||
|
GPL3
|
3
u_skins/meta/mff_character_8.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Cyberpangolin official
|
||||||
|
Cyberpangolin
|
||||||
|
??
|
3
u_skins/meta/mff_character_9.txt
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
Greyscale Anhedonia
|
||||||
|
Mg
|
||||||
|
WTFPL
|
@ -1 +0,0 @@
|
|||||||
Please run the update_from_db.py script to update the skins.
|
|
13
u_skins/players.lua
Normal file → Executable file
@ -10,15 +10,12 @@ u_skins.load_players = function()
|
|||||||
end
|
end
|
||||||
u_skins.load_players()
|
u_skins.load_players()
|
||||||
|
|
||||||
local ttime = 0
|
local function tick()
|
||||||
minetest.register_globalstep(function(t)
|
minetest.after(120, tick) --every 2min'
|
||||||
ttime = ttime + t
|
|
||||||
if ttime < 360 then --every 6min'
|
|
||||||
return
|
|
||||||
end
|
|
||||||
ttime = 0
|
|
||||||
u_skins.save()
|
u_skins.save()
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
minetest.after(120, tick)
|
||||||
|
|
||||||
minetest.register_on_shutdown(function() u_skins.save() end)
|
minetest.register_on_shutdown(function() u_skins.save() end)
|
||||||
|
|
||||||
|
24
u_skins/skinlist.lua
Normal file → Executable file
@ -24,3 +24,27 @@ while fetched_skip < 40 do
|
|||||||
fetched_skip = fetched_skip + 1
|
fetched_skip = fetched_skip + 1
|
||||||
id = id + 1
|
id = id + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- MODIFICATION MADE FOR MFF
|
||||||
|
id = 1
|
||||||
|
fetched_skip = 0
|
||||||
|
while fetched_skip < 40 do
|
||||||
|
local name = "mff_character_"..id
|
||||||
|
local file = io.open(u_skins.modpath.."/meta/"..name..".txt", "r")
|
||||||
|
if file then
|
||||||
|
local data = string.split(file:read("*all"), "\n", 3)
|
||||||
|
file:close()
|
||||||
|
u_skins.list[internal_id] = name
|
||||||
|
u_skins.meta[name] = {}
|
||||||
|
u_skins.meta[name].name = data[1]
|
||||||
|
u_skins.meta[name].author = data[2]
|
||||||
|
u_skins.meta[name].license = data[3] or ""
|
||||||
|
u_skins.meta[name].description = ""
|
||||||
|
|
||||||
|
fetched_skip = 0
|
||||||
|
internal_id = internal_id + 1
|
||||||
|
end
|
||||||
|
fetched_skip = fetched_skip + 1
|
||||||
|
id = id + 1
|
||||||
|
end
|
||||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
u_skins/textures/character_10.png
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
u_skins/textures/character_10_preview.png
Normal file
After Width: | Height: | Size: 876 B |
BIN
u_skins/textures/character_11.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
u_skins/textures/character_11_preview.png
Normal file
After Width: | Height: | Size: 762 B |
BIN
u_skins/textures/character_12.png
Executable file
After Width: | Height: | Size: 571 B |
BIN
u_skins/textures/character_12_preview.png
Normal file
After Width: | Height: | Size: 387 B |
BIN
u_skins/textures/character_13.png
Executable file
After Width: | Height: | Size: 3.1 KiB |
BIN
u_skins/textures/character_13_preview.png
Normal file
After Width: | Height: | Size: 989 B |
BIN
u_skins/textures/character_14.png
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
u_skins/textures/character_14_preview.png
Normal file
After Width: | Height: | Size: 807 B |
BIN
u_skins/textures/character_15.png
Executable file
After Width: | Height: | Size: 590 B |
BIN
u_skins/textures/character_15_preview.png
Normal file
After Width: | Height: | Size: 325 B |
BIN
u_skins/textures/character_16.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
u_skins/textures/character_16_preview.png
Normal file
After Width: | Height: | Size: 662 B |
BIN
u_skins/textures/character_17.png
Executable file
After Width: | Height: | Size: 612 B |
BIN
u_skins/textures/character_17_preview.png
Normal file
After Width: | Height: | Size: 283 B |
BIN
u_skins/textures/character_18.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
u_skins/textures/character_18_preview.png
Normal file
After Width: | Height: | Size: 495 B |
BIN
u_skins/textures/character_19.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
u_skins/textures/character_19_preview.png
Normal file
After Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 800 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
u_skins/textures/character_20.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
u_skins/textures/character_20_preview.png
Normal file
After Width: | Height: | Size: 744 B |
BIN
u_skins/textures/character_21.png
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
u_skins/textures/character_21_preview.png
Normal file
After Width: | Height: | Size: 575 B |
BIN
u_skins/textures/character_22.png
Executable file
After Width: | Height: | Size: 1005 B |
BIN
u_skins/textures/character_22_preview.png
Normal file
After Width: | Height: | Size: 490 B |
BIN
u_skins/textures/character_23.png
Executable file
After Width: | Height: | Size: 3.4 KiB |
BIN
u_skins/textures/character_23_preview.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
u_skins/textures/character_24.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
u_skins/textures/character_24_preview.png
Normal file
After Width: | Height: | Size: 704 B |
BIN
u_skins/textures/character_25.png
Executable file
After Width: | Height: | Size: 767 B |
BIN
u_skins/textures/character_25_preview.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
u_skins/textures/character_26.png
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
u_skins/textures/character_26_preview.png
Normal file
After Width: | Height: | Size: 744 B |
BIN
u_skins/textures/character_27.png
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
u_skins/textures/character_27_preview.png
Normal file
After Width: | Height: | Size: 1.0 KiB |