Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseCompartmentManagerComponent.c File Reference

Go to the source code of this file.

Classes

class  SCR_BaseCompartmentManagerComponentClass

Functions

bool BlockSuppliesIfOccupied ()
void GetCompartmentsOfType (inout array< BaseCompartmentSlot > outCompartments, ECompartmentType compartmentType)
void GetCompartmentsOfTypes (inout array< BaseCompartmentSlot > outCompartments, notnull array< ECompartmentType > compartmentTypes)
void GetFreeCompartmentsOfType (inout array< BaseCompartmentSlot > outCompartments, ECompartmentType compartmentType, bool checkHasValidOccupantPrefab=false)
BaseCompartmentSlot GetFirstFreeCompartmentOfType (ECompartmentType compartmentType, bool checkHasValidOccupantPrefab=false)
BaseCompartmentSlot GetFirstFreeCompartmentOfType (typename compartmentClass, bool checkHasValidOccupantPrefab=false)
bool HasFreeCompartmentOfTypes (notnull array< ECompartmentType > compartmentTypes)
int GetOccupantCount ()
void GetOccupants (inout array< IEntity > occupants)
void GetOccupantsOfType (inout array< IEntity > occupants, ECompartmentType compartmentType)
void DamageOccupants (float damage, EDamageType damageType, notnull Instigator instigator, bool damageWhileGetIn=false, bool damageWhileGetOut=false)
void KillOccupants (notnull Instigator instigator, bool eject=false, bool gettingIn=false, bool gettingOut=false)
bool EjectRandomOccupants (float ejectionChance=-1, bool ejectUnconscious=false, out bool allEjectedImmediately=true, bool ejectOnTheSpot=false)
void SetCompartmentsAccessibleForAI (bool accessible)
ScriptInvoker GetOnDoneSpawningDefaultOccupants ()
void SetAllCompartmentsAccessibleOfTypes (notnull array< ECompartmentType > compartmentTypes, bool setAccessible)
bool CanOccupy (array< ECompartmentType > compartmentTypes, bool checkHasDefaultOccupantsData=true, FactionKey friendlyFaction=string.Empty, bool checkOccupyingFaction=true, bool checkForFreeCompartments=true)
bool SpawnDefaultOccupants (notnull array< ECompartmentType > compartmentTypes)
bool InitiateSpawnDefaultOccupants (notnull array< ECompartmentType > compartmentTypes)
void SpawnDefaultOccupantEachFrame ()
void CancelSpawningCharacters ()
 Cancel spawning if in progress.
bool IsSpawningDefaultOccupants ()
void FinishedSpawningDefaultOccupants (bool wasCanceled)
bool IsOccupiedByFriendlies (FactionKey vehicleFactionKey, bool allFriendly, bool trueIfEmpty=true)
bool AnyCompartmentsOccupiedOrLocked ()
bool HasDefaultOccupantsDataForTypes (array< ECompartmentType > compartmentTypes)
void ~SCR_BaseCompartmentManagerComponent ()

Variables

SCR_BaseCompartmentManagerComponentClass CREW_COMPARTMENT_TYPES = {ECompartmentType.PILOT, ECompartmentType.TURRET}
ref array< BaseCompartmentSlotm_aCompartmentsToSpawnDefaultOccupant
ref array< IEntitym_aSpawnedDefaultOccupants
AIGroup m_SpawnedOccupantsAIGroup
bool m_bIsSpawningDefaultOccupants
ref ScriptInvoker Event_OnDoneSpawningDefaultOccupants
ref array< ref array< ECompartmentType > > m_aDefaultOccupantsCompartmentTypesToSpawn = {}

Function Documentation

◆ AnyCompartmentsOccupiedOrLocked()

bool AnyCompartmentsOccupiedOrLocked ( )
protected
Returns
Returns true if vehicle is occupied by any character or a compartment is locked

