mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2024-12-22 23:40:18 +01:00
initial minetest-0.5/player_api support
This commit is contained in:
parent
4c3072ba8b
commit
165e917b5f
56
init.lua
56
init.lua
@ -66,20 +66,42 @@ minetest.register_on_leaveplayer(function(player)
|
|||||||
skins.ui_context[player:get_player_name()] = nil
|
skins.ui_context[player:get_player_name()] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
default.player_register_model("skinsdb_3d_armor_character.b3d", {
|
if minetest.global_exists("player_api") then
|
||||||
animation_speed = 30,
|
-- Minetest-0.5 and above compatible
|
||||||
textures = {
|
player_api.register_model("skinsdb_3d_armor_character_0_5.b3d", {
|
||||||
"blank.png",
|
animation_speed = 30,
|
||||||
"blank.png",
|
textures = {
|
||||||
"blank.png",
|
"blank.png",
|
||||||
"blank.png",
|
"blank.png",
|
||||||
},
|
"blank.png",
|
||||||
animations = {
|
"blank.png"
|
||||||
stand = {x=0, y=79},
|
},
|
||||||
lay = {x=162, y=166},
|
animations = {
|
||||||
walk = {x=168, y=187},
|
stand = {x=0, y=79},
|
||||||
mine = {x=189, y=198},
|
lay = {x=162, y=166},
|
||||||
walk_mine = {x=200, y=219},
|
walk = {x=168, y=187},
|
||||||
sit = {x=81, y=160},
|
mine = {x=189, y=198},
|
||||||
},
|
walk_mine = {x=200, y=219},
|
||||||
})
|
sit = {x=81, y=160},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
else
|
||||||
|
-- Minetest-0.4 compatible
|
||||||
|
default.player_register_model("skinsdb_3d_armor_character.b3d", {
|
||||||
|
animation_speed = 30,
|
||||||
|
textures = {
|
||||||
|
"blank.png",
|
||||||
|
"blank.png",
|
||||||
|
"blank.png",
|
||||||
|
"blank.png",
|
||||||
|
},
|
||||||
|
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},
|
||||||
|
sit = {x=81, y=160},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
BIN
models/skinsdb_3d_armor_character_0_5.b3d
Normal file
BIN
models/skinsdb_3d_armor_character_0_5.b3d
Normal file
Binary file not shown.
BIN
models/skinsdb_3d_armor_character_0_5.blend
Normal file
BIN
models/skinsdb_3d_armor_character_0_5.blend
Normal file
Binary file not shown.
@ -73,8 +73,13 @@ function skin_class:apply_skin_to_player(player)
|
|||||||
|
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
local ver = self:get_meta("format") or "1.0"
|
local ver = self:get_meta("format") or "1.0"
|
||||||
default.player_set_model(player, "skinsdb_3d_armor_character.b3d")
|
if minetest.global_exists("player_api") then
|
||||||
|
-- Minetest-0.5 compatible
|
||||||
|
player_api.set_model(player, "skinsdb_3d_armor_character_0_5.b3d")
|
||||||
|
else
|
||||||
|
-- Minetest-0.4 compatible
|
||||||
|
default.player_set_model(player, "skinsdb_3d_armor_character.b3d")
|
||||||
|
end
|
||||||
local v10_texture = "blank.png"
|
local v10_texture = "blank.png"
|
||||||
local v18_texture = "blank.png"
|
local v18_texture = "blank.png"
|
||||||
local armor_texture = "blank.png"
|
local armor_texture = "blank.png"
|
||||||
@ -109,12 +114,23 @@ function skin_class:apply_skin_to_player(player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
default.player_set_textures(player, {
|
if minetest.global_exists("player_api") then
|
||||||
v10_texture,
|
-- Minetest-0.5 compatible
|
||||||
v18_texture,
|
player_api.set_textures(player, {
|
||||||
armor_texture,
|
v10_texture,
|
||||||
wielditem_texture,
|
v18_texture,
|
||||||
})
|
armor_texture,
|
||||||
|
wielditem_texture,
|
||||||
|
})
|
||||||
|
else
|
||||||
|
-- Minetest-0.4 compatible
|
||||||
|
default.player_set_textures(player, {
|
||||||
|
v10_texture,
|
||||||
|
v18_texture,
|
||||||
|
armor_texture,
|
||||||
|
wielditem_texture,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
player:set_properties({
|
player:set_properties({
|
||||||
visual_size = {
|
visual_size = {
|
||||||
|
Loading…
Reference in New Issue
Block a user