// Token: 0x06002072 RID: 8306 RVA: 0x000C6CF8 File Offset: 0x000C4EF8
 public void Trigger(OgsOld_CompTurretGun A, TargetInfo B)
 {
     for (int i = 0; i < this.children.Count; i++)
     {
         if (this.children[i] is SubEffecterComp subEffecterComp)
         {
             subEffecterComp.SubTrigger(A, B);
         }
     }
 }
Example #2
0
        // Token: 0x0600313C RID: 12604 RVA: 0x00114148 File Offset: 0x00112348
        public static Job MakeReloadJob(OgsOld_CompTurretGun comp, List <Thing> chosenAmmo)
        {
            Job job = JobMaker.MakeJob(JobDefOf.OgsOld_CompTurretReload, comp.parent, null, targetC: comp.gun);

            job.targetQueueB = (from t in chosenAmmo
                                select new LocalTargetInfo(t)).ToList <LocalTargetInfo>();
            job.count = chosenAmmo.Sum((Thing t) => t.stackCount);

            job.count = Math.Min(job.count, comp.MaxAmmoNeeded(true));
            return(job);
        }
Example #3
0
 // Token: 0x0600208B RID: 8331 RVA: 0x000C7350 File Offset: 0x000C5550
 public override void SubEffectTick(OgsOld_CompTurretGun A, TargetInfo B)
 {
     this.age++;
     if (this.age > this.def.ticksBeforeSustainerStart)
     {
         if (this.sustainer == null)
         {
             SoundInfo info = SoundInfo.InMap(A.OperatorPawn, MaintenanceType.PerTick);
             this.sustainer = this.def.soundDef.TrySpawnSustainer(info);
             return;
         }
         this.sustainer.Maintain();
     }
 }
Example #4
0
 // Token: 0x06002082 RID: 8322 RVA: 0x000C7228 File Offset: 0x000C5428
 public override void SubEffectTick(OgsOld_CompTurretGun A, TargetInfo B)
 {
     if (this.moteCount >= this.def.maxMoteCount)
     {
         return;
     }
     this.ticksUntilMote--;
     if (this.ticksUntilMote <= 0)
     {
         base.MakeMote(A, B);
         this.ticksUntilMote = this.def.ticksBetweenMotes;
         this.moteCount++;
     }
 }
Example #5
0
 public override void Tick()
 {
     base.Tick();
     if (Wearer != null)
     {
         for (int i = 0; i < Turrets.Count; i++)
         {
             OgsOld_CompTurretGun turretGun = Turrets[i] as OgsOld_CompTurretGun;
             if (turretGun != null)
             {
                 turretGun.CompTick();
             }
         }
     }
 }
Example #6
0
        // Token: 0x06002084 RID: 8324 RVA: 0x000C7288 File Offset: 0x000C5488
        public override void SubEffectTick(OgsOld_CompTurretGun A, TargetInfo B)
        {
            float num = this.def.chancePerTick;

            if (this.def.spawnLocType == MoteSpawnLocType.RandomCellOnTarget && B.HasThing)
            {
                num *= (float)(B.Thing.def.size.x * B.Thing.def.size.z);
            }
            Rand.PushState();
            if (Rand.Value < num)
            {
                base.MakeMote(A, B);
            }
            Rand.PopState();
        }
Example #7
0
 public void Attach(TargetInfo a, OgsOld_CompTurretGun turretGun)
 {
     this.link1     = new MoteAttachLink(a, Vector3.zero);
     this.turretGun = turretGun;
 }
        public override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(() => AmmoDef == null);
            OgsOld_CompTurretGun comp = null;

            if (true)
            {
            }
            foreach (var item in Gear?.AllComps)
            {
                if (item is OgsOld_CompTurretGun c)
                {
                    if (c.Props.ammoDef == AmmoDef && c.gun == Gun)
                    {
                        comp = c;
                        break;
                    }
                }
            }
            //	CompApparel_Turret comp = Gear?.AllComps.Find(x=> x is CompApparel_Turret && ((CompApparel_Turret)(x)).Props.ammoDef == Ammo.def) as CompApparel_Turret;
            this.FailOn(() => comp == null);
            //	this.FailOn(() => comp.OperatorPawn != pawn);
            this.FailOn(() => !comp.NeedsReload(allowForcedReload: true));
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            Toil getNextIngredient = Toils_General.Label();

            yield return(getNextIngredient);

            foreach (Toil item in ReloadAsMuchAsPossible(comp))
            {
                yield return(item);
            }
            yield return(Toils_JobTransforms.ExtractNextTargetFromQueue(TargetIndex.B));

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B, putRemainderInQueue: false, subtractNumTakenFromJobCount: true).FailOnDestroyedNullOrForbidden(TargetIndex.B));

            if (comp.OperatorPawn == null || (comp.OperatorPawn != null && comp.OperatorPawn != pawn))
            {
                yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

                yield return(Toils_General.Wait(240, TargetIndex.None).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));
            }
            yield return(Toils_Jump.JumpIf(getNextIngredient, () => !job.GetTargetQueue(TargetIndex.B).NullOrEmpty()));

            foreach (Toil item2 in ReloadAsMuchAsPossible(comp))
            {
                yield return(item2);
            }
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Thing carriedThing = pawn.carryTracker.CarriedThing;
                if (carriedThing != null && !carriedThing.Destroyed)
                {
                    pawn.carryTracker.TryDropCarriedThing(pawn.Position, ThingPlaceMode.Near, out Thing _);
                }
            };
            toil.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(toil);
        }
