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

Public Member Functions

void SetPlacingBlocked (bool blocked)
 
int GetPrefabID (ResourceName prefab)
 
bool CreateEntity (bool unselectPrefab=true, bool canBePlayer=false, SCR_EditableEntityComponent holder=null)
 Create entity exactly where the preview entity is.
 
bool CreateEntity (ResourceName prefab, SCR_EditorPreviewParams param, bool unselectPrefab=true, bool canBePlayer=false, set< SCR_EditableEntityComponent > recipients=null, SCR_EditableEntityComponent holder=null)
 Create entity with custom params.
 
bool CanCreateEntity (out ENotification outNotification=-1, inout SCR_EPreviewState previewStateToShow=SCR_EPreviewState.PLACEABLE)
 Check if the entity can be created.
 
void SetInstantPlacing (SCR_EditorPreviewParams param)
 Set instant placing parameters.
 
bool SetSelectedPrefab (ResourceName prefab="", bool onConfirm=false, bool showBudgetMaxNotification=true, set< SCR_EditableEntityComponent > recipients=null)
 Set currently placed prefab.
 
ResourceName GetSelectedPrefab ()
 Get currently placed prefab.
 
bool IsPlacing ()
 
void SetSlot (SCR_SiteSlotEntity slot)
 Attach plcing preview to a slot.
 
SCR_SiteSlotEntity GetSlot ()
 Get slot which placing preview is currently attached to.
 
void SetPlacingFlag (EEditorPlacingFlags flag, bool toAdd)
 Set value of placing flag.
 
void TogglePlacingFlag (EEditorPlacingFlags flag)
 Toggle value of placing flag.
 
bool HasPlacingFlag (EEditorPlacingFlags flag)
 Check if placing flag is active.
 
bool IsPlacingFlagCompatible (EEditorPlacingFlags flag)
 Check if placing flag is compatible with currently placed entity.
 
bool IsPlacingFlagAllowed (EEditorPlacingFlags flag)
 Check if placing flag is allowed in placing manager settings.
 
ScriptInvoker GetOnSelectedPrefabChange ()
 Get invoker called when selected prefab changes.
 
ScriptInvoker GetOnPlacingFlagsChange ()
 Get event called when placing flags change.
 
ScriptInvoker GetOnRequestEntity ()
 Get event called when request for placing an entity is sent to server.
 
ScriptInvoker GetOnPlaceEntity ()
 Get event called when an entity is placed.
 
ScriptInvoker GetOnPlaceEntityServer ()
 
override void EOnEditorDebug (array< string > debugTexts)
 Every frame while the editor is opened and debug menu is shown.
 
override void EOnEditorActivate ()
 When the component is activated.
 
override void EOnEditorDeactivate ()
 When the component is deactivated.
 
void SetCycleWaypoints (notnull set< SCR_EditableGroupComponent > selectedGroups, bool value)
 Sets the cycle waypoints to the given value on each group of the array.
 
- Public Member Functions inherited from SCR_BaseEditorComponent
sealed void OnInitBase ()
 
sealed void OnDeleteBase ()
 
sealed void OnRequestBase (bool isOpen)
 
sealed void OnOpenedBase ()
 
sealed void OnClosedBase ()
 
sealed void OnPreActivateBase ()
 
sealed void OnActivateBase ()
 
sealed bool OnActivateAsyncBase (int attempt)
 
sealed void OnPostActivateBase ()
 
sealed void OnDeactivateBase ()
 
sealed void OnPostDeactivateBase ()
 
sealed bool OnDeactivateAsyncBase (int attempt)
 
sealed void OnEffectBase (SCR_BaseEditorEffect effect)
 
SCR_EditorManagerEntity GetManager ()
 Get editor manager this component belongs to.
 
SCR_BaseEditorComponent FindEditorComponent (TypeName type, bool showError=false, bool modeFirst=false)
 Get the editor manager to which this component belongs.
 
EntityComponentPrefabData GetEditorComponentData ()
 Get prefab data of this component.
 
bool IsRemoved ()
 Check if the component is being deleted.
 
void ResetEditorComponent ()
 Reset values controlled by the component.
 
ScriptInvoker GetOnEffect ()
 Get event called when an effect is activated.
 
void InitServer ()
 
void InitOwner ()
 
override void OnPostInit (IEntity owner)
 
void SCR_BaseEditorComponent (IEntityComponentSource src, IEntity ent, IEntity parent)
 
void ~SCR_BaseEditorComponent ()
 

