Revamped collision system
This commit is contained in:
39
src/lua.h
39
src/lua.h
@@ -31,14 +31,13 @@ enum EventMask : uint32_t {
|
||||
EVENT_ON_COLLISION = 1 << 1,
|
||||
EVENT_ON_INTERACT = 1 << 2,
|
||||
EVENT_ON_TRIGGER_ENTER = 1 << 3,
|
||||
EVENT_ON_TRIGGER_STAY = 1 << 4,
|
||||
EVENT_ON_TRIGGER_EXIT = 1 << 5,
|
||||
EVENT_ON_UPDATE = 1 << 6,
|
||||
EVENT_ON_DESTROY = 1 << 7,
|
||||
EVENT_ON_ENABLE = 1 << 8,
|
||||
EVENT_ON_DISABLE = 1 << 9,
|
||||
EVENT_ON_BUTTON_PRESS = 1 << 10,
|
||||
EVENT_ON_BUTTON_RELEASE = 1 << 11,
|
||||
EVENT_ON_TRIGGER_EXIT = 1 << 4,
|
||||
EVENT_ON_UPDATE = 1 << 5,
|
||||
EVENT_ON_DESTROY = 1 << 6,
|
||||
EVENT_ON_ENABLE = 1 << 7,
|
||||
EVENT_ON_DISABLE = 1 << 8,
|
||||
EVENT_ON_BUTTON_PRESS = 1 << 9,
|
||||
EVENT_ON_BUTTON_RELEASE = 1 << 10,
|
||||
};
|
||||
|
||||
class Lua {
|
||||
@@ -70,11 +69,12 @@ class Lua {
|
||||
}
|
||||
|
||||
// Event dispatchers - these check the bitmask before calling Lua
|
||||
void OnCollision(GameObject* self, GameObject* other);
|
||||
void OnCollideWithPlayer(GameObject* self);
|
||||
void OnInteract(GameObject* self);
|
||||
void OnTriggerEnter(GameObject* trigger, GameObject* other);
|
||||
void OnTriggerStay(GameObject* trigger, GameObject* other);
|
||||
void OnTriggerExit(GameObject* trigger, GameObject* other);
|
||||
void OnTriggerEnterScript(int luaFileIndex, int triggerIndex);
|
||||
void OnTriggerExitScript(int luaFileIndex, int triggerIndex);
|
||||
void OnUpdate(GameObject* go, int deltaFrames); // Per-object update
|
||||
void OnDestroy(GameObject* go);
|
||||
void OnEnable(GameObject* go);
|
||||
@@ -157,19 +157,18 @@ class Lua {
|
||||
[[no_unique_address]] FunctionWrapper<1, typestring_is("onSceneCreationStart")> onSceneCreationStartFunctionWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<2, typestring_is("onSceneCreationEnd")> onSceneCreationEndFunctionWrapper;
|
||||
|
||||
// Object-level events (methodId 100-111, offset to avoid collision with scene events)
|
||||
// Object-level events (methodId 100+, offset to avoid collision with scene events)
|
||||
[[no_unique_address]] FunctionWrapper<100, typestring_is("onCreate")> onCreateMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<101, typestring_is("onCollision")> onCollisionMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<101, typestring_is("onCollideWithPlayer")> onCollideWithPlayerMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<102, typestring_is("onInteract")> onInteractMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<103, typestring_is("onTriggerEnter")> onTriggerEnterMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<104, typestring_is("onTriggerStay")> onTriggerStayMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<105, typestring_is("onTriggerExit")> onTriggerExitMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<106, typestring_is("onUpdate")> onUpdateMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<107, typestring_is("onDestroy")> onDestroyMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<108, typestring_is("onEnable")> onEnableMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<109, typestring_is("onDisable")> onDisableMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<110, typestring_is("onButtonPress")> onButtonPressMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<111, typestring_is("onButtonRelease")> onButtonReleaseMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<104, typestring_is("onTriggerExit")> onTriggerExitMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<105, typestring_is("onUpdate")> onUpdateMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<106, typestring_is("onDestroy")> onDestroyMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<107, typestring_is("onEnable")> onEnableMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<108, typestring_is("onDisable")> onDisableMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<109, typestring_is("onButtonPress")> onButtonPressMethodWrapper;
|
||||
[[no_unique_address]] FunctionWrapper<110, typestring_is("onButtonRelease")> onButtonReleaseMethodWrapper;
|
||||
|
||||
void PushGameObject(GameObject* go);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user