public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!((CommandSender)sender).CheckPermission("fctrl.killzone"))
            {
                response = "Access denied.";
                return(false);
            }
            if (arguments.Count() < 1)
            {
                response = "Invalid format. Must be: \"killzone light/heavy/entrance/surface (eg. killzone light)";
                return(false);
            }
            if (arguments.At(0).ToLower() != "light" && arguments.At(0).ToLower() != "heavy" && arguments.At(0).ToLower() != "entrance" && arguments.At(0).ToLower() != "surface")
            {
                response = "First argument must be light, heavy, entrance, or surface";
                return(false);
            }
            ZoneType zone        = (arguments.At(0).ToLower() == "light" ? ZoneType.LightContainment : (arguments.At(0).ToLower() == "heavy" ? ZoneType.HeavyContainment : (arguments.At(0).ToLower() == "entrance" ? ZoneType.Entrance : (arguments.At(0).ToLower() == "surface" ? ZoneType.Surface : ZoneType.Unspecified))));
            int      totalKilled = 0;

            foreach (Player Ply in Player.List)
            {
                if (Ply.CurrentRoom.Zone == zone && !Ply.IsGodModeEnabled)
                {
                    Ply.Hurt(99999, DamageTypes.Wall, "ZONEKILL");
                    totalKilled++;
                }
            }
            response = $"Killed {totalKilled} players in {zone.ToString()}";
            return(true);
        }
Exemple #2
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!((CommandSender)sender).CheckPermission("fctrl.zones"))
            {
                response = "Access denied.";
                return(false);
            }
            if (arguments.Count() < 1)
            {
                response = "Invalid format. Must be: \"blackoutzone light/heavy/entrance\" (eg. closezone light)";
                return(false);
            }
            if (arguments.At(0).ToLower() != "light" && arguments.At(0).ToLower() != "heavy" && arguments.At(0).ToLower() != "entrance")
            {
                response = "First argument must be light, heavy, or entrance";
                return(false);
            }
            ZoneType zone = (arguments.At(0).ToLower() == "light" ? ZoneType.LightContainment : (arguments.At(0).ToLower() == "heavy" ? ZoneType.HeavyContainment : (arguments.At(0).ToLower() == "entrance" ? ZoneType.Entrance : ZoneType.Unspecified)));

            foreach (Room r in Map.Rooms)
            {
                if (r.Zone == zone)
                {
                    foreach (Door d in r.Doors)
                    {
                        d.SetStateWithSound(false);
                    }
                }
            }
            response = $"Successfully closed all the doors in {zone.ToString()}";
            return(true);
        }
Exemple #3
0
        // Detect the relevant MapEntry on the cell
        // Information gathered here is used both for building the overlay legend and actually highlighting the objects
        public static void ProcessCell(int cell)
        {
            GameObject building   = Grid.Objects[cell, (int)ObjectLayer.Building];
            GameObject pickupable = Grid.Objects[cell, (int)ObjectLayer.Pickupables];

            if (IsCurrentFilter(FilterGeysers) && building != null && IsGeyserRevealed(cell) && building.GetComponent <Geyser>() != null)
            {
                UpdateMapEntry(building, building.GetComponent <Geyser>().configuration.GetElement());
            }
            else if (IsCurrentFilter(FilterGeysers) && building != null && IsGeyserRevealed(cell) && building.HasTag(GameTags.OilWell))
            {
                UpdateMapEntry(building, SimHashes.CrudeOil);
            }
            else if (IsCurrentFilter(FilterBuildings) && building != null && BuildingList.Contains(building.name))
            {
                UpdateMapEntry(building);
            }
            else if (IsCurrentFilter(FilterCritters) && pickupable != null && pickupable.HasTag(GameTags.Creature))
            {
                UpdateMapEntry(pickupable);
            }
            else if (IsCurrentFilter(FilterPlants) && building != null && building.HasTag(GameTags.Plant))
            {
                UpdateMapEntry(building);
            }
            else if (IsCurrentFilter(FilterBiomes))
            {
                ZoneType biome = World.Instance.zoneRenderData.worldZoneTypes[cell];
                UpdateMapEntry(biome.ToString(), GetName(biome), biome);
            }
        }
