mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Impliment crawling
This commit is contained in:
parent
903a29f949
commit
ba86cf1d8b
@ -154,8 +154,12 @@ minetest.register_globalstep(function(dtime)
|
|||||||
animation_speed_mod = animation_speed_mod / 2
|
animation_speed_mod = animation_speed_mod / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- ask if player is in a place which he should crawl
|
||||||
|
node_in_feet = minetest.registered_nodes[mcl_playerinfo[name].node_feet]
|
||||||
-- ask if player is swiming
|
-- ask if player is swiming
|
||||||
local standing_on_water = minetest.get_item_group(mcl_playerinfo[name].node_stand, "water") ~= 0
|
standing_on_water = minetest.get_item_group(mcl_playerinfo[name].node_stand, "water") ~= 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Apply animations based on what the player is doing
|
-- Apply animations based on what the player is doing
|
||||||
if player:get_hp() == 0 then
|
if player:get_hp() == 0 then
|
||||||
@ -169,6 +173,10 @@ minetest.register_globalstep(function(dtime)
|
|||||||
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
|
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 then
|
||||||
player_set_animation(player, "swim_walk", animation_speed_mod)
|
player_set_animation(player, "swim_walk", animation_speed_mod)
|
||||||
|
elseif node_in_feet.walkable and controls.LMB then
|
||||||
|
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
|
||||||
|
elseif node_in_feet.walkable then
|
||||||
|
player_set_animation(player, "swim_walk", animation_speed_mod)
|
||||||
elseif controls.LMB and not controls.sneak and not standing_on_water then
|
elseif controls.LMB and not controls.sneak and not standing_on_water then
|
||||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
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 not standing_on_water then
|
||||||
@ -178,6 +186,8 @@ minetest.register_globalstep(function(dtime)
|
|||||||
else
|
else
|
||||||
player_set_animation(player, "sneak_walk", animation_speed_mod)
|
player_set_animation(player, "sneak_walk", animation_speed_mod)
|
||||||
end
|
end
|
||||||
|
elseif controls.LMB and node_in_feet.walkable then
|
||||||
|
player_set_animation(player, "swim_mine")
|
||||||
elseif controls.LMB and not controls.sneak and standing_on_water then
|
elseif controls.LMB and not controls.sneak and standing_on_water then
|
||||||
player_set_animation(player, "swim_mine")
|
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 and not standing_on_water then
|
||||||
|
@ -24,8 +24,11 @@ minetest.register_globalstep(function(dtime)
|
|||||||
name = player:get_player_name()
|
name = player:get_player_name()
|
||||||
|
|
||||||
-- controls head bone
|
-- controls head bone
|
||||||
pitch = degrees(player:get_look_vertical()) * -1
|
local pitch = degrees(player:get_look_vertical()) * -1
|
||||||
|
|
||||||
|
local node_in_feet = minetest.registered_nodes[mcl_playerinfo[name].node_feet]
|
||||||
|
|
||||||
|
-- controls right and left arms pitch when shooting a bow or punching
|
||||||
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
if string.find(player:get_wielded_item():get_name(), "mcl_bows:bow") and controls.RMB and not controls.up and not controls.down and not controls.left and not controls.right then
|
||||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch+90,-30,pitch * -1 * .35))
|
||||||
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
player:set_bone_position("Arm_Left_Pitch_Control", vector.new(3.5,5.785,0), vector.new(pitch+90,43,pitch * .35))
|
||||||
@ -37,23 +40,33 @@ minetest.register_globalstep(function(dtime)
|
|||||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
|
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
|
||||||
end
|
end
|
||||||
|
|
||||||
if controls.sneak and player:get_attach() == nil then
|
if node_in_feet.walkable and player:get_attach() == nil then
|
||||||
|
if not controls.RMB and not controls.up and not controls.down and not controls.left and not controls.right and not controls.LMB then
|
||||||
|
mcl_player.player_set_animation(player, "swim_stand")
|
||||||
|
end
|
||||||
|
player:set_properties({collisionbox = {-0.35,1,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
||||||
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
|
||||||
|
player:set_bone_position("Body_Control", vector.new(0,12.5,0), vector.new(90,0,180))
|
||||||
|
elseif controls.sneak and player:get_attach() == nil then
|
||||||
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
-- controls head pitch when sneaking
|
-- controls head pitch when sneaking
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }})
|
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_stand, "water") ~= 0 and player:get_attach() == nil then
|
elseif minetest.get_item_group(mcl_playerinfo[name].node_stand, "water") ~= 0 and player:get_attach() == nil then
|
||||||
|
player:set_bone_position("Body_Control", vector.new(0,12.5,0), vector.new(90,0,180))
|
||||||
-- controls head pitch when swiming
|
-- controls head pitch when swiming
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,1,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
|
|
||||||
else
|
else
|
||||||
-- controls head pitch when not sneaking
|
-- controls head pitch when not sneaking
|
||||||
|
player:set_bone_position("Body_Control", vector.new(0,6.3,0), vector.new(0,0,0))
|
||||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
||||||
-- sets eye height, and nametag color accordingly
|
-- sets eye height, and nametag color accordingly
|
||||||
player:set_properties({eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 225, b = 225, a = 225, g = 225 }})
|
||||||
end
|
end
|
||||||
|
|
||||||
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||||
|
Loading…
Reference in New Issue
Block a user