35typedef Param7<vector, vector, vector, vector, float, string, array<ref TriggerInsider>> DebugTriggerInfo;
48 string m_DebugAreaType;
65 CleanupDebugShapes(dbgTargets);
124 return GetCollisionRadius();
138 for (
int n = 0; n <
m_insiders.Count(); ++n )
153 for (
int n = 0; n <
m_insiders.Count(); ++n )
255 obj.OnEnterTrigger(
this);
257 #ifdef TRIGGER_DEBUG_NORMAL
262 #ifdef DIAG_DEVELOPER
263 DebugSendDmgTrigger();
271 insider.
GetObject().OnLeaveTrigger(
this);
273 #ifdef TRIGGER_DEBUG_NORMAL
283 #ifdef DIAG_DEVELOPER
284 DebugSendDmgTrigger();
292 for (
int n = 0; n <
m_insiders.Count(); ++n )
310 #ifdef DIAG_DEVELOPER
311 DebugSendDmgTrigger();
322 for (
int n =
m_insiders.Count() - 1; n >= 0 ; --n)
330 #ifdef TRIGGER_DEBUG_BASIC
347 float currentTime =
g_Game.GetTickTime();
363 super.OnRPC(sender, rpc_type, ctx);
364 #ifdef DIAG_DEVELOPER
367 case ERPCs.DIAG_TRIGGER_DEBUG:
370 if ( ctx.
Read( data ) )
371 DebugDmgTrigger( data.param1, data.param2, data.param3, data.param4, data.param5, data.param6, data.param7 );
378 void DebugSendDmgTrigger()
381 GetCollisionBox(minmax);
384 data.param1 = GetWorldPosition();
386 data.param3 = minmax[0];
387 data.param4 = minmax[1];
388 data.param5 = GetCollisionRadius();
389 data.param6 = m_DebugAreaType;
393 PluginDiagMenuServer.SendDataToSubscribersServer(
this, ESubscriberSystems.TRIGGERS,
ERPCs.DIAG_TRIGGER_DEBUG, data,
false);
394 else if (!
GetGame().IsMultiplayer() || m_Local)
395 DebugDmgTrigger( data.param1, data.param2, data.param3, data.param4, data.param5, data.param6, data.param7 );
402 CleanupDebugShapes( dbgTargets );
412 vector w_pos, w_pos_sphr, w_pos_lend;
421 m_DebugAreaType = dmgType;
424 switch ( m_DebugAreaType )
430 case "BarbedWireHit":
440 m_dbgInsiders = insiders;
442 if ( m_dbgInsiders.Count() > 0 )
447 for (
int i = 0; i < m_dbgInsiders.Count(); i++ )
452 vector insiderPos = insider_EAI.GetWorldPosition() +
"0 0.1 0";
471 dbgShape.CreateMatrix(mat);
472 dbgShape.SetMatrix(mat);
485 dbgTargets.Insert(dbgShape);
492 for (
int it = 0; it < shapes.Count(); ++it)
override string GetDebugName()
Gets the debug name for the ParticleManager.
proto native void SetCollisionBox(vector mins, vector maxs)
Sets collision box for object.
proto native TriggerShape GetTriggerShape()
Get the current TriggerShape.
Super root of all classes in Enforce script.
static void TriggerLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
static void RemoveShape(out Shape shape)
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
static Shape DrawSphere(vector pos, float size=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
static Shape DrawCylinder(vector pos, float radius, float height=1, int color=0x1fff7f7f, ShapeFlags flags=ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE)
The class that will be instanced (moddable)
Serialization general interface. Serializer API works with:
proto bool Read(void value_in)
protected void Enter(TriggerInsider insider)
protected void Leave(TriggerInsider insider)
protected void StayFinish()
protected void StayStart(int nrOfInsiders)
protected void Stay(TriggerInsider insider, float deltaTime)
protected TriggerInsider CreateInsider(Object obj)
Used for easily overriding TriggerInsider creation without rewriting AddInsider.
protected bool CanAddObjectAsInsider(Object object)
Condition whether an Object can be added as TriggerInsider (checked before calling AddInsider)
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
void SetExtents(vector mins, vector maxs)
Set the size of the Trigger, avoid using SetCollisionBox directly.
override void EOnLeave(IEntity other, int extra)
When an Object exits the trigger remove it from Insiders.
protected void RemoveInsider(TriggerInsider insider, int index=-1)
Removing of TriggerInsider.
protected void UpdateInsiders(int timeout)
Update the current TriggerInsider inside the Trigger, timeout paramter is deprecated.
override protected void OnLeaveBeginEvent(TriggerInsider insider)
protected bool ShouldRemoveInsider(TriggerInsider insider)
Condition whether a TriggerInsider should still be updated or not (checked in update loop and before ...
protected bool ShouldRemoveInsiderNoLeave(TriggerInsider insider)
Condition whether a TriggerInsider should still be updated or not, skips OnLeaveEvent (checked in upd...
protected void AddInsider(Object obj)
Adding of new TriggerInsider.
protected void RemoveInsiderByObject(Object object)
Removing of TriggerInsider through Object.
override protected void OnEnterBeginEvent(TriggerInsider insider)
float GetRadius(vector min, vector max)
Get the radius of the CollisionBox, simply left for backwards compatibility.
override void OnEnter(Object obj)
private void ~Trigger()
dtor
override void OnLeave(Object obj)
override void EOnInit(IEntity other, int extra)
Set the default extents of the Trigger only once it is properly initialized.
const int TIMEOUT
DEPRECATED.
override protected void UpdateInsiders(int timeout)
int GetInsiderIndexForObject(Object object)
Gets the index in m_insiders for the Object.
ref array< ref TriggerInsider > m_insiders
The objects and their metadata which are currently inside the Trigger.
TriggerInsider GetInsiderForObject(Object object)
Gets the TriggerInsider for the Object if it exists.
array< ref TriggerInsider > GetInsiders()
Get the current TriggerInsider array, left for backwards compatibility, moved down from ManTrigger.
override void EOnFrame(IEntity other, float timeSlice)
When an Object touches the Trigger, we want to register it being inside the Trigger -> Replaced by EO...
private void Trigger()
ctor
override void EOnEnter(IEntity other, int extra)
When an Object enters the trigger add it to Insiders.
The object which is in a trigger and its metadata.
protected Object m_Object
Object that data belongs to.
int timeStamp
Last time the object was seen in ms.
float lastUpdated
Last time the object was updated in seconds, is used for calculating deltaTime.
float timeEntered
Time the object was first seen in seconds.
void TriggerInsider(Object obj)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto native void SetFlags(ShapeFlags flags)
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
EntityEvent
Entity events for event-mask, or throwing event from code.