Esempio n. 1
0
 private AnimalPen(ZoneType Data, WorldManager World) :
     base(Data, World)
 {
 }
Esempio n. 2
0
 public AttackTool(WorldManager World)
 {
     this.World = World;
 }
Esempio n. 3
0
 public GatherTool(WorldManager World)
 {
     this.World = World;
 }
Esempio n. 4
0
 public CommonRoom(bool designation, IEnumerable <VoxelHandle> designations, WorldManager chunks, Faction faction) :
     base(designation, designations, CommonRoomData, chunks, faction)
 {
 }
Esempio n. 5
0
        public ComponentManager(ComponentSaveData SaveData, WorldManager World)
        {
            this.World             = World;
            World.ComponentManager = this;
            Components             = new Dictionary <uint, GameComponent>();
            SaveData.SaveableComponents.RemoveAll(c => c == null);

            foreach (var component in SaveData.SaveableComponents)
            {
                Components.Add(component.GlobalID, component);
                component.World = World;
            }

            RootComponent = Components[SaveData.RootComponent] as GameComponent;

            foreach (var component in Components)
            {
                if (component.Value is MinimapIcon)
                {
                    MinimapIcons.Add(component.Value as MinimapIcon);
                }

                foreach (var system in World.UpdateSystems)
                {
                    system.ComponentCreated(component.Value);
                }
            }

            MaxGlobalID = Components.Aggregate <KeyValuePair <uint, GameComponent>, uint>(0, (current, component) => Math.Max(current, component.Value.GlobalID));

            foreach (var component in SaveData.SaveableComponents)
            {
                component.PostSerialization(this);
            }

            foreach (var component in SaveData.SaveableComponents)
            {
                component.ProcessTransformChange();
                component.CreateCosmeticChildren(this);
            }

            var removals = SaveData.SaveableComponents.Where(p => p.Parent == null && p != RootComponent).ToList();

            foreach (var component in removals)
            {
                Console.Error.WriteLine("Component {0} has no parent. removing.", component.Name);
                RemoveComponentImmediate(component);
                SaveData.SaveableComponents.Remove(component);
            }

            StartThreads();

            /*
             * foreach (var component in Components)
             * {
             *  if (component.Value.Parent != null && (!HasComponent(component.Value.Parent.GlobalID) || !component.Value.Parent.Children.Contains(component.Value)))
             *  {
             *      Console.Error.WriteLine("Component {0} parent: {1} is not in the list of components", component.Value.Name, component.Value.Parent.Name);
             *  }
             */
        }
 public override bool IsComplete(WorldManager World)
 {
     return(Des.Finished);
 }
Esempio n. 7
0
 public override void OnEnqueued(WorldManager World)
 {
     World.PersistentData.Designations.AddEntityDesignation(EntityToGather, DesignationType.Gather, null, this);
 }
Esempio n. 8
0
 public BuildWallTool(WorldManager World)
 {
     this.World = World;
 }
