forked from Mineclonia/Mineclonia
Sprinting anim, MC-like Player anims, Swimming detection
This commit is contained in:
parent
a49e144911
commit
18a8d011a2
|
@ -363,6 +363,8 @@ mcl_player.player_register_model("mcl_armor_character.b3d", {
|
|||
swim_walk_mine = {x=389, y=408},
|
||||
swim_stand = {x=434, y=434},
|
||||
swim_mine = {x=411, y=430},
|
||||
run_walk = {x=440, y=459},
|
||||
run_walk_mine = {x=461, y=480},
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -31,6 +31,8 @@ mcl_player.player_register_model("character.b3d", {
|
|||
sneak_mine = {x=346, y=366},
|
||||
sneak_walk = {x=304, y=323},
|
||||
sneak_walk_mine = {x=325, y=344},
|
||||
run_walk = {x=440, y=460},
|
||||
run_walk_mine = {x=461, y=481},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -158,8 +160,8 @@ minetest.register_globalstep(function(dtime)
|
|||
local node_in_feet = minetest.registered_nodes[mcl_playerinfo[name].node_feet]
|
||||
-- ask if player is swiming
|
||||
local standing_on_water = minetest.get_item_group(mcl_playerinfo[name].node_feet, "water") ~= 0
|
||||
|
||||
|
||||
-- ask if player is sprinting
|
||||
local is_sprinting = mcl_sprint.is_sprinting(name)
|
||||
|
||||
-- Apply animations based on what the player is doing
|
||||
if player:get_hp() == 0 then
|
||||
|
@ -169,28 +171,32 @@ minetest.register_globalstep(function(dtime)
|
|||
player_anim[name] = nil
|
||||
player_sneak[name] = controls.sneak
|
||||
end
|
||||
if controls.LMB and not controls.sneak and standing_on_water then
|
||||
if controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true then
|
||||
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
|
||||
elseif not controls.sneak and standing_on_water then
|
||||
elseif not controls.sneak and standing_on_water and is_sprinting == true then
|
||||
player_set_animation(player, "swim_walk", animation_speed_mod)
|
||||
elseif controls.LMB and not controls.sneak and not standing_on_water then
|
||||
elseif is_sprinting == true and controls.LMB and not controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "run_walk_mine", animation_speed_mod)
|
||||
elseif controls.LMB and not controls.sneak then
|
||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
||||
elseif controls.LMB and controls.sneak and not standing_on_water then
|
||||
elseif controls.LMB and controls.sneak and is_sprinting ~= true then
|
||||
player_set_animation(player, "sneak_walk_mine", animation_speed_mod)
|
||||
elseif not controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "walk", animation_speed_mod)
|
||||
else
|
||||
elseif is_sprinting == true and not controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "run_walk", animation_speed_mod)
|
||||
elseif controls.sneak and not controls.LMB then
|
||||
player_set_animation(player, "sneak_walk", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "walk", animation_speed_mod)
|
||||
end
|
||||
elseif controls.LMB and not controls.sneak and standing_on_water then
|
||||
elseif controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true then
|
||||
player_set_animation(player, "swim_mine")
|
||||
elseif controls.LMB and not controls.sneak and not standing_on_water then
|
||||
elseif controls.LMB and not controls.sneak then
|
||||
player_set_animation(player, "mine")
|
||||
elseif controls.LMB and controls.sneak then
|
||||
player_set_animation(player, "sneak_mine")
|
||||
elseif not controls.sneak and standing_on_water then
|
||||
elseif not controls.sneak and standing_on_water and is_sprinting == true then
|
||||
player_set_animation(player, "swim_stand", animation_speed_mod)
|
||||
elseif not controls.sneak and not standing_on_water then
|
||||
elseif not controls.sneak then
|
||||
player_set_animation(player, "stand", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "sneak_stand", animation_speed_mod)
|
||||
|
|
|
@ -44,7 +44,7 @@ minetest.register_globalstep(function(dtime)
|
|||
-- sets eye height, and nametag color accordingly
|
||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
||||
|
||||
elseif minetest.get_item_group(mcl_playerinfo[name].node_feet, "water") ~= 0 and player:get_attach() == nil then
|
||||
elseif minetest.get_item_group(mcl_playerinfo[name].node_feet, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true then
|
||||
-- controls head pitch when swiming
|
||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
|
||||
-- sets eye height, and nametag color accordingly
|
||||
|
|
Loading…
Reference in New Issue