Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Rah

#1
updated for 1.5. if you encounter any bugs, please report on steam page.
#2
updated for Rimworld 1.4. not tested with the official dlc yet. Please report issues on the official steam mod page.
#3
Small update: Biosculpter pod can now cure the RBSE chronic diseases with the bio regen option.
#4
Quote from: Jim the Humanski on January 12, 2022, 02:17:52 PM
When I am downing an enemy pawn with any turret i am getting this error message.

Error log: https://gist.github.com/c647e4680d7cf32514d89a09274a7fde
Sorry I was not able to respond earlier. If you have any problems please post it on the steam page. But yes, that error looks like another mod (kill for me) interfering. Try to turn it off.
#5
v2.3: Bunch of tweaks and balancing
#6
@evilbob, not atm.
#7
Help / Re: Gizmo error with Shield Belt code
August 31, 2021, 05:25:37 PM
thanks for the help. that is hilariously weird. I guess I have to do some more studying.
#8
Help / Re: Gizmo error with Shield Belt code
August 30, 2021, 03:27:19 PM
I understand that it is some sort of intermediate language from VB to C# or whatever, and that some of the translation has to be removed / redone for it work properly, most likely the bracketed part, and some more. That's my understanding of it. Still getting some errors after that.

        public override IEnumerable<Gizmo> GetWornGizmos()
        {
            while (true)
            {
                int num; // num declared but never used
                IEnumerator<Gizmo> enumerator;
                break;
                try // unreachable code
                {
                    if (!enumerator.MoveNext())
                    continue;
                }
                finally
                {
                    if (enumerator != null)
                    {
                        enumerator.Dispose();
                    }
                }
enumerator = null;
                if (Find.Selector.SingleSelectedThing != base.Wearer)
                yield return new Gizmo_EnergyShieldStatus
                {
                    shield = this // cant implicitly convert hellfirebattlearmor to shieldbelt
                };
            }
            yield break;
        }
#9
Help / Re: Gizmo error with Shield Belt code
August 30, 2021, 08:30:37 AM
I thought once you have the dll references it should always work without errors, but apparently not. I'm not much into C coding, so this is a bit greek to me. Could you explain a bit further?
#10
update 3.0:
- New research node; Nanomedicine. Can cure Frailty, Sleeping sickness, Muscle parasites, Mechanites, Gut worms and other infections.
- Neurostimulator has no negative side effects. Cures dementia, alzheimer's and brain damage.
#11
v2.2:
- Devastator mortar now takes plasma power cells; 1 cell for 20 rounds. Made at the Fabrication bench.
- Minor balance, tweaks.
#12
updated for 1.3
#13
Help / Gizmo error with Shield Belt code
August 27, 2021, 04:30:52 PM
Hi, I made some armor with the shield belt feature on it and pawns being able to shoot with it. Everything works except for the shield energy display in-game when drafted. The "Gizmo" code for the vanilla shield belt is the code responsible for showing the energy in-game. I have to remove that code to be error free, but then I can't see how much shield the pawn has.

It gives all kinds of errors, like "IteratorStateMachine" cant be found, d 26 cannot be found, etc. Anyone know how to fix that error? Thanks.

using System;
using UnityEngine;
using Verse;
using Verse.Sound;

namespace RimWorld
{
    [StaticConstructorOnStartup]
    public class HellfireBattleArmor : Apparel
    {
        private float energy;

        private int ticksToReset = -1;

        private int lastKeepDisplayTick = -9999;

        private Vector3 impactAngleVect;

        private int lastAbsorbDamageTick = -9999;

        private const float MinDrawSize = 1.2f;

        private const float MaxDrawSize = 1.55f;

        private const float MaxDamagedJitterDist = 0.05f;

        private const int JitterDurationTicks = 8;

        private int StartingTicksToReset = 3200;

        private float EnergyOnReset = 0.2f;

        private float EnergyLossPerDamage = 0.033f;

        private int KeepDisplayingTicks = 1000;

        private float ApparelScorePerEnergyMax = 0.25f;

        private static readonly Material BubbleMat = MaterialPool.MatFrom("Other/ShieldBubble", ShaderDatabase.Transparent);

