SendConsoleEvent function for EventHandlers

This commit is contained in:
Boondorl 2022-11-11 04:53:53 -05:00 committed by Christoph Oelckers
parent a483ad20be
commit b4a8b1278f
2 changed files with 16 additions and 0 deletions

View file

@ -686,6 +686,21 @@ DEFINE_ACTION_FUNCTION(DEventHandler, SendNetworkEvent)
ACTION_RETURN_BOOL(currentVMLevel->localEventManager->SendNetworkEvent(name, arg1, arg2, arg3, false));
}
DEFINE_ACTION_FUNCTION(DEventHandler, SendConsoleEvent)
{
PARAM_PROLOGUE;
PARAM_INT(playerNum);
PARAM_STRING(name);
PARAM_INT(arg1);
PARAM_INT(arg2);
PARAM_INT(arg3);
if (playerNum == consoleplayer)
primaryLevel->localEventManager->Console(-1, name, arg1, arg2, arg3, false);
return 0;
}
DEFINE_ACTION_FUNCTION(DEventHandler, Find)
{
PARAM_PROLOGUE;

View file

@ -148,4 +148,5 @@ class EventHandler : StaticEventHandler native version("2.4")
{
clearscope static native StaticEventHandler Find(class<StaticEventHandler> type);
clearscope static native void SendNetworkEvent(String name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
clearscope static native void SendConsoleEvent(int playerNum, string name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
}