Definition at line 598 of file SCR_BaseCompartmentManagerComponent.c.

◆ BlockSuppliesIfOccupied()

bool BlockSuppliesIfOccupied ( )
protected

TODO: HOT FIX - Will block supply actions if one or more compartments are occupied as well as blocking player get in actions if there are supplies. This is a hotfix until proper solution as it simply disables some player actions on the surface rather than with proper logic and does not effect AI

Returns
True if the get in actions and supply actions care if the compartments are occupied or if there are supplies stored in the vehicle

Definition at line 32 of file SCR_BaseCompartmentManagerComponent.c.

◆ CancelSpawningCharacters()

void CancelSpawningCharacters ( )
protected

Cancel spawning if in progress.

Definition at line 476 of file SCR_BaseCompartmentManagerComponent.c.

◆ CanOccupy()

bool CanOccupy ( array< ECompartmentType > compartmentTypes,
bool checkHasDefaultOccupantsData = true,
FactionKey friendlyFaction = string.Empty,
bool checkOccupyingFaction = true,
bool checkForFreeCompartments = true )
protected

Check if can spawn characters in the vehicle.

Parameters
compartmentTypesGiven compartment types that need to be checked if can be filled.
checkHasDefaultOccupantsData
friendlyFaction
checkOccupyingFactionIf true function will check if the faction of the vehicle is null (empty) or the same/friendly to the static faction as given in the editableUIInfo. Function will return false if faction is hostile or neutral
checkForFreeCompartmentsIf true will check if there are compartments free for the given compartments types. Function will return false if there are no free compartments of given type
Returns
Will return true if a character can be spawned in at least one compartment
Parameters
checkOccupyingFaction
checkForFreeCompartments
Returns
true if can occupy, false otherwise

Definition at line 325 of file SCR_BaseCompartmentManagerComponent.c.

◆ DamageOccupants()

void DamageOccupants ( float damage,
EDamageType damageType,
notnull Instigator instigator,
bool damageWhileGetIn = false,
bool damageWhileGetOut = false )
protected

Damage random hitzones depending on amount of damage to be applied. Must be called on authority.

Parameters
damage
damageType
instigator
gettingIn
gettingOut

Definition at line 196 of file SCR_BaseCompartmentManagerComponent.c.

◆ EjectRandomOccupants()

bool EjectRandomOccupants ( float ejectionChance = -1,
bool ejectUnconscious = false,
out bool allEjectedImmediately = true,
bool ejectOnTheSpot = false )
protected

Kill all the occupants and eject them if requested. Must be called on authority.

Parameters
[in]forceEjectChance the passengers get ejected. -1 Will use the same value that is configured on the compartment. 1 will force eject. In-between is custom chance.
[in]ejectUnconscious
[out]allEjectedImmediatelyinforms if this client was able to make characters leave their compartments
[in]ejectOnTheSpotif characters should be ejected in the position where they currently are
Returns
true if any character was ejected

Definition at line 240 of file SCR_BaseCompartmentManagerComponent.c.

◆ FinishedSpawningDefaultOccupants()

void FinishedSpawningDefaultOccupants ( bool wasCanceled)
protected

Definition at line 490 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetCompartmentsOfType()

void GetCompartmentsOfType ( inout array< BaseCompartmentSlot > outCompartments,
ECompartmentType compartmentType )
protected

Get compartments of specific type

Parameters
[in,out]outCompartments
compartmentType

Definition at line 45 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetCompartmentsOfTypes()

void GetCompartmentsOfTypes ( inout array< BaseCompartmentSlot > outCompartments,
notnull array< ECompartmentType > compartmentTypes )
protected
Parameters
[in,out]outCompartments
compartmentTypes

Definition at line 58 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetFirstFreeCompartmentOfType() [1/2]

BaseCompartmentSlot GetFirstFreeCompartmentOfType ( ECompartmentType compartmentType,
bool checkHasValidOccupantPrefab = false )
protected

