Skip to content

Commit

Permalink
final enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
JustMarfix committed Jul 27, 2024
1 parent cd8555c commit 107017d
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 7 deletions.
80 changes: 74 additions & 6 deletions Commands/ChaosMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class ChaosMode : ICommand
public string[] Aliases => new string[] { };
public string Description => "Для FX. Включает режим хаоса для конкретной комнаты / для всего комплекса.";
public bool SanitizeResponse => false;
public string[] Zones => new[] { "LCZ", "HCZ", "EZ", "SFC" };

public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
{
Expand All @@ -24,7 +25,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
}
if (arguments.Count < 1)
{
response = "Использование: chaosmode <list(l)/set(s)/unset(u)> [комнаты через пробел / all]";
response = "Использование: chaosmode <list(l)/set(s)/unset(u)> [комнаты через пробел / all / LCZ/HCZ/EZ/SFC]";
return false;
}
var args = arguments.ToArray();
Expand All @@ -45,7 +46,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
{
if (arguments.Count < 2)
{
response = "Использование: chaosmode set <комнаты через пробел / all>";
response = "Использование: chaosmode set <комнаты через пробел / all / LCZ/HCZ/EZ/SFC>";
return false;
}

Expand All @@ -62,12 +63,47 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
}
}
}
else if (roomName.In(Zones) && arguments.Count == 2)
{
ZoneType zone;
switch (roomName)
{
case "HCZ":
{
zone = ZoneType.HeavyContainment;
break;
}
case "LCZ":
{
zone = ZoneType.LightContainment;
break;
}
case "EZ":
{
zone = ZoneType.Entrance;
break;
}
default:
{
zone = ZoneType.Surface;
break;
}
}
foreach (var room in Room.List.Where(p => p.Zone == zone))
{
room.Color = Color.red;
if (!room.Type.In(VeryUsualDay.Instance.ChaosRooms.ToArray()))
{
VeryUsualDay.Instance.ChaosRooms.Add(room.Type);
}
}
}
else
{
var rooms = Room.Get(p => p.Type.ToString() == roomName).ToArray();
if (!rooms.Any())
{
response = "Использование: chaosmode set <комнаты через пробел / all>. Список комнат - chaosmode list.";
response = "Использование: chaosmode set <комнаты через пробел / all / LCZ/HCZ/EZ/SFC>. Список комнат - chaosmode list.";
return false;
}
rooms[0].Color = Color.red;
Expand All @@ -86,7 +122,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
{
if (arguments.Count < 2)
{
response = "Использование: chaosmode unset <комнаты через пробел / all>";
response = "Использование: chaosmode unset <комнаты через пробел / all / LCZ/HCZ/EZ/SFC>";
return false;
}

Expand All @@ -100,12 +136,44 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
VeryUsualDay.Instance.ChaosRooms.Clear();
}
}
else if (roomName.In(Zones) && arguments.Count == 2)
{
ZoneType zone;
switch (roomName)
{
case "HCZ":
{
zone = ZoneType.HeavyContainment;
break;
}
case "LCZ":
{
zone = ZoneType.LightContainment;
break;
}
case "EZ":
{
zone = ZoneType.Entrance;
break;
}
default:
{
zone = ZoneType.Surface;
break;
}
}
foreach (var room in Room.List.Where(p => p.Zone == zone))
{
room.ResetColor();
VeryUsualDay.Instance.ChaosRooms.Remove(room.Type);
}
}
else
{
var rooms = Room.Get(p => p.Name == roomName).ToArray();
if (!rooms.Any())
{
response = "Использование: chaosmode unset <комнаты через пробел / all>. Список комнат - chaosmode list.";
response = "Использование: chaosmode unset <комнаты через пробел / all / LCZ/HCZ/EZ/SFC>. Список комнат - chaosmode list.";
return false;
}
rooms[0].ResetColor();
Expand All @@ -117,7 +185,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
return true;
}

response = "Использование: chaosmode <list(l)/set(s)/unset(u)> [комнаты через пробел / all]";
response = "Использование: chaosmode <list(l)/set(s)/unset(u)> [комнаты через пробел / all / LCZ/HCZ/EZ/SFC]";
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion VeryUsualDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public IEnumerator<float> _chaos()
foreach (var roomType in ChaosRooms)
{
var room = Room.Get(roomType);
foreach (var door in room.Doors.Where(p => !p.IsElevator && !p.IsGate && !p.IsKeycardDoor).Shuffle())
foreach (var door in room.Doors.Where(p => !p.IsElevator && !p.IsGate && !p.IsKeycardDoor && !p.IsLocked).Shuffle())
{
Timing.CallDelayed(Random.Range(0f, 1.5f), () =>
{
Expand Down

0 comments on commit 107017d

Please sign in to comment.