Exemple #1
0
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Values.Look <float>(ref this.period, "period", 0, false);
     Scribe_Values.Look <int>(ref this.timeOffset, "timeOffset", 0, false);
     //Scribe_Values.Look<float>(ref this.traveledPct, "traveledPct", 0f, false);
     Scribe_Values.Look <Vector3>(ref this.maxOrbits, "maxOrbits", default(Vector3), false);
     Scribe_Values.Look <Vector3>(ref this.shiftOrbits, "shiftOrbits", default(Vector3), false);
     WorldObjectChild_Satellite.GetInstanceField(typeof(WorldObject), this, "BaseDrawSize");
 }
Exemple #2
0
 public bool tryGenSatellite(int tile)
 {
     try
     {
         //this.defs.AddRange(this.satDef.getWorldObjectDefNames);
         WorldObjectChild_Satellite worldObject_SmallMoon = (WorldObjectChild_Satellite)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed(defs.RandomElement <string>(), true));
         worldObject_SmallMoon.Tile = tile;
         Find.WorldObjects.Add(worldObject_SmallMoon);
         return(true);
     }
     catch
     {
         Log.Error("Failed to add satellite"); return(false);
     }
 }
Exemple #3
0
        public Map makeMoonMap()
        {
            //Log.Message("Look at that moon!");
            WorldObjectChild_Satellite target = this.satellites.Find((WorldObjectChild_Satellite x) => !x.hasMap);

            this.satellites.Remove(target);
            Map map2 = MapGenerator.GenerateMap(new IntVec3(300, 1, 300), target, target.MapGeneratorDef, target.ExtraGenStepDefs, null);

            target.hasMap = true;
            this.satellites.Add(target);
            try
            {
                bool flag = false;
                List <WeatherDef> wdefs = DefDatabase <WeatherDef> .AllDefs.ToList();

                foreach (WeatherDef defer in wdefs)
                {
                    if (defer.defName.Equals("OuterSpaceWeather"))
                    {
                        flag = true;
                    }
                }
                if (flag)
                {
                    //Log.Message("set weather");
                    map2.weatherManager.curWeather = WeatherDef.Named("OuterSpaceWeather");
                }
                else
                {
                    //Log.Message("no weather");
                }
            }
            catch { if (Prefs.DevMode)
                    {
                        Log.Message("No space weather catch");
                    }
            }
            Find.World.WorldUpdate();
            return(map2);
        }
Exemple #4
0
        public bool tryGenSatellite()
        {
            int     tile    = Find.World.grid.TilesCount - this.numberOfSatellites - 2;
            Vector3 baseVec = satDef.getOrbitVectorBase;
            Vector3 varVec  = satDef.getOrbitVectorRange;

            try
            {
                WorldObjectChild_Satellite worldObject_SmallMoon = (WorldObjectChild_Satellite)WorldObjectMaker.MakeWorldObject(
                    DefDatabase <WorldObjectDef> .GetNamed(satDef.WorldObjectDefNames.RandomElement <string>(), true));
                worldObject_SmallMoon.Tile = tile;
                Find.WorldObjects.Add(worldObject_SmallMoon);
                this.numberOfSatellites += 1;
                this.satellites.Add(worldObject_SmallMoon);
                this.applySatelliteSurface(tile);
                worldObject_SmallMoon.realTile = getTile(tile);
                return(true);
            }
            catch
            {
                Log.Error("Failed to add satellite"); return(false);
            }
        }
Exemple #5
0
 public void removeSatellite(WorldObjectChild_Satellite satellite)
 {
     this.satellites.Remove(satellite);
     this.numberOfSatellites -= 1;
 }