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
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
+})