Esempio n. 9
0
 public static Room CreateRoom(Faction faction, string name, List <VoxelHandle> designations, bool blueprint, WorldManager world)
 {
     // TODO(mklingen): omg get rid of this horrible legacy function!
     if (name == BalloonPort.BalloonPortName)
     {
         return(blueprint ? new BalloonPort(faction, true, designations, world) : new BalloonPort(faction, designations, world));
     }
     else if (name == BedRoom.BedRoomName)
     {
         return(blueprint ? new BedRoom(true, designations, world, faction) : new BedRoom(designations, world, faction));
     }
     else if (name == CommonRoom.CommonRoomName)
     {
         return(blueprint ? new CommonRoom(true, designations, world, faction) : new CommonRoom(designations, world, faction));
     }
     else if (name == LibraryRoom.LibraryRoomName)
     {
         return(blueprint ? new LibraryRoom(true, designations, world, faction) : new LibraryRoom(designations, world, faction));
     }
     else if (name == TrainingRoom.TrainingRoomName)
     {
         return(blueprint ? new TrainingRoom(true, designations, world, faction) : new TrainingRoom(designations, world, faction));
     }
     else if (name == WorkshopRoom.WorkshopName)
     {
         return(blueprint ? new WorkshopRoom(true, designations, world, faction) : new WorkshopRoom(designations, world, faction));
     }
     else if (name == Kitchen.KitchenName)
     {
         return(blueprint ? new Kitchen(true, designations, world, faction) : new Kitchen(designations, world, faction));
     }
     else if (name == Stockpile.StockpileName)
     {
         Stockpile toBuild = new Stockpile(faction, world);
         foreach (var voxel in designations)
         {
             toBuild.AddVoxel(voxel);
         }
         return(toBuild);
     }
     else if (name == Graveyard.GraveyardName)
     {
         return(blueprint
             ? new Graveyard(faction, true, designations, world)
             : new Graveyard(faction, designations, world));
     }
     else if (name == AnimalPen.AnimalPenName)
     {
         return(blueprint
             ? new AnimalPen(true, designations, world, faction) :
                new AnimalPen(designations, world, faction));
     }
     else if (name == Treasury.TreasuryName)
     {
         Treasury toBuild = new Treasury(faction, world);
         foreach (var voxel in designations)
         {
             toBuild.AddVoxel(voxel);
         }
         return(toBuild);
     }
     else
     {
         return(null);
     }
 }
Esempio n. 10
0
 public Spell(WorldManager world)
 {
     World = world;
 }
Esempio n. 11
0
 private static PlayerTool _factory(WorldManager World)
 {
     return(new BuildWallTool(World));
 }
Esempio n. 12
0
 public WorkshopRoom(IEnumerable <Voxel> voxels, WorldManager chunks) :
     base(voxels, WorkshopRoomData, chunks)
 {
     OnBuilt();
 }
Esempio n. 13
0
 public WorkshopRoom(bool designation, IEnumerable <Voxel> designations, WorldManager chunks) :
     base(designation, designations, WorkshopRoomData, chunks)
 {
 }
Esempio n. 14
0
 public WrangleTool(WorldManager World)
 {
     this.World = World;
 }
Esempio n. 15
0
 public PlantTool(WorldManager World)
 {
     this.World = World;
 }