Static Public Member Functions

static SCR_EditableEntityComponent SpawnEntityResource (ResourceName prefab, vector transform[4])
 Create entity from prefab resource.
 
static SCR_EditableEntityComponent SpawnEntityResource (SCR_EditorPreviewParams params, Resource prefabResource, int playerID=0, bool isQueue=false, SCR_EditableEntityComponent recipient=null, bool canBePlayer=false)
 Create entity with given params.
 
- Static Public Member Functions inherited from SCR_BaseEditorComponent
static Managed GetInstance (TypeName type, bool showError=false, bool modeFirst=false)
 Get the local instance of a component attached on editor manager (SCR_EditorManagerEntity).
 
static Managed GetInstance (SCR_EditorBaseEntity editorManager, TypeName type, bool showError=false)
 Get instance of a component attached on specific editor manager / mode (SCR_EditorBaseEntity).
 
static int GetAllInstances (TypeName type, out notnull array< Managed > outComponents)
 Get component instances on editor manager (SCR_EditorBaseEntity) and all its modes (SCR_EditorModeEntity).
 

Protected Member Functions

void CreateEntityServer (SCR_EditorPreviewParams params, RplId prefabID, int playerID, int entityIndex, bool isQueue, array< RplId > recipientIds, bool canBePlayer, RplId holderId)
 
void CreateEntityOwner (int prefabID, array< RplId > entityIds, int entityIndex, int isQueue, bool hasRecipients, RplId currentLayerID, int attempt)
 
void OnBeforeEntityCreatedServer (ResourceName prefab)
 Function called right before entities are created on server.
 
void OnEntityCreatedServer (array< SCR_EditableEntityComponent > entities)
 Function called when entities are created on server.
 
void CheckBudgetOwner ()
 
void OnBudgetMaxReached (EEditableEntityBudget entityBudget, bool maxReached)
 
bool CanPlaceEntityServer (IEntityComponentSource editableEntitySource, out EEditableEntityBudget blockingBudget, bool updatePreview, bool showNotification)
 
bool CanSelectEntityPrefab (ResourceName prefab, out EEditableEntityBudget blockingBudget, bool updatePreview=true, bool showBudgetMaxNotification=true)
 
array< vector > GetOffsets (int count)
 
void OnEntityUnregistered (SCR_EditableEntityComponent entity)
 
void UpdatePlacingFlagBudget (ResourceName selectedPrefab, EEditorPlacingFlags flagChanged, EEditorPlacingFlags currentPlacingFlag, EEditorPlacingFlags prevPlacingFlag)
 Update budget with given placing flags.
 
void SetCycleWaypointsServer (array< RplId > selectedGroups, bool value)
 
- Protected Member Functions inherited from SCR_BaseEditorComponent
bool IsOnEditorManager ()
 
bool IsOwner ()
 
bool IsProxy ()
 
bool IsMaster ()
 
bool IsAdmin ()
 
SCR_BaseEditorComponent GetParentComponent ()
 
void SetParentComponent (SCR_BaseEditorComponent parent)
 
void SendNotification (ENotification notificationID, int selfID=0, int targetID=0, vector position=vector.Zero)
 
void EOnEditorInit ()
 When the entity is created.
 
void EOnEditorDelete ()
 When the entity is destroyed.
 
void EOnEditorRequest (bool isOpen)
 When opening/closing request is sent to server.
 
void EOnEditorOpen ()
 When the editor is opened.
 
void EOnEditorClose ()
 When the editor is closed.
 
void EOnEditorPreActivate ()
 Before the component is activated.
 
bool EOnEditorActivateAsync (int attempt)
 When the component is activated.
 
void EOnEditorPostActivate ()
 When the component is activated, but after EOnEditorActivate() function was called in all components.
 
bool EOnEditorDeactivateAsync (int attempt)
 When the component is deactivated.
 
void EOnEditorPostDeactivate ()
 When the component is deactivated, but after the next mode is activated.
 
void EOnEffect (SCR_BaseEditorEffect effect)
 When an effect is created in reaction an an event.
 
void EOnEditorInitServer ()
 When the entity is created (called on server)
 
void EOnEditorDeleteServer ()
 When the entity is destroyed (called on server)
 
void EOnEditorOpenServer ()
 When the editor is opened (called on server)
 
void EOnEditorOpenServerCallback ()
 When the editor is opened (called on server after async loading finished on client)
 
void EOnEditorCloseServer ()
 When the editor is closed (called on server)
 
