8 static string GetStringFromPort(
Node node,
string port)
10 const string UNASSIGNED_VARIABLE =
"Unassigned";
15 value = UNASSIGNED_VARIABLE;
22 return UNASSIGNED_VARIABLE;
23 return value.ToString();
29 return UNASSIGNED_VARIABLE;
30 return value.ToString();
36 return UNASSIGNED_VARIABLE;
37 return value.ToString();
43 return UNASSIGNED_VARIABLE;
44 return value.ToString();
50 return UNASSIGNED_VARIABLE;
52 return value.ToString();
65 foreach (
string s: second)
95 [
Obsolete(
"Use SetStance without Info Component")]
98 charContrComp.SetStanceChange(ConvertStanceToStanceChange(stance));
101 static void SetStance(notnull CharacterControllerComponent charContrComp,
ECharacterStance stance)
103 charContrComp.SetStanceChange(ConvertStanceToStanceChange(stance));
124 if (depth > maxDepth)
142 outComponents.Insert(component);
169 foreach (
IEntity vehicle: vehicles)
175 if (!
Vehicle.Cast(vehicle) || !compartmentMan)
177 ref array<BaseCompartmentSlot> compartments = {};
178 compartmentMan.GetCompartments(compartments);
183 if (!compartment.GetOccupant() && compartment.IsCompartmentAccessible() && !compartment.IsReserved())
185 compartmentOut = compartment;
186 vehicleOut = vehicle;
198 IEntity controlledEntity = agent.GetControlledEntity();
199 if (!controlledEntity)
206 return character.IsInVehicle();
212 outCompartmentSlot = null;
214 IEntity controlledEntity = agent.GetControlledEntity();
215 if (!controlledEntity)
218 CompartmentAccessComponent compartmentAccessComp = CompartmentAccessComponent.Cast(controlledEntity.
FindComponent(CompartmentAccessComponent));
219 if (!compartmentAccessComp)
227 outCompartmentSlot = slot;
232 static int GetAvailableCompartmentCount (notnull
IEntity vehicle)
234 int availableCompCount;
238 ref array<BaseCompartmentSlot> compartments = {};
239 compartmentMan.GetCompartments(compartments);
242 if (!compartment.GetOccupant() && compartment.IsCompartmentAccessible() && !compartment.IsReserved())
244 availableCompCount++;
247 return availableCompCount;
253class SCR_AIVehicleUsability
259 if (vehicleLightManager)
260 vehicleLightManager.SetLightsState(
ELightType.Hazard,
true);
264 static bool VehicleCanMove(
IEntity vehicle, SCR_DamageManagerComponent damageManager = null)
271 damageManager = SCR_DamageManagerComponent.GetDamageManager(vehicle);
276 return damageManager.GetMovementDamage() < 1;
280 static bool VehicleIsOnFire(
IEntity vehicle, SCR_DamageManagerComponent damageManager = null)
287 damageManager = SCR_DamageManagerComponent.GetDamageManager(vehicle);
292 return damageManager.IsOnFire(damageManager.GetDefaultHitZone());
305 return currentMuzzle.GetMuzzleType();
315 if (!overrideWithMuzzle)
332 static int GetCurrentMuzzleId(BaseWeaponManagerComponent weapMgr)
340 array<BaseMuzzleComponent> muzzles = {};
341 weaponComp.GetMuzzlesList(muzzles);
344 if (!currentMuzzle || muzzles.IsEmpty())
347 int currentMuzzleId = muzzles.Find(currentMuzzle);
348 return currentMuzzleId;
363 return currentMuzzle.GetMagazine();
368 static bool IsCurrentMuzzleChambered(BaseWeaponManagerComponent weapMgr,
bool defValue =
false)
379 if (!currentMuzzle.IsChamberingPossible())
382 return currentMuzzle.IsCurrentBarrelChambered();
389 return weapMgr.GetCurrentWeapon();
393 static void StartMuzzleSwitch(CharacterControllerComponent controller,
int newMuzzleId)
395 controller.SetMuzzle(newMuzzleId);
399 static void StartMagazineSwitchCharacter(CharacterControllerComponent controller,
BaseMagazineComponent newMagazineComp)
401 controller.ReloadWeaponWith(newMagazineComp.GetOwner());
407 controller.DoReloadWeaponWith(newMagazineComp.GetOwner());
411 static void StartWeaponSwitchCharacter(CharacterControllerComponent controller,
BaseWeaponComponent newWeaponComp)
413 controller.TryEquipRightHandItem(newWeaponComp.GetOwner(),
EEquipItemType.EEquipTypeWeapon,
false);
420 IEntity newWeaponEntity = newWeaponComp.GetOwner();
421 BaseWeaponManagerComponent weaponMgr = controller.GetWeaponManager();
426 array<WeaponSlotComponent> slots = {};
427 weaponMgr.GetWeaponsSlots(slots);
430 if (slot.GetWeaponEntity() == newWeaponEntity)
431 newWeaponSlot = slot;
440 controller.SelectWeapon(turretOperator, newWeaponSlot);
444class SCR_AIDamageHandling
454 CharacterControllerComponent contr = character.GetCharacterController();
459 DamageManagerComponent damageManager = DamageManagerComponent.Cast(entity.
FindComponent(DamageManagerComponent));
462 return damageManager.GetState() !=
EDamageState.DESTROYED;
466 static bool IsAlive(
IEntity entity)
471 DamageManagerComponent damageManager;
472 ChimeraCharacter character = ChimeraCharacter.Cast(entity);
474 damageManager = character.GetDamageManager();
476 damageManager = DamageManagerComponent.Cast(entity.
FindComponent(DamageManagerComponent));
481 return damageManager.GetState() !=
EDamageState.DESTROYED;
485 static bool IsCharacterWounded(
IEntity entity)
504 array<Managed> components = {};
507 array<string>
tags = {};
509 foreach (Managed c : components)
513 if (checkAccessibility && !saComp.IsActionAccessible())
517 saComp.GetTags(
tags);
519 if (
tags.Contains(tag))
527class SCR_AIMessageHandling
531 notnull AICommunicationComponent myComms,
string sendFrom =
string.Empty)
533 float dismountDelay = 0.9 * soldierId;
537 msg.SetReceiver(agent);
539 msg.m_sSentFromBt = sendFrom;
541 myComms.RequestBroadcast(msg, agent);
546 SCR_AIActivityBase relatedActivity, notnull AICommunicationComponent myComms,
string sendFrom =
string.Empty)
548 SCR_AIBoardingParameters bParams =
new SCR_AIBoardingParameters();
549 int priorityLevel = SCR_AIActionBase.PRIORITY_LEVEL_NORMAL;
551 priorityLevel = relatedActivity.EvaluatePriorityLevel();
552 SCR_AIMessage_GetIn msg = SCR_AIMessage_GetIn.Create(vehicleEntity, bParams, roleInVehicle,
false,
553 priorityLevel: priorityLevel, null, relatedActivity: relatedActivity, compartmentSlot: null);
555 msg.SetReceiver(agent);
557 msg.m_sSentFromBt = sendFrom;
559 myComms.RequestBroadcast(msg, agent);
564 notnull AICommunicationComponent myComms,
string sendFrom =
string.Empty)
566 SCR_AIMessage_Move msg = SCR_AIMessage_Move.Create(moveToEntity, vector.Zero,
EMovementType.SPRINT,
true, relatedActivity);
567 msg.SetReceiver(agent);
569 msg.m_sSentFromBt = sendFrom;
571 myComms.RequestBroadcast(msg, agent);
575 static void SendCancelMessage(notnull AIAgent agent,
SCR_AIActivityBase relatedActivity,
576 notnull AICommunicationComponent myComms,
string sendFrom =
string.Empty)
578 SCR_AIMessage_Cancel msg = SCR_AIMessage_Cancel.Create(relatedActivity);
579 msg.SetReceiver(agent);
581 msg.m_sSentFromBt = sendFrom;
583 myComms.RequestBroadcast(msg, agent);
588 notnull AICommunicationComponent myComms,
string sendFrom =
string.Empty)
591 msg.SetReceiver(agent);
593 msg.m_sSentFromBt = sendFrom;
595 myComms.RequestBroadcast(msg, agent);
602 static bool IsLowLightEnvironment()
604 PerceptionManager pm =
GetGame().GetPerceptionManager();
608 float directLV, ambientLV, totalAmbientLv;
609 pm.GetAmbientLV(directLV, ambientLV, totalAmbientLv);
611 return totalAmbientLv < -3.5;
615class SCR_AIFactionHandling
621 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(entity);
622 if (character && character.m_pPerceivableComponent)
624 return character.m_pPerceivableComponent.GetPerceivedFaction();
628 if (vehicle && vehicle.m_pPerceivableComponent)
630 return vehicle.m_pPerceivableComponent.GetPerceivedFaction();
634 PerceivableComponent perceivableComponent = PerceivableComponent.Cast(entity.FindComponent(PerceivableComponent));
635 if (perceivableComponent)
636 return perceivableComponent.GetPerceivedFaction();
645 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(entity);
646 if (character && character.m_pFactionComponent)
648 return character.m_pFactionComponent.GetAffiliatedFaction();
652 if (vehicle && vehicle.m_pFactionComponent)
654 return vehicle.m_pFactionComponent.GetAffiliatedFaction();
658 FactionAffiliationComponent factionAffiliation = FactionAffiliationComponent.Cast(entity.FindComponent(FactionAffiliationComponent));
659 if (factionAffiliation)
660 return factionAffiliation.GetAffiliatedFaction();
668 static AIAgent GetAIAgent(notnull
IEntity ent)
670 AIControlComponent controlComp = AIControlComponent.Cast(ent.FindComponent(AIControlComponent));
674 return controlComp.GetControlAIAgent();
ArmaReforgerScripted GetGame()
void SCR_AIActivityBase(SCR_AIGroupUtilityComponent utility, AIWaypoint relatedWaypoint)
class SCR_AICompartmentHandling TurnOnVehicleHazardLights(IEntity vehicle)
class SCR_AIWorldHandling GetEntityPerceivedFaction(notnull IEntity entity)
Returns GetPerceivedFaction from PerceivableComponent - the faction which we should use in all AI scr...
class SCR_AISmartActionHandling SendDismountMessage(notnull AIAgent agent, notnull IEntity vehicleEntity, int soldierId, SCR_AIActivityBase relatedActivity, notnull AICommunicationComponent myComms, string sendFrom=string.Empty)
class SCR_AINodePortsHelpers s_AIRandomGenerator
class SCR_AIStanceHandling FindComponentsInAllChildren(typename typeName, IEntity parent, bool findFirst, int depth, int maxDepth, notnull inout array< Managed > outComponents)
Get all prefabs that have the spawner the given labels and are valid in the editor mode param catalogType Type to catalog to get prefabs from param editorMode Editor mode to get valid entries from param faction Faction(Optional)
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
proto external IEntity GetChildren()
proto external IEntity GetSibling()
proto bool GetVariableIn(string name, out void val)
proto external GetVariableType(bool inputPort, string name)
bool IsBleeding()
the official and globally used way of checking if bleeding tests for any PERSISTENT damage effects of...
enum EPhysicsLayerPresets Vehicle
proto external bool IsInCompartment()
Returns true if we're inside a compartment.
array< string > TStringArray