-
-
Save Jordach/b4d4eb89501b0a55ba34d702f488da49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- GRAB FROM HERE: https://raw.githubusercontent.com/Jordach/Solar_Plains/master/mods/core/models/character.x | |
-- AND THIS: https://raw.githubusercontent.com/Jordach/Solar_Plains/master/mods/core/models/player_singleplayer2.png | |
-- ARMOR LAYOUT: https://raw.githubusercontent.com/Jordach/Solar_Plains/be0f2657baff7d1de95754f70ffa36c5cef3ea7f/blends/base_armour.png | |
-- OVERLAY THIS UNDER ARMOR: https://raw.githubusercontent.com/Jordach/Solar_Plains/be0f2657baff7d1de95754f70ffa36c5cef3ea7f/blends/base_armour_straps.png | |
local function get_size(w) | |
local file = io.open(w) | |
if file then | |
file:seek("set", 16) | |
local widthstr, heightstr = file:read(4), file:read(4) | |
-- magic BS | |
local width=widthstr:sub(1,1):byte()*16777216+widthstr:sub(2,2):byte()*65536+widthstr:sub(3,3):byte()*256+widthstr:sub(4,4):byte() | |
local height=heightstr:sub(1,1):byte()*16777216+heightstr:sub(2,2):byte()*65536+heightstr:sub(3,3):byte()*256+heightstr:sub(4,4):byte() | |
file:close() | |
return width, height | |
end | |
end | |
-- use inside on_joinplayer | |
local your_texture_path = minetest.get_modpath("YOUR FOLDER").."/textures/" | |
minetest.register_on_joinplayer(function(player) | |
local pname = player:get_player_name() | |
local f = io.open(your_texture_path.."player_"..pname..".png") | |
if f then | |
local w, h = get_size(your_texture_path.."player_"..pname..".png") | |
if w / h == 2 then -- this is a 64x32 type skin | |
print ("[INFO] " .. pname .. " has a 64x32 type skin!") | |
player:set_properties({ | |
textures = { | |
"player_" .. pname .. ".png", -- 64x32 | |
"transparent.png", -- 64x64 | |
"transparent.png", -- head armor | |
"transparent.png", -- chest armor | |
"transparent.png", -- leg armor | |
"transparent.png", -- boots | |
"transparent.png", -- shield | |
}, | |
}) | |
else -- this is a square 64x64 type skin; | |
print ("[INFO] " .. pname .. " has a 64x64 type skin!") | |
player:set_properties({ | |
textures = { | |
"transparent.png", -- 64x32 | |
"player_" .. pname .. ".png", -- 64x64 | |
"transparent.png", -- head armor | |
"transparent.png", -- chest armor | |
"transparent.png", -- leg armor | |
"transparent.png", -- boots | |
"transparent.png", -- shield | |
}, | |
}) | |
end | |
else -- no skin found | |
player:set_properties({ | |
"transparent.png", | |
"player_singleplayer2.png", | |
"transparent.png", | |
"transparent.png", | |
"transparent.png", | |
"transparent.png", | |
"transparent.png", | |
}, | |
}) | |
end | |
end) | |
-- USE THIS TO IMPLEMENT AGAINST THE NEW PLAYER API!!! | |
-- TEXTURES ARE PLACEHOLDER NAMES | |
default.player_register_model("character.x", { | |
animation_speed = 30, | |
textures = { | |
-- NO DEFAULT TEXTURE SUPPLIED: | |
-- THIS IS A GUIDE TO MODEL MATERIALS | |
-- ARMOR FORMAT IS 64x32 | |
"64x32_layer", | |
"64x64_layer", | |
"armor_helment.png", | |
"armor_chest.png", | |
"armor_legs.png", | |
"armor_boots.png", | |
"armor_shield.png" | |
}, | |
animations = { | |
-- Standard animations. | |
stand = { x= 0, y= 79, }, | |
lay = { x=162, y=166, }, | |
walk = { x=168, y=187, }, | |
mine = { x=189, y=198, }, | |
walk_mine = { x=200, y=219, }, | |
dead = { x= 221, y=225, }, | |
-- Utility animations (not currently used by the game; but still usable by mods). | |
sit = { x= 81, y=160, }, | |
}, | |
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.77, 0.3}, | |
stepheight = 0.6, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment