mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-30 21:27:32 +01:00
Merge pull request 'wielditem' (#4) from wielditem into master
Reviewed-on: https://git.minetest.land/epCode/MineClone2/pulls/4
This commit is contained in:
commit
0d53c946ce
@ -355,6 +355,10 @@ mcl_player.player_register_model("mcl_armor_character.b3d", {
|
||||
mine = {x=189, y=198},
|
||||
walk_mine = {x=200, y=219},
|
||||
sit = {x=81, y=160},
|
||||
sneak_stand = {x=222, y=302},
|
||||
sneak_mine = {x=346, y=366},
|
||||
sneak_walk = {x=304, y=323},
|
||||
sneak_walk_mine = {x=325, y=345},
|
||||
},
|
||||
})
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
@ -21,12 +21,16 @@ mcl_player.player_register_model("character.b3d", {
|
||||
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, },
|
||||
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},
|
||||
sneak_stand = {x=222, y=302},
|
||||
sneak_mine = {x=346, y=366},
|
||||
sneak_walk = {x=304, y=323},
|
||||
sneak_walk_mine = {x=325, y=345},
|
||||
},
|
||||
})
|
||||
|
||||
@ -106,7 +110,7 @@ end
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
mcl_player.player_attached[player:get_player_name()] = false
|
||||
mcl_player.player_set_model(player, "character.b3d")
|
||||
player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
--player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30)
|
||||
player:set_fov(86.1) -- see <https://minecraft.gamepedia.com/Options#Video_settings>>>>
|
||||
end)
|
||||
|
||||
@ -150,15 +154,23 @@ minetest.register_globalstep(function(dtime)
|
||||
player_anim[name] = nil
|
||||
player_sneak[name] = controls.sneak
|
||||
end
|
||||
if controls.LMB then
|
||||
if controls.LMB and not controls.sneak then
|
||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
||||
else
|
||||
elseif controls.LMB and controls.sneak then
|
||||
player_set_animation(player, "sneak_walk_mine", animation_speed_mod)
|
||||
elseif not controls.sneak then
|
||||
player_set_animation(player, "walk", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "sneak_walk", animation_speed_mod)
|
||||
end
|
||||
elseif controls.LMB then
|
||||
elseif controls.LMB and not controls.sneak then
|
||||
player_set_animation(player, "mine")
|
||||
else
|
||||
elseif controls.LMB and controls.sneak then
|
||||
player_set_animation(player, "sneak_mine")
|
||||
elseif not controls.sneak then
|
||||
player_set_animation(player, "stand", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "sneak_stand", animation_speed_mod)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3,6 +3,7 @@ local S = minetest.get_translator("mcl_playerplus")
|
||||
-- Internal player state
|
||||
local mcl_playerplus_internal = {}
|
||||
|
||||
|
||||
local def = {}
|
||||
local time = 0
|
||||
|
||||
@ -20,11 +21,22 @@ minetest.register_globalstep(function(dtime)
|
||||
-- Update jump status immediately since we need this info in real time.
|
||||
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local controls = player:get_player_control()
|
||||
name = player:get_player_name()
|
||||
|
||||
-- controls head bone
|
||||
pitch = degrees(player:get_look_vertical()) * -1
|
||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
||||
if controls.sneak then
|
||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
||||
if player:get_properties().collisionbox ~= {-0.35,0,-0.35,0.35,1.40,0.35} then
|
||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.35,0.35}, eye_height = 1.35})
|
||||
end
|
||||
else
|
||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
||||
if player:get_properties().collisionbox ~= {-0.35,0,-0.35,0.35,1.8,0.35} then
|
||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65})
|
||||
end
|
||||
end
|
||||
|
||||
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
||||
|
Loading…
Reference in New Issue
Block a user