Arma Reforger Script API
Loading...
Searching...
No Matches
SCR_AISectorThreatFilter Interface Reference

This object splits incoming events into sectors based on direction. More...

Public Member Functions

void SCR_AISectorThreatFilter (IEntity myEntity)
 
void GetActiveSectors (out int outSectorMajor, out int outSectorMinor)
 Returns sectors to outside. Can return -1 if the sector is inactive.
 
vector GetSectorPos (int sectorId)
 
float GetSectorDanger (int sectorId)
 
SCR_EAIThreatSectorFlags GetSectorFlags (int sectorId)
 
bool IsSectorActive (int sectorId)
 
SCR_AIThreatSector GetSector (int sectorId)
 Primarily used for save/load. Do not call unless you know what you are doing!
 
ScriptInvokerBase< SCR_AISectorThreatFilter_OnEscalation > GetOnEscalationInvoker ()
 See m_OnEscalation.
 
ScriptInvokerBase< SCR_AISectorThreatFilter_OnMajorSectorChanged > GetOnMajorSectorChangedInvoker ()
 See m_OnMajorSectorChanged.
 
ScriptInvokerBase< SCR_AISectorThreatFilter_OnDamageTaken > GetOnDamageTaken ()
 See m_OnDamageTaken.
 
void Update (float timeSlice_s)
 Must be called periodically Udpates state of each sector Selects which sector is more relevant (major sector) and the other one (minor sector)
 
void OnShotsFired (vector eventPos, int count, bool isFlyby)
 Must be called from gunshot event.
 
void OnDamageTaken (vector eventPos)
 
void OnExplosion (vector eventPos)
 Must be called from explosion event.
 
void EOnDiag (float timeSlice)
 

Static Public Attributes

const int SECTOR_COUNT = 2
 
const float REFERENCE_RATE_OF_FIRE = 10.8333
 
const float REFERENCE_DISTANCE_INV = 0.01
 
const float DANGER_MULT_ZERO = 7
 
const float GUNSHOT_DANGER_CONST_C = 1.0 / (DANGER_MULT_ZERO - 1.0)
 
const float GUNSHOT_DANGER_CONST_A = (DANGER_MULT_ZERO / (DANGER_MULT_ZERO - 1.0)) / REFERENCE_RATE_OF_FIRE
 
const float DANGER_MULT_FLYBY = 20
 
const float DAMAGE_TAKEN_DANGER_BUMP_TO = 20
 

Protected Member Functions

void AddNewEventsToSector (int sectorId, vector eventPos, float dangerDeltaPerEvent, int eventCount, float bumpDangerTo, SCR_EAIThreatSectorFlags flagsToAdd=0)
 There are two ways which can be used to 'bump' danger values in sector.
 
int FindSectorForEvent (vector eventPos)
 Finds closest (by angle) sector for event, or returns index of an inactive sector, if there's one.
 
vector GetMyPos ()
 

Protected Attributes

ref SCR_AIThreatSector m_aSectors [SECTOR_COUNT]
 
int m_iSectorMajor = -1
 
int m_iSectorMinor = -1
 
IEntity m_MyEntity
 
ref ScriptInvokerBase< SCR_AISectorThreatFilter_OnEscalation > m_OnEscalation = new ScriptInvokerBase<SCR_AISectorThreatFilter_OnEscalation>()
 
ref ScriptInvokerBase< SCR_AISectorThreatFilter_OnMajorSectorChanged > m_OnMajorSectorChanged = new ScriptInvokerBase<SCR_AISectorThreatFilter_OnMajorSectorChanged>()
 
ref ScriptInvokerBase< SCR_AISectorThreatFilter_OnDamageTaken > m_OnDamageTaken = new ScriptInvokerBase<SCR_AISectorThreatFilter_OnDamageTaken>()
 

Static Protected Attributes

static const float COS_SECTOR_HALF_ANGLE = 0.5
 
static const float SECTOR_FORGET_S = 45.0
 
static const float SECTOR_URGENT_S = 1.5
 
