1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +00:00

Add some missing getter functions to the lua API

ObjectRef:
get_properties
get_armor_groups
get_animation
get_attach
get_bone_position

Players:
get_physics_override
hud_get_hotbar_itemcount
hud_get_hotbar_image
hud_get_hotbar_selected_image
get_sky
get_day_night_ratio
get_local_animation
get_eye_offset

Global:
minetest.get_gen_notify
minetest.get_noiseparams
This commit is contained in:
TeTpaAka 2015-05-26 14:10:08 +02:00 committed by est31
parent 990a96578f
commit c0335f7d13
17 changed files with 665 additions and 8 deletions

View file

@ -533,6 +533,11 @@ void LuaEntitySAO::setArmorGroups(const ItemGroupList &armor_groups)
m_armor_groups_sent = false;
}
ItemGroupList LuaEntitySAO::getArmorGroups()
{
return m_armor_groups;
}
void LuaEntitySAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend)
{
m_animation_range = frame_range;
@ -541,12 +546,25 @@ void LuaEntitySAO::setAnimation(v2f frame_range, float frame_speed, float frame_
m_animation_sent = false;
}
void LuaEntitySAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend)
{
*frame_range = m_animation_range;
*frame_speed = m_animation_speed;
*frame_blend = m_animation_blend;
}
void LuaEntitySAO::setBonePosition(const std::string &bone, v3f position, v3f rotation)
{
m_bone_position[bone] = core::vector2d<v3f>(position, rotation);
m_bone_position_sent = false;
}
void LuaEntitySAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotation)
{
*position = m_bone_position[bone].X;
*rotation = m_bone_position[bone].Y;
}
void LuaEntitySAO::setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation)
{
// Attachments need to be handled on both the server and client.
@ -564,6 +582,15 @@ void LuaEntitySAO::setAttachment(int parent_id, const std::string &bone, v3f pos
m_attachment_sent = false;
}
void LuaEntitySAO::getAttachment(int *parent_id, std::string *bone, v3f *position,
v3f *rotation)
{
*parent_id = m_attachment_parent_id;
*bone = m_attachment_bone;
*position = m_attachment_position;
*rotation = m_attachment_rotation;
}
ObjectProperties* LuaEntitySAO::accessObjectProperties()
{
return &m_prop;
@ -1133,6 +1160,11 @@ void PlayerSAO::setArmorGroups(const ItemGroupList &armor_groups)
m_armor_groups_sent = false;
}
ItemGroupList PlayerSAO::getArmorGroups()
{
return m_armor_groups;
}
void PlayerSAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend)
{
// store these so they can be updated to clients
@ -1142,6 +1174,13 @@ void PlayerSAO::setAnimation(v2f frame_range, float frame_speed, float frame_ble
m_animation_sent = false;
}
void PlayerSAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend)
{
*frame_range = m_animation_range;
*frame_speed = m_animation_speed;
*frame_blend = m_animation_blend;
}
void PlayerSAO::setBonePosition(const std::string &bone, v3f position, v3f rotation)
{
// store these so they can be updated to clients
@ -1149,6 +1188,12 @@ void PlayerSAO::setBonePosition(const std::string &bone, v3f position, v3f rotat
m_bone_position_sent = false;
}
void PlayerSAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotation)
{
*position = m_bone_position[bone].X;
*rotation = m_bone_position[bone].Y;
}
void PlayerSAO::setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation)
{
// Attachments need to be handled on both the server and client.
@ -1166,6 +1211,15 @@ void PlayerSAO::setAttachment(int parent_id, const std::string &bone, v3f positi
m_attachment_sent = false;
}
void PlayerSAO::getAttachment(int *parent_id, std::string *bone, v3f *position,
v3f *rotation)
{
*parent_id = m_attachment_parent_id;
*bone = m_attachment_bone;
*position = m_attachment_position;
*rotation = m_attachment_rotation;
}
ObjectProperties* PlayerSAO::accessObjectProperties()
{
return &m_prop;