Exemple #4
0
        public void Add(ZoneType zone, Card card)
        {
            switch (zone)
            {
            case ZoneType.Hand:
                _hand.Add(card);
                break;

            case ZoneType.BattleField:
                _battlefield.Add(card);
                break;

            default:
                throw new ArgumentOutOfRangeException(zone.ToString(), zone, null);
            }
        }
Exemple #5
0
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!((CommandSender)sender).CheckPermission("fctrl.zones"))
            {
                response = "Access denied.";
                return(false);
            }
            if (arguments.Count() < 2)
            {
                response = "Invalid format. Must be: \"closezone light/heavy/entrance duration (eg. closezone light 5)";
                return(false);
            }
            if (arguments.At(0).ToLower() != "light" && arguments.At(0).ToLower() != "heavy" && arguments.At(0).ToLower() != "entrance")
            {
                response = "First argument must be light, heavy, or entrance";
                return(false);
            }
            ZoneType zone = (arguments.At(0).ToLower() == "light" ? ZoneType.LightContainment : (arguments.At(0).ToLower() == "heavy" ? ZoneType.HeavyContainment : (arguments.At(0).ToLower() == "entrance" ? ZoneType.Entrance : ZoneType.Unspecified)));
            int      length;

            try
            {
                length = Convert.ToInt32(arguments.At(1));
            }
            catch
            {
                response = "Second argument must be a valid number (duration)";
                return(false);
            }
            foreach (Room r in Map.Rooms)
            {
                if (r.Zone == zone)
                {
                    foreach (Door d in r.Doors)
                    {
                        d.SetLock(true);
                        d.SetState(false);
                        Timing.CallDelayed(length, () =>
                        {
                            d.SetLock(false);
                        });
                    }
                }
            }
            response = $"Successfully locked all doors in {zone.ToString()}";
            return(true);
        }
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!((CommandSender)sender).CheckPermission("fctrl.zones"))
            {
                response = "Access denied.";
                return(false);
            }
            if (arguments.Count() < 2)
            {
                response = "Invalid format. Must be: \"blackoutzone light/heavy/entrance duration (eg. blackoutzone light 5)";
                return(false);
            }
            if (arguments.At(0).ToLower() != "light" && arguments.At(0).ToLower() != "heavy" && arguments.At(0).ToLower() != "entrance")
            {
                response = "First argument must be light, heavy, or entrance";
                return(false);
            }
            ZoneType zone = (arguments.At(0).ToLower() == "light" ? ZoneType.LightContainment : (arguments.At(0).ToLower() == "heavy" ? ZoneType.HeavyContainment : (arguments.At(0).ToLower() == "entrance" ? ZoneType.Entrance : ZoneType.Unspecified)));
            int      length;

            try
            {
                length = Convert.ToInt32(arguments.At(1));
            }
            catch
            {
                response = "Second argument must be a valid number (duration)";
                return(false);
            }
            foreach (Room r in Map.Rooms)
            {
                if (r.Zone == zone)
                {
                    r.TurnOffLights(length);
                }
            }
            FacilityControl.LightsOut[zone] = true;
            Timing.CallDelayed((float)length, () =>
            {
                FacilityControl.LightsOut[zone] = false;
            });
            response = $"Successfully blacked out all lights in {zone.ToString()}";
            return(true);
        }
        public bool Execute(ArraySegment <string> arguments, ICommandSender sender, out string response)
        {
            if (!((CommandSender)sender).CheckPermission("fctrl.zones"))
            {
                response = "Access denied.";
                return(false);
            }
            if (arguments.Count() < 2)
            {
                response = "Invalid format. Must be: \"isolate light/heavy/entrance duration (eg. isolate light 5)";
                return(false);
            }
            if (arguments.At(0).ToLower() != "light" && arguments.At(0).ToLower() != "heavy" && arguments.At(0).ToLower() != "entrance" && arguments.At(0).ToLower() != "facility")
            {
                response = "First argument must be light, heavy, entrance, or facility";
                return(false);
            }
            ZoneType zone = (arguments.At(0).ToLower() == "light" ? ZoneType.LightContainment : (arguments.At(0).ToLower() == "heavy" ? ZoneType.HeavyContainment : (arguments.At(0).ToLower() == "entrance" ? ZoneType.Entrance : (arguments.At(0).ToLower() == "facility" ? ZoneType.Surface : ZoneType.Unspecified))));
            int      length;

            try
            {
                length = Convert.ToInt32(arguments.At(1));
            }
            catch
            {
                response = "Second argument must be a valid number (duration)";
                return(false);
            }
            List <Door> doors = new List <Door> {
            };

            switch (zone)
            {
            case ZoneType.LightContainment:
                doors = Map.Doors.ToList().FindAll(door => door.DoorName == "CHECKPOINT_LCZ_A" || door.DoorName == "CHECKPOINT_LCZ_B");
                break;

            case ZoneType.HeavyContainment:
                doors = Map.Doors.ToList().FindAll(door => door.DoorName == "CHECKPOINT_LCZ_A" || door.DoorName == "CHECKPOINT_LCZ_B" || door.DoorName == "CHECKPOINT_ENT");
                break;

            case ZoneType.Entrance:
                doors = Map.Doors.ToList().FindAll(door => door.DoorName == "GATE_A" || door.DoorName == "GATE_B" || door.DoorName == "CHECKPOINT_ENT");
                break;

            case ZoneType.Surface:
                doors = Map.Doors.ToList().FindAll(door => door.DoorName == "GATE_A" || door.DoorName == "GATE_B");
                break;
            }
            foreach (Door door in doors)
            {
                door.SetStateWithSound(false);
                door.SetLock(true);
            }
            Timing.CallDelayed(length, () =>
            {
                foreach (Door door in doors)
                {
                    door.SetLock(false);
                }
            });
            response = $"Successfully isolated {(zone == ZoneType.Surface ? "the facility" : zone.ToString())}";
            return(true);
        }
