1[
ComponentEditorProps(
category:
"GameScripted/Editor (Editables)", description:
"", icon:
"WBData/ComponentEditorProps/componentEditor.png")]
43 if (rplComponent && rplComponent.Role() ==
RplRole.Authority)
103 params.Transform[3] =
m_Agent.GetControlledEntity().GetOrigin();
108 AIGroup group = AIGroup.Cast(groupEntity);
111 Print(
string.Format(
"Cannot create group, prefab '%1' is not AIGroup entity!", prefabData.GetPrefabGroup()),
LogLevel.ERROR);
117 if (!groupEditableEntity)
119 Print(
string.Format(
"Cannot create group, prefab '%1' does not contain SCR_EditableEntityComponent!", prefabData.GetPrefabGroup()),
LogLevel.ERROR);
128 FactionAffiliationComponent factionComponent = FactionAffiliationComponent.Cast(owner.
FindComponent(FactionAffiliationComponent));
129 if (factionComponent)
131 Faction faction = factionComponent.GetAffiliatedFaction();
142 return groupEditableEntity;
152 return SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(owner) > 0;
154 return SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(
m_Owner) > 0;
168 return !rplComp || rplComp.IsOwner();
195 override bool Delete(
bool changedByUser =
false,
bool updateNavmesh =
true)
198 if (compartmentAccess)
208 int deletedCharacterPlayerId = SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(
GetOwner());
210 if (
GetGame().GetPlayerManager().HasPlayerRole(deletedCharacterPlayerId,
EPlayerRole.GAME_MASTER))
212 SCR_PlayerControllerGroupComponent groupController = SCR_PlayerControllerGroupComponent.GetPlayerControllerComponent(deletedCharacterPlayerId);
215 groupController.RequestRemovePlayer(deletedCharacterPlayerId);
220 return super.Delete(changedByUser, updateNavmesh);
244 super.SetTransformOwner(transform);
257 if (!playerController)
263 SCR_PlayerTeleportedFeedbackComponent playerTeleportedComponent = SCR_PlayerTeleportedFeedbackComponent.Cast(playerController.FindComponent(SCR_PlayerTeleportedFeedbackComponent));
264 if (!playerTeleportedComponent)
285 if (world.IsGameTimePaused())
287 world.PauseGameTime(
false);
296 if (world.IsGameTimePaused() || !
GetOwner() || CompartmentAccessComponent.GetVehicleIn(
GetOwner()) == newParent)
298 world.PauseGameTime(
true);
309 AIControlComponent aiControl = AIControlComponent.Cast(
GetOwner().
FindComponent(AIControlComponent));
310 if (aiControl && aiControl.IsAIActivated())
333 if (forceVehicleCompartments.IsEmpty())
365 if (vehicleFaction && characterFaction.IsFactionEnemy(vehicleFaction))
372 if (compartmentAccess)
458 super.OnParentEntityChanged(null, parentEntityPrev, changedByUser);
474 transform[3][1] =
Math.Max(transform[3][1],
GetOwner().GetWorld().GetSurfaceY(transform[3][0], transform[3][2]));
477 CompartmentAccessComponent compartmentAccess = CompartmentAccessComponent.Cast(
GetOwner().
FindComponent(CompartmentAccessComponent));
478 if (compartmentAccess && compartmentAccess.IsInCompartment())
490 RplComponent slotRplComponent = RplComponent.Cast(compartmentAccess.GetOwner().FindComponent(RplComponent));
491 RplId slotEntityID = slotRplComponent.Id();
498 return super.SetTransform(transform, changedByUser);
505 RplComponent slotRplComponent = RplComponent.Cast(
Replication.FindItem(slotEntityID));
506 IEntity slotEntity = slotRplComponent.GetEntity();
508 CompartmentAccessComponent compartmentAccess = CompartmentAccessComponent.Cast(slotEntity.
FindComponent(CompartmentAccessComponent));
510 compartmentAccess.GetOutVehicle_NoDoor(transform,
false,
true);
520 return SCR_PossessingManagerComponent.GetPlayerIdFromMainEntity(
GetOwner());
537 Faction faction = factionManager.GetPlayerFaction(playerID);
543 FactionAffiliationComponent factionAffiliation = FactionAffiliationComponent.Cast(
m_Owner.FindComponent(FactionAffiliationComponent));
544 if (factionAffiliation)
545 return factionAffiliation.GetAffiliatedFaction();
572 if (compartmentAccess)
579 override int GetCrew(out notnull array<CompartmentAccessComponent> crewCompartmentAccess,
bool ignorePlayers =
true)
584 if (
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(
GetOwner()) > 0)
589 CompartmentAccessComponent compartmentAccess = CompartmentAccessComponent.Cast(
GetOwner().
FindComponent(CompartmentAccessComponent));
590 if (compartmentAccess && compartmentAccess.IsInCompartment())
591 crewCompartmentAccess.Insert(compartmentAccess);
593 return crewCompartmentAccess.Count();
613 if (!vehicleUsageComp)
639 if (!vehicleUsageComp)
647 if (checkIfVehicleStillUsed)
649 set<SCR_EditableEntityComponent> entities =
new set<SCR_EditableEntityComponent>();
650 group.GetChildren(entities,
true);
652 SCR_EditableVehicleComponent editableVehicle = SCR_EditableVehicleComponent.Cast(vehicle.
FindComponent(SCR_EditableVehicleComponent));
656 array<CompartmentAccessComponent> crewCompartmentAccess = {};
657 editableVehicle.
GetCrew(crewCompartmentAccess,
true);
659 foreach (CompartmentAccessComponent compartment : crewCompartmentAccess)
663 if (crew == null || crew ==
this)
667 if (entities.Contains(crew) && !compartment.IsGettingOut())
703 bool isPlayerInVehicle = vehicle && playerId > 0;
713 return m_fMaxDrawDistance;
745 if (parent && AIGroup.Cast(parent.GetOwner()))
767 control.ActivateAI();
813 super.OnPostInit(owner);
838 Print(
string.Format(
"Failed to insert listened for lifestate changing on SCR_EditableEntityComponent of: " +
GetOwner()),
LogLevel.ERROR);
SCR_EAIThreatSectorFlags flags
ArmaReforgerScripted GetGame()
SCR_ChimeraAIAgent m_Agent
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_CharacterControllerComponent GetCharacterController()
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
void RemoveUsableVehicle(IEntity vehicle, bool checkIfVehicleStillUsed=true)
ref ScriptInvokerEntity m_OnDestroyed
bool GetIsPlayerPending()
ref array< ECompartmentType > m_aForceVehicleCompartments
Authority only, Allows character to be forced into a specific vehicle position and will delete it if ...
bool m_bShouldRecalculateDrawDistance
void UpdateCompartment(IEntity newParent)
void PlayerTeleportedFeedback(bool isLongFade)
float m_fPlayerDrawDistance
void SetIsPlayerPending(int playerId)
bool IsLocalPlayerOwner()
void ~SCR_EditableCharacterComponent()
AIControlComponent m_AgentControlComponent
void AddUsableVehicle(IEntity vehicle)
void OnPlayerCharacterEnterCompartment(IEntity compartmentEntity)
SCR_EditableEntityComponent CreateGroupForCharacter()
ref ScriptInvoker Event_OnCharacterMovedInVehicle
void GetOutVehicleOwner(RplId slotEntityID, vector transform[4])
bool IsPlayer(IEntity owner=null)
ScriptInvoker GetOnCharacterMovedInVehicle()
ScriptInvokerEntity GetOnDestroyed()
void PlayerTeleportedByParentFeedback(bool isLongFade)
void OnPlayerCharacterExitCompartment(IEntity compartmentEntity)
override bool Delete(bool changedByUser=false, bool updateNavmesh=true)
bool IsPlayerOrPossessed()
ref ScriptInvoker m_OnUIRefresh
void WaitForCompartmentUpdate(IEntity newParent)
void SCR_EditableGroupComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
void PlayerTeleportedFeedback()
Add feedback to players that they are teleported when inside of the vehicle.
void SCR_FactionManager(IEntitySource src, IEntity parent)
SCR_EPlayerTeleportedReason
ScriptInvokerBase< ScriptInvokerEntityMethod > ScriptInvokerEntity
void SetCompartmentAccessible(bool val)
proto external GenericComponent FindComponent(typename typeName)
void Rpc(func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
proto external Managed FindComponent(typename typeName)
proto external BaseWorld GetWorld()
Object holding reference to resource. In destructor release the resource.
Replication item identifier.
bool InitFactionKey(string factionKey)
SCR_AIGroupUtilityComponent GetGroupUtilityComponent()
ref SCR_AIGroupVehicleManager m_VehicleMgr
SCR_AIGroupVehicle FindVehicle(IEntity vehicleEntity)
SCR_AIGroupVehicle TryAddVehicle(notnull SCR_AIVehicleUsageComponent vehicleUsageComp)
bool RemoveVehicle(notnull SCR_AIVehicleUsageComponent vehicleUsageComp)
static SCR_AIVehicleUsageComponent FindOnNearestParent(notnull IEntity ent, out IEntity componentOwner)
ref OnLifeStateChangedInvoker m_OnLifeStateChanged
bool MoveInVehicle(IEntity vehicle, ECompartmentType compartmentType, bool performWhenPaused=false, BaseCompartmentSlot customSlot=null)
SCR_EditableEntityComponentClass GetEditableEntityData(IEntity owner=null)
bool SetTransform(vector transform[4], bool changedByUser=false)
RplComponent GetRplComponent()
SCR_EditableEntityComponent EOnEditorPlace(out SCR_EditableEntityComponent parent, SCR_EditableEntityComponent recipient, EEditorPlacingFlags flags, bool isQueue, int playerID=0)
void ForceVehicleCompartments(notnull array< ECompartmentType > forceVehicleCompartments)
void SetTransformOwner(vector transform[4])
void OnParentEntityChanged(SCR_EditableEntityComponent parentEntity, SCR_EditableEntityComponent parentEntityPrev, bool changedByUser)
SCR_EditableEntityComponent GetAIEntity()
ScriptInvoker GetOnUIRefresh()
bool HasEntityState(EEditableEntityState state)
SCR_EditableEntityComponent GetVehicle()
bool Delete(bool changedByUser=false, bool updateNavmesh=false)
static SCR_EditableEntityComponent GetEditableEntity(IEntity owner)
void EOnEditorSessionLoad(SCR_EditableEntityComponent parent)
EEditableEntityType GetEntityType(IEntity owner=null)
SCR_EditableEntityComponent SetParentEntity(SCR_EditableEntityComponent parentEntity, bool changedByUser=false)
int GetCrew(out notnull array< CompartmentAccessComponent > crewCompartmentAccess, bool ignorePlayers=true)
bool IsReplicated(out RplId replicationID=-1)
float GetMaxDrawDistanceSq()
SCR_EditableEntityComponent GetParentEntity()
SCR_EditableEntityComponent GetAIGroup()
static IEntity GetLocalControlledEntity()
static IEntity GetLocalMainEntity()
proto external GenericEntity GetOwner()
Get owner entity.
IEntity GetOwner()
Owner entity of the fuel tank.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
EEditableEntityType
Defines type of SCR_EditableEntityComponent. Assigned automatically based on IEntity inheritance.
SCR_FieldOfViewSettings Attribute
proto external PlayerController GetPlayerController()
RplRole
Role of replicated node (and all items in it) within the replication system.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.