static const float URGENT_SECTOR_PRIORITY_MULTIPLIER = 10
 
static const float ACCUMULATOR_DROP_RATE = 0.05
 
static const float NEXT_ESCALATION_MULTIPLIER = 1.8
 

Detailed Description

This object splits incoming events into sectors based on direction.

It can maintain up to SECTOR_COUNT sectors. This class meant to solve soldier's awarenes of danger events around him, by tracking not only amount of danger, but also direction to danger. This is designed to be used for very numerous events, such as gunshots.

Constructor & Destructor Documentation

◆ SCR_AISectorThreatFilter()

void SCR_AISectorThreatFilter.SCR_AISectorThreatFilter ( IEntity myEntity)

Member Function Documentation

◆ AddNewEventsToSector()

void SCR_AISectorThreatFilter.AddNewEventsToSector ( int sectorId,
vector eventPos,
float dangerDeltaPerEvent,
int eventCount,
float bumpDangerTo,
SCR_EAIThreatSectorFlags flagsToAdd = 0 )
protected

There are two ways which can be used to 'bump' danger values in sector.

Both ways can be used in same call as well.

  1. Provide how many events happened (eventCount) and what was increment per each event (dangerDeltaPerEvent). At next update the provided values get summed, danger per second is calculated, and sector's danger value is bumped to that value, if it's higher. This is meant for frequent events like gunshots.
  2. Provide value to which sector's danger value should be bumped to, if it's higher (bumpDangerTo) This is meant for infrequent events like explosions.

◆ EOnDiag()

void SCR_AISectorThreatFilter.EOnDiag ( float timeSlice)

◆ FindSectorForEvent()

int SCR_AISectorThreatFilter.FindSectorForEvent ( vector eventPos)
protected

Finds closest (by angle) sector for event, or returns index of an inactive sector, if there's one.

◆ GetActiveSectors()

void SCR_AISectorThreatFilter.GetActiveSectors ( out int outSectorMajor,
out int outSectorMinor )

Returns sectors to outside. Can return -1 if the sector is inactive.

◆ GetMyPos()

vector SCR_AISectorThreatFilter.GetMyPos ( )
protected

◆ GetOnDamageTaken()

ScriptInvokerBase< SCR_AISectorThreatFilter_OnDamageTaken > SCR_AISectorThreatFilter.GetOnDamageTaken ( )

See m_OnDamageTaken.

◆ GetOnEscalationInvoker()

ScriptInvokerBase< SCR_AISectorThreatFilter_OnEscalation > SCR_AISectorThreatFilter.GetOnEscalationInvoker ( )

See m_OnEscalation.

◆ GetOnMajorSectorChangedInvoker()

ScriptInvokerBase< SCR_AISectorThreatFilter_OnMajorSectorChanged > SCR_AISectorThreatFilter.GetOnMajorSectorChangedInvoker ( )

See m_OnMajorSectorChanged.

◆ GetSector()

SCR_AIThreatSector SCR_AISectorThreatFilter.GetSector ( int sectorId)

Primarily used for save/load. Do not call unless you know what you are doing!

◆ GetSectorDanger()

float SCR_AISectorThreatFilter.GetSectorDanger ( int sectorId)

◆ GetSectorFlags()

SCR_EAIThreatSectorFlags SCR_AISectorThreatFilter.GetSectorFlags ( int sectorId)

◆ GetSectorPos()

vector SCR_AISectorThreatFilter.GetSectorPos ( int sectorId)

◆ IsSectorActive()

bool SCR_AISectorThreatFilter.IsSectorActive ( int sectorId)

◆ OnDamageTaken()

void SCR_AISectorThreatFilter.OnDamageTaken ( vector eventPos)

◆ OnExplosion()

void SCR_AISectorThreatFilter.OnExplosion ( vector eventPos)

Must be called from explosion event.

◆ OnShotsFired()

void SCR_AISectorThreatFilter.OnShotsFired ( vector eventPos,
int count,
bool isFlyby )

Must be called from gunshot event.

◆ Update()