void EOnEditorCloseServerCallback ()
 When the editor is closed (called on server after async loading finished on client)
 
void EOnEditorActivateServer ()
 When the component is activated (called on server)
 
void EOnEditorDeactivateServer ()
 When the component is deactivated (called on server)
 

Static Protected Member Functions

static void OnAIGroupAllEntitiesSpawned (SCR_AIGroup group)
 Callback reacting to all delayed spawned entities being created.
 
static EEditorPlacingFlags GetCompatiblePlacingFlags (Resource prefabResource)
 

Protected Attributes

float m_fSpacing
 
SCR_PreviewEntityEditorComponent m_PreviewManager
 
SCR_BudgetEditorComponent m_BudgetManager
 
bool m_bBlockPlacing
 
- Protected Attributes inherited from SCR_BaseEditorComponent
SCR_EditorBaseEntity m_Owner
 
SCR_EditorManagerEntity m_Manager
 
SCR_BaseEditorComponent m_Parent
 
RplComponent m_RplComponent
 

Static Protected Attributes

static SCR_EditableEntityComponent m_DelayedSpawnEntity
 
static ref SCR_EditorPreviewParams m_DelayedSpawnPreviewParams
 

Member Function Documentation

◆ CanCreateEntity()

bool SCR_PlacingEditorComponent.CanCreateEntity ( out ENotification  outNotification = -1,
inout SCR_EPreviewState  previewStateToShow = SCR_EPreviewState::PLACEABLE 
)

Check if the entity can be created.

Evaluated both on client an on server (notification is used only on client though) To be overridden by inherited classes.

Parameters
[out]outNotificationNotification to be sent when attempting to place the entity
Returns
True to allow placing, false to prevent it

Implemented in SCR_CampaignBuildingPlacingEditorComponent.

◆ CanPlaceEntityServer()

bool SCR_PlacingEditorComponent.CanPlaceEntityServer ( IEntityComponentSource  editableEntitySource,
out EEditableEntityBudget  blockingBudget,
bool  updatePreview,
bool  showNotification 
)
protected

◆ CanSelectEntityPrefab()

bool SCR_PlacingEditorComponent.CanSelectEntityPrefab ( ResourceName  prefab,
out EEditableEntityBudget  blockingBudget,
bool  updatePreview = true,
bool  showBudgetMaxNotification = true 
)
protected

◆ CheckBudgetOwner()

void SCR_PlacingEditorComponent.CheckBudgetOwner ( )
protected

◆ CreateEntity() [1/2]

bool SCR_PlacingEditorComponent.CreateEntity ( bool  unselectPrefab = true,
bool  canBePlayer = false,
SCR_EditableEntityComponent  holder = null 
)

Create entity exactly where the preview entity is.

The entity is created from a prefab defined by SetSelectedPrefab().

Parameters
unselectPrefabTrue to unselect prefab after placing the entity
canBePlayerTrue if the entity should be spawned as player
Returns
True if the request was sent

◆ CreateEntity() [2/2]

bool SCR_PlacingEditorComponent.CreateEntity ( ResourceName  prefab,
SCR_EditorPreviewParams  param,
bool  unselectPrefab = true,
bool  canBePlayer = false,
set< SCR_EditableEntityComponent recipients = null,
SCR_EditableEntityComponent  holder = null 
)

Create entity with custom params.

Parameters
prefabEntity prefab
paramPreview param
unselectPrefabTrue to unselect prefab after placing the entity
canBePlayerTrue if the entity should be spawned as player
recipientsArray of entities for whom new entities will be created (e.g., waypoints for groups)
[in]holderEntity to which the spawned entity will be attached (used in waypoints and tasks)
Returns
True if the request was sent

◆ CreateEntityOwner()

void SCR_PlacingEditorComponent.CreateEntityOwner ( int  prefabID,
array< RplId >  entityIds,
int  entityIndex,
int  isQueue,
bool  hasRecipients,
RplId  currentLayerID,
int  attempt 
)
protected

◆ CreateEntityServer()

void SCR_PlacingEditorComponent.CreateEntityServer ( SCR_EditorPreviewParams  params,
RplId  prefabID,
int  playerID,
int  entityIndex,
bool  isQueue,
array< RplId >  recipientIds,
bool  canBePlayer,
RplId  holderId 
)
protected

◆ EOnEditorActivate()

override void SCR_PlacingEditorComponent.EOnEditorActivate ( )

When the component is activated.

Implements SCR_BaseEditorComponent.

