Compare commits
2 Commits
23eb8437f4
...
a3a271b21f
Author | SHA1 | Date | |
---|---|---|---|
a3a271b21f | |||
a110849017 |
@ -5,20 +5,66 @@
|
||||
-- Note: This is currently broken due to a bug in Irrlicht, leave at 0
|
||||
local animation_blend = 0
|
||||
local modelchar
|
||||
local eyeheithg
|
||||
local eyeheithg = 1.5 -- must be autodetected at client connection due different protocols
|
||||
local collsibox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}
|
||||
|
||||
local is_50 = minetest.has_feature("object_use_texture_alpha") or nil
|
||||
|
||||
if is_50 then
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.47
|
||||
else
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.625
|
||||
function dynamicmodel(player_name)
|
||||
|
||||
if not player_name then
|
||||
if is_50 then
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.625
|
||||
else
|
||||
modelchar = "character40.b3d"
|
||||
eyeheithg = 1.47
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local engineold = is_50
|
||||
local info = minetest.get_player_information(player_name)
|
||||
-- ugly hack due mixed protocols:
|
||||
if info then
|
||||
local 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, 0.0, -0.3, 0.3, 1.7, 0.3}
|
||||
else
|
||||
engineold = false
|
||||
modelchar = "character50.b3d"
|
||||
eyeheithg = 1.625
|
||||
collsibox = {-0.3, 0.0, -0.3, 0.3, 1.7, 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( modelchar, {
|
||||
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,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
default.registered_player_models = { }
|
||||
|
||||
dynamicmodel(nil)
|
||||
-- Local for speed.
|
||||
local models = default.registered_player_models
|
||||
|
||||
@ -39,7 +85,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,
|
||||
})
|
||||
@ -83,7 +129,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,
|
||||
})
|
||||
@ -116,7 +162,9 @@ 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()
|
||||
dynamicmodel(player_name)
|
||||
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)
|
||||
|
||||
|
@ -11,20 +11,6 @@ function default.node_sound_wool_defaults(table)
|
||||
return table
|
||||
end
|
||||
|
||||
-- add new 5.x snow sounds to 0.4.x client
|
||||
if not minetest.has_feature("object_use_texture_alpha") then
|
||||
|
||||
function default.node_sound_snow_defaults(table)
|
||||
|
||||
table = table or {}
|
||||
|
||||
table.footstep = table.footstep or {name = "default_snow_footstep", gain = 0.1}
|
||||
table.dug = table.dug or {name = "default_snow_footstep", gain = 0.3}
|
||||
table.place = table.place or {name = "default_place_node", gain = 1.0}
|
||||
|
||||
return table
|
||||
end
|
||||
end
|
||||
|
||||
stairs = {
|
||||
mod = "redo",
|
||||
@ -37,6 +23,20 @@ stairs = {
|
||||
wool = default.node_sound_wool_defaults()
|
||||
}
|
||||
|
||||
-- add new 5.x snow sounds to 0.4.x client
|
||||
--if not minetest.has_feature("object_use_texture_alpha") then
|
||||
function stairs.node_sound_snow_defaults(table)
|
||||
|
||||
table = table or {}
|
||||
|
||||
table.footstep = table.footstep or {name = "default_snow_footstep", gain = 0.1}
|
||||
table.dug = table.dug or {name = "default_snow_footstep", gain = 0.3}
|
||||
table.place = table.place or {name = "default_place_node", gain = 1.0}
|
||||
|
||||
return table
|
||||
end
|
||||
--end
|
||||
|
||||
|
||||
-- cache creative
|
||||
local creative = minetest.settings:get_bool("creative_mode")
|
||||
|
@ -273,7 +273,7 @@ stairs.register_all("snowblock", "default:snowblock",
|
||||
{crumbly = 3, cools_lava = 1, snowy = 1},
|
||||
{"default_snow.png"},
|
||||
"Snow Block",
|
||||
default.node_sound_snow_defaults(), true)
|
||||
stairs.node_sound_snow_defaults(), true)
|
||||
|
||||
stairs.register_all("ice", "default:ice",
|
||||
{cracky = 3, cools_lava = 1},
|
||||
|
Loading…
x
Reference in New Issue
Block a user