Example #9
0
 // Token: 0x06002086 RID: 8326 RVA: 0x000C72F9 File Offset: 0x000C54F9
 public override void SubTrigger(OgsOld_CompTurretGun A, TargetInfo B)
 {
     base.MakeMote(A, B);
 }
Example #10
0
 // Token: 0x06002076 RID: 8310 RVA: 0x00002681 File Offset: 0x00000881
 public virtual void SubTrigger(OgsOld_CompTurretGun A, TargetInfo B)
 {
 }
Example #11
0
 // Token: 0x06002075 RID: 8309 RVA: 0x00002681 File Offset: 0x00000881
 public virtual void SubEffectTick(OgsOld_CompTurretGun A, TargetInfo B)
 {
 }
Example #12
0
        // Token: 0x06002080 RID: 8320 RVA: 0x000C6E58 File Offset: 0x000C5058
        protected void MakeMote(OgsOld_CompTurretGun A, TargetInfo B)
        {
            Vector3 vector = Vector3.zero;

            switch (this.def.spawnLocType)
            {
            case MoteSpawnLocType.OnSource:
                vector = A.TurretPos;
                break;

            case MoteSpawnLocType.BetweenPositions:
            {
                Vector3 vector2 = A.IsOperated ? A.TurretPos : A.parent.DrawPos;
                Vector3 vector3 = B.HasThing ? B.Thing.DrawPos : B.Cell.ToVector3Shifted();
                if (A.IsOperated && !A.Operator.Spawned)
                {
                    vector = vector3;
                }
                else if (B.HasThing && !B.Thing.Spawned)
                {
                    vector = vector2;
                }
                else
                {
                    vector = vector2 * this.def.positionLerpFactor + vector3 * (1f - this.def.positionLerpFactor);
                }
                break;
            }

            case MoteSpawnLocType.BetweenTouchingCells:
                vector = A.Operator.Position.ToVector3Shifted() + (B.Cell - A.Operator.Position).ToVector3().normalized * 0.5f;
                break;

            case MoteSpawnLocType.RandomCellOnTarget:
            {
                CellRect cellRect;
                if (B.HasThing)
                {
                    cellRect = B.Thing.OccupiedRect();
                }
                else
                {
                    cellRect = CellRect.CenteredOn(B.Cell, 0);
                }
                vector = cellRect.RandomCell.ToVector3Shifted();
                break;
            }
            }
            if (this.parent != null)
            {
                Rand.PushState(this.parent.GetHashCode());
                if (A.TurretPos != B.CenterVector3)
                {
                    vector += (B.CenterVector3 - A.TurretPos).normalized * this.parent.def.offsetTowardsTarget.RandomInRange;
                }
                vector += Gen.RandomHorizontalVector(this.parent.def.positionRadius) + this.parent.offset;
                Rand.PopState();
            }
            Map   map  = A.Operator.Map ?? B.Map;
            float num  = this.def.absoluteAngle ? 0f : (B.Cell - A.Operator.Position).AngleFlat;
            float num2 = (this.parent != null) ? this.parent.scale : 1f;

            if (map != null && vector.ShouldSpawnMotesAt(map))
            {
                int randomInRange = this.def.burstCount.RandomInRange;
                for (int i = 0; i < randomInRange; i++)
                {
                    Mote mote = (Mote)ThingMaker.MakeThing(this.def.moteDef, null);
                    GenSpawn.Spawn(mote, vector.ToIntVec3(), map, WipeMode.Vanish);
                    mote.Scale         = this.def.scale.RandomInRange * num2;
                    mote.exactPosition = vector + this.def.positionOffset * num2 + Gen.RandomHorizontalVector(this.def.positionRadius) * num2;
                    mote.rotationRate  = this.def.rotationRate.RandomInRange;
                    mote.exactRotation = this.def.rotation.RandomInRange + num;
                    mote.instanceColor = this.def.color;
                    MoteThrown moteThrown = mote as MoteThrown;
                    if (moteThrown != null)
                    {
                        moteThrown.airTimeLeft = this.def.airTime.RandomInRange;
                        moteThrown.SetVelocity(this.def.angle.RandomInRange + num, this.def.speed.RandomInRange);
                    }
                }
            }
        }