26 protected const string IN_USE =
"#AR-UserAction_Blocked_InUseByOther";
27 protected const string OCCUPIED =
"#AR-UserAction_SeatOccupied";
28 protected const string ENEMY_PRESENCE =
"#AR-Campaign_Action_ShowBuildPreviewEnemyPresence";
49 BaseGameMode gameMode =
GetGame().GetGameMode();
53 SCR_CampaignBuildingManagerComponent buildingManagerComponent = SCR_CampaignBuildingManagerComponent.Cast(gameMode.FindComponent(SCR_CampaignBuildingManagerComponent));
54 if (!buildingManagerComponent)
77 CharacterControllerComponent charController = character.GetCharacterController();
81 int itemActionId = pAnimationComponent.BindCommand(
"CMD_Item_Action");
85 params.SetAllowMovementDuringAction(
false);
86 params.SetKeepInHandAfterSuccess(
true);
87 params.SetCommandID(itemActionId);
88 params.SetCommandIntArg(2);
90 charController.TryUseItemOverrideParams(
params);
93 super.OnActionStart(pUserEntity);
121 SCR_BaseCompartmentManagerComponent compartmentMgr = SCR_BaseCompartmentManagerComponent.Cast(turret.FindComponent(SCR_BaseCompartmentManagerComponent));
125 array<BaseCompartmentSlot> outCompartments = {};
126 if (compartmentMgr.GetCompartments(outCompartments) < 1)
131 compartment.SetReserved(blockingUser);
152 CharacterControllerComponent charController = character.GetCharacterController();
158 cmdHandler.FinishItemUse(
true);
167 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(pUserEntity);
173 SCR_CampaignBuildingCompositionComponent buildingComponent = SCR_CampaignBuildingCompositionComponent.Cast(pOwnerEntity.
FindComponent(SCR_CampaignBuildingCompositionComponent));
174 if (buildingComponent)
176 if (!
System.IsConsoleApp())
177 buildingComponent.SetCanPlaySoundOnDeletion(
true);
179 else if (!pOwnerEntity.
FindComponent(SCR_CampaignBuildingLayoutComponent))
192 int playerId = playerMgr.GetPlayerIdFromControlledEntity(character);
193 if (!playerMgr.IsPlayerConnected(playerId))
226 editableEntity.
Delete(
true,
true);
233 array<ref Tuple2<vector, vector>> areas = {};
234 array<bool> redoAreas = {};
239 RplComponent.DeleteRplEntity(composition,
false);
251 SCR_DismantleCampaignMilitaryBaseTaskEntity
task = SCR_DismantleCampaignMilitaryBaseTaskEntity.Cast(
SCR_CampaignTaskHelper.GetTaskOnBase(
base, playerFaction, SCR_DismantleCampaignMilitaryBaseTaskEntity));
259 PrintFormat(
"Base:%1 was dismantled by playerId:%2",
base.GetBaseNameUpperCase(), userPlayerId, level:
LogLevel.DEBUG);
261 RplComponent.DeleteRplEntity(
base.GetOwner(),
false);
270 int playerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(disassemblingCharacter);
276 SCR_CampaignBuildingProviderComponent providerComponent = SCR_CampaignBuildingProviderComponent.Cast(provider.
FindComponent(SCR_CampaignBuildingProviderComponent));
277 if (!providerComponent)
280 array<SCR_MilitaryBaseComponent> bases = {};
281 providerComponent.GetBases(bases);
285 SCR_MilitaryBaseComponent
base = bases[0];
286 int callsign =
base.GetCallsign();
287 if (callsign == SCR_MilitaryBaseComponent.INVALID_BASE_CALLSIGN)
292 if (characterFaction != baseFaction)
295 RplComponent rplComponent = RplComponent.Cast(
m_EditableEntity.GetOwner().FindComponent(RplComponent));
299 SCR_NotificationsComponent.SendToFaction(characterFaction,
true,
ENotification.EDITOR_SERVICE_DISASSEMBLED, playerId, rplComponent.Id(), callsign);
310 return editableEntityUIInfo && editableEntityUIInfo.
HasEntityLabel(label);
317 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(user);
329 if (playerController)
335 if (!SCR_CampaignBuildingGadgetToolComponent.Cast(
m_GadgetManager.GetHeldGadgetComponent()))
369 outName =
WidgetManager.Translate(actionUiInfo.GetDescription(), uiInfo.GetName());
383 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(user);
421 array<BaseCompartmentSlot> outCompartments = {};
424 if (!editableVehicle)
428 if (!comaprtmentMgrComp)
431 outCompartments.Clear();
432 comaprtmentMgrComp.GetCompartments(outCompartments);
435 if (!compartment.IsOccupied())
485 SCR_CampaignBuildingProviderComponent providerComponent = SCR_CampaignBuildingProviderComponent.Cast(provider.
FindComponent(SCR_CampaignBuildingProviderComponent));
486 if (!providerComponent)
489 array<SCR_MilitaryBaseComponent> bases = {};
490 providerComponent.GetBases(bases);
497 Faction playerFaction = character.GetFaction();
499 return playerFaction && playerFaction ==
m_BaseComponent.GetCapturingFaction();
507 if (!baseActionManager)
510 array<BaseUserAction> actions = {};
511 baseActionManager.GetActionsList(actions);
539 set<SCR_EditableEntityComponent> editableEntities =
new set<SCR_EditableEntityComponent>();
544 SCR_EditableVehicleComponent editableVehicle = SCR_EditableVehicleComponent.Cast(ent);
588 Faction playerFaction = user.GetFaction();
601 if (!editableEntityUIInfo)
604 array<EEditableEntityLabel> entityLabels = {};
658 Faction playerFaction = disassemblingCharacter.GetFaction();
663 SCR_DismantleCampaignMilitaryBaseTaskEntity
task = SCR_DismantleCampaignMilitaryBaseTaskEntity.Cast(
SCR_CampaignTaskHelper.GetTaskOnBase(campaignBase, playerFaction, SCR_DismantleCampaignMilitaryBaseTaskEntity));
667 int playerId =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(disassemblingCharacter);
684 return editableEntityUIInfo && editableEntityUIInfo.
HasEntityLabel(label);
698 SCR_CampaignBuildingManagerComponent buildingManagerComponent = SCR_CampaignBuildingManagerComponent.Cast(campaign.FindComponent(SCR_CampaignBuildingManagerComponent));
699 if (!buildingManagerComponent)
702 array<SCR_CampaignBuildingCompositionComponent> compositions = {};
703 int compositionCount = buildingManagerComponent.GetBuildingCompositions(campaignBase, compositions);
704 foreach (SCR_CampaignBuildingCompositionComponent composition : compositions)
721 WorldTimestamp currentServerTimestamp = world.GetServerTimestamp();
734 array<SCR_CampaignBuildingProviderComponent> providers = {};
735 campaignBase.GetBuildingProviders(providers);
737 foreach (SCR_CampaignBuildingProviderComponent provider : providers)
739 if (!provider.IsMasterProvider())
754 array<int> outPlayers = {};
755 playerManager.GetPlayers(outPlayers);
761 foreach (
int playerID : outPlayers)
763 playerEntity = playerManager.GetPlayerControlledEntity(playerID);
767 SCR_ChimeraCharacter
char = SCR_ChimeraCharacter.Cast(playerEntity);
772 if (!charDamageManager || charDamageManager.GetState() ==
EDamageState.DESTROYED)
ArmaReforgerScripted GetGame()
SCR_BaseGameMode GetGameMode()
void SCR_CharacterRankComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
proto external ActionsManagerComponent GetActionsManager()
void SetCannotPerformReason(string reason)
proto external IEntity GetOwner()
Returns the parent entity of this action.
proto external UIInfo GetUIInfo()
Returns the UIInfo set for this user action or null if none.
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external IEntity GetChildren()
proto external IEntity GetSibling()
proto external IEntity GetRootParent()
void GetNavmeshRebuildAreas(IEntity entity, out notnull array< ref Tuple2< vector, vector > > outAreas, out notnull array< bool > redoRoads)
void RequestNavmeshRebuildAreas(notnull array< ref Tuple2< vector, vector > > areas, notnull array< bool > redoRoads)
bool m_bTemporarilyBlockedAccess
SCR_CampaignBuildingCompositionComponent m_CompositionComponent
override void OnActionStart(IEntity pUserEntity)
bool HasCompositionLabel(notnull SCR_CampaignBuildingCompositionComponent composition, EEditableEntityLabel label=EEditableEntityLabel.TRAIT_SERVICE)
const string DISMANTLE_ALL_BUILDINGS
bool m_bAccessCanBeBlocked
override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
bool m_bSameFactionDisassembleOnly
override bool GetActionNameScript(out string outName)
SCR_GadgetManagerComponent m_GadgetManager
RplComponent m_RplComponent
const string ENEMY_PRESENCE
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
SCR_CampaignBuildingLayoutComponent m_LayoutComponent
void TryToSendNotification(notnull IEntity pOwnerEntity, notnull SCR_ChimeraCharacter disassemblingCharacter)
bool HasCompositionLabel(EEditableEntityLabel label=EEditableEntityLabel.TRAIT_SERVICE)
void OnCompositionSpawned(bool compositionSpawned)
Get call once the composition is fully spawned.
FactionAffiliationComponent m_FactionComponent
SCR_MilitaryBaseComponent m_BaseComponent
SCR_CampaignBuildingBuildUserAction m_BuildAction
const int ALLOWED_PLAYER_DISTANCE_SQ
bool CanBaseBeDisassembled(notnull SCR_ChimeraCharacter disassemblingCharacter)
void SetNewGadgetManager(IEntity from, IEntity to)
Sets a new gadget manager. Controlled by an event when the controlled entity has changed.
void CacheFactionAffiliationComponent()
Get call once the provider is set.
IEntity GetBuildingTool(notnull IEntity ent)
Get building tool entity.
void GetBuildingAction()
Search for first instance of building action, as we can safely assume there is only one per entity.
void ~SCR_CampaignBuildingDisassemblyUserAction()
SCR_CampaignBuildingProviderComponent m_MasterProviderComponent
bool IsPlayerFactionSame(notnull SCR_ChimeraCharacter user)
Is user faction same as the composition one.
void SetTemporaryBlockedAccess()
Set temporary blocked access.
bool m_bCompositionSpawned
ref array< SCR_EditableVehicleComponent > m_EditableVehicle
void DeleteComposition(notnull IEntity composition, notnull SCR_ChimeraCharacter character)
SCR_EditableEntityComponent m_EditableEntity
void ToggleCompartmentAccess(notnull IEntity object, IEntity blockingUser=null)
SCR_CampaignMilitaryBaseComponent GetBase()
void CancelPlayerAnimation(notnull IEntity entity)
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
100m
void GetAllTurretsInComposition(IEntity object)
Check the hierarchy of the composition for any turret and make a list of them.
SCR_EditorManagerEntity m_EditorManager
bool m_bDisassembleOnlyWhenCapturing
override bool CanBeShownScript(IEntity user)
bool HasBaseCompositionsAnyService()
override bool CanBePerformedScript(IEntity user)
const int TEMPORARY_BLOCKED_ACCESS_RESET_TIME
WorldTimestamp m_ResetTemporaryBlockedAccessTimestamp
void DeleteBase(notnull SCR_CampaignMilitaryBaseComponent base, int userPlayerId)
SCR_ECampaignBaseType GetType()
Returns type of this base.
Created in SCR_GameModeCampaign.
SCR_CampaignMilitaryBaseComponent FindClosestBase(vector position, SCR_ECampaignBaseType searchedType=-1)
bool Delete(bool changedByUser=false, bool updateNavmesh=false)
SCR_UIInfo GetInfo(IEntity owner=null)
bool HasEntityLabel(EEditableEntityLabel label)
int GetEntityLabels(out notnull array< EEditableEntityLabel > entityLabels)
Core component to manage SCR_EditorManagerEntity.
SCR_EditorManagerEntity GetEditorManager()
SCR_RankContainer GetRanks()
static SCR_GadgetManagerComponent GetGadgetManager(IEntity entity)
ref OnControlledEntityChangedPlayerControllerInvoker m_OnControlledEntityChanged
bool IsRankRenegade(SCR_ECharacterRank rankID)
UIInfo - allows to define UI elements.
LogLevel
Enum with severity of the logging message.
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
proto external PlayerController GetPlayerController()