Get first free compartment slots of the given type

Parameters
compartmentTypeThe compartment type to check
checkHasValidOccupantPrefabif true checks if compartment has valid default occupant prefab
Returns
first found compartment. Will return null if none found.

Definition at line 91 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetFirstFreeCompartmentOfType() [2/2]

BaseCompartmentSlot GetFirstFreeCompartmentOfType ( typename compartmentClass ,
bool checkHasValidOccupantPrefab = false )
protected

Get first free compartment slots of the given class

Parameters
compartmentClassThe compartment clas to check
checkHasValidOccupantPrefabif true checks if compartment has valid default occupant prefab
Returns
first found compartment. Will return null if none found.

Definition at line 108 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetFreeCompartmentsOfType()

void GetFreeCompartmentsOfType ( inout array< BaseCompartmentSlot > outCompartments,
ECompartmentType compartmentType,
bool checkHasValidOccupantPrefab = false )
protected

Get all free compartment slots of the given type

Parameters
[in,out]outCompartmentsarray of all free compartments of type
compartmentTypeThe compartment type to check
checkHasValidOccupantPrefabif true checks if compartment has valid default occupant prefab

Definition at line 76 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetOccupantCount()

int GetOccupantCount ( )
protected
Returns
Count of all occupants

Definition at line 150 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetOccupants()

void GetOccupants ( inout array< IEntity > occupants)
protected

Get occupants of all managed compartments

Parameters
[in,out]occupants

Definition at line 161 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetOccupantsOfType()

void GetOccupantsOfType ( inout array< IEntity > occupants,
ECompartmentType compartmentType )
protected

Get occupants of all managed compartments of specified type.

Parameters
[out]occupants
compartmentType

Definition at line 177 of file SCR_BaseCompartmentManagerComponent.c.

◆ GetOnDoneSpawningDefaultOccupants()

ScriptInvoker GetOnDoneSpawningDefaultOccupants ( )
protected

Get event called when spawning of occupants is done. Gives an array of IEntity (Spawned characters) and bool if spawning was canceled or not

Returns
Spawn done scriptinvoker

Definition at line 289 of file SCR_BaseCompartmentManagerComponent.c.

◆ HasDefaultOccupantsDataForTypes()

bool HasDefaultOccupantsDataForTypes ( array< ECompartmentType > compartmentTypes)
protected

Check if there is at least one default occupant prefab set for the given compartment types

Parameters
compartmentTypesGiven compartment types that need to be filled with characters
Returns
True if at least one prefab data is set

Definition at line 630 of file SCR_BaseCompartmentManagerComponent.c.

◆ HasFreeCompartmentOfTypes()

bool HasFreeCompartmentOfTypes ( notnull array< ECompartmentType > compartmentTypes)
protected

Go over all compartments of given type and checks if at least one compartment is free

Parameters
compartmentTypes
Returns
true if at least one compartment of given types is free

Definition at line 129 of file SCR_BaseCompartmentManagerComponent.c.

◆ InitiateSpawnDefaultOccupants()

bool InitiateSpawnDefaultOccupants ( notnull array< ECompartmentType > compartmentTypes)
protected

Definition at line 412 of file SCR_BaseCompartmentManagerComponent.c.

◆ IsOccupiedByFriendlies()

bool IsOccupiedByFriendlies ( FactionKey vehicleFactionKey,
bool allFriendly,
bool trueIfEmpty = true )
protected

Checks if vehicle is occupied by characters that are friendly towards the given faction

Parameters
vehicleFactionKeythe vehicle's faction
allFriendlyIf true will find all occupants and check if all of them are friendly. If false it will only check the first character it finds, mixed factions might not return a valid value.
trueIfEmptyIf this is true then the function will return true if the vehicle is empty. Else it will return false
Returns
true if the vehicle is occupied by a friendly/friendlies, false otherwise

