3 [
Attribute(
"0",
desc:
"Switching seats is allowed only between compartments with matching section")]
6 [
Attribute(
"0",
desc:
"Set whether compartment is water tight. People inside may drown if false")]
9 [
Attribute(
desc:
"Contains Default Prefab of character to be spawned into compartment",
params:
"et")]
12 [
Attribute(
desc:
"Contains parameters for executing screenshake upon crashing vehicle for passengers",
params:
"et")]
15 [
Attribute(
"-89.9",
desc:
"Aim limit angle override (in degrees) when free-looking down",
params:
"-89.9 0.05 0.05")]
18 [
Attribute(
"89.9",
desc:
"Aim limit angle override (in degrees) when free-looking up",
params:
"0.05 89.9 0.05")]
21 [
Attribute(
"-160.0",
desc:
"Aim limit angle override (in degrees) when free-looking left",
params:
"-160.0 0.05 0.05")]
24 [
Attribute(
"160.0",
desc:
"Aim limit angle override (in degrees) when free-looking right",
params:
"0.05 160.0 0.05")]
27 [
Attribute(
"-1 1 1",
desc:
"First person camera local space offset scale from Neck1 bone")]
30 [
Attribute(
"1.0",
desc:
"Extent to which body should account for turret traverse.\nThe higher, the more neck will rotate around turret pivot\nExamples: BTR-70 neck does not pivot, tripod and M151 turret pivots")]
33 [
Attribute(
"0.5",
desc:
"Chance the occupant will get ejected upon EjectOccupant being called.\nOnly applies to compartments without roof or open doors unless forced")]
48 Shape.CreateCylinder(c.PackToInt(),
ShapeFlags.ONCE, GetPosition(), 0.05, 5);
108 Managed component, componentCandidate;
112 if (componentCandidate)
115 component = componentCandidate;
123 array<BaseCompartmentSlot> compartments = {};
124 manager.GetCompartments(compartments);
125 compartmentID = compartments.Find(
this);
137 return GetOccupant() != null;
147 RplComponent rpl = character.GetRplComponent();
148 if (rpl && rpl.IsProxy())
152 CompartmentAccessComponent access = character.GetCompartmentAccessComponent();
153 if (!damageWhileGetIn && access && access.IsGettingIn())
156 if (!damageWhileGetOut && access && access.IsGettingOut())
159 SCR_DamageManagerComponent damageManager = character.GetDamageManager();
161 damageManager.DamageRandomHitZones(damage, damageType, instigator);
174 SCR_DamageManagerComponent damageManager = character.GetDamageManager();
178 float inTime, sustainTime, outTime, maxScreenShakeHealthThreshold, linearMagnitude, angularMagnitude;
179 m_ScreenShakeData.GetScreenShakeData(inTime, sustainTime, outTime, maxScreenShakeHealthThreshold, linearMagnitude, angularMagnitude);
181 float maxScreenShake = damageManager.GetMaxHealth() * maxScreenShakeHealthThreshold;
182 if (maxScreenShake == 0)
185 SCR_CameraShakeManagerComponent.AddCameraShake(
Math.Lerp(0, linearMagnitude, damage / maxScreenShake),
Math.Lerp(0, angularMagnitude, damage / maxScreenShake), inTime, sustainTime, outTime);
195 SCR_DamageManagerComponent damageManager = character.GetDamageManager();
199 CharacterControllerComponent controller = character.GetCharacterController();
203 CompartmentAccessComponent access = character.GetCompartmentAccessComponent();
204 if (!gettingIn && access && access.IsGettingIn())
207 if (!gettingOut && access && access.IsGettingOut())
214 GetGame().GetCallqueue().CallLater(damageManager.Kill, 1,
false, instigator);
218 damageManager.Kill(instigator);
229 bool EjectOccupant(
bool forceEject =
false,
bool ejectUnconsciously =
false, out
bool ejectedImmediately =
false,
bool ejectOnTheSpot =
false)
235 RplComponent rpl = character.GetRplComponent();
236 if (rpl && rpl.IsProxy())
247 nearestDoorInd = PickDoorIndexForPoint(character.GetOrigin());
249 if (compartmentManager)
250 ejectOnTheSpot = compartmentManager.IsDoorFake(nearestDoorInd);
253 if (ejectUnconsciously)
260 if (forceEject ||
GetManager().IsDoorOpen(nearestDoorInd) || ShouldCharactersFallOutWhenFlipped())
269 character.GetTransform(mat);
270 mat[3] = character.AimingPosition();
272 ejectedImmediately = access.GetOutVehicle_NoDoor(mat, ejectUnconsciously,
false);
275 if (!ejectedImmediately)
343 if (!spawnedCharacter)
345 Print(
string.Format(
"'BaseCompartmentSlot' Failed to spawn character in compartment. Check if ResourceName is correct! Path: '%1'", characterPrefab),
LogLevel.ERROR);
349 AIControlComponent agentControlComponent = AIControlComponent.Cast(spawnedCharacter.
FindComponent(AIControlComponent));
350 if (!agentControlComponent)
352 Print(
"'BaseCompartmentSlot' Could not get AIControlComponent from spawned character, so entity is deleted!",
LogLevel.ERROR);
353 delete spawnedCharacter;
357 agentControlComponent.ActivateAI();
359 CompartmentAccessComponent compartmentAccess = CompartmentAccessComponent.Cast(spawnedCharacter.
FindComponent(CompartmentAccessComponent));
360 if (!compartmentAccess)
362 Print(
"'BaseCompartmentSlot' Could not get CompartmentAccessComponent from spawned character, so entity is deleted!",
LogLevel.ERROR);
363 delete spawnedCharacter;
368 if (!compartmentAccess.GetInVehicle(GetOwner(),
this,
true, -1,
ECloseDoorAfterActions.INVALID, world.IsGameTimePaused()))
370 Print(
string.Format(
"'BaseCompartmentSlot' Trying to spawn character in compartment but it could not be moved into it so character is deleted. Compartment type: %1",
typename.EnumToString(
ECompartmentType,
GetType())),
LogLevel.WARNING);
371 delete spawnedCharacter;
381 Print(
"'BaseCompartmentSlot' Could not create group for spawned character. Most likly incorrect group prefab given!",
LogLevel.ERROR);
382 return spawnedCharacter;
385 group = AIGroup.Cast(groupEntity);
388 Print(
"'BaseCompartmentSlot' Could not create group for spawned character as spawned group prefab is missing AIGroup component!",
LogLevel.ERROR);
390 return spawnedCharacter;
397 FactionAffiliationComponent factionComponent = FactionAffiliationComponent.Cast(spawnedCharacter.
FindComponent(FactionAffiliationComponent));
398 if (factionComponent)
400 Faction faction = factionComponent.GetAffiliatedFaction();
408 group.AddAgent(agentControlComponent.GetControlAIAgent());
410 return spawnedCharacter;
457class SCR_DefaultOccupantData
459 [
Attribute(
desc:
"Default Prefab of character to be spawned into compartment",
params:
"et")]
462 [
Attribute(
"1",
desc:
"This entry will be considered empty and is ignored if flase")]
463 protected bool m_bEnabled;
467 return m_sDefaultOccupantPrefab;
472 return m_bEnabled && !m_sDefaultOccupantPrefab.IsEmpty();
480 [
Attribute(defvalue:
"0.05",
desc:
"Screen shake effect fade in duration")]
483 [
Attribute(defvalue:
"0.05",
desc:
"Screen shake effect peak intensity sustain duration")]
486 [
Attribute(defvalue:
"0.01",
desc:
"Screen shake effect fade out duration")]
489 [
Attribute(defvalue:
"0.5",
desc:
"At this health (scaled) the maximum shake effect will occur")]
492 [
Attribute(defvalue:
"7",
desc:
"Magnitude of linear (positional change) shake")]
495 [
Attribute(defvalue:
"5",
desc:
"Magnitude of angular (rotational change) shake")]
498 void GetScreenShakeData(out
float inTime, out
float sustainTime, out
float outTime, out
float maxScreenShakeHealthThreshold, out
float linearMagnitude, out
float angularMagnitude)
BaseCompartmentSlot ExtBaseCompartmentSlot BaseContainerCustomTitleField("m_sDefaultOccupantPrefab")
ResourceName GetDefaultOccupantPrefab(bool checkIfValid=true)
BaseCompartmentSlot ExtBaseCompartmentSlot BaseContainerProps()
ArmaReforgerScripted GetGame()
override SCR_EditorManagerEntity GetManager()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
static const vector SPAWN_IN_VEHICLE_OFFSET
SCR_DefaultOccupantData GetDefaultOccupantData()
override void DebugDrawPosition()
ResourceName GetDefaultOccupantPrefab(bool checkIfValid=true)
float GetRandomEjectionChance()
ref SCR_BaseScreenShakeData m_ScreenShakeData
IEntity SpawnCharacterInCompartment(ResourceName characterPrefab, inout AIGroup group, ResourceName groupPrefab="{000CD338713F2B5A}Prefabs/AI/Groups/Group_Base.et")
float GetFreelookAimLimitOverrideDown()
bool m_bCompartmentAccessible
IEntity SpawnDefaultCharacterInCompartment(inout AIGroup group, ResourceName groupPrefab="{000CD338713F2B5A}Prefabs/AI/Groups/Group_Base.et")
float GetFreelookAimLimitOverrideRight()
float m_fFreelookAimLimitOverrideRight
bool IsCompartmentAccessible()
void KillOccupant(notnull Instigator instigator, bool eject=false, bool gettingIn=false, bool gettingOut=false)
float m_fFreelookCameraNeckFollowTraverse
float GetFreelookAimLimitOverrideUp()
float m_fFreelookAimLimitOverrideDown
float GetFreelookCameraNeckFollowTraverse()
IEntity GetVehicle(out int compartmentID)
void SetCompartmentAccessible(bool val)
void DamageOccupant(float damage, EDamageType damageType, notnull Instigator instigator, bool damageWhileGetIn=true, bool damageWhileGetOut=true)
bool EjectOccupant(bool forceEject=false, bool ejectUnconsciously=false, out bool ejectedImmediately=false, bool ejectOnTheSpot=false)
ref SCR_DefaultOccupantData m_DefaultOccupantData
float m_fFreelookAimLimitOverrideLeft
vector GetFreelookCameraNeckOffsetScale()
vector m_vFreelookCameraNeckOffsetScale
float GetFreelookAimLimitOverrideLeft()
float m_fFreelookAimLimitOverrideUp
float m_fRandomEjectionChance
int GetCompartmentSection()
Switching seats is allowed only between compartments with matching area.
int m_iCompartmentSection
void ScreenShakeOccupant(float damage)
proto external Managed FindComponent(typename typeName)
proto external void GetTransform(out vector mat[])
proto external IEntity GetParent()
Object holding reference to resource. In destructor release the resource.
bool InitFactionKey(string factionKey)
void GetScreenShakeData(out float inTime, out float sustainTime, out float outTime, out float maxScreenShakeHealthThreshold, out float linearMagnitude, out float angularMagnitude)
float m_fMaxScreenShakeHealthThreshold
float m_fAngularMagnitude
SCR_CharacterResilienceHitZone GetResilienceHitZone()
void ForceUnconsciousness(float resilienceHealth=0)
void AskOwnerToGetOutFromVehicle(EGetOutType type, int doorInfoIndex, ECloseDoorAfterActions closeDoor, bool performWhenPaused, bool ejectOnTheSpot=false)
static ResourceName GetRandomVariant(ResourceName prefab)
static IEntity GetLocalControlledEntity()
Instance of created debug visualizer.
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.
SCR_FieldOfViewSettings Attribute
proto native vector Vector(float x, float y, float z)