Arma Reforger Script API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
SCR_BaseCompartmentManagerComponent Interface Reference
Inheritance diagram for SCR_BaseCompartmentManagerComponent:
[legend]

Public Member Functions

bool BlockSuppliesIfOccupied ()
 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.
 
void GetCompartmentsOfType (inout array< BaseCompartmentSlot > outCompartments, ECompartmentType compartmentType)
 Get compartments of specific type.
 
void GetCompartmentsOfTypes (inout array< BaseCompartmentSlot > outCompartments, notnull array< ECompartmentType > compartmentTypes)
 
void GetFreeCompartmentsOfType (inout array< BaseCompartmentSlot > outCompartments, ECompartmentType compartmentType, bool checkHasValidOccupantPrefab=false)
 Get all free compartment slots of the given type.
 
BaseCompartmentSlot GetFirstFreeCompartmentOfType (ECompartmentType compartmentType, bool checkHasValidOccupantPrefab=false)
 Get first free compartment slots of the given type.
 
BaseCompartmentSlot GetFirstFreeCompartmentOfType (TypeName compartmentClass, bool checkHasValidOccupantPrefab=false)
 Get first free compartment slots of the given class.
 
bool HasFreeCompartmentOfTypes (notnull array< ECompartmentType > compartmentTypes)
 Go over all compartments of given type and checks if at least one compartment is free.
 
int GetOccupantCount ()
 
void GetOccupants (inout array< IEntity > occupants)
 Get occupants of all managed compartments.
 
void GetOccupantsOfType (inout array< IEntity > occupants, ECompartmentType compartmentType)
 Get occupants of all managed compartments of specified type.
 
void DamageOccupants (float damage, EDamageType damageType, notnull Instigator instigator, bool gettingIn=false, bool gettingOut=false)
 Damage random hitzones depending on amount of damage to be applied.
 
void KillOccupants (notnull Instigator instigator, bool eject=false, bool gettingIn=false, bool gettingOut=false)
 Kill all the occupants and eject them if requested.
 
void SetCompartmentsAccessibleForAI (bool accessible)
 Set AI compartment access for all compartments.
 
ScriptInvoker GetOnDoneSpawningDefaultOccupants ()
 Get event called when spawning of occupants is done.
 
void SetAllCompartmentsAccessibleOfTypes (notnull array< ECompartmentType > compartmentTypes, bool setAccessible)
 Lock/Unlock all compartment slots of given types for AI.
 
bool CanOccupy (array< ECompartmentType > compartmentTypes, bool checkHasDefaultOccupantsData=true, FactionKey friendlyFaction=string.Empty, bool checkOccupyingFaction=true, bool checkForFreeCompartments=true)
 Check if can spawn characters in the vehicle.
 
bool SpawnDefaultOccupants (notnull array< ECompartmentType > compartmentTypes)
 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.
 
void CancelSpawningCharacters ()
 Cancel spawning if in progress.
 
bool IsSpawningDefaultOccupants ()
 
bool IsOccupiedByFriendlies (FactionKey vehicleFactionKey, bool allFriendly, bool trueIfEmpty=true)
 Checks if vehicle is occupied by characters that are friendly towards the given faction.
 
bool AnyCompartmentsOccupiedOrLocked ()
 
bool HasDefaultOccupantsDataForTypes (array< ECompartmentType > compartmentTypes)
 Check if there is at least one default occupant prefab set for the given compartment types.
 
void ~SCR_BaseCompartmentManagerComponent ()
 
- Public Member Functions inherited from BaseCompartmentManagerComponent
proto external bool AreDoorOpen (int doorIndex)
 
proto external bool AreDoorFake (int doorIndex)
 
proto external IEntity GetDoorUser (int doorIndex)
 
proto external IEntity IsGetInAndOutBlockedByDoorUser (int doorIndex)
 
proto external IEntity GetOwner ()
 
proto external BaseCompartmentSlot FindCompartment (int compartmentID, int mgrId=-1)
 Searches for compartment by ID of slot and compartment manager.
 
proto external int GetCompartments (out notnull array< BaseCompartmentSlot > outCompartments)
 Returns a list and count of all compartments.
 
proto external CompartmentDoorInfo GetDoorInfo (int doorIndex)
 
- Public Member Functions inherited from GameComponent
bool OnTicksOnRemoteProxy ()
 

Static Public Attributes

static const ref array< ECompartmentType > CREW_COMPARTMENT_TYPES = {ECompartmentType.PILOT, ECompartmentType.TURRET}
 
static const ref array< ECompartmentType > PASSENGER_COMPARTMENT_TYPES = {ECompartmentType.CARGO}
 

Protected Member Functions

bool InitiateSpawnDefaultOccupants (notnull array< ECompartmentType > compartmentTypes)
 
void SpawnDefaultOccupantEachFrame ()
 
void FinishedSpawningDefaultOccupants (bool wasCanceled)
 

Protected Attributes

bool m_bBlockSuppliesIfOccupied
 
ref array< BaseCompartmentSlotm_aCompartmentsToSpawnDefaultOccupant
 
ref array< IEntity > m_aSpawnedDefaultOccupants
 
AIGroup m_SpawnedOccupantsAIGroup
 
bool m_bIsSpawningDefaultOccupants
 
ref ScriptInvoker Event_OnDoneSpawningDefaultOccupants
 
ref array< ref array< ECompartmentType > > m_aDefaultOccupantsCompartmentTypesToSpawn = {}
 

Constructor & Destructor Documentation

◆ ~SCR_BaseCompartmentManagerComponent()

void SCR_BaseCompartmentManagerComponent.~SCR_BaseCompartmentManagerComponent ( )

Member Function Documentation

◆ AnyCompartmentsOccupiedOrLocked()

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

◆ BlockSuppliesIfOccupied()

bool SCR_BaseCompartmentManagerComponent.BlockSuppliesIfOccupied ( )

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

◆ CancelSpawningCharacters()

void SCR_BaseCompartmentManagerComponent.CancelSpawningCharacters ( )

Cancel spawning if in progress.

◆ CanOccupy()

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

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

◆ DamageOccupants()

void SCR_BaseCompartmentManagerComponent.DamageOccupants ( float  damage,
EDamageType  damageType,
notnull Instigator  instigator,
bool  gettingIn = false,
bool  gettingOut = false 
)

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

Must be called on authority.

Parameters
damage
damageType
instigator
gettingIn
gettingOut

◆ FinishedSpawningDefaultOccupants()

void SCR_BaseCompartmentManagerComponent.FinishedSpawningDefaultOccupants ( bool  wasCanceled)
protected

◆ GetCompartmentsOfType()

void SCR_BaseCompartmentManagerComponent.GetCompartmentsOfType ( inout array< BaseCompartmentSlot outCompartments,
ECompartmentType  compartmentType 
)

Get compartments of specific type.

Parameters
[in,out]outCompartments
compartmentType

◆ GetCompartmentsOfTypes()

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

◆ GetFirstFreeCompartmentOfType() [1/2]

BaseCompartmentSlot SCR_BaseCompartmentManagerComponent.GetFirstFreeCompartmentOfType ( ECompartmentType  compartmentType,
bool  checkHasValidOccupantPrefab = false 
)

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.

◆ GetFirstFreeCompartmentOfType() [2/2]

BaseCompartmentSlot SCR_BaseCompartmentManagerComponent.GetFirstFreeCompartmentOfType ( TypeName  compartmentClass,
bool  checkHasValidOccupantPrefab = false 
)

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.

◆ GetFreeCompartmentsOfType()

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

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

◆ GetOccupantCount()

int SCR_BaseCompartmentManagerComponent.GetOccupantCount ( )
Returns
Count of all occupants

◆ GetOccupants()

void SCR_BaseCompartmentManagerComponent.GetOccupants ( inout array< IEntity >  occupants)

Get occupants of all managed compartments.

Parameters
[in,out]occupants

◆ GetOccupantsOfType()

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

Get occupants of all managed compartments of specified type.

Parameters
[out]occupants
compartmentType

◆ GetOnDoneSpawningDefaultOccupants()

ScriptInvoker SCR_BaseCompartmentManagerComponent.GetOnDoneSpawningDefaultOccupants ( )

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

◆ HasDefaultOccupantsDataForTypes()

bool SCR_BaseCompartmentManagerComponent.HasDefaultOccupantsDataForTypes ( array< ECompartmentType >  compartmentTypes)

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

◆ HasFreeCompartmentOfTypes()

bool SCR_BaseCompartmentManagerComponent.HasFreeCompartmentOfTypes ( notnull array< ECompartmentType >  compartmentTypes)

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

◆ InitiateSpawnDefaultOccupants()

bool SCR_BaseCompartmentManagerComponent.InitiateSpawnDefaultOccupants ( notnull array< ECompartmentType >  compartmentTypes)
protected

◆ IsOccupiedByFriendlies()

bool SCR_BaseCompartmentManagerComponent.IsOccupiedByFriendlies ( FactionKey  vehicleFactionKey,
bool  allFriendly,
bool  trueIfEmpty = true 
)

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

◆ IsSpawningDefaultOccupants()

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

◆ KillOccupants()

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

Kill all the occupants and eject them if requested.

Must be called on authority.

Parameters
instigator
eject
gettingIn
gettingOut

◆ SetAllCompartmentsAccessibleOfTypes()

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

Lock/Unlock all compartment slots of given types for AI.

Parameters
compartmentTypesTypes to lock
setAccessibleIf true sets locked else set unlocked

◆ SetCompartmentsAccessibleForAI()

void SCR_BaseCompartmentManagerComponent.SetCompartmentsAccessibleForAI ( bool  accessible)

Set AI compartment access for all compartments.

Parameters
accessible

◆ SpawnDefaultOccupantEachFrame()

void SCR_BaseCompartmentManagerComponent.SpawnDefaultOccupantEachFrame ( )
protected

◆ SpawnDefaultOccupants()

bool SCR_BaseCompartmentManagerComponent.SpawnDefaultOccupants ( notnull array< ECompartmentType >  compartmentTypes)

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

Member Data Documentation

◆ CREW_COMPARTMENT_TYPES

const ref array<ECompartmentType> SCR_BaseCompartmentManagerComponent.CREW_COMPARTMENT_TYPES = {ECompartmentType.PILOT, ECompartmentType.TURRET}
static

◆ Event_OnDoneSpawningDefaultOccupants

ref ScriptInvoker SCR_BaseCompartmentManagerComponent.Event_OnDoneSpawningDefaultOccupants
protected

◆ m_aCompartmentsToSpawnDefaultOccupant

ref array<BaseCompartmentSlot> SCR_BaseCompartmentManagerComponent.m_aCompartmentsToSpawnDefaultOccupant
protected

◆ m_aDefaultOccupantsCompartmentTypesToSpawn

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

◆ m_aSpawnedDefaultOccupants

ref array<IEntity> SCR_BaseCompartmentManagerComponent.m_aSpawnedDefaultOccupants
protected

◆ m_bBlockSuppliesIfOccupied

bool SCR_BaseCompartmentManagerComponent.m_bBlockSuppliesIfOccupied
protected

◆ m_bIsSpawningDefaultOccupants

bool SCR_BaseCompartmentManagerComponent.m_bIsSpawningDefaultOccupants
protected

◆ m_SpawnedOccupantsAIGroup

AIGroup SCR_BaseCompartmentManagerComponent.m_SpawnedOccupantsAIGroup
protected

◆ PASSENGER_COMPARTMENT_TYPES

const ref array<ECompartmentType> SCR_BaseCompartmentManagerComponent.PASSENGER_COMPARTMENT_TYPES = {ECompartmentType.CARGO}
static

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