Esempio n. 1
0
        protected override void SpringSub(Pawn p)
        {
            SoundDefOf.TrapSpring.PlayOneShot(new TargetInfo(base.Position, base.Map, false));
            if (p == null)
            {
                return;
            }
            float num              = this.GetStatValue(StatDefOf.TrapMeleeDamage, true) * Building_FPSRT.DamageRandomFactorRange.RandomInRange * FPSRT_settings.Gettrapdamage();
            float num2             = num / Building_FPSRT.DamageCount;
            float armorPenetration = num2 * 0.015f * FPSRT_settings.Getarmorpenetrate();
            int   num3             = 0;

            while ((float)num3 < Building_FPSRT.DamageCount)
            {
                DamageInfo dinfo = new DamageInfo(DamageDefOf.Stab, num2, armorPenetration, -1f, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                DamageWorker.DamageResult damageResult = p.TakeDamage(dinfo);
                if (num3 == 0)
                {
                    BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_TrapSpike, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
                }
                num3++;
            }
            Map     map   = base.Map;
            IntVec3 loc   = this.Position;
            Thing   thing = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDef.Named("Building_FPSRTunarmed"), this.Stuff), loc, map, WipeMode.Vanish);

            thing.SetFaction(Faction.OfPlayer, null);
        }
Esempio n. 2
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());

            string newDesc = "";

            newDesc = "charging... : " + ((int)((FPSRT_settings.Gettraparmingtime() * 60 - FPSRT_arming))).ToStringSecondsFromTicks();

            stringBuilder.Append(newDesc);

            return(stringBuilder.ToString());
        }
Esempio n. 3
0
        public override void Tick()
        {
            base.Tick();
            if (this.Spawned)
            {
                FPSRT_arming++;

                if (FPSRT_arming > (FPSRT_settings.Gettraparmingtime() * 60))
                {
                    Map     map   = base.Map;
                    IntVec3 loc   = this.Position;
                    Thing   thing = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDef.Named("Building_FPSRT"), this.Stuff), loc, map, WipeMode.Vanish);
                    thing.SetFaction(Faction.OfPlayer, null);
                }
            }
        }