Beispiel #1
0
        public override string GetInspectString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(base.GetInspectString());
            CompGoldMiner cgm = ThingCompUtility.TryGetComp <CompGoldMiner>(this);

            if (cgm != null)
            {
                int tickss = cgm.goldMineral != null ? cgm.goldMineral.ticks : 0;
                sb.Append("\n" + "GoldMinerProgress".Translate() + ":" + ((float)(tickss / 36.0)).ToString("#0.00") + "%");
            }



            // String sb = base.GetInspectString() + "\n" + Translator.Translate("restoreBullet") + ":" + this.restoreBullet + "\n" + Translator.Translate("restoreProgress") + ":" + (this.ticks);
            return(sb.ToString());
        }
 public override void Tick()
 {
     if (this.ticks >= 3600)
     {
         Thing gold = ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("ra2_GoldBar", true));
         gold.stackCount = 100;
         GenPlace.TryPlaceThing(gold, this.harvester.Position, this.Map, ThingPlaceMode.Near);
         this.ticks = 0;
         if (this.goldStore <= 100)
         {
             Messages.Message("MessageGoldMineralLifeOut".Translate().CapitalizeFirst(), this.harvester, MessageTypeDefOf.NeutralEvent, true);
             this.Destroy(DestroyMode.Vanish);
             CompGoldMiner cg = this.harvester.TryGetComp <CompGoldMiner>();
             if (cg != null && cg.goldMineral != null)
             {
                 cg.goldMineral = null;
             }
         }
         else
         {
             this.goldStore -= 100;
         }
     }
 }