6class SCR_MeleeHitDataClass
29 ref array<ref Shape> m_aDbgSamplePositionsShapes;
30 ref array<ref Shape> m_aDbgCollisionShapes;
92 if (SCR_ChimeraCharacter.Cast(ent))
95 return !SCR_ChimeraCharacter.Cast(ent.GetRootParent());
103 Math3D.AnglesToMatrix(character.GetCharacterController().GetInputContext().GetAimingAngles() *
Math.RAD2DEG, aimMat);
114 SCR_ChimeraCharacter character = SCR_ChimeraCharacter.Cast(
GetOwner());
119 param.LayerMask = EPhysicsLayerDefs.Projectile;
121 array<IEntity> ExcludeArray = {character};
122 param.ExcludeArray = ExcludeArray;
125 param.Start = character.EyePosition();
134 vector dir = (param.End - param.Start);
136 pHitData.m_Entity = param.TraceEnt;
137 pHitData.m_iColliderIndex = param.ColliderIndex;
138 pHitData.m_vHitPosition = dir * hit + param.Start;
139 pHitData.m_vHitDirection = dir.Normalized();
140 pHitData.m_vHitNormal = param.TraceNorm;
141 pHitData.m_SurfaceProps = param.SurfaceProps;
142 pHitData.m_iNodeIndex = param.NodeIndex;
144#ifdef SCR_MELEE_DEBUG_MSG
145 MCDbgPrint(
"Check collision from: "+param.Start);
146 MCDbgPrint(
"Check collision to: "+param.End);
147 MCDbgPrint(
"Check collision range: " +
vector.Distance(param.End, param.Start));
148 MCDbgPrint(
"Check collision entity: "+pHitData.m_Entity.ToString());
149 MCDbgPrint(
"Check collision hitzone: "+pHitData.m_sHitZoneName);
150 MCDbgPrint(
"Check collision hitPos: "+pHitData.m_vHitPosition);
162 BaseWeaponManagerComponent wpnManager = BaseWeaponManagerComponent.Cast(
GetOwner().
FindComponent(BaseWeaponManagerComponent));
173 IEntity weaponEntity = currentSlot.GetWeaponEntity();
215 int surfaceInt = material.GetSoundInfo().GetSignalValue();
219 RplComponent weaponRpl = RplComponent.Cast(
m_MeleeHitData.m_Weapon.FindComponent(RplComponent));
229 Print(
string.Format(
"Surface: %1", surfaceInt),
LogLevel.NORMAL);
230 Print(
string.Format(
"-------------------------------------"),
LogLevel.NORMAL);
243 if (signalsManagerComponent)
245 int signalHitZone = signalsManagerComponent.FindSignal(
"HitZone");
246 int signalSurface = signalsManagerComponent.FindSignal(
"Surface");
250 signalsManagerComponent.SetSignalValue(signalHitZone, signalValue0);
251 signalsManagerComponent.SetSignalValue(signalSurface, signalValue1);
255 Math3D.MatrixIdentity3(transform);
259 soundComp.SoundEventTransform(
SCR_SoundEvent.SOUND_MELEE_IMPACT_BAYONET, transform);
261 soundComp.SoundEventTransform(
SCR_SoundEvent.SOUND_MELEE_IMPACT, transform);
268 RplComponent weaponRpl = RplComponent.Cast(
Replication.FindItem(weaponID));
272 IEntity weaponEntity = weaponRpl.GetEntity();
289 SCR_DamageManagerComponent damageManager;
292 damageManager = SCR_DamageManagerComponent.GetDamageManager(startEntity);
301 hitZone = damageManager.GetHitZoneByColliderID(
m_MeleeHitData.m_iColliderIndex);
303 hitZone = damageManager.GetDefaultHitZone();
306 return damageManager;
314 if (rplComponent && rplComponent.IsProxy())
323#ifdef SCR_MELEE_DEBUG
324 m_aDbgSamplePositionsShapes.Clear();
340 SCR_BayonetComponent bayonet = SCR_BayonetComponent.Cast(
m_MeleeHitData.m_Bayonet.FindComponent(SCR_BayonetComponent));
341 if (bayonet && SCR_ChimeraCharacter.Cast(
m_MeleeHitData.m_Entity))
342 bayonet.AddBloodToBayonet();
344 SCR_BayonetEffectComponent effectComponent = SCR_BayonetEffectComponent.Cast(
m_MeleeHitData.m_Bayonet.FindComponent(SCR_BayonetEffectComponent));
346 effectComponent.OnImpact(
361 if (destructibleEntity)
370 if (!hitZone || !damageManager)
388 damageManager.HandleDamage(context);
403#ifdef SCR_MELEE_DEBUG
407 protected void Do_ClearDbgShapes()
409 m_aDbgSamplePositionsShapes.Clear();
410 m_aDbgCollisionShapes.Clear();
422 shapeFlags =
ShapeFlags.NOOUTLINE | shapeFlags;
425 Math3D.MatrixIdentity4(matx);
436 Math3D.MatrixIdentity4(matx);
439 Shape s =
Shape.CreateSphere(color, shapeFlags, pos, 0.05);
456#ifdef SCR_MELEE_DEBUG_MSG
460 protected void MCDbgPrint(
string msg =
"")
485 super.OnPostInit(owner);
494 if (!
GetGame().GetWorldEntity())
501#ifdef SCR_MELEE_DEBUG
502 m_aDbgSamplePositionsShapes = {};
503 m_aDbgCollisionShapes = {};
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
enum EAITargetInfoCategory m_Entity
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
void SCR_DestructibleEntity(IEntitySource src, IEntity parent)
SurfaceProperties m_SurfaceProps
ScriptInvokerBase< OnMeleePerformedDelegate > OnMeleePerformedInvoker
func OnMeleePerformedDelegate
proto external int SetEventMask(notnull IEntity owner, int mask)
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 IEntity GetChildren()
proto external BaseWorld GetWorld()
proto external IEntity GetParent()
proto external IEntity GetSibling()
Replication item identifier.
void CollectMeleeWeaponProperties()
void Debug_DrawSphereAtPos(vector pos, int color, array< ref Shape > dbgShapes)
vector GetAimingVector(notnull ChimeraCharacter character)
SCR_DamageManagerComponent SearchHierarchyForDamageManager(IEntity startEntity, out HitZone hitZone)
SCR_MeleeWeaponProperties m_MeleeWeaponProperties
void Debug_DrawLineSimple(vector start, vector end, array< ref Shape > dbgShapes)
void Do_OnFrameCleanup()
cleanup
void Update(float timeSlice)
Event methods.
void RPC_HandleMeleeSound(RplId weaponID, vector position, int signalValue0, int signalValue1)
bool TraceFilter(notnull IEntity ent)
void SetMeleeAttackStarted(bool started)
void PlaySound(IEntity weaponEntity, vector position, int signalValue0, int signalValue1)
float m_fWeaponMeleeRange
void Debug_DrawSphereAtPos(vector v, array< ref Shape > dbgShapes, int color=COLOR_BLUE, float size=0.03, ShapeFlags shapeFlags=ShapeFlags.VISIBLE)
DEBUG methods.
ref OnMeleePerformedInvoker m_OnMeleePerformed
void PerformAttack()
Called from character command handler, based on user input.
ref SCR_MeleeHitDataClass m_MeleeHitData
bool m_bAttackAlreadyExecuted
bool m_bMeleeAttackStarted
attack execution limiter
bool m_bMeasurementDone
holds melee hit data
float m_fWeaponMeleeAccuracy
bool CheckCollisionsSimple(out SCR_MeleeHitDataClass pHitData)
void HandleMeleeSound()
Handles playing of sound & setting of signals (AUDIO).
override void OnPostInit(IEntity owner)
override void EOnInit(IEntity owner)
void HandleDamageDelayed()
void ProcessMeleeAttack()
Processes the melee attack. Applies the damage if applicable.
OnMeleePerformedInvoker GetOnMeleePerformed()
proto external GenericEntity GetOwner()
Get owner entity.
Instance of created debug visualizer.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
EntityEvent
Various entity events.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
proto int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.