Esempio n. 16
0
        public static SpellTree CreateSpellTree(WorldManager world)
        {
            Texture2D icons = TextureManager.GetTexture(ContentPaths.GUI.icons);


            SpellTree toReturn = new SpellTree()
            {
                RootSpells = new List <SpellTree.Node>()
                {
                    new SpellTree.Node()
                    {
                        Spell            = new InspectSpell(world, InspectSpell.InspectType.InspectEntity),
                        ResearchProgress = 10.0f,
                        ResearchTime     = 10.0f,
                        Children         = new List <SpellTree.Node>()
                        {
                            new SpellTree.Node()
                            {
                                Spell = new BuffSpell(world,
                                                      new StatBuff(30.0f, new CreatureStats.StatNums()
                                {
                                    Dexterity    = 2.0f,
                                    Strength     = 2.0f,
                                    Wisdom       = 2.0f,
                                    Intelligence = 2.0f,
                                    Charisma     = 0.0f,
                                    Constitution = 0.0f,
                                    Size         = 0.0f
                                })
                                {
                                    Particles = "star_particle", SoundOnStart = ContentPaths.Audio.powerup, SoundOnEnd = ContentPaths.Audio.wurp
                                }
                                                      )
                                {
                                    Name        = "Minor Inspire",
                                    Description = "Makes the selected creatures work harder for 30 seconds (+2 to DEX, STR, INT and WIS)",
                                    Hint        = "Click and drag to select creatures"
                                },
                                ResearchProgress = 0.0f,
                                ResearchTime     = 30.0f,

                                Children = new List <SpellTree.Node>()
                                {
                                    new SpellTree.Node()
                                    {
                                        Spell = new BuffSpell(world,
                                                              new StatBuff(60.0f, new CreatureStats.StatNums()
                                        {
                                            Dexterity    = 5.0f,
                                            Strength     = 5.0f,
                                            Wisdom       = 5.0f,
                                            Intelligence = 5.0f,
                                            Charisma     = 0.0f,
                                            Constitution = 0.0f,
                                            Size         = 0.0f
                                        })
                                        {
                                            Particles = "star_particle", SoundOnStart = ContentPaths.Audio.powerup, SoundOnEnd = ContentPaths.Audio.wurp
                                        }
                                                              )
                                        {
                                            Name        = "Major Inspire",
                                            Description = "Makes the selected creatures work harder for 60 seconds (+5 to DEX, STR, INT and WIS)",
                                            Hint        = "Click and drag to select creatures"
                                        },
                                        Children = new List <SpellTree.Node>()
                                        {
                                            new SpellTree.Node()
                                            {
                                                Spell = new CreateEntitySpell(world, "Fairy", false)
                                                {
                                                    Name        = "Magic Helper",
                                                    Description = "Creates a magical helper employee who persists for 30 seconds",
                                                    Hint        = "Click to spawn a helper"
                                                },
                                                ResearchProgress = 0.0f,
                                                ResearchTime     = 150.0f
                                            }
                                        },
                                        ResearchProgress = 0.0f,
                                        ResearchTime     = 60.0f,
                                    },
                                    new SpellTree.Node()
                                    {
                                        Spell = new BuffSpell(world,
                                                              new ThoughtBuff(30.0f, Thought.ThoughtType.Magic)
                                        {
                                            SoundOnStart = ContentPaths.Audio.powerup
                                        })
                                        {
                                            Name        = "Minor Happiness",
                                            Description = "Makes the selected creatures happy for 30 seconds.",
                                            Hint        = "Click and drag to select creatures",
                                            Image       = new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 5, 2),
                                            TileRef     = 21
                                        },
                                        ResearchTime     = 60.0f,
                                        ResearchProgress = 0.0f,
                                        Children         = new List <SpellTree.Node>()
                                        {
                                            new SpellTree.Node()
                                            {
                                                Spell = new BuffSpell(world,
                                                                      new ThoughtBuff(60.0f, Thought.ThoughtType.Magic)
                                                {
                                                    SoundOnStart = ContentPaths.Audio.powerup
                                                })
                                                {
                                                    Name        = "Major Happiness",
                                                    Description = "Makes the selected creatures happy for 60 seconds.",
                                                    Hint        = "Click and drag to select creatures",
                                                    Image       = new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 5, 2),
                                                    TileRef     = 21
                                                },
                                                ResearchTime     = 120.0f,
                                                ResearchProgress = 0.0f
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    new SpellTree.Node()
                    {
                        Spell            = new InspectSpell(world, InspectSpell.InspectType.InspectBlock),
                        ResearchProgress = 25.0f,
                        ResearchTime     = 25.0f,
                        Children         = new List <SpellTree.Node>()
                        {
                            new SpellTree.Node()
                            {
                                Spell            = new PlaceBlockSpell(world, "Dirt", false),
                                ResearchProgress = 0.0f,
                                ResearchTime     = 50.0f,

                                Children = new List <SpellTree.Node>()
                                {
                                    new SpellTree.Node()
                                    {
                                        ResearchProgress = 0.0f,
                                        ResearchTime     = 100.0f,
                                        Spell            = new PlaceBlockSpell(world, "Stone", false),

                                        Children = new List <SpellTree.Node>()
                                        {
                                            new SpellTree.Node()
                                            {
                                                ResearchProgress = 0.0f,
                                                ResearchTime     = 150.0f,
                                                Spell            = new DestroyBlockSpell(world)
                                            }
                                        }
                                    }
                                }
                            },
                            new SpellTree.Node()
                            {
                                Spell = new PlaceBlockSpell(world, "Magic", false)
                                {
                                    Image       = new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 2, 3),
                                    Description = "Creates a temporary magic wall.",
                                    TileRef     = 26
                                },
                                ResearchProgress = 0.0f,
                                ResearchTime     = 50.0f,

                                Children = new List <SpellTree.Node>()
                                {
                                    new SpellTree.Node()
                                    {
                                        ResearchProgress = 0.0f,
                                        ResearchTime     = 100.0f,
                                        Spell            = new PlaceBlockSpell(world, "Iron", true),
                                        Children         = new List <SpellTree.Node>()
                                        {
                                            new SpellTree.Node()
                                            {
                                                ResearchProgress = 0.0f,
                                                ResearchTime     = 150.0f,
                                                Spell            = new PlaceBlockSpell(world, "Gold", true)
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    new SpellTree.Node()
                    {
                        Spell = new BuffSpell(world, new OngoingHealBuff(2, 10)
                        {
                            Particles = "heart", SoundOnStart = ContentPaths.Audio.powerup, SoundOnEnd = ContentPaths.Audio.wurp
                        })
                        {
                            Name        = "Minor Heal",
                            Description = "Heals 2 damage per second for 10 seconds",
                            Hint        = "Click and drag to select creatures",
                            Image       = new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 3, 2),
                            TileRef     = 19
                        },
                        ResearchProgress = 0.0f,
                        ResearchTime     = 30.0f,
                        Children         = new List <SpellTree.Node>()
                        {
                            new SpellTree.Node()
                            {
                                Spell = new BuffSpell(world, new OngoingHealBuff(5, 10)
                                {
                                    Particles = "heart", SoundOnStart = ContentPaths.Audio.powerup, SoundOnEnd = ContentPaths.Audio.wurp
                                })
                                {
                                    Name        = "Major Heal",
                                    Description = "Heals 5 damage per second for 10 seconds",
                                    Hint        = "Click and drag to select creatures",
                                    Image       = new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 3, 2),
                                    TileRef     = 19
                                },
                                ResearchProgress = 0.0f,
                                ResearchTime     = 150.0f
                            }
                        }
                    }
                }
            };


            foreach (SpellTree.Node spell in toReturn.RootSpells)
            {
                spell.SetupParentsRecursive();
            }

            return(toReturn);
        }
Esempio n. 17
0
 public override void OnDequeued(WorldManager World)
 {
 }
Esempio n. 18
0
 private static Zone _factory(String ZoneTypeName, WorldManager World)
 {
     return(new Stockpile(ZoneTypeName, World));
 }
Esempio n. 19
0
 public override bool IsComplete(WorldManager World)
 {
     return(EntityToGather == null || !EntityToGather.Active || EntityToGather.IsDead);
 }
Esempio n. 20
0
 public virtual void OnUpdate(WorldManager World)
 {
 }
Esempio n. 21
0
 public override void OnDequeued(WorldManager World)
 {
     World.PersistentData.Designations.RemoveEntityDesignation(EntityToGather, DesignationType.Gather);
 }
Esempio n. 22
0
 public virtual void OnCancelled(TaskManager Manager, WorldManager World)
 {
 }
Esempio n. 23
0
 public CommonRoom(IEnumerable <VoxelHandle> voxels, WorldManager chunks, Faction faction) :
     base(voxels, CommonRoomData, chunks, faction)
 {
     OnBuilt();
 }
Esempio n. 24
0
 public virtual bool IsComplete(WorldManager World)
 {
     return(false);
 }
Esempio n. 25
0
 public ComponentManager(WorldManager state)
 {
     World      = state;
     Components = new Dictionary <uint, GameComponent>();
     StartThreads();
 }
Esempio n. 26
0
 public virtual void OnDequeued(WorldManager World)
 {
 }
Esempio n. 27
0
 private static PlayerTool _factory(WorldManager World)
 {
     return(new GatherTool(World));
 }
Esempio n. 28
0
 private static Room _factory(RoomData Data, Faction Faction, WorldManager World)
 {
     return(new Treasury(Data, Faction, World));
 }
Esempio n. 29
0
 public Room(bool designation, IEnumerable <Voxel> designations, RoomData data, WorldManager world) :
     base(data.Name + " " + Counter, world)
 {
     RoomData        = data;
     ReplacementType = VoxelLibrary.GetVoxelType(RoomData.FloorType);
     Counter++;
     Designations = designations.ToList();
     IsBuilt      = false;
 }
Esempio n. 30
0
 private static Zone _factory(ZoneType Data, WorldManager World)
 {
     return(new AnimalPen(Data, World));
 }