-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mechs that get knocked down after either getting hit in the head or losing their head causes an exception #14
Comments
Hi. I'm trying to setup a savegame for testing so hoping to clarify a couple key points if you could. Do you know if the knockdown from head hit/destruction, throws on weapons fire or only melee? Do you know what is the exception? Thanks! |
@gnivler Here's what I have right now
|
Cool thanks. That looks a bit like #12 that I thought was just me. Yesterday I was able to execute all test scenarios without reproducing a bug. I'll try again. I had knocked over opfor with melee, shooting, punching and DFA (I rigged the json to make all hits go to head). Update: I've been unable to repro the issue at all. |
I replicated it during normal play it appears. I wonder if the trigger is actually the head being destroyed by a fall. Update: confirmed this NRE occurs when a mech falls and Charles destroys the head Easy to repro if you hardcode the mod to only destroy the head. First knockdown will throw.
|
I don't know with any certainty but I'm tempted to call this a vanilla bug. I re-wrote the method in a patch and simply added a null check, which is present in related code. Just works now. [HarmonyPatch(typeof(Mech), "ApplyHeadStructureEffects", MethodType.Normal)]
public static class Mech_ApplyHeadStructureEffects_Patch
{
public static bool Prefix(
Mech __instance,
ChassisLocations location,
LocationDamageLevel oldDamageLevel,
LocationDamageLevel newDamageLevel,
WeaponHitInfo hitInfo)
{
var mech = __instance;
mech.pilot.SetNeedsInjury(InjuryReason.HeadHit);
if (newDamageLevel == oldDamageLevel) return false;
if (newDamageLevel == LocationDamageLevel.Destroyed)
{
AttackDirector.AttackSequence attackSequence =
mech.Combat.AttackDirector.GetAttackSequence(hitInfo.attackSequenceId);
if (attackSequence != null)
{
mech.pilot.LethalInjurePilot(
mech.Combat.Constants,
hitInfo.attackerId,
hitInfo.stackItemUID,
true,
DamageType.HeadShot,
attackSequence.GetWeapon(hitInfo.attackGroupIndex, hitInfo.attackWeaponIndex),
attackSequence.attacker);
}
mech.Combat.MessageCenter.PublishMessage(
new AddSequenceToStackMessage(
new ShowActorInfoSequence(mech, "PILOT: LETHAL DAMAGE!", FloatieMessage.MessageNature.PilotInjury, true)))
}
return false;
}
} |
With that patch is the head still destroyed in the end? |
The head is pretty sure. The only conclusive proof might be an
after-action report for review? I'll re-test it sometime soon. Looking it
over again, I wonder if it's the pilot that may be an issue, not receiving
any injury from the destroyed head. That will shake out with testing
though.
…On Thu, Sep 27, 2018 at 9:27 AM janxious ***@***.***> wrote:
With that patch is the head still destroyed in the end?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#14 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARmQpVxtEaVDOrArcchN7cm67yxjChf5ks5ufO5ugaJpZM4Wmbt2>
.
|
Frig, I forgot about this, sorry. Well more accurately procrastinated, then forgot. update: Tried a few things I could come up with but no joy. My thought is that checking for head destruction and doing it manually, by mimicking how the game does it, might do the trick.
is not enough not surprisingly 👎 |
Don't worry about it. I have a fix mostly worked out, I think.The issue is primarily that the damage code expects a weapon to be involved, so I may create a new weapon called "TheGround" for this mod. |
Ok right on I'm glad, was going to ask if you had ideas. I was thinking something might need to be created and had tried new Mech() and new Weapon() which compiled.. but yeah, didn't work :) I've got the testing method more or less cased, if you want me to test your changes just lemme know. |
No description provided.
The text was updated successfully, but these errors were encountered: