forked from VoxeLibre/VoxeLibre
wielditem #4
|
@ -3,6 +3,7 @@ local S = minetest.get_translator("mcl_playerplus")
|
||||||
-- Internal player state
|
-- Internal player state
|
||||||
local mcl_playerplus_internal = {}
|
local mcl_playerplus_internal = {}
|
||||||
|
|
||||||
|
|
||||||
local def = {}
|
local def = {}
|
||||||
local time = 0
|
local time = 0
|
||||||
|
|
||||||
|
@ -20,11 +21,22 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- Update jump status immediately since we need this info in real time.
|
-- 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.
|
-- WARNING: This section is HACKY as hell since it is all just based on heuristics.
|
||||||
for _,player in pairs(minetest.get_connected_players()) do
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
|
local controls = player:get_player_control()
|
||||||
name = player:get_player_name()
|
name = player:get_player_name()
|
||||||
|
|
||||||
-- controls head bone
|
-- controls head bone
|
||||||
pitch = degrees(player:get_look_vertical()) * -1
|
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
|
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||||
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
||||||
|
|
Loading…
Reference in New Issue