Implemented entity.GetType() in lua
This will only work for userdata decented from the Entity base class. Using something else results in undefined behavior.
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include "bounding_box.hpp"
|
||||
#include "vector2.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
//The base class for all objects in the world
|
||||
class Entity {
|
||||
public:
|
||||
@@ -41,14 +43,17 @@ public:
|
||||
Vector2 GetMotion() const;
|
||||
BoundingBox GetBounds() const;
|
||||
|
||||
const char* GetType() const;
|
||||
|
||||
protected:
|
||||
Entity() = default;
|
||||
Entity(const char*);
|
||||
virtual ~Entity() = default;
|
||||
|
||||
int roomIndex = -1;
|
||||
Vector2 origin;
|
||||
Vector2 motion;
|
||||
BoundingBox bounds;
|
||||
Vector2 origin = {0, 0};
|
||||
Vector2 motion = {0, 0};
|
||||
BoundingBox bounds = {0, 0, 0, 0};
|
||||
const char* type;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user