コード例 #1
0
        /*public override void WarmupComplete()
         * {
         *  base.WarmupComplete();
         *  if (ShooterPawn != null && ShooterPawn.skills != null)
         *  {
         *      ShooterPawn.skills.Learn(SkillDefOf.Shooting, 100);
         *  }
         * }*/
        public override ShiftVecReport ShiftVecReportFor(TargetInfo target)
        {
            ShiftVecReport report = base.ShiftVecReportFor(target);

            report.circularMissRadius = this.GetMissRadiusForDist(report.shotDist);

            // Check for marker
            ArtilleryMarker marker = null;

            if (this.currentTarget.HasThing && this.currentTarget.Thing.HasAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef)))
            {
                marker = (ArtilleryMarker)this.currentTarget.Thing.GetAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef));
            }
            else
            {
                marker = (ArtilleryMarker)this.currentTarget.Cell.GetFirstThing(ThingDef.Named(ArtilleryMarker.MarkerDef));
            }
            if (marker != null)
            {
                report.aimingAccuracy = marker.aimingAccuracy;
                report.aimEfficiency  = marker.aimEfficiency;
                report.weatherShift   = marker.weatherShift;
                report.lightingShift  = marker.lightingShift;
            }
            // If we don't have a marker check for indirect fire and apply penalty
            else if (report.shotDist > 107 || !GenSight.LineOfSight(this.caster.Position, report.target.Cell, true))
            {
                report.indirectFireShift = this.verbPropsCR.indirectFirePenalty * report.shotDist;
                report.weatherShift      = 0f;
                report.lightingShift     = 0f;
            }
            return(report);
        }
コード例 #2
0
 public override void AttachTo(Thing parent)
 {
     if (parent != null)
     {
         CompAttachBase comp = parent.TryGetComp <CompAttachBase>();
         if (comp != null)
         {
             if (parent.HasAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef)))
             {
                 ArtilleryMarker oldMarker = (ArtilleryMarker)parent.GetAttachment(ThingDef.Named(ArtilleryMarker.MarkerDef));
                 oldMarker.Destroy();
             }
         }
     }
     base.AttachTo(parent);
 }
コード例 #3
0
        protected override bool TryCastShot()
        {
            ArtilleryMarker marker = ThingMaker.MakeThing(ThingDef.Named(ArtilleryMarker.MarkerDef)) as ArtilleryMarker;
            ShiftVecReport  report = ShiftVecReportFor(currentTarget);

            marker.aimEfficiency  = report.aimEfficiency;
            marker.aimingAccuracy = report.aimingAccuracy;
            marker.lightingShift  = report.lightingShift;
            marker.weatherShift   = report.weatherShift;

            GenSpawn.Spawn(marker, this.currentTarget.Cell, caster.Map);

            // Check for something to attach marker to
            if (this.currentTarget.HasThing)
            {
                CompAttachBase comp = this.currentTarget.Thing.TryGetComp <CompAttachBase>();
                if (comp != null)
                {
                    marker.AttachTo(this.currentTarget.Thing);
                }
            }
            return(true);
        }