Definition at line 526 of file SCR_BaseCompartmentManagerComponent.c.

◆ IsSpawningDefaultOccupants()

bool IsSpawningDefaultOccupants ( )
protected
Returns
True if asynchronous operation of spawning default occupants is underway.

Definition at line 484 of file SCR_BaseCompartmentManagerComponent.c.

◆ KillOccupants()

void KillOccupants ( notnull Instigator instigator,
bool eject = false,
bool gettingIn = false,
bool gettingOut = false )
protected

Kill all the occupants and eject them if requested. Must be called on authority.

Parameters
instigator
eject
gettingIn
gettingOut

Definition at line 221 of file SCR_BaseCompartmentManagerComponent.c.

◆ SetAllCompartmentsAccessibleOfTypes()

void SetAllCompartmentsAccessibleOfTypes ( notnull array< ECompartmentType > compartmentTypes,
bool setAccessible )
protected

Lock/Unlock all compartment slots of given types for AI

Parameters
compartmentTypesTypes to lock
setAccessibleIf true sets locked else set unlocked

Definition at line 301 of file SCR_BaseCompartmentManagerComponent.c.

◆ SetCompartmentsAccessibleForAI()

void SetCompartmentsAccessibleForAI ( bool accessible)
protected

Set AI compartment access for all compartments

Parameters
accessible

Definition at line 276 of file SCR_BaseCompartmentManagerComponent.c.

◆ SpawnDefaultOccupantEachFrame()

void SpawnDefaultOccupantEachFrame ( )
protected

Definition at line 437 of file SCR_BaseCompartmentManagerComponent.c.

◆ SpawnDefaultOccupants()

bool SpawnDefaultOccupants ( notnull array< ECompartmentType > compartmentTypes)
protected

Spawns default characters as defined in BaseComparmentSlots inside the vehicle of given compartment types (Server only) Places all spawned characters in the same group Note that it can only spawn the same compartment type once and will fail if you try to do it twice. If the system is already spawning default characters and you call it again for other department types it will send them to a queue and execute them after the current compartment types are filled.

Parameters
compartmentTypesGiven compartment types that need to be filled with characters
Returns
True if start spawning occupants

Definition at line 354 of file SCR_BaseCompartmentManagerComponent.c.

◆ ~SCR_BaseCompartmentManagerComponent()

void ~SCR_BaseCompartmentManagerComponent ( )
protected

Definition at line 653 of file SCR_BaseCompartmentManagerComponent.c.

Variable Documentation

◆ CREW_COMPARTMENT_TYPES

◆ Event_OnDoneSpawningDefaultOccupants

ref ScriptInvoker Event_OnDoneSpawningDefaultOccupants
protected

Definition at line 26 of file SCR_BaseCompartmentManagerComponent.c.

◆ m_aCompartmentsToSpawnDefaultOccupant

ref array<BaseCompartmentSlot> m_aCompartmentsToSpawnDefaultOccupant
protected

Definition at line 22 of file SCR_BaseCompartmentManagerComponent.c.

◆ m_aDefaultOccupantsCompartmentTypesToSpawn

ref array<ref array<ECompartmentType> > m_aDefaultOccupantsCompartmentTypesToSpawn = {}
protected

Definition at line 27 of file SCR_BaseCompartmentManagerComponent.c.

◆ m_aSpawnedDefaultOccupants

ref array<IEntity> m_aSpawnedDefaultOccupants
protected

Definition at line 23 of file SCR_BaseCompartmentManagerComponent.c.

◆ m_bIsSpawningDefaultOccupants

bool m_bIsSpawningDefaultOccupants
protected

Definition at line 25 of file SCR_BaseCompartmentManagerComponent.c.

◆ m_SpawnedOccupantsAIGroup

AIGroup m_SpawnedOccupantsAIGroup
protected

Definition at line 24 of file SCR_BaseCompartmentManagerComponent.c.