update entity script semantics

This commit is contained in:
MihailRis
2024-06-29 21:01:30 +03:00
parent c54be7b2b1
commit fc3994446a
11 changed files with 193 additions and 69 deletions
+15
View File
@@ -9,6 +9,12 @@
#include <unordered_map>
#include <entt/entity/registry.hpp>
struct entity_funcs_set {
bool init : 1;
bool on_despawn : 1;
bool on_grounded : 1;
};
struct EntityDef;
struct EntityId {
@@ -30,6 +36,11 @@ struct Rigidbody {
Hitbox hitbox;
};
struct Scripting {
entity_funcs_set funcsset;
scriptenv env;
};
class Level;
class Assets;
class LineBatch;
@@ -67,6 +78,10 @@ public:
return registry.get<Rigidbody>(entity);
}
Scripting& getScripting() const {
return registry.get<Scripting>(entity);
}
entityid_t getUID() const {
return registry.get<EntityId>(entity).uid;
}