default/player_Api/skindb - dinamically set the model player on client conection
* improves commit 322d7d3b70
of player model,
the problem is that both server and client must be same protocol, so
this ugly hack is a minimal set (not using a function like normal game)
to dinamically check client nature and re-registering the model
* NOTE: the check already need to check if the engine is old and the server not,
so the conditional just try to do exact check agains TRUE boolean.
* Closed https://codeberg.org/minenux/minetest-game-minetest/issues/12
fixed the problem of collisionbox for the lufix player in ugly way but
much more effectivelly due can be mixed in FinalMinetest and Multicraft
* fix model preview based on client view, not on server engine version
for the skindb mod
master
parent
2d410af5aa
commit
837a49b290
|
@ -0,0 +1,306 @@
|
|||
Minetest Game mod: default
|
||||
==========================
|
||||
|
||||
This mod is a base mod for almost any minetest game, it provide default nodes, blocks and biomes configuration.
|
||||
|
||||
This mod integrates player_api and autodetect older or newer model set for any protocol
|
||||
|
||||
# License
|
||||
|
||||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by celeron55, Perttu Ahola <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
|
||||
Authors of media (textures, models and sounds)
|
||||
----------------------------------------------
|
||||
Everything not listed in here:
|
||||
celeron55, Perttu Ahola <celeron55@gmail.com> (CC BY-SA 3.0)
|
||||
|
||||
Cisoun's texture pack (CC BY-SA 3.0):
|
||||
default_jungletree.png
|
||||
default_lava.png
|
||||
default_leaves.png
|
||||
default_sapling.png
|
||||
default_bush_sapling.png
|
||||
default_stone.png
|
||||
default_tree.png
|
||||
default_tree_top.png
|
||||
default_water.png
|
||||
|
||||
Cisoun's conifers mod (CC BY-SA 3.0):
|
||||
default_pine_needles.png
|
||||
|
||||
Originating from G4JC's Almost MC Texture Pack (CC BY-SA 3.0):
|
||||
default_torch.png
|
||||
default_torch_on_ceiling.png
|
||||
default_torch_on_floor.png
|
||||
|
||||
VanessaE's animated torches (CC BY-SA 3.0):
|
||||
default_torch_animated.png
|
||||
default_torch_on_ceiling_animated.png
|
||||
default_torch_on_floor_animated.png
|
||||
default_torch_on_floor.png
|
||||
|
||||
RealBadAngel's animated water (CC BY-SA 3.0):
|
||||
default_water_source_animated.png
|
||||
default_water_flowing_animated.png
|
||||
|
||||
VanessaE (CC BY-SA 3.0):
|
||||
default_desert_sand.png
|
||||
default_desert_stone.png
|
||||
default_sand.png
|
||||
default_mese_crystal.png
|
||||
default_mese_crystal_fragment.png
|
||||
|
||||
Calinou (CC BY-SA 3.0):
|
||||
default_brick.png
|
||||
default_papyrus.png
|
||||
default_mineral_copper.png
|
||||
default_glass_detail.png
|
||||
|
||||
MirceaKitsune (CC BY-SA 3.0):
|
||||
character.x
|
||||
|
||||
Jordach (CC BY-SA 3.0):
|
||||
character.png
|
||||
|
||||
PilzAdam (CC BY-SA 3.0):
|
||||
default_jungleleaves.png
|
||||
default_junglesapling.png
|
||||
default_obsidian_glass.png
|
||||
default_obsidian_shard.png
|
||||
default_mineral_gold.png
|
||||
|
||||
jojoa1997 (CC BY-SA 3.0):
|
||||
default_obsidian.png
|
||||
|
||||
InfinityProject (CC BY-SA 3.0):
|
||||
default_mineral_diamond.png
|
||||
|
||||
Splizard (CC BY-SA 3.0):
|
||||
default_pine_sapling.png
|
||||
|
||||
Zeg9 (CC BY-SA 3.0):
|
||||
default_coal_block.png
|
||||
|
||||
paramat (CC BY-SA 3.0):
|
||||
wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0)
|
||||
default_pinetree.png
|
||||
default_pinetree_top.png
|
||||
default_pinewood.png
|
||||
default_acacia_leaves.png
|
||||
default_acacia_leaves_simple.png
|
||||
default_acacia_sapling.png
|
||||
default_acacia_bush_sapling.png
|
||||
default_acacia_tree.png
|
||||
default_acacia_tree_top.png
|
||||
default_acacia_wood.png
|
||||
default_acacia_bush_stem.png
|
||||
default_bush_stem.png
|
||||
default_junglewood.png
|
||||
default_jungletree_top.png
|
||||
default_sandstone_brick.png
|
||||
default_obsidian_brick.png
|
||||
default_stone_brick.png
|
||||
default_desert_stone_brick.png
|
||||
default_sandstone_block.png
|
||||
default_obsidian_block.png
|
||||
default_stone_block.png
|
||||
default_desert_stone_block.png
|
||||
default_river_water.png
|
||||
default_river_water_source_animated.png
|
||||
default_river_water_flowing_animated.png
|
||||
default_dry_grass.png
|
||||
default_dry_grass_side.png
|
||||
default_dry_grass_*.png
|
||||
default_grass.png
|
||||
default_grass_side.png
|
||||
default_mese_block.png
|
||||
default_silver_sand.png
|
||||
default_mese_post_light_side.png
|
||||
default_mese_post_light_side_dark.png
|
||||
default_mese_post_light_top.png
|
||||
default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0)
|
||||
default_bookshelf_slot.png -- Derived from a texture by Gambit (CC-BY-SA 3.0)
|
||||
|
||||
brunob.santos (CC BY-SA 4.0):
|
||||
default_desert_cobble.png
|
||||
|
||||
BlockMen (CC BY-SA 3.0):
|
||||
default_aspen_leaves.png -- Derived from Sofar's texture
|
||||
default_wood.png
|
||||
default_clay_brick.png
|
||||
default_iron_ingot.png
|
||||
default_gold_ingot.png
|
||||
default_tool_steelsword.png
|
||||
default_diamond.png
|
||||
default_tool_*.png
|
||||
default_lava_source_animated.png
|
||||
default_lava_flowing_animated.png
|
||||
default_stick.png
|
||||
default_chest_front.png
|
||||
default_chest_lock.png
|
||||
default_chest_side.png
|
||||
default_chest_top.png
|
||||
default_mineral_mese.png
|
||||
default_meselamp.png
|
||||
bubble.png
|
||||
gui_*.png
|
||||
|
||||
sofar (CC BY-SA 3.0):
|
||||
default_aspen_sapling
|
||||
default_aspen_tree
|
||||
default_aspen_tree_top, derived from default_pine_tree_top (by paramat)
|
||||
default_aspen_wood, derived from default_pine_wood (by paramat)
|
||||
default_chest_inside
|
||||
|
||||
sofar (WTFPL):
|
||||
default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel
|
||||
|
||||
Neuromancer (CC BY-SA 2.0):
|
||||
default_cobble.png, based on texture by Brane praefect
|
||||
default_mossycobble.png, based on texture by Brane praefect
|
||||
|
||||
Neuromancer (CC BY-SA 3.0):
|
||||
default_dirt.png
|
||||
default_furnace_*.png
|
||||
|
||||
Gambit (CC BY-SA 3.0):
|
||||
default_bronze_ingot.png
|
||||
default_copper_ingot.png
|
||||
default_copper_lump.png
|
||||
default_iron_lump.png
|
||||
default_gold_lump.png
|
||||
default_clay_lump.png
|
||||
default_coal.png
|
||||
default_grass_*.png
|
||||
default_paper.png
|
||||
default_diamond_block.png
|
||||
default_ladder_steel.png
|
||||
default_sign_wall_wood.png
|
||||
default_flint.png
|
||||
default_snow.png
|
||||
default_snow_side.png
|
||||
default_snowball.png
|
||||
default_key.png
|
||||
default_key_skeleton.png
|
||||
default_book.png
|
||||
|
||||
asl97 (CC BY-SA 3.0):
|
||||
default_ice.png
|
||||
|
||||
KevDoy (CC BY-SA 3.0)
|
||||
heart.png
|
||||
|
||||
Pithydon (CC BY-SA 3.0)
|
||||
default_coral_brown.png
|
||||
default_coral_orange.png
|
||||
default_coral_skeleton.png
|
||||
|
||||
Ferk (CC0 1.0)
|
||||
default_item_smoke.png
|
||||
default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart
|
||||
|
||||
npx (CC BY-SA 3.0)
|
||||
default_rainforest_litter.png
|
||||
default_rainforest_litter_side.png
|
||||
|
||||
kaeza (CC-BY-SA 3.0):
|
||||
default_desert_sandstone.png
|
||||
default_desert_sandstone_brick.png
|
||||
default_desert_sandstone_block.png
|
||||
|
||||
kilbith (CC BY-SA 3.0):
|
||||
default_steel_block.png
|
||||
default_copper_block.png
|
||||
default_bronze_block.png
|
||||
default_gold_block.png
|
||||
default_tin_block.png
|
||||
default_mineral_tin.png
|
||||
default_tin_ingot.png
|
||||
default_tin_lump.png
|
||||
|
||||
CloudyProton (CC BY-SA 3.0):
|
||||
default_book_written.png, based on default_book.png by Gambit
|
||||
|
||||
Glass breaking sounds (CC BY 3.0):
|
||||
1: http://www.freesound.org/people/cmusounddesign/sounds/71947/
|
||||
2: http://www.freesound.org/people/Tomlija/sounds/97669/
|
||||
3: http://www.freesound.org/people/lsprice/sounds/88808/
|
||||
|
||||
sonictechtonic (CC BY 3.0):
|
||||
https://www.freesound.org/people/sonictechtonic/sounds/241872/
|
||||
player_damage.ogg
|
||||
|
||||
Mito551 (sounds) (CC BY-SA 3.0):
|
||||
default_dig_choppy.ogg
|
||||
default_dig_cracky.ogg
|
||||
default_dig_crumbly.1.ogg
|
||||
default_dig_crumbly.2.ogg
|
||||
default_dig_dig_immediate.ogg
|
||||
default_dig_oddly_breakable_by_hand.ogg
|
||||
default_dug_node.1.ogg
|
||||
default_dug_node.2.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_grass_footstep.2.ogg
|
||||
default_grass_footstep.3.ogg
|
||||
default_gravel_footstep.1.ogg
|
||||
default_gravel_footstep.2.ogg
|
||||
default_gravel_footstep.3.ogg
|
||||
default_gravel_footstep.4.ogg
|
||||
default_grass_footstep.1.ogg
|
||||
default_place_node.1.ogg
|
||||
default_place_node.2.ogg
|
||||
default_place_node.3.ogg
|
||||
default_place_node_hard.1.ogg
|
||||
default_place_node_hard.2.ogg
|
||||
default_snow_footstep.1.ogg
|
||||
default_snow_footstep.2.ogg
|
||||
default_hard_footstep.1.ogg
|
||||
default_hard_footstep.2.ogg
|
||||
default_hard_footstep.3.ogg
|
||||
default_sand_footstep.1.ogg
|
||||
default_sand_footstep.2.ogg
|
||||
default_wood_footstep.1.ogg
|
||||
default_wood_footstep.2.ogg
|
||||
default_dirt_footstep.1.ogg
|
||||
default_dirt_footstep.2.ogg
|
||||
default_glass_footstep.ogg
|
||||
|
||||
Metal sounds:
|
||||
default_dig_metal.ogg - yadronoff - CC-BY-3.0
|
||||
- https://www.freesound.org/people/yadronoff/sounds/320397/
|
||||
default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0
|
||||
- http://opengameart.org/users/qubodup
|
||||
default_metal_footstep.*.ogg - Ottomaani138 - CC0
|
||||
- https://www.freesound.org/people/Ottomaani138/sounds/232692/
|
||||
default_place_node_metal.*.ogg - Ogrebane - CC0
|
||||
- http://opengameart.org/content/wood-and-metal-sound-effects-volume-2
|
||||
|
||||
Tool breaking sounds added by sofar: CC-BY-3.0
|
||||
default_tool_breaks.* - http://www.freesound.org/people/HerbertBoland/sounds/33206/
|
||||
|
||||
AGFX (CC BY 3.0)
|
||||
https://www.freesound.org/people/AGFX/packs/1253/
|
||||
default_water_footstep.1.ogg
|
||||
default_water_footstep.2.ogg
|
||||
default_water_footstep.3.ogg
|
||||
(default_water_footstep.4.ogg is silent)
|
||||
|
||||
blukotek (CC0 1.0)
|
||||
https://www.freesound.org/people/blukotek/sounds/251660/
|
||||
default_dig_snappy.ogg
|
||||
|
||||
Chests sounds added by sofar, derived of several files mixed together:
|
||||
default_chest_open.ogg
|
||||
default_chest_close.ogg
|
||||
- http://www.freesound.org/people/Sevin7/sounds/269722/ CC0
|
||||
- http://www.freesound.org/people/Percy%20Duke/sounds/23448/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/kingsamas/sounds/135576/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0
|
||||
- http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0
|
||||
|
|
@ -6,18 +6,19 @@
|
|||
local animation_blend = 0
|
||||
local hp_player_maximun = tonumber(minetest.settings:get('default_hp_player_maximun')) or 40
|
||||
local modelchar
|
||||
local eyeheithg
|
||||
local eyeheithg = 1.5 -- must be autodetected at client connection due different protocols
|
||||
local collsibox = {-0.3, -0.5, -0.3, 0.3, 1.6, 0.3}
|
||||
|
||||
local is_50 = minetest.has_feature("object_use_texture_alpha") or nil
|
||||
|
||||
if is_50 then
|
||||
core.PLAYER_MAX_HP_DEFAULT = hp_player_maximun
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.47
|
||||
else
|
||||
core.PLAYER_MAX_HP = hp_player_maximun
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.625
|
||||
else
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.47
|
||||
core.PLAYER_MAX_HP = hp_player_maximun
|
||||
end
|
||||
|
||||
default.registered_player_models = { }
|
||||
|
@ -42,7 +43,7 @@ default.player_register_model( modelchar, {
|
|||
walk_mine = { x=200, y=219, },
|
||||
sit = { x= 81, y=160, },
|
||||
},
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
collisionbox = collsibox,
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
|
@ -86,7 +87,7 @@ function default.player_set_model(player, model_name)
|
|||
textures = { "player.png", "player_back.png", },
|
||||
visual = "upright_sprite",
|
||||
visual_size = {x=1, y=2},
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.75, 0.3},
|
||||
collisionbox = collsibox,
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
|
@ -119,10 +120,52 @@ end
|
|||
|
||||
-- Update appearance when the player joins
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
default.player_attached[player:get_player_name()] = false
|
||||
local player_name = player:get_player_name()
|
||||
local engineold = is_50
|
||||
local info = minetest.get_player_information(player_name)
|
||||
local test = "5.0"
|
||||
-- ugly hack due mixed protocols:
|
||||
if info then
|
||||
test = info.version_string or "5.0"
|
||||
if test:find("0.4.") or test:find("4.0.") or test:find("4.1.") then
|
||||
engineold = true
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.47
|
||||
collsibox = {-0.3, -1, -0.3, 0.3, 0.7, 0.3}
|
||||
else
|
||||
engineold = false
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.625
|
||||
collsibox = {-0.3, 0.3, -0.3, 0.3, 1.0, 0.3}
|
||||
end
|
||||
-- only refix register model when protocols are mixed, will slow down server
|
||||
if engineold == true and is_50 == true then
|
||||
minetest.log("warning", "[default/player_api] performance impact: mixed protocols DETECTED on player .. "..player_name.." doin re-register model hack")
|
||||
default.player_register_model( "character40.b3d", {
|
||||
animation_speed = 30,
|
||||
textures = {"character.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},
|
||||
sit = {x = 81, y = 160},
|
||||
},
|
||||
collisionbox = collsibox,
|
||||
stepheight = 0.6,
|
||||
eye_height = eyeheithg,
|
||||
})
|
||||
minetest.log("warning","[default/player_api]: mixed engine protocol detected, performance impatc ugly hack")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
default.player_attached[player_name] = false
|
||||
default.player_set_model(player, modelchar)
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
player:set_properties({hp_max = hp_player_maximun})
|
||||
player:set_properties({hp_max = hp_player_maximun, eye_height = eyeheithg, collisionbox = collsibox})
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
|
|
|
@ -165,8 +165,13 @@ skins.formspec.main = function(name)
|
|||
|
||||
-- if preview enabled then add player model to formspec (5.4dev only)
|
||||
if skins.preview == true then
|
||||
info = minetest.get_player_information(name)
|
||||
if info then
|
||||
local test = info.version_string or "5"
|
||||
if test:find("0.4.") or test:find("4.0.") or test:find("5.0.") or test:find("5.1.") or test:find("5.2.") or test:find("5.3.") then is_54 = false else is_54 = true end
|
||||
end
|
||||
if is_54 then
|
||||
formspec = formspec .. "model[6,-0.2;1.5,3;player;character.b3d;"
|
||||
formspec = formspec .. "model[6,-0.2;1.5,3;player;character50.b3d;"
|
||||
.. skins.skins[name] .. ".png;0,180;false;true]"
|
||||
else
|
||||
local head = "[combine:8x8:-8,-8="..skins.skins[name]..".png"
|
||||
|
|
Loading…
Reference in New Issue