public override void Apply(Simulation Sim)
        {
            var cell = Sim.World.CellAt(Location);

            if (cell.Block == null)
            {
                Result = MutationResult.Failure;
                return;
            }

            if (cell.PresentActor != null || (!Task.NoGnomesInArea(Sim, Location)))
            {
                Result = MutationResult.Failure;
                return;
            }

            if (cell.Resources.Count != 0)
            {
                Result = MutationResult.Failure;
                return;
            }

            if (cell.Block.MineResources != null) cell.Resources = new List<String>(cell.Block.MineResources);
            cell.Block = null;

            if (cell.Resources.Count > 0)
            {
                Gnome.CarriedResource = cell.Resources[0];
                cell.Resources.RemoveAt(0);
            }

            Sim.SetUpdateFlag(Location);

            Result = MutationResult.Success;
        }
Exemple #2
0
 public override void Apply(Simulation Sim, WorldSceneNode WorldNode)
 {
     if (Sim.World.Check(WorldNode.HoverBlock))
     {
         var cell = Sim.World.CellAt(WorldNode.HoverBlock);
         cell.SetFlag(CellFlags.Storehouse, true);
         Sim.SetUpdateFlag(WorldNode.HoverBlock);
     }
 }