Example #1
0
        public override void SpawnNewInWorld(IGlobalPosition spawnTo)
        {
            //We can't even try this until we know if the data is there
            IGaiaTemplate bS = Template <IGaiaTemplate>() ?? throw new InvalidOperationException("Missing backing data store on gaia spawn event.");

            Keywords = bS.Keywords;

            if (CelestialPositions == null || CelestialPositions.Count() == 0)
            {
                HashSet <ICelestialPosition> celestials = new HashSet <ICelestialPosition>();

                foreach (ICelestial body in bS.CelestialBodies)
                {
                    celestials.Add(new CelestialPosition(body, 0));
                }

                CelestialPositions = celestials;
            }

            RotationalAngle = bS.RotationalAngle;
            Qualities       = bS.Qualities;

            //gotta spawn 2 per hemisphere
            if (MeterologicalFronts == null || MeterologicalFronts.Count() == 0)
            {
                MeterologicalFronts = AddFronts();
            }

            CurrentTimeOfDay = new TimeOfDay(bS.ChronologicalSystem);

            if (string.IsNullOrWhiteSpace(BirthMark))
            {
                BirthMark = LiveCache.GetUniqueIdentifier(bS);
                Birthdate = DateTime.Now;
            }

            Macroeconomy = new Economy(bS);

            UpsertToLiveWorldCache(true);

            CurrentLocation = new GlobalPosition(null, null, null);
            KickoffProcesses();

            UpsertToLiveWorldCache(true);

            Save();
        }