Version MFF.

This commit is contained in:
sys4-fr 2018-09-08 23:10:14 +02:00
parent 71bebbeb09
commit f0d5f20a3a
166 changed files with 290 additions and 162 deletions

Binary file not shown.

Binary file not shown.

0
README Normal file → Executable file
View File

85
generate_previews.py Executable file
View 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
View File

0
u_skins/depends.txt Normal file → Executable file
View File

15
u_skins/init.lua Normal file → Executable file
View File

@ -51,12 +51,12 @@ unified_inventory.register_page("u_skins", {
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
@ -84,6 +84,8 @@ unified_inventory.register_page("u_skins", {
unified_inventory.register_button("u_skins", {
type = "image",
image = "u_skins_button.png",
tooltip = "Skin inventory",
show_with = false, -- modif MFF (Crabman 30/06/2015)
})
-- Create all of the skin-picker pages.
@ -109,8 +111,9 @@ u_skins.generate_pages = function(texture)
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]..";]")
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
@ -124,7 +127,7 @@ u_skins.generate_pages = function(texture)
.."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}
@ -162,4 +165,4 @@ minetest.register_on_joinplayer(function(player)
end)
u_skins.generate_pages()
u_skins.load_players()
u_skins.load_players()

15
u_skins/meta.lua Executable 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

4
u_skins/meta/character_1.txt Normal file → Executable file
View File

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

3
u_skins/meta/character_10.txt Executable file
View File

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

3
u_skins/meta/character_11.txt Executable file
View File

@ -0,0 +1,3 @@
Ladyvioletkitty
lordphoenixmh
CC BY 4.0

3
u_skins/meta/character_12.txt Executable file
View File

@ -0,0 +1,3 @@
Jaded Bow
jadedtest
CC BY 4.0

3
u_skins/meta/character_13.txt Executable file
View File

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

3
u_skins/meta/character_14.txt Executable file
View File

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

3
u_skins/meta/character_15.txt Executable file
View File

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

3
u_skins/meta/character_16.txt Executable file
View File

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

3
u_skins/meta/character_17.txt Executable file
View 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
View File

@ -0,0 +1,3 @@
Jayne
Andromeda
CC BY-NC-SA 3.0

3
u_skins/meta/character_19.txt Executable file
View File

@ -0,0 +1,3 @@
Red-brown-shirt-dude
Krock
CC BY-SA 4.0

6
u_skins/meta/character_2.txt Normal file → Executable file
View File

@ -1,3 +1,3 @@
Sam I
Jordach
CC BY-SA 3.0
Azou
Azeddine
CC BY-SA 3.0

3
u_skins/meta/character_20.txt Executable file
View File

@ -0,0 +1,3 @@
ColerArt26
Colerart_26
CC BY-SA 4.0

3
u_skins/meta/character_21.txt Executable file
View File

@ -0,0 +1,3 @@
BrightGirl
Malarif
CC BY-NC-SA 3.0

3
u_skins/meta/character_22.txt Executable file
View 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
View File

@ -0,0 +1,3 @@
dwarf from lottmob
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_24.txt Executable file
View File

@ -0,0 +1,3 @@
Pirate girl
Misty
CC BY-SA 3.0

3
u_skins/meta/character_25.txt Executable file
View File

@ -0,0 +1,3 @@
elf from lottmob
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_26.txt Executable file
View File

@ -0,0 +1,3 @@
gondor guard from lottmob
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_27.txt Executable file
View File

@ -0,0 +1,3 @@
hobbit from lottmob
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_28.txt Executable file
View File

@ -0,0 +1,3 @@
rohan guard from lottmob
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_29.txt Executable file
View File

@ -0,0 +1,3 @@
npc trader from mobf
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_3.txt Executable file
View File

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

3
u_skins/meta/character_30.txt Executable file
View File

@ -0,0 +1,3 @@
Adventer girl
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_31.txt Executable file
View File

@ -0,0 +1,3 @@
Adventurer
XSuperSaintX
CC BY 3.0

3
u_skins/meta/character_32.txt Executable file
View File

@ -0,0 +1,3 @@
Builder
Jyrgenf
CC BY 3.0

3
u_skins/meta/character_33.txt Executable file
View File

@ -0,0 +1,3 @@
Orange
Wuzzy
CC BY-SA 3.0

3
u_skins/meta/character_34.txt Executable file
View File

@ -0,0 +1,3 @@
thewillyrex
edwar masterchieft
CC BY-SA 4.0

3
u_skins/meta/character_35.txt Executable file
View File

@ -0,0 +1,3 @@
war-sloop
ange_black69
CC BY-NC-SA 3.0

3
u_skins/meta/character_36.txt Executable file
View File

@ -0,0 +1,3 @@
test
addi
CC 0 (1.0)

3
u_skins/meta/character_37.txt Executable file
View File

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

3
u_skins/meta/character_38.txt Executable file
View File

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

3
u_skins/meta/character_39.txt Executable file
View File

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

3
u_skins/meta/character_4.txt Executable file
View File

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

3
u_skins/meta/character_40.txt Executable file
View File

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

3
u_skins/meta/character_41.txt Executable file
View File

@ -0,0 +1,3 @@
Adventer girl
lovehart
CC BY-SA 3.0

3
u_skins/meta/character_5.txt Executable file
View File

@ -0,0 +1,3 @@
Samantha I
philipbenr
CC BY-SA 3.0

3
u_skins/meta/character_6.txt Executable file
View File

@ -0,0 +1,3 @@
Summer
lizzie
CC BY-NC-SA 3.0

3
u_skins/meta/character_7.txt Executable file
View File

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

3
u_skins/meta/character_8.txt Executable file
View File

@ -0,0 +1,3 @@
Hobo/Homeless person
Minetestian
CC BY-SA 3.0

3
u_skins/meta/character_9.txt Executable file
View File

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

View File

@ -0,0 +1,3 @@
aquaman
GPL3

View File

@ -0,0 +1,3 @@
Matrix
Obani
GPL3

View File

@ -0,0 +1,3 @@
Cyclède
GPL3

View File

@ -0,0 +1,3 @@
mystic
GPL3

View File

@ -0,0 +1,3 @@
Obani
Obani
GPL3

View File

@ -0,0 +1,3 @@
strangekiller
GPL3

View File

@ -0,0 +1,3 @@
walkingdead
GPL3

View File

@ -0,0 +1,3 @@
Cyberpangolin official
Cyberpangolin
??

View File

@ -0,0 +1,3 @@
Greyscale Anhedonia
Mg
WTFPL

View File

@ -1 +0,0 @@
Please run the update_from_db.py script to update the skins.

13
u_skins/players.lua Normal file → Executable file
View File

@ -10,15 +10,12 @@ u_skins.load_players = function()
end
u_skins.load_players()
local ttime = 0
minetest.register_globalstep(function(t)
ttime = ttime + t
if ttime < 360 then --every 6min'
return
end
ttime = 0
local function tick()
minetest.after(120, tick) --every 2min'
u_skins.save()
end)
end
minetest.after(120, tick)
minetest.register_on_shutdown(function() u_skins.save() end)

30
u_skins/skinlist.lua Normal file → Executable file
View File

@ -10,17 +10,41 @@ while fetched_skip < 40 do
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]
u_skins.meta[name].description = "" --what's that??
fetched_skip = 0
internal_id = internal_id + 1
end
fetched_skip = fetched_skip + 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
u_skins/textures/character_10.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

BIN
u_skins/textures/character_11.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

BIN
u_skins/textures/character_12.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

BIN
u_skins/textures/character_13.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

BIN
u_skins/textures/character_14.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

BIN
u_skins/textures/character_15.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

BIN
u_skins/textures/character_16.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

BIN
u_skins/textures/character_17.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

BIN
u_skins/textures/character_18.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 495 B

BIN
u_skins/textures/character_19.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 783 B

After

Width:  |  Height:  |  Size: 800 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
u_skins/textures/character_20.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

BIN
u_skins/textures/character_21.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

BIN
u_skins/textures/character_22.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

BIN
u_skins/textures/character_23.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

BIN
u_skins/textures/character_25.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

BIN
u_skins/textures/character_26.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

BIN
u_skins/textures/character_27.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

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