void SCR_AISectorThreatFilter.Update ( float timeSlice_s)

Must be called periodically Udpates state of each sector Selects which sector is more relevant (major sector) and the other one (minor sector)

Member Data Documentation

◆ ACCUMULATOR_DROP_RATE

const float SCR_AISectorThreatFilter.ACCUMULATOR_DROP_RATE = 0.05
staticprotected

◆ COS_SECTOR_HALF_ANGLE

const float SCR_AISectorThreatFilter.COS_SECTOR_HALF_ANGLE = 0.5
staticprotected

◆ DAMAGE_TAKEN_DANGER_BUMP_TO

const float SCR_AISectorThreatFilter.DAMAGE_TAKEN_DANGER_BUMP_TO = 20
static

◆ DANGER_MULT_FLYBY

const float SCR_AISectorThreatFilter.DANGER_MULT_FLYBY = 20
static

◆ DANGER_MULT_ZERO

const float SCR_AISectorThreatFilter.DANGER_MULT_ZERO = 7
static

◆ GUNSHOT_DANGER_CONST_A

const float SCR_AISectorThreatFilter.GUNSHOT_DANGER_CONST_A = (DANGER_MULT_ZERO / (DANGER_MULT_ZERO - 1.0)) / REFERENCE_RATE_OF_FIRE
static

◆ GUNSHOT_DANGER_CONST_C

const float SCR_AISectorThreatFilter.GUNSHOT_DANGER_CONST_C = 1.0 / (DANGER_MULT_ZERO - 1.0)
static

◆ m_aSectors

ref SCR_AIThreatSector SCR_AISectorThreatFilter.m_aSectors[SECTOR_COUNT]
protected

◆ m_iSectorMajor

int SCR_AISectorThreatFilter.m_iSectorMajor = -1
protected

◆ m_iSectorMinor

int SCR_AISectorThreatFilter.m_iSectorMinor = -1
protected

◆ m_MyEntity

IEntity SCR_AISectorThreatFilter.m_MyEntity
protected

◆ m_OnDamageTaken

ref ScriptInvokerBase<SCR_AISectorThreatFilter_OnDamageTaken> SCR_AISectorThreatFilter.m_OnDamageTaken = new ScriptInvokerBase<SCR_AISectorThreatFilter_OnDamageTaken>()
protected

◆ m_OnEscalation

ref ScriptInvokerBase<SCR_AISectorThreatFilter_OnEscalation> SCR_AISectorThreatFilter.m_OnEscalation = new ScriptInvokerBase<SCR_AISectorThreatFilter_OnEscalation>()
protected

◆ m_OnMajorSectorChanged

ref ScriptInvokerBase<SCR_AISectorThreatFilter_OnMajorSectorChanged> SCR_AISectorThreatFilter.m_OnMajorSectorChanged = new ScriptInvokerBase<SCR_AISectorThreatFilter_OnMajorSectorChanged>()
protected

◆ NEXT_ESCALATION_MULTIPLIER

const float SCR_AISectorThreatFilter.NEXT_ESCALATION_MULTIPLIER = 1.8
staticprotected

◆ REFERENCE_DISTANCE_INV

const float SCR_AISectorThreatFilter.REFERENCE_DISTANCE_INV = 0.01
static

◆ REFERENCE_RATE_OF_FIRE

const float SCR_AISectorThreatFilter.REFERENCE_RATE_OF_FIRE = 10.8333
static

◆ SECTOR_COUNT

const int SCR_AISectorThreatFilter.SECTOR_COUNT = 2
static

◆ SECTOR_FORGET_S

const float SCR_AISectorThreatFilter.SECTOR_FORGET_S = 45.0
staticprotected

◆ SECTOR_URGENT_S

const float SCR_AISectorThreatFilter.SECTOR_URGENT_S = 1.5
staticprotected

◆ URGENT_SECTOR_PRIORITY_MULTIPLIER

const float SCR_AISectorThreatFilter.URGENT_SECTOR_PRIORITY_MULTIPLIER = 10
staticprotected

The documentation for this interface was generated from the following file: