Arma Reforger Script API
|
Component allowing user to request spawning entities using asset catalogs Requires ActionManager with enough SCR_CatalogSpawnerUserAction attached to it (they cannot be generated through script) and SCR_EntitySlotComponents in hiearchy or vicinity of owner. More...
Public Member Functions | |
bool | IsProxy () |
bool | IsSuppliesConsumptionEnabled () |
float | GetPostGracePeriodRefundMultiplier () |
bool | IsInGracePeriod (IEntity entity) |
bool | IsInGracePeriod (RplId entityId) |
bool | CanRefund (RplId entityId, RplId userId) |
bool | CanRefund (notnull IEntity entity, notnull IEntity user) |
void | UnregisterGracePeriod (notnull IEntity entity) |
void | UnregisterGracePeriod (RplId entityId) |
void | RegisterGracePeriod (notnull IEntity entity, notnull IEntity user, float startingTime=FLT_INF) |
void | RegisterGracePeriod (RplId entityId, RplId userId, float startingTime=FLT_INF) |
bool | RankCheck (notnull SCR_EntityCatalogEntry entityEntry, notnull IEntity user) |
Check if user is elibigle for requesting specified entity. | |
SCR_EntityCatalogEntry | GetEntryAtIndex (int index) |
Obtain Faction entity from AssetList on specific index. | |
void | AssignResourceComponent (notnull SCR_ResourceComponent component) |
Assign resource component to handle resources of spawner. | |
void | AssignSupplyComponent (notnull SCR_CampaignSuppliesComponent supplyComp) |
Assign supply component to handle supplies of spawner. | |
void | ClearKnownSlots () |
Manually clears known slots, thus forcing Spawner to do otherwise ignored checks. | |
void | AddKnownOccupiedSlot (notnull SCR_EntitySpawnerSlotComponent slot) |
Set slot as occupied. | |
SCR_EntitySpawnerSlotComponent | GetFreeSlot (notnull SCR_EntityCatalogSpawnerData spawnerData) |
Returns free slot suitable for requested Entity. | |
void | InitiateSpawn (notnull SCR_EntityCatalogEntry entityEntry, int userId, SCR_EntitySpawnerSlotComponent slot) |
Initiate spawn. | |
SCR_EEntityRequestStatus | GetRequestState (notnull SCR_EntityCatalogEntry entityEntry, IEntity user=null) |
Returns SCR_EEntityRequestStatus for request of selected entity with optional parameter of user requesting it. | |
bool | CanRequestAI (notnull IEntity user, int aiCount=1) |
Faction | GetRequesterFaction (notnull IEntity user) |
ScriptInvoker | GetOnEntitySpawned () |
Gets script invoker on entity spawns. | |
ScriptInvoker | GetOnSpawnerSuppliesChanged () |
Gets script invoker on supplies changes. | |
SCR_PlayerController | GetPlayerControllerFromEntity (notnull IEntity userEntity) |
SCR_SpawnerRequestComponent | GetRequestComponentFromPlayerEntity (notnull IEntity playerEntity) |
void | CreatePreviewEntity (notnull SCR_EntityCatalogEntry spawnData, notnull SCR_EntitySpawnerSlotComponent slot, SCR_EEntityRequestStatus reqStatus=SCR_EEntityRequestStatus.CAN_SPAWN) |
Used to create local "preview" model on specified slot. | |
void | DeletePreviewEntity () |
Delete existing Preview entity at spawner. | |
SCR_PrefabPreviewEntity | GetPreviewEntity () |
SCR_ResourceComponent | GetSpawnerResourceComponent () |
Get the resource component that is assigned to the spawner. | |
SCR_CampaignSuppliesComponent | GetSpawnerSupplyComponent () |
Get supply component assigned to spawner. | |
float | GetSpawnerResourceValue () |
Get resources left for spawner. | |
float | GetSpawnerSupplies () |
Get supplies left for spawner. | |
void | AddSpawnerSupplies (float supplies) |
Add or reduce (by entering negative value) supplies available to spawner. | |
void | SpawnAIGroupMember (ResourceName resName, notnull IEntity user, IEntity slotEntity, SCR_EntityLabelPointComponent rallyPoint=null) |
override void | EOnFrame (IEntity owner, float timeSlice) |
void | ~SCR_CatalogEntitySpawnerComponent () |
Public Member Functions inherited from SCR_SlotServiceComponent | |
void | RegisterSlot (SCR_EntitySpawnerSlotComponent slot) |
Register slot to be used for service. | |
Public Member Functions inherited from SCR_ServicePointComponent | |
Faction | GetFaction () |
ResourceName | GetDelegatePrefab () |
ScriptInvoker< SCR_ServicePointComponent, SCR_MilitaryBaseComponent > | GetOnBaseRegistered () |
ScriptInvoker< SCR_ServicePointComponent, SCR_MilitaryBaseComponent > | GetOnBaseUnregistered () |
ScriptInvoker | GetOnServiceStateChanged () |
SCR_EServicePointType | GetType () |
EEditableEntityLabel | GetLabel () |
SCR_EServicePointStatus | GetServiceState () |
void | SetServiceState (SCR_EServicePointStatus state) |
Set the current operational state of the service. | |
void | ServiceStateChanged () |
Called from RplProp event. | |
void | SetDelegate (notnull SCR_ServicePointDelegateComponent delegate) |
override void | OnBaseRegistered (notnull SCR_MilitaryBaseComponent base) |
override void | OnBaseUnregistered (notnull SCR_MilitaryBaseComponent base) |
void | RegisterService () |
void | SetServiceOnline () |
Switch service to online status. | |
override void | OnPostInit (IEntity owner) |
override void | OnDelete (IEntity owner) |
Public Member Functions inherited from SCR_MilitaryBaseLogicComponent | |
void | RegisterBase (notnull SCR_MilitaryBaseComponent base) |
void | OnBaseRegistered (notnull SCR_MilitaryBaseComponent base) |
void | UnregisterBase (notnull SCR_MilitaryBaseComponent base) |
void | OnBaseUnregistered (notnull SCR_MilitaryBaseComponent base) |
int | GetBases (out array< SCR_MilitaryBaseComponent > bases) |
void | OnBaseFactionChanged (Faction faction) |
override void | EOnInit (IEntity owner) |
override void | OnPostInit (IEntity owner) |
void | ~SCR_MilitaryBaseLogicComponent () |
Static Public Attributes | |
static const ref array< SCR_CatalogEntitySpawnerComponent > | INSTANCES = {} |
static variable used to store all the instances created of this component. | |
static const int | SLOT_CHECK_INTERVAL = 60 |
Protected Member Functions | |
void | SetCurrentFactionCatalog () |
Set Asset Catalog from currently owning faction. If null, asset list will be cleared. | |
void | AddAssetsFromCatalog (notnull SCR_EntityCatalog entityCatalog, bool overwriteOld=false) |
Add Assets from entityCatalog. | |
void | AssignUserActions () |
Fills SCR_CatalogSpawnerUserAction actions on ActionManager. | |
void | UpdateOccupiedSlots (out array< SCR_EntitySpawnerSlotComponent > occupiedSlots) |
Update currently known occupied slots. | |
SCR_EntitySpawnerSlotComponent | GetLastKnownSuitableSlot (notnull SCR_EntityCatalogSpawnerData spawnerData) |
Returns last known suitable free slot. Used to reduce amount of redundant slot checks and save performance. | |
SCR_EntitySpawnerSlotComponent | GetFreeSlotFromArray (notnull array< SCR_EntitySpawnerSlotComponent > slots, notnull SCR_EntityCatalogSpawnerData spawnerData, notnull array< SCR_EntitySpawnerSlotComponent > occupiedSlots) |
Used in GetFreeSlot to obtain free slot from inserted array. | |
void | OnGroupWaypointFinished (notnull AIWaypoint wp) |
Called when AI finishes initial WP (making it move away from spawning position, before joining player squad) | |
void | AddAISoldierToPlayerGroup (notnull SCR_ChimeraCharacter ai, notnull IEntity user) |
void | SendNotification (int msgId, notnull IEntity user, int assetId=-1, int catalogType=-1) |
void | PerformSpawn (notnull SCR_EntityCatalogEntry entityEntry, IEntity user=null, SCR_EntitySpawnerSlotComponent preferredSlot=null) |
Spawn the actual entity. | |
IEntity | SpawnEntity (ResourceName entityResourceName, notnull IEntity slotOwner) |
void | LockSpawnedVehicle (notnull IEntity owningUser) |
bool | CooldownCheck (notnull IEntity user) |
override void | OnFactionChanged (FactionAffiliationComponent owner, Faction previousFaction, Faction faction) |
void | OnAIGroupSpawned (notnull SCR_AIGroup group, notnull IEntity user, notnull IEntity slotEntity, SCR_EntityLabelPointComponent rallyPoint=null) |
Called from PerformSpawn, if spawned entity is AIGroup. | |
void | OnAIAgentRemoved (SCR_AIGroup group, AIAgent ai) |
void | OnChimeraCharacterSpawned (notnull SCR_ChimeraCharacter ai, notnull IEntity user, SCR_EntityLabelPointComponent rallyPoint=null) |
Called from PerformSpawn, if spawned entity is ChimeraCharacter. | |
SCR_AIWaypoint | CreateRallyPointWaypoint (notnull SCR_EntityLabelPointComponent rallyPoint) |
Returns waypoint created as rally point for spawned unit. | |
bool | SupplyComponentSearchCallback (IEntity ent) |
Callback for Search query in EOnInit. Search will be stopped, if Base with Supply component is found. | |
override void | EOnInit (IEntity owner) |
override void | OnDelete (IEntity owner) |
override void | OnPostInit (IEntity owner) |
Protected Member Functions inherited from SCR_SlotServiceComponent | |
bool | CanBeSlotRegistered (notnull SCR_EntitySpawnerSlotComponent slot) |
Prevents registration of slots that are too far from service, or are already child of another slot service. | |
bool | SlotSearchCallback (IEntity ent) |
Callback function for Query used in RegisterNearbySlots Should callback return true, QueryEntitiesBySphere will continue with query. | |
void | RegisterNearbySlots () |
Registers slots in near distance. Kept for sake of client checks. Skips slots that are in hiearchy of any entity with SCR_SlotService or classes inherited from it. | |
void | RegisterChildSlots () |
Registers slots initially created as children. There slots cannot be used by any other spawner and shouldn't change in runtime. | |
void | OnSlotUpdate (SCR_EntitySpawnerSlotComponent slot, vector position) |
Called, if slot possition was changed. If it fails to meet previously required criteria in CanBeSlotRegistered, slot wont be used anymore. | |
void | OnSlotRemoved (SCR_EntitySpawnerSlotComponent slot) |
Called, if slot possition was changed. If it fails to meet previously required criteria in CanBeSlotRegistered, slot wont be used anymore. | |
override void | EOnInit (IEntity owner) |
void | OnFactionChanged (FactionAffiliationComponent owner, Faction previousFaction, Faction faction) |
Static Protected Attributes | |
const float | UPDATE_PERIOD = 10.0 / 60.0 |
Static Protected Attributes inherited from SCR_ServicePointComponent | |
static bool | s_bSpawnAsOffline |
Additional Inherited Members | |
Static Public Member Functions inherited from SCR_ServicePointComponent | |
static void | SpawnAsOffline (bool val) |
The service will not be registered on init. For an example for Free Roam building - the registration will happen once the service is fully build. | |
Component allowing user to request spawning entities using asset catalogs Requires ActionManager with enough SCR_CatalogSpawnerUserAction attached to it (they cannot be generated through script) and SCR_EntitySlotComponents in hiearchy or vicinity of owner.
void SCR_CatalogEntitySpawnerComponent.~SCR_CatalogEntitySpawnerComponent | ( | ) |
|
protected |
|
protected |
Add Assets from entityCatalog.
[in] | entityCatalog | Entity catalog which should be added |
[in] | overwriteOld | IF true, old entities are overwriten by new ones, thus removing their availability |
void SCR_CatalogEntitySpawnerComponent.AddKnownOccupiedSlot | ( | notnull SCR_EntitySpawnerSlotComponent | slot | ) |
Set slot as occupied.
[in] | slot |
void SCR_CatalogEntitySpawnerComponent.AddSpawnerSupplies | ( | float | supplies | ) |
Add or reduce (by entering negative value) supplies available to spawner.
[in] | supplies | amount of supplies to be added/reduced |
void SCR_CatalogEntitySpawnerComponent.AssignResourceComponent | ( | notnull SCR_ResourceComponent | component | ) |
Assign resource component to handle resources of spawner.
void SCR_CatalogEntitySpawnerComponent.AssignSupplyComponent | ( | notnull SCR_CampaignSuppliesComponent | supplyComp | ) |
Assign supply component to handle supplies of spawner.
Currently uses Campaign specific supplies (temporarily)
supplyComp |
|
protected |
Fills SCR_CatalogSpawnerUserAction actions on ActionManager.
The method should always be called when the Asset list is changed.
bool SCR_CatalogEntitySpawnerComponent.CanRefund | ( | notnull IEntity | entity, |
notnull IEntity | user | ||
) |
[in] | entity | |
[in] | user |
bool SCR_CatalogEntitySpawnerComponent.CanRefund | ( | RplId | entityId, |
RplId | userId | ||
) |
[in] | entityId | |
[in] | userId |
bool SCR_CatalogEntitySpawnerComponent.CanRequestAI | ( | notnull IEntity | user, |
int | aiCount = 1 |
||
) |
[in] | user | Entity of user requesting AI |
[in] | aiCount | Amount of AI's to be added |
void SCR_CatalogEntitySpawnerComponent.ClearKnownSlots | ( | ) |
Manually clears known slots, thus forcing Spawner to do otherwise ignored checks.
|
protected |
[in] | user |
void SCR_CatalogEntitySpawnerComponent.CreatePreviewEntity | ( | notnull SCR_EntityCatalogEntry | spawnData, |
notnull SCR_EntitySpawnerSlotComponent | slot, | ||
SCR_EEntityRequestStatus | reqStatus = SCR_EEntityRequestStatus::CAN_SPAWN |
||
) |
Used to create local "preview" model on specified slot.
Used to visualise what entity is player requesting and position where it will appear
[in] | spawnData | SCR_EntityCatalogEntry containing information about entity (prefab data is required) |
[in] | slot | Slot on which preview should appear |
[in] | reqStatus |
|
protected |
Returns waypoint created as rally point for spawned unit.
void SCR_CatalogEntitySpawnerComponent.DeletePreviewEntity | ( | ) |
Delete existing Preview entity at spawner.
override void SCR_CatalogEntitySpawnerComponent.EOnFrame | ( | IEntity | owner, |
float | timeSlice | ||
) |
|
protected |
Implements SCR_SlotServiceComponent.
SCR_EntityCatalogEntry SCR_CatalogEntitySpawnerComponent.GetEntryAtIndex | ( | int | index | ) |
Obtain Faction entity from AssetList on specific index.
SCR_EntitySpawnerSlotComponent SCR_CatalogEntitySpawnerComponent.GetFreeSlot | ( | notnull SCR_EntityCatalogSpawnerData | spawnerData | ) |
Returns free slot suitable for requested Entity.
[in] | spawnerData | SCR_EntityCatalogSpawnerData found on Catalog Entry |
|
protected |
Used in GetFreeSlot to obtain free slot from inserted array.
[in] | slots | Array containing slots that will be checked |
[in] | spawnerData | Data containing parameters needed for free slot (slotType, for example) |
[in] | occupiedSlots |
|
protected |
Returns last known suitable free slot. Used to reduce amount of redundant slot checks and save performance.
ScriptInvoker SCR_CatalogEntitySpawnerComponent.GetOnEntitySpawned | ( | ) |
Gets script invoker on entity spawns.
Invoker will send over spawned IEntity
ScriptInvoker SCR_CatalogEntitySpawnerComponent.GetOnSpawnerSuppliesChanged | ( | ) |
Gets script invoker on supplies changes.
Invoker will send over previous supply amount and changed one
SCR_PlayerController SCR_CatalogEntitySpawnerComponent.GetPlayerControllerFromEntity | ( | notnull IEntity | userEntity | ) |
[in] | userEntity |
float SCR_CatalogEntitySpawnerComponent.GetPostGracePeriodRefundMultiplier | ( | ) |
SCR_PrefabPreviewEntity SCR_CatalogEntitySpawnerComponent.GetPreviewEntity | ( | ) |
SCR_SpawnerRequestComponent SCR_CatalogEntitySpawnerComponent.GetRequestComponentFromPlayerEntity | ( | notnull IEntity | playerEntity | ) |
[in] | playerEntity |
Faction SCR_CatalogEntitySpawnerComponent.GetRequesterFaction | ( | notnull IEntity | user | ) |
[in] | user |
SCR_EEntityRequestStatus SCR_CatalogEntitySpawnerComponent.GetRequestState | ( | notnull SCR_EntityCatalogEntry | entityEntry, |
IEntity | user = null |
||
) |
Returns SCR_EEntityRequestStatus for request of selected entity with optional parameter of user requesting it.
[in] | entityEntry | entityEntry in catalog to be spawned |
[in] | user | User requesting spawn |
SCR_ResourceComponent SCR_CatalogEntitySpawnerComponent.GetSpawnerResourceComponent | ( | ) |
Get the resource component that is assigned to the spawner.
float SCR_CatalogEntitySpawnerComponent.GetSpawnerResourceValue | ( | ) |
Get resources left for spawner.
float SCR_CatalogEntitySpawnerComponent.GetSpawnerSupplies | ( | ) |
Get supplies left for spawner.
SCR_CampaignSuppliesComponent SCR_CatalogEntitySpawnerComponent.GetSpawnerSupplyComponent | ( | ) |
Get supply component assigned to spawner.
void SCR_CatalogEntitySpawnerComponent.InitiateSpawn | ( | notnull SCR_EntityCatalogEntry | entityEntry, |
int | userId, | ||
SCR_EntitySpawnerSlotComponent | slot | ||
) |
Initiate spawn.
Called through RPC from SCR_SpawnerRequestComponent on CharacterComponent
[in] | entityEntry | entity entry to be spawned |
[in] | userId | Id of user requesting spawn |
[in] | slot | Slot on which user requests spawn. As last check for empty position is done by PerformSpawn itselt, this might be ignored, should slot be already occupied. |
bool SCR_CatalogEntitySpawnerComponent.IsInGracePeriod | ( | IEntity | entity | ) |
[in] | entity |
bool SCR_CatalogEntitySpawnerComponent.IsInGracePeriod | ( | RplId | entityId | ) |
[in] | entityId |
bool SCR_CatalogEntitySpawnerComponent.IsProxy | ( | ) |
bool SCR_CatalogEntitySpawnerComponent.IsSuppliesConsumptionEnabled | ( | ) |
|
protected |
|
protected |
|
protected |
Called from PerformSpawn, if spawned entity is AIGroup.
|
protected |
Called from PerformSpawn, if spawned entity is ChimeraCharacter.
|
protected |
Implements SCR_ServicePointComponent.
|
protected |
Implements SCR_ServicePointComponent.
|
protected |
Called when AI finishes initial WP (making it move away from spawning position, before joining player squad)
[in] | wp |
|
protected |
Implements SCR_ServicePointComponent.
|
protected |
Spawn the actual entity.
[in] | entityEntry | |
[in] | user | |
[in] | preferredSlot | optional slot to be used for spawning |
bool SCR_CatalogEntitySpawnerComponent.RankCheck | ( | notnull SCR_EntityCatalogEntry | entityEntry, |
notnull IEntity | user | ||
) |
Check if user is elibigle for requesting specified entity.
[in] | entityEntry | entity entry of item to be checked |
[in] | user | controlled entity of requester |
void SCR_CatalogEntitySpawnerComponent.RegisterGracePeriod | ( | notnull IEntity | entity, |
notnull IEntity | user, | ||
float | startingTime = FLT_INF |
||
) |
[in] | entity | |
[in] | user | |
[in] | startingTime |
void SCR_CatalogEntitySpawnerComponent.RegisterGracePeriod | ( | RplId | entityId, |
RplId | userId, | ||
float | startingTime = FLT_INF |
||
) |
[in] | entityId | |
[in] | userId | |
[in] | startingTime |
|
protected |
|
protected |
Set Asset Catalog from currently owning faction. If null, asset list will be cleared.
void SCR_CatalogEntitySpawnerComponent.SpawnAIGroupMember | ( | ResourceName | resName, |
notnull IEntity | user, | ||
IEntity | slotEntity, | ||
SCR_EntityLabelPointComponent | rallyPoint = null |
||
) |
[in] | resName | |
[in] | user | |
[in] | slotEntity | |
[in] | rallyPoint |
|
protected |
|
protected |
Callback for Search query in EOnInit. Search will be stopped, if Base with Supply component is found.
void SCR_CatalogEntitySpawnerComponent.UnregisterGracePeriod | ( | notnull IEntity | entity | ) |
[in] | entity |
void SCR_CatalogEntitySpawnerComponent.UnregisterGracePeriod | ( | RplId | entityId | ) |
[in] | entityId |
|
protected |
Update currently known occupied slots.
If certain amount of time passed since last slot check, it will be removed from known slots and checked again next time it is needed.
|
static |
static variable used to store all the instances created of this component.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
staticprotected |