1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-29 22:55:19 +01:00

Allow damage for attached objects, add attach/detach callbacks (#6786)

* Allow right-clicking on attached LuaEntities
This commit is contained in:
SmallJoker
2018-04-30 18:43:49 +02:00
committed by GitHub
parent 0b5b32b026
commit ba91624d8c
9 changed files with 136 additions and 78 deletions

View File

@@ -52,6 +52,8 @@ public:
void getBonePosition(const std::string &bone, v3f *position, v3f *rotation);
void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation);
void getAttachment(int *parent_id, std::string *bone, v3f *position, v3f *rotation);
void clearChildAttachments();
void clearParentAttachment();
void addAttachmentChild(int child_id);
void removeAttachmentChild(int child_id);
const std::unordered_set<int> &getAttachmentChildIds();
@@ -72,7 +74,7 @@ protected:
float m_animation_blend = 0.0f;
bool m_animation_loop = true;
bool m_animation_sent = false;
bool m_animation_speed_sent = false;
bool m_animation_speed_sent = false;
// Stores position and rotation for each bone name
std::unordered_map<std::string, core::vector2d<v3f>> m_bone_position;
@@ -84,6 +86,9 @@ protected:
v3f m_attachment_position;
v3f m_attachment_rotation;
bool m_attachment_sent = false;
private:
void onAttach(int parent_id);
void onDetach(int parent_id);
};
/*