2017-01-30 23:28:47 +00:00
|
|
|
|
2017-03-06 21:27:51 +00:00
|
|
|
struct RenderEvent native ui version("2.4")
|
2017-01-30 23:28:47 +00:00
|
|
|
{
|
|
|
|
native readonly Vector3 ViewPos;
|
|
|
|
native readonly double ViewAngle;
|
|
|
|
native readonly double ViewPitch;
|
|
|
|
native readonly double ViewRoll;
|
|
|
|
native readonly double FracTic;
|
|
|
|
native readonly Actor Camera;
|
|
|
|
}
|
|
|
|
|
2017-03-06 21:27:51 +00:00
|
|
|
struct WorldEvent native play version("2.4")
|
2017-01-30 23:28:47 +00:00
|
|
|
{
|
|
|
|
// for loaded/unloaded
|
|
|
|
native readonly bool IsSaveGame;
|
2017-02-02 18:26:56 +00:00
|
|
|
// this will be true if we are re-entering the hub level.
|
|
|
|
native readonly bool IsReopen;
|
2021-09-27 17:40:57 +00:00
|
|
|
// for unloaded, name of next map (if any)
|
|
|
|
native readonly String NextMap;
|
2020-09-06 12:34:40 +00:00
|
|
|
// for thingspawned/thingdied/thingdestroyed/thingground
|
2017-01-30 23:28:47 +00:00
|
|
|
native readonly Actor Thing;
|
2017-01-31 00:07:00 +00:00
|
|
|
// for thingdied. can be null
|
|
|
|
native readonly Actor Inflictor;
|
2018-11-06 02:59:17 +00:00
|
|
|
// for thingdamaged, line/sector damaged
|
2017-01-31 02:35:44 +00:00
|
|
|
native readonly int Damage;
|
|
|
|
native readonly Actor DamageSource;
|
|
|
|
native readonly Name DamageType;
|
|
|
|
native readonly EDmgFlags DamageFlags;
|
|
|
|
native readonly double DamageAngle;
|
2018-03-24 14:59:20 +00:00
|
|
|
// for line(pre)activated
|
2018-03-17 15:01:47 +00:00
|
|
|
native readonly Line ActivatedLine;
|
2018-04-14 08:33:17 +00:00
|
|
|
native readonly int ActivationType;
|
2018-03-24 14:59:20 +00:00
|
|
|
native bool ShouldActivate;
|
2018-11-06 02:59:17 +00:00
|
|
|
// for line/sector damaged
|
|
|
|
native readonly SectorPart DamageSectorPart;
|
|
|
|
native readonly Line DamageLine;
|
|
|
|
native readonly Sector DamageSector;
|
|
|
|
native readonly int DamageLineSide;
|
|
|
|
native readonly vector3 DamagePosition;
|
|
|
|
native readonly bool DamageIsRadius;
|
|
|
|
native int NewDamage;
|
2020-09-30 01:56:36 +00:00
|
|
|
native readonly State CrushedState;
|
2017-01-30 23:28:47 +00:00
|
|
|
}
|
|
|
|
|
2017-03-06 21:27:51 +00:00
|
|
|
struct PlayerEvent native play version("2.4")
|
2017-02-02 18:26:56 +00:00
|
|
|
{
|
|
|
|
// this is the player number that caused the event.
|
|
|
|
// note: you can get player struct from this by using players[e.PlayerNumber]
|
|
|
|
native readonly int PlayerNumber;
|
|
|
|
// this will be true if we are re-entering the hub level.
|
|
|
|
native readonly bool IsReturn;
|
|
|
|
}
|
|
|
|
|
2017-03-06 21:27:51 +00:00
|
|
|
struct ConsoleEvent native version("2.4")
|
2017-02-06 13:52:20 +00:00
|
|
|
{
|
|
|
|
// for net events, this will be the activator.
|
|
|
|
// for UI events, this is always -1, and you need to check if level is loaded and use players[consoleplayer].
|
|
|
|
native readonly int Player;
|
2017-03-06 09:25:30 +00:00
|
|
|
// this is the name and args as specified in SendNetworkEvent or event/netevent CCMDs
|
2017-02-06 13:52:20 +00:00
|
|
|
native readonly String Name;
|
|
|
|
native readonly int Args[3];
|
2017-03-06 09:25:30 +00:00
|
|
|
// this will be true if the event is fired from the console by event/netevent CCMD
|
|
|
|
native readonly bool IsManual;
|
2017-02-06 13:52:20 +00:00
|
|
|
}
|
|
|
|
|
2018-08-15 15:46:03 +00:00
|
|
|
struct ReplaceEvent native version("2.4")
|
|
|
|
{
|
|
|
|
native readonly Class<Actor> Replacee;
|
|
|
|
native Class<Actor> Replacement;
|
2018-08-16 18:46:40 +00:00
|
|
|
native bool IsFinal;
|
2018-08-15 15:46:03 +00:00
|
|
|
}
|
|
|
|
|
2019-01-28 00:03:04 +00:00
|
|
|
struct ReplacedEvent native version("3.7")
|
|
|
|
{
|
|
|
|
native Class<Actor> Replacee;
|
|
|
|
native readonly Class<Actor> Replacement;
|
|
|
|
native bool IsFinal;
|
|
|
|
}
|
|
|
|
|
2017-03-05 13:03:27 +00:00
|
|
|
class StaticEventHandler : Object native play version("2.4")
|
2017-01-22 02:15:30 +00:00
|
|
|
{
|
2017-01-30 07:28:27 +00:00
|
|
|
// static event handlers CAN register other static event handlers.
|
|
|
|
// unlike EventHandler.Create that will not create them.
|
2017-03-04 22:52:43 +00:00
|
|
|
clearscope static native StaticEventHandler Find(Class<StaticEventHandler> type); // just for convenience. who knows.
|
2017-01-30 07:28:27 +00:00
|
|
|
|
2017-02-03 10:28:40 +00:00
|
|
|
// these are called when the handler gets registered or unregistered
|
|
|
|
// you can set Order/IsUiProcessor here.
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual void OnRegister() {}
|
|
|
|
virtual void OnUnregister() {}
|
2017-01-30 07:28:27 +00:00
|
|
|
|
2017-01-30 23:28:47 +00:00
|
|
|
// actual handlers are here
|
2019-01-28 00:03:04 +00:00
|
|
|
virtual void WorldLoaded(WorldEvent e) {}
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual void WorldUnloaded(WorldEvent e) {}
|
|
|
|
virtual void WorldThingSpawned(WorldEvent e) {}
|
|
|
|
virtual void WorldThingDied(WorldEvent e) {}
|
2020-09-06 12:34:40 +00:00
|
|
|
virtual void WorldThingGround(WorldEvent e) {}
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual void WorldThingRevived(WorldEvent e) {}
|
|
|
|
virtual void WorldThingDamaged(WorldEvent e) {}
|
|
|
|
virtual void WorldThingDestroyed(WorldEvent e) {}
|
|
|
|
virtual void WorldLinePreActivated(WorldEvent e) {}
|
|
|
|
virtual void WorldLineActivated(WorldEvent e) {}
|
|
|
|
virtual void WorldSectorDamaged(WorldEvent e) {}
|
|
|
|
virtual void WorldLineDamaged(WorldEvent e) {}
|
|
|
|
virtual void WorldLightning(WorldEvent e) {} // for the sake of completeness.
|
|
|
|
virtual void WorldTick() {}
|
2017-01-22 06:56:57 +00:00
|
|
|
|
2017-02-02 18:26:56 +00:00
|
|
|
//
|
2018-11-29 17:46:28 +00:00
|
|
|
//virtual ui void RenderFrame(RenderEvent e) {}
|
|
|
|
virtual ui void RenderOverlay(RenderEvent e) {}
|
2019-07-03 14:46:02 +00:00
|
|
|
virtual ui void RenderUnderlay(RenderEvent e) {}
|
2017-02-02 17:57:00 +00:00
|
|
|
|
2017-02-02 18:26:56 +00:00
|
|
|
//
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual void PlayerEntered(PlayerEvent e) {}
|
2020-08-25 15:54:20 +00:00
|
|
|
virtual void PlayerSpawned(PlayerEvent e) {}
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual void PlayerRespawned(PlayerEvent e) {}
|
|
|
|
virtual void PlayerDied(PlayerEvent e) {}
|
|
|
|
virtual void PlayerDisconnected(PlayerEvent e) {}
|
2017-02-02 18:26:56 +00:00
|
|
|
|
2017-02-03 10:28:40 +00:00
|
|
|
//
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual ui bool UiProcess(UiEvent e) { return false; }
|
|
|
|
virtual ui bool InputProcess(InputEvent e) { return false; }
|
|
|
|
virtual ui void UiTick() {}
|
|
|
|
virtual ui void PostUiTick() {}
|
2017-02-03 10:28:40 +00:00
|
|
|
|
2017-02-06 13:52:20 +00:00
|
|
|
//
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual ui void ConsoleProcess(ConsoleEvent e) {}
|
|
|
|
virtual void NetworkProcess(ConsoleEvent e) {}
|
2017-02-06 13:52:20 +00:00
|
|
|
|
2018-08-15 15:46:03 +00:00
|
|
|
//
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual void CheckReplacement(ReplaceEvent e) {}
|
2019-01-28 00:03:04 +00:00
|
|
|
virtual void CheckReplacee(ReplacedEvent e) {}
|
2018-08-15 15:46:03 +00:00
|
|
|
|
2018-09-15 02:57:07 +00:00
|
|
|
//
|
2018-11-29 17:46:28 +00:00
|
|
|
virtual void NewGame() {}
|
2018-09-15 02:57:07 +00:00
|
|
|
|
2017-02-03 10:28:40 +00:00
|
|
|
// this value will be queried on Register() to decide the relative order of this handler to every other.
|
2017-02-02 17:57:00 +00:00
|
|
|
// this is most useful in UI systems.
|
|
|
|
// default is 0.
|
2017-02-03 18:44:27 +00:00
|
|
|
native readonly int Order;
|
|
|
|
native void SetOrder(int order);
|
2017-02-03 10:28:40 +00:00
|
|
|
// this value will be queried on user input to decide whether to send UiProcess to this handler.
|
|
|
|
native bool IsUiProcessor;
|
2017-02-03 18:34:34 +00:00
|
|
|
// this value determines whether mouse input is required.
|
|
|
|
native bool RequireMouse;
|
2017-01-30 06:47:15 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 13:03:27 +00:00
|
|
|
class EventHandler : StaticEventHandler native version("2.4")
|
2017-01-22 06:56:57 +00:00
|
|
|
{
|
2017-03-04 22:38:00 +00:00
|
|
|
clearscope static native StaticEventHandler Find(class<StaticEventHandler> type);
|
2017-03-03 22:57:41 +00:00
|
|
|
clearscope static native void SendNetworkEvent(String name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
2022-11-11 09:53:53 +00:00
|
|
|
clearscope static native void SendConsoleEvent(int playerNum, string name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
|
2017-01-22 06:56:57 +00:00
|
|
|
}
|