Implemented in SCR_CampaignBuildingPlacingEditorComponent.

◆ EOnEditorDeactivate()

override void SCR_PlacingEditorComponent.EOnEditorDeactivate ( )

When the component is deactivated.

Implements SCR_BaseEditorComponent.

◆ EOnEditorDebug()

override void SCR_PlacingEditorComponent.EOnEditorDebug ( array< string >  debugTexts)

Every frame while the editor is opened and debug menu is shown.

Implements SCR_BaseEditorComponent.

◆ GetCompatiblePlacingFlags()

static EEditorPlacingFlags SCR_PlacingEditorComponent.GetCompatiblePlacingFlags ( Resource  prefabResource)
staticprotected

◆ GetOffsets()

array< vector > SCR_PlacingEditorComponent.GetOffsets ( int  count)
protected

◆ GetOnPlaceEntity()

ScriptInvoker SCR_PlacingEditorComponent.GetOnPlaceEntity ( )

Get event called when an entity is placed.

Called only for editor user.

Returns
Script invoker

◆ GetOnPlaceEntityServer()

ScriptInvoker SCR_PlacingEditorComponent.GetOnPlaceEntityServer ( )

◆ GetOnPlacingFlagsChange()

ScriptInvoker SCR_PlacingEditorComponent.GetOnPlacingFlagsChange ( )

Get event called when placing flags change.

Called only for editor user.

Returns
Script invoker

◆ GetOnRequestEntity()

ScriptInvoker SCR_PlacingEditorComponent.GetOnRequestEntity ( )

Get event called when request for placing an entity is sent to server.

Called only for editor user.

Returns
Script invoker

◆ GetOnSelectedPrefabChange()

ScriptInvoker SCR_PlacingEditorComponent.GetOnSelectedPrefabChange ( )

Get invoker called when selected prefab changes.

Returns
Script invoker

◆ GetPrefabID()

int SCR_PlacingEditorComponent.GetPrefabID ( ResourceName  prefab)

◆ GetSelectedPrefab()

ResourceName SCR_PlacingEditorComponent.GetSelectedPrefab ( )

Get currently placed prefab.

Returns
prefab

◆ GetSlot()

SCR_SiteSlotEntity SCR_PlacingEditorComponent.GetSlot ( )

Get slot which placing preview is currently attached to.

Returns
Slot entity

◆ HasPlacingFlag()

bool SCR_PlacingEditorComponent.HasPlacingFlag ( EEditorPlacingFlags  flag)

Check if placing flag is active.

Parameters
flagPlacing flag
Returns
True when active

◆ IsPlacing()

bool SCR_PlacingEditorComponent.IsPlacing ( )

◆ IsPlacingFlagAllowed()

bool SCR_PlacingEditorComponent.IsPlacingFlagAllowed ( EEditorPlacingFlags  flag)

Check if placing flag is allowed in placing manager settings.

Parameters
flagPlacing flag
Returns
True when allowed

◆ IsPlacingFlagCompatible()

bool SCR_PlacingEditorComponent.IsPlacingFlagCompatible ( EEditorPlacingFlags  flag)

Check if placing flag is compatible with currently placed entity.

Parameters
flagPlacing flag
Returns
True when compatible

◆ OnAIGroupAllEntitiesSpawned()

static void SCR_PlacingEditorComponent.OnAIGroupAllEntitiesSpawned ( SCR_AIGroup  group)
staticprotected

Callback reacting to all delayed spawned entities being created.

◆ OnBeforeEntityCreatedServer()

void SCR_PlacingEditorComponent.OnBeforeEntityCreatedServer ( ResourceName  prefab)
protected

Function called right before entities are created on server.

To be overloaded by inherited classes.

Parameters
prefabPrefab that entities to be created will use

Implemented in SCR_CampaignBuildingPlacingEditorComponent.

◆ OnBudgetMaxReached()

void SCR_PlacingEditorComponent.OnBudgetMaxReached ( EEditableEntityBudget  entityBudget,
bool  maxReached 
)
protected

◆ OnEntityCreatedServer()

void SCR_PlacingEditorComponent.OnEntityCreatedServer ( array< SCR_EditableEntityComponent entities)
protected

Function called when entities are created on server.

To be overloaded by inherited classes.

Parameters
entitiesArray of created entities

Implemented in SCR_CampaignBuildingPlacingEditorComponent.

◆ OnEntityUnregistered()

void SCR_PlacingEditorComponent.OnEntityUnregistered ( SCR_EditableEntityComponent  entity)
protected

