Skip to content

Commit

Permalink
SendConsoleEvent function for EventHandlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Boondorl authored and coelckers committed Nov 13, 2022
1 parent a483ad2 commit b4a8b12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions wadsrc/static/zscript/events.zs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit b4a8b12

Please sign in to comment.