Example #1
0
        public SimulationHost(string empyrionPath)
        {
            this.EmpyrionBasePath = new DirectoryInfo(empyrionPath);

            this.IApplication = new ApplicationSimulator();
            this.IApplication.EmpyrionRootDirectory = this.EmpyrionBasePath.FullName;

            PlayfieldSimulator playfield = this.IApplication.CreatePlayfield("Planet", "Temperate", 1);

            playfield.GeneratePoIs(30);

            this.IApplication.LocalPlayer = playfield.Players[playfield.SpawnTestPlayer(UnityEngine.Vector3.zero)];

            this.IModApi                 = new ModApiSimulator();
            this.IModApi.Application     = this.IApplication;
            this.IModApi.ClientPlayfield = playfield;

            this.ModGameAPI = new ModGameApiSimulator();

            foreach (string dir in Directory.GetDirectories(Path.Combine(this.EmpyrionBasePath.FullName, @"Content\Mods")))
            {
                ModDetails mod = new ModDetails(dir);
                this.Mods[mod.ShortName] = mod;
            }
        }
        public PlayfieldSimulator CreatePlayfield(string playfieldType, string planetClass, int sizeClass)
        {
            PlayfieldSimulator playfield = new PlayfieldSimulator();

            playfield.Name = "Simulated Playfield #" + SimulationHost.NextEntityId;
            playfield.GenerateMap(playfieldType, planetClass, sizeClass);
            this.Playfields.Add(playfield);
            if (this.OnPlayfieldLoaded != null)
            {
                this.OnPlayfieldLoaded(playfield);
            }
            return(playfield);
        }