◆ SetCycleWaypoints()

void SCR_PlacingEditorComponent.SetCycleWaypoints ( notnull set< SCR_EditableGroupComponent selectedGroups,
bool  value 
)

Sets the cycle waypoints to the given value on each group of the array.

Parameters
[in]selectedGroupsarray of groups not null
[in]valueof type bool

◆ SetCycleWaypointsServer()

void SCR_PlacingEditorComponent.SetCycleWaypointsServer ( array< RplId >  selectedGroups,
bool  value 
)
protected

◆ SetInstantPlacing()

void SCR_PlacingEditorComponent.SetInstantPlacing ( SCR_EditorPreviewParams  param)

Set instant placing parameters.

When defined, selected entity will be placed immediatelly.

Parameters
paramPlacing param

◆ SetPlacingBlocked()

void SCR_PlacingEditorComponent.SetPlacingBlocked ( bool  blocked)

◆ SetPlacingFlag()

void SCR_PlacingEditorComponent.SetPlacingFlag ( EEditorPlacingFlags  flag,
bool  toAdd 
)

Set value of placing flag.

Parameters
Placingflag
toAddTrue to set the flag, false to unset it

◆ SetSelectedPrefab()

bool SCR_PlacingEditorComponent.SetSelectedPrefab ( ResourceName  prefab = "",
bool  onConfirm = false,
bool  showBudgetMaxNotification = true,
set< SCR_EditableEntityComponent recipients = null 
)

Set currently placed prefab.

Parameters
prefabPrefab. Must be registered!
Returns
true when prefab can be selected (fits budget + prefab data available)

◆ SetSlot()

void SCR_PlacingEditorComponent.SetSlot ( SCR_SiteSlotEntity  slot)

Attach plcing preview to a slot.

Parameters
slotSlot entity

◆ SpawnEntityResource() [1/2]

static SCR_EditableEntityComponent SCR_PlacingEditorComponent.SpawnEntityResource ( ResourceName  prefab,
vector  transform[4] 
)
static

Create entity from prefab resource.

Parameters
prefabEntity prefab
transformSpawning transformation matrix
Returns
Editable entity

◆ SpawnEntityResource() [2/2]

static SCR_EditableEntityComponent SCR_PlacingEditorComponent.SpawnEntityResource ( SCR_EditorPreviewParams  params,
Resource  prefabResource,
int  playerID = 0,
bool  isQueue = false,
SCR_EditableEntityComponent  recipient = null,
bool  canBePlayer = false 
)
static

Create entity with given params.

Parameters
paramsSpawning params \prefabResource Prefab which will be spawned \playerID Id of entity requested spawning. \recipient Currently selected entity for whom the new entity is added (e.g., new waypoint for a group) \canBePlayer When true, spawned entity will become the player
Returns
Editable entity

◆ TogglePlacingFlag()

void SCR_PlacingEditorComponent.TogglePlacingFlag ( EEditorPlacingFlags  flag)

Toggle value of placing flag.

Parameters
flagPlacing flag

◆ UpdatePlacingFlagBudget()

void SCR_PlacingEditorComponent.UpdatePlacingFlagBudget ( ResourceName  selectedPrefab,
EEditorPlacingFlags  flagChanged,
EEditorPlacingFlags  currentPlacingFlag,
EEditorPlacingFlags  prevPlacingFlag 
)
protected

Update budget with given placing flags.

Parameters
selectedPrefabCurrent selected prefab resource
flagChangedFlag that was changed
currentPlacingFlagCurrent placing flags
prevPlacingFlagThe placing flags that where active before new flags are set

Member Data Documentation

◆ m_bBlockPlacing

bool SCR_PlacingEditorComponent.m_bBlockPlacing
protected

◆ m_BudgetManager

SCR_BudgetEditorComponent SCR_PlacingEditorComponent.m_BudgetManager
protected

◆ m_DelayedSpawnEntity

SCR_EditableEntityComponent SCR_PlacingEditorComponent.m_DelayedSpawnEntity
staticprotected

◆ m_DelayedSpawnPreviewParams

ref SCR_EditorPreviewParams SCR_PlacingEditorComponent.m_DelayedSpawnPreviewParams
staticprotected

◆ m_fSpacing

float SCR_PlacingEditorComponent.m_fSpacing
protected

◆ m_PreviewManager

SCR_PreviewEntityEditorComponent SCR_PlacingEditorComponent.m_PreviewManager
protected

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