Exemple #8
0
        public override string ToString()
        {
            var list = GeneralDescription().ToList();

            return(PlayerInfo["Name"] + " " + string.Join(" ", list.Select(value => value + " " + PlayerInfo[value])) + " " + PreferredZone.ToString());
        }
Exemple #9
0
 //Triggers an event twice, once with zonetype information as a prefix.
 public static void TriggerTypeZoneEvent(ZoneType type, string eventName)
 {
     TriggerZoneEvent(eventName);
     TriggerZoneEvent(type.ToString() + ":" + eventName);
 }
Exemple #10
0
        /// <summary>
        /// Creates all zones or ensures their consistency between different managers using those.
        /// </summary>
        /// <param name="config">The configuration to use for creating the zones.</param>
        internal void CreateOrEnsureZones(CacheConfiguration config)
        {
            // Check whether this was already done
            if (_config != null)
            {
                // --> Ensure compatibility
                if (!_config.Match(config))
                {
                    throw new ArgumentException("Incompatible cache configurations: " + _config.ToString() + " vs. " + config.ToString());
                }
            }
            else
            {
                // Init
                _config = config;
                List <ZoneType> zoneTypes = new List <ZoneType>()
                {
                    ZoneType.Cache, ZoneType.Dropoff
                };
                UnzonedStorageLocations = Instance.Waypoints.Where(w => w.PodStorageLocation).ToHashSet();
                CachePartitions         = new VolatileIDDictionary <OutputStation, HashSet <Waypoint> >(Instance.OutputStations.Select(s =>
                                                                                                                                       new VolatileKeyValuePair <OutputStation, HashSet <Waypoint> >(s, new HashSet <Waypoint>())).ToList());
                int cacheWPCountPerStation = (int)Math.Ceiling(UnzonedStorageLocations.Count * _config.CacheFraction / Instance.OutputStations.Count);
                DropoffPartitions = new VolatileIDDictionary <OutputStation, HashSet <Waypoint> >(Instance.OutputStations.Select(s =>
                                                                                                                                 new VolatileKeyValuePair <OutputStation, HashSet <Waypoint> >(s, new HashSet <Waypoint>())).ToList());
                int dropoffWPCountPerStation = _config.DropoffCount;
                // Init selector
                BestCandidateSelector scorer = new BestCandidateSelector(false,
                                                                         // First adhere to preference between zone types
                                                                         () =>
                {
                    switch (_config.ZonePriority)
                    {
                    case ZonePriority.CacheFirst: return(_currentZoneType == ZoneType.Cache ? 0 : 1);

                    case ZonePriority.DropoffFirst: return(_currentZoneType == ZoneType.Dropoff ? 0 : 1);

                    case ZonePriority.CacheDropoffEqual: return(0);

                    default: throw new ArgumentException("Unknown priority: " + _config.ZonePriority);
                    }
                },
                                                                         // Then assess the main distance metric
                                                                         () =>
                {
                    switch (_currentZoneType)
                    {
                    case ZoneType.Cache: return(Distances.CalculateShortestTimePathPodSafe(_currentStorageLocation, _currentStation.Waypoint, Instance));

                    case ZoneType.Dropoff: return(Distances.CalculateShortestTimePathPodSafe(_currentStation.Waypoint, _currentStorageLocation, Instance));

                    default: throw new ArgumentException("Unknown zone type for partitioning: " + _currentZoneType.ToString());
                    }
                },
                                                                         // Break ties based on the value for the other zone
                                                                         () =>
                {
                    switch (_currentZoneType)
                    {
                    case ZoneType.Cache: return(-Distances.CalculateShortestTimePathPodSafe(_currentStation.Waypoint, _currentStorageLocation, Instance));

                    case ZoneType.Dropoff: return(-Distances.CalculateShortestTimePathPodSafe(_currentStorageLocation, _currentStation.Waypoint, Instance));

                    default: throw new ArgumentException("Unknown zone type for partitioning: " + _currentZoneType.ToString());
                    }
                });

                // --> Create partitions
                // Assign storage locations to different zones
                while ( // Check for any remaining assignments
                    CachePartitions.Values.Any(p => p.Count < cacheWPCountPerStation) ||
                    DropoffPartitions.Values.Any(p => p.Count < dropoffWPCountPerStation))
                {
                    // Search for next assignment
                    scorer.Recycle();
                    OutputStation bestStation         = null;
                    Waypoint      bestStorageLocation = null;
                    ZoneType      bestZoneType        = ZoneType.None;
                    // Check all unzoned storage locations
                    foreach (var storageLocation in UnzonedStorageLocations)
                    {
                        _currentStorageLocation = storageLocation;
                        // Check all stations
                        foreach (var station in Instance.OutputStations)
                        {
                            _currentStation = station;
                            // Check all types
                            foreach (var zoneType in zoneTypes)
                            {
                                _currentZoneType = zoneType;
                                // Skip invalid assignments
                                if (zoneType == ZoneType.Cache && CachePartitions[station].Count >= cacheWPCountPerStation)
                                {
                                    continue;
                                }
                                if (zoneType == ZoneType.Dropoff && DropoffPartitions[station].Count >= dropoffWPCountPerStation)
                                {
                                    continue;
                                }
                                // Determine score and update assignment
                                if (scorer.Reassess())
                                {
                                    bestStation         = _currentStation;
                                    bestStorageLocation = _currentStorageLocation;
                                    bestZoneType        = _currentZoneType;
                                }
                            }
                        }
                    }
                    // Sanity check
                    if (bestStation == null)
                    {
                        throw new InvalidOperationException("Ran out of available assignments while partitioning the caches - partitions so far: " +
                                                            "Cache: " + string.Join(",", CachePartitions.Select(p => p.Key.ToString() + "(" + p.Value.Count + ")")) +
                                                            "Dropoff: " + string.Join(",", DropoffPartitions.Select(p => p.Key.ToString() + "(" + p.Value.Count + ")")));
                    }
                    // Set assignment
                    switch (bestZoneType)
                    {
                    case ZoneType.Cache:
                        CachePartitions[bestStation].Add(bestStorageLocation);
                        bestStorageLocation.InfoTagCache = ZoneType.Cache;
                        break;

                    case ZoneType.Dropoff:
                        DropoffPartitions[bestStation].Add(bestStorageLocation);
                        bestStorageLocation.InfoTagCache = ZoneType.Dropoff;
                        break;

                    default: throw new InvalidOperationException("Invalid zone determined: " + bestZoneType);
                    }
                    UnzonedStorageLocations.Remove(bestStorageLocation);
                }
            }
        }
Exemple #11
0
 protected BaseZone(int size, ZoneType type)
 {
     Type     = type;
     Size     = size;
     ZoneName = type.ToString();
 }