7 protected float m_fMassToForce;
10 protected float m_fForceLimit;
16 protected float m_fAngularSpeedLimit;
21 [
Attribute(defvalue:
"5",
desc:
"How many times per second server should try to apply this force to the vehicle",
params:
"1 30 1")]
24 [
Attribute(defvalue:
"1.5",
desc:
"Multiplies the offset used for the position of the counter force.\nThis makes it easier to apply rotational force without pushing away the object from the user.",
params:
"0.1 inf")]
31 protected ref array<ref Shape>
m_aShapes = {};
55 if (!super.CanBeShownScript(user))
65 CharacterControllerComponent controller =
character.GetCharacterController();
69 if (controller.IsSwimming())
77 if (!characterAnimationComp || characterAnimationComp.GetLinkedEntity() == owner)
87 if (m_fAngularSpeedLimit > 0 && physics.GetAngularVelocity().LengthSq() > m_fAngularSpeedLimit * m_fAngularSpeedLimit)
124 forceOrigin[1] = forceTarget[1];
125 vector forceDirection =
vector.Direction(forceTarget, forceOrigin);
127 forceDirection.Normalize();
129 float mass = physics.GetMass();
130 float force =
Math.Min(m_fMassToForce * mass, m_fForceLimit);
138 float linearSpeedFactor = 1;
142 float angularSpeedFactor = 1;
143 if (m_fAngularSpeedLimit > 0)
144 angularSpeedFactor -=
Math.Clamp(physics.GetAngularVelocity().LengthSq() / (m_fAngularSpeedLimit * m_fAngularSpeedLimit), 0, 1);
151 if (forceOffset !=
vector.Zero)
159 m_aShapes.Insert(
Shape.CreateArrow(forceTarget, forceTarget + forceOffset, 0.1,
Color.BLUE, shapeFlags));
160 m_aShapes.Insert(
Shape.CreateArrow(forceOrigin, forceOrigin - forceDirection, 0.1,
Color.RED, shapeFlags));
161 m_aShapes.Insert(
Shape.CreateArrow(forceTarget + forceOffset, forceTarget + forceOffset +
impulse, 1,
Color.GREEN, shapeFlags));
162 if (forceOffset !=
vector.Zero)
183 super.OnActionStart(pUserEntity);
195 GetGame().GetCallqueue().CallLater(ClearDebug, 10000);
198 super.OnActionCanceled(pOwnerEntity, pUserEntity);
206 return fProgress + timeSlice;
ArmaReforgerScripted GetGame()
SCR_DestructibleTreeV2Class impulse
ref array< ref Shape > m_aShapes
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external IEntity GetOwner()
Returns the parent entity of this action.
proto external Managed FindComponent(typename typeName)
proto external Physics GetPhysics()
proto external vector CoordToParent(vector coord)
proto external IEntity GetRootParent()
override void OnActionStart(IEntity pUserEntity)
override float GetActionProgressScript(float fProgress, float timeSlice)
Returns the progress of this action in seconds.
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Called when object is initialized and registered to actions manager.
float GetMaxForceToMassFactor()
int m_iForceApplicationFrequency
float m_fLinearSpeedLimit
float GetAdditionalForce()
float m_fCounterForceOffsetMultiplier
float m_fApplicationInterval
override bool CanBroadcastScript()
If HasLocalEffectOnly() is false this method tells if the server is supposed to broadcast this action...
override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
float m_fApplicationDeltaTime
override bool CanBeShownScript(IEntity user)
Can this action be shown in the UI to the provided user entity?
void ApplyForce(IEntity rootEntity, IEntity pUserEntity, float timeSlice, vector forceOffset=vector.Zero)
const float COUNTERFORCE_SCALE
override void PerformContinuousAction(IEntity pOwnerEntity, IEntity pUserEntity, float timeSlice)
Called when someone tries to perform the continuous action, user entity is typically character.
A scripted action class having optional logic to check if vehicle is valid.
ChimeraCharacter character
Instance of created debug visualizer.
SCR_FieldOfViewSettings Attribute
RplRole
Role of replicated node (and all items in it) within the replication system.