No virtual methods that occur on any Hit to Agents, where Blow or AttackCollisionData is passed?

Users who are viewing this thread

schnoodly

Recruit
I am looking at making effects based on the details of a Blow / Attack WITHOUT using Harmony, as I hear about compatibility issues. The only exposed virtual methods I've been able to find are OnRegisterBlow, OnAgentHit, OnScoreHit, and OnMissileHit; all of these are missing one or two vital parts to be any extra use:

  • OnRegisterBlow has everything I need, BUT the method that passes to it, RegisterBlow, isn't reliably called it appears
C#:
internal void MeleeHitCallback(ref AttackCollisionData collisionData, Agent attacker, Agent victim, GameEntity realHitEntity, float momentumRemainingToComputeDamage, ref float inOutMomentumRemaining, ref MeleeCollisionReaction colReaction, CrushThroughState cts, Vec3 blowDir, Vec3 swingDir, ref HitParticleResultData hprd, bool crushedThroughWithoutAgentCollision)
        {
                // [...]
                if (!crushedThroughWithoutAgentCollision)
                {
                    Blow blow = this.CreateBlow(attacker, victim, ref collisionData, cts, blowDir, swingDir, flag2);
                    if (!flag && ((victim != null && victim.IsActive()) || realHitEntity != null))
                    {
                        this.RegisterBlow(attacker, victim, realHitEntity, blow, ref collisionData);
                    }
                    // [...]
                }
                colReaction = MeleeCollisionReaction.ContinueChecking;
            }
        }
I have NO idea what if (!crushedThroughWithoutAgentCollision) means, but it doesn't seem to be what passes validation on every hit.
  • OnAgentHit, OnScoreHit, and OnMissileHit don't have any Blow struct passed into them, so I really can't use those for getting Blow.VictimBodyPart, Blow.DamageType , Blow.SwingDirection, or Blow.DamagePercentage
Is anyone aware of any other method I could override WITHOUT worrying about Harmony? Alternatively, would the devs consider exposing a virtual method that gets called on each hit?
 
I am looking at making effects based on the details of a Blow / Attack WITHOUT using Harmony, as I hear about compatibility issues. The only exposed virtual methods I've been able to find are OnRegisterBlow, OnAgentHit, OnScoreHit, and OnMissileHit; all of these are missing one or two vital parts to be any extra use:

  • OnRegisterBlow has everything I need, BUT the method that passes to it, RegisterBlow, isn't reliably called it appears
C#:
internal void MeleeHitCallback(ref AttackCollisionData collisionData, Agent attacker, Agent victim, GameEntity realHitEntity, float momentumRemainingToComputeDamage, ref float inOutMomentumRemaining, ref MeleeCollisionReaction colReaction, CrushThroughState cts, Vec3 blowDir, Vec3 swingDir, ref HitParticleResultData hprd, bool crushedThroughWithoutAgentCollision)
        {
                // [...]
                if (!crushedThroughWithoutAgentCollision)
                {
                    Blow blow = this.CreateBlow(attacker, victim, ref collisionData, cts, blowDir, swingDir, flag2);
                    if (!flag && ((victim != null && victim.IsActive()) || realHitEntity != null))
                    {
                        this.RegisterBlow(attacker, victim, realHitEntity, blow, ref collisionData);
                    }
                    // [...]
                }
                colReaction = MeleeCollisionReaction.ContinueChecking;
            }
        }
I have NO idea what if (!crushedThroughWithoutAgentCollision) means, but it doesn't seem to be what passes validation on every hit.
  • OnAgentHit, OnScoreHit, and OnMissileHit don't have any Blow struct passed into them, so I really can't use those for getting Blow.VictimBodyPart, Blow.DamageType , Blow.SwingDirection, or Blow.DamagePercentage
Is anyone aware of any other method I could override WITHOUT worrying about Harmony? Alternatively, would the devs consider exposing a virtual method that gets called on each hit?
U can create a CustomMissionLogic that inherits MissionLogic class - it has a virtual void OnRegisterBlow(Agent attacker, Agent victim, GameEntity realHitEntity, Blow b, ref AttackCollisionData collisionData) or OnMissileCollisionReaction (for range..) and add it to the mission on void OnMissionBehaviourInitialize(Mission mission) in the sub module.
 
Upvote 0
U can create a CustomMissionLogic that inherits MissionLogic class - it has a virtual void OnRegisterBlow(Agent attacker, Agent victim, GameEntity realHitEntity, Blow b, ref AttackCollisionData collisionData) or OnMissileCollisionReaction (for range..) and add it to the mission on void OnMissionBehaviourInitialize(Mission mission) in the sub module.

This is the OnRegisterBlow that I'm talking about, unfortunately. It seems like it's not called on every strike -- I've tested having it simply make a new InformationMessage each hit, but nothing would pop up.
 
Upvote 0
This is the OnRegisterBlow that I'm talking about, unfortunately. It seems like it's not called on every strike -- I've tested having it simply make a new InformationMessage each hit, but nothing would pop up.
Yeah i think its called only on agent hit.. I wanted to make a wood chopping mod but could not detect tree hit. Only `OnMissileCollisionReaction` registers only on any hit.
 
Upvote 0
Back
Top Bottom