feat: add ObjectRef for scene loading to not rely on runtime id's

This commit is contained in:
2026-10-18 17:15:51 +02:00
parent 94fa2bb4b2
commit d21c2ccfd7
10 changed files with 262 additions and 35 deletions
@@ -6,7 +6,7 @@
#include <cstddef>
#include <vector>
#include <destrum/ObjectModel/ObjectId.h>
#include <destrum/ObjectModel/ObjectRef.h>
class InteractableButton final : public Interactable {
public:
@@ -19,6 +19,7 @@ public:
nlohmann::json Serialize() const override;
void Deserialize(const nlohmann::json& data) override;
void ResolveReferences(const ObjectMap& objects) override;
void ImGuiInspector() override;
[[nodiscard]] std::size_t GetColorIndex() const { return m_ColorIndex; }
@@ -29,7 +30,7 @@ public:
// Every Activatable on a target object is activated when the button is pressed
void AddTarget(const GameObject& target);
void RemoveTarget(ObjectId target);
[[nodiscard]] const std::vector<ObjectId>& GetTargets() const { return m_Targets; }
[[nodiscard]] const std::vector<ObjectRef>& GetTargets() const { return m_Targets; }
private:
void ApplyColor();
@@ -39,7 +40,7 @@ private:
std::size_t m_ColorIndex{0};
int m_PressCount{0};
bool m_CycleColors{true};
std::vector<ObjectId> m_Targets;
std::vector<ObjectRef> m_Targets;
};
#endif // LIGHTKEEPER_INTERACTABLEBUTTON_H