Assembly-CSharp.dll Update from A7 to A8 Questions (noob)

Started by want_some, January 21, 2015, 08:59:22 PM

Previous topic - Next topic

want_some

Found an issue for the stun gun. getting an error for the pawn.healthTracker.NewlyDowned()


        protected override void Impact(Thing hitThing)
        {
            if (hitThing != null)
            {
                int damageAmountBase = this.def.projectile.damageAmountBase;
                BodyPartDamageInfo? part = null;
                DamageInfo dinfo = new DamageInfo(this.dmgdef, damageAmountBase, base.launcher, this.ExactRotation.eulerAngles.y, part, null);
                hitThing.TakeDamage(dinfo);
                Pawn pawn = hitThing as Pawn;
                if (pawn != null && !pawn.Downed)
                {
                    hitThing.TakeDamage(new DamageInfo(DamageTypeDefOf.Stun, 0, this.launcher));
                    pawn.healthTracker.NewlyDowned();
                    if (pawn.def.race.humanoid)
                    {
                        pawn.health = UnityEngine.Random.Range(80, 99);
                    }
                }
            }
            else
            {
                MoteMaker.MakeShotHitDirt(this.ExactPosition);
            }
            this.Destroy(DestroyMode.Vanish);
        }


I looked in Verse.Pawn_HealthTracker and found that this method changed from public in A7 to private in A8. Would there be another way to write this to get it to work? or will this weapon be disabled until A9/A10?


Learning to mod while also updating TTM Mod!
Full credit goes to Minami26

Gaesatae

I don't have the A7 dll's to compare, but instead of calling the method I believe that you can do the same by using:
pawn.healthTracker.down = true;
pawn.NewlyDowned()

Also, you may want to check if the pawn is already down before downing it.

I hate accessibility errors...

Haplo

This doesn't really work in alpha 8 anymore.
I've switched the code for MAI to this line:

HealthUtility.GiveInjuriesToForceDowned(this);

But, this does create injuries!

want_some

Quote from: Haplo on January 25, 2015, 11:37:52 AM
This doesn't really work in alpha 8 anymore.
I've switched the code for MAI to this line:

HealthUtility.GiveInjuriesToForceDowned(this);

But, this does create injuries!

Ok so i need to replace Verse.Pawn_HealthTracker with HealthUtility.GiveInjuriesToForceDowned(this); ?


Learning to mod while also updating TTM Mod!
Full credit goes to Minami26