"blank_skin.png",
},
current_animation = "stand",
- --swimming = false,
+ swimming = false,
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
old_controls = {},
stepheight = 0.6 ,
entity.wielder = name
- object:set_attach(player, "Right_Hand", vector.new(0,0,0), vector.new(0,0,0))
+ object:set_attach(player, "Right_Hand", vector.new(0,0,0), vector.new(0, 0, 0))
temp_pool.wield_item = object
end
temp_pool.stepheight = player_constant.stepheight
temp_pool.visual_size = player_constant.visual_size
temp_pool.attached = false
+ temp_pool.sleeping = false
player:set_properties(temp_pool)
end
pool[name].attached = truth
end
+local name
+get_if_player_attached = function(player)
+ name = player:get_player_name()
+ return(pool[name].attached)
+end
+
+
+local name
+player_is_sleeping = function(player,truth)
+ name = player:get_player_name()
+ pool[name].sleeping = truth
+end
+
+local name
+get_if_player_sleeping = function(player)
+ name = player:get_player_name()
+ return(pool[name].sleeping)
+end
-- toggles nametag visibility
-- controls head bone
local state
---local swimming
+local swimming
local pitch
local pitch_look = function(player,sneak)
state = get_player_state(player)
- --swimming = is_player_swimming(player)
+ swimming = is_player_swimming(player)
pitch = degrees(player:get_look_vertical()) * -1
- --if swimming then
- --pitch = pitch + 90
- if sneak then
+ if swimming then
+ pitch = pitch + 90
+ elseif sneak then
pitch = pitch + 15
end
temp_pool = pool[name]
state = get_player_state(player)
- --swimming = is_player_swimming(player)
+ swimming = is_player_swimming(player)
mouse = (control.LMB or control.RMB)
- --[[
if swimming then
for k,i in pairs(control) do
if i and translation_table.swim.keys[k] then
set_animation(player, translated.animation, translated.speed)
return
else
- ]]--
- if control.sneak then
- for k,i in pairs(control) do
- if i and translation_table.sneak.keys[k] then
- translated = translation_table.sneak.states[true][mouse]
- set_animation(player, translated.animation, translated.speed)
- return
- end
- end
- translated = translation_table.sneak.states[false][mouse]
- set_animation(player, translated.animation, translated.speed)
- return
- else
- for k,i in pairs(control) do
- if i and translation_table.walk.keys[k] then
- translated = translation_table.walk.states[mouse][state]
- if translated then
+ if control.sneak then
+ for k,i in pairs(control) do
+ if i and translation_table.sneak.keys[k] then
+ translated = translation_table.sneak.states[true][mouse]
set_animation(player, translated.animation, translated.speed)
return
end
end
+ translated = translation_table.sneak.states[false][mouse]
+ set_animation(player, translated.animation, translated.speed)
+ return
+ else
+ for k,i in pairs(control) do
+ if i and translation_table.walk.keys[k] then
+ translated = translation_table.walk.states[mouse][state]
+ if translated then
+ set_animation(player, translated.animation, translated.speed)
+ return
+ end
+ end
+ end
end
- end
- translated = translation_table.stand[mouse]
- set_animation(player, translated.animation, translated.speed)
- --end
+ translated = translation_table.stand[mouse]
+ set_animation(player, translated.animation, translated.speed)
+ end
end
-- translates player movement to animation
if player:get_hp() <= 0 then
set_animation(player,"die",40,false)
- elseif not temp_pool.attached or not player:get_attach() then
+ elseif not temp_pool.sleeping and (not temp_pool.attached or not player:get_attach()) then
temp_pool.attached = false
update = control_check(player,control_table)
update_wield_item(player)
itemname = stack:is_known() and stack:get_name() or "unknown"
def = minetest.registered_nodes[itemname]
+ local tooldef = minetest.registered_tools[itemname]
self.object:set_properties({
textures = {itemname},
wield_item = self.itemstring,
glow = def and def.light_source,
})
+
+ local parent, bone, offset, rotation, forced_visible = self.object:get_attach()
+
+ if not parent then
+ return
+ end
+
+ if tooldef then
+ rotation = vector.new(90, 45, 90)
+ else
+ rotation = vector.new(0, 0, 0)
+ end
+
+ self.object:set_attach(parent, bone, offset, rotation, forced_visible)
end
minetest.register_entity("player_api:item", {
self.object:remove()
end
end,
-})
\ No newline at end of file
+})