        private float EnergyMax
        {
            get
            {
                return this.GetStatValue(StatDefOf.EnergyShieldEnergyMax, true);
            }
        }

        private float EnergyGainPerTick
        {
            get
            {
                return this.GetStatValue(StatDefOf.EnergyShieldRechargeRate, true) / 60f;
            }
        }

        public float Energy
        {
            get
            {
                return this.energy;
            }
        }

        public ShieldState ShieldState
        {
            get
            {
                bool flag = this.ticksToReset > 0;
                ShieldState result;
                if (flag)
                {
                    result = ShieldState.Resetting;
                }
                else
                {
                    result = ShieldState.Active;
                }
                return result;
            }
        }

        private bool ShouldDisplay
        {
            get
            {
                Pawn wearer = base.Wearer;
                return wearer.Spawned && !wearer.Dead && !wearer.Downed && (wearer.InAggroMentalState || wearer.Drafted || (wearer.Faction.HostileTo(Faction.OfPlayer) && !wearer.IsPrisoner) || Find.TickManager.TicksGame < this.lastKeepDisplayTick + this.KeepDisplayingTicks);
            }
        }

        public override void ExposeData()
        {
            base.ExposeData();
            Scribe_Values.Look<float>(ref this.energy, "energy", 0f, false);
            Scribe_Values.Look<int>(ref this.ticksToReset, "ticksToReset", -1, false);
            Scribe_Values.Look<int>(ref this.lastKeepDisplayTick, "lastKeepDisplayTick", 0, false);
        }

        [IteratorStateMachine(typeof(ShieldBelt.< GetWornGizmos > d__26))]
        public override IEnumerable<Gizmo> GetWornGizmos()
        {
            while (true)
            {
                int num;
                IEnumerator<Gizmo> enumerator;
                switch (num)
                {
                    case 0:
                        enumerator = this.<> n__0().GetEnumerator();
                        goto Block_2;
                    case 1:
                        goto IL_67;
                    case 2:
                        goto IL_BD;
                }
                break;
                Block_2:
                try
                {
                    IL_6F:
                    if (!enumerator.MoveNext())
                    {
                        goto JumpOutOfTryFinally-3;
                    }
                    Gizmo current = enumerator.Current;
                    yield return current;
                    continue;
                    IL_67:
                    goto IL_6F;
                }
                finally
                {
                    if (enumerator != null)
                    {
                        enumerator.Dispose();
                    }
                }
                JumpOutOfTryFinally - 3:
enumerator = null;
                if (Find.Selector.SingleSelectedThing != base.Wearer)
                {
                    goto IL_C4;
                }
                yield return new Gizmo_EnergyShieldStatus
                {
                    shield = this
                };
            }
            yield break;
            IL_BD:
            IL_C4:
            yield break;
        }

        public override float GetSpecialApparelScoreOffset()
        {
            return this.EnergyMax * this.ApparelScorePerEnergyMax;
        }

        public override void Tick()
        {
            base.Tick();
            bool flag = base.Wearer == null;
            if (flag)
            {
                this.energy = 0f;
            }
            else
            {
                bool flag2 = this.ShieldState == ShieldState.Resetting;
                if (flag2)
                {
                    this.ticksToReset--;
                    bool flag3 = this.ticksToReset <= 0;
                    if (flag3)
                    {
                        this.Reset();
                    }
                }
                else
                {
                    bool flag4 = this.ShieldState == ShieldState.Active;
                    if (flag4)
                    {
                        this.energy += this.EnergyGainPerTick;
                        bool flag5 = this.energy > this.EnergyMax;
                        if (flag5)
                        {
                            this.energy = this.EnergyMax;
                        }
                    }
                }
            }
        }

        public override bool CheckPreAbsorbDamage(DamageInfo dinfo)
        {
            bool flag = this.ShieldState > ShieldState.Active;
            bool result;
            if (flag)
            {
                result = false;
            }
            else
            {
                bool flag2 = dinfo.Def == DamageDefOf.EMP;
                if (flag2)
                {
                    this.energy = 0f;
                    this.Break();
                    result = false;
                }
                else
                {
                    bool flag3 = dinfo.Def.isRanged || dinfo.Def.isExplosive;
                    if (flag3)
                    {
                        this.energy -= dinfo.Amount * this.EnergyLossPerDamage;
                        bool flag4 = this.energy < 0f;
                        if (flag4)
                        {
                            this.Break();
                        }
                        else
                        {
                            this.AbsorbedDamage(dinfo);
                        }
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
            }
            return result;
        }

        public void KeepDisplaying()
        {
            this.lastKeepDisplayTick = Find.TickManager.TicksGame;
        }

        private void AbsorbedDamage(DamageInfo dinfo)
        {
            SoundDefOf.EnergyShield_AbsorbDamage.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));
            this.impactAngleVect = Vector3Utility.HorizontalVectorFromAngle(dinfo.Angle);
            Vector3 loc = base.Wearer.TrueCenter() + this.impactAngleVect.RotatedBy(180f) * 0.5f;
            float num = Mathf.Min(10f, 2f + dinfo.Amount / 10f);
            FleckMaker.Static(loc, base.Wearer.Map, FleckDefOf.ExplosionFlash, num);
            int num2 = (int)num;
            for (int i = 0; i < num2; i++)
            {
                FleckMaker.ThrowDustPuff(loc, base.Wearer.Map, Rand.Range(0.8f, 1.2f));
            }
            this.lastAbsorbDamageTick = Find.TickManager.TicksGame;
            this.KeepDisplaying();
        }

        private void Break()
        {
            SoundDefOf.EnergyShield_Broken.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));
            FleckMaker.Static(base.Wearer.TrueCenter(), base.Wearer.Map, FleckDefOf.ExplosionFlash, 12f);
            for (int i = 0; i < 6; i++)
            {
                FleckMaker.ThrowDustPuff(base.Wearer.TrueCenter() + Vector3Utility.HorizontalVectorFromAngle((float)Rand.Range(0, 360)) * Rand.Range(0.3f, 0.6f), base.Wearer.Map, Rand.Range(0.8f, 1.2f));
            }
            this.energy = 0f;
            this.ticksToReset = this.StartingTicksToReset;
        }

        private void Reset()
        {
            bool spawned = base.Wearer.Spawned;
            if (spawned)
            {
                SoundDefOf.EnergyShield_Reset.PlayOneShot(new TargetInfo(base.Wearer.Position, base.Wearer.Map, false));
                FleckMaker.ThrowLightningGlow(base.Wearer.TrueCenter(), base.Wearer.Map, 3f);
            }
            this.ticksToReset = -1;
            this.energy = this.EnergyOnReset;
        }

        public override void DrawWornExtras()
        {
            bool flag = this.ShieldState == ShieldState.Active && this.ShouldDisplay;
            if (flag)
            {
                float num = Mathf.Lerp(1.2f, 1.55f, this.energy);
                Vector3 vector = base.Wearer.Drawer.DrawPos;
                vector.y = AltitudeLayer.MoteOverhead.AltitudeFor();
                int num2 = Find.TickManager.TicksGame - this.lastAbsorbDamageTick;
                bool flag2 = num2 < 8;
                if (flag2)
                {
                    float num3 = (float)(8 - num2) / 8f * 0.05f;
                    vector += this.impactAngleVect * num3;
                    num -= num3;
                }
                float angle = (float)Rand.Range(0, 360);
                Vector3 s = new Vector3(num, 1f, num);
                Matrix4x4 matrix = default(Matrix4x4);
                matrix.SetTRS(vector, Quaternion.AngleAxis(angle, Vector3.up), s);
                Graphics.DrawMesh(MeshPool.plane10, matrix, HellfireBattleArmor.BubbleMat, 0);
            }
        }

        public bool AllowVerbCast(IntVec3 root, Map map, LocalTargetInfo targ, Verb verb)
        {
            return !(verb is Verb_LaunchProjectile);
        }
    }
}


#14
v2.1:
- New turret: Charge cannon added with v2.1. High precision, armor piercing turret.
- New mod name.
- Balance work
#15
No alternate link atm. Currently doing updates regularly.