Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions EXILED/Exiled.API/Enums/RoomType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,35 @@
/// Heavy Containment Zone's storage / server room.
/// </summary>
HczServerRoom,

Check failure on line 341 in EXILED/Exiled.API/Enums/RoomType.cs

View workflow job for this annotation

GitHub Actions / build

/// <summary>
/// Surface Elevator to Entrance room.
/// </summary>
SurfaceToEntranceElevator,

Check failure on line 346 in EXILED/Exiled.API/Enums/RoomType.cs

View workflow job for this annotation

GitHub Actions / build

/// <summary>
/// Entrance Elevator to Surface room.
/// </summary>
EntranceToSurfaceElevator,
/// <summary>

Check failure on line 351 in EXILED/Exiled.API/Enums/RoomType.cs

View workflow job for this annotation

GitHub Actions / build

Element documentation header should be preceded by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1514.md)
/// Lcz Elevator to Hcz room.
/// </summary>
LczToHczElevator,

Check failure on line 355 in EXILED/Exiled.API/Enums/RoomType.cs

View workflow job for this annotation

GitHub Actions / build

/// <summary>
/// Hcz Elevator to Lcz room.
/// </summary>
HczToLczElevator,

Check failure on line 360 in EXILED/Exiled.API/Enums/RoomType.cs

View workflow job for this annotation

GitHub Actions / build

/// <summary>
/// Hcz Elevator to Nuke room.
/// </summary>
HczToNukeElevator,

Check failure on line 365 in EXILED/Exiled.API/Enums/RoomType.cs

View workflow job for this annotation

GitHub Actions / build

/// <summary>
/// Nuke Elevator to Hcz room.
/// </summary>
NukeToHczElevator,

}

Check failure on line 371 in EXILED/Exiled.API/Enums/RoomType.cs

View workflow job for this annotation

GitHub Actions / build

}
5 changes: 5 additions & 0 deletions EXILED/Exiled.API/Enums/ZoneType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,10 @@
/// An unknown type of zone.
/// </summary>
Other = 32,

Check failure on line 63 in EXILED/Exiled.API/Enums/ZoneType.cs

View workflow job for this annotation

GitHub Actions / build

/// <summary>
/// Nuke Zone
/// </summary>
Nuke = 64,
}
}
13 changes: 12 additions & 1 deletion EXILED/Exiled.API/Exiled.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,18 @@
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<PostBuildEvent>if not "$(EXILED_DEV_PLUGINAPI_REFERENCE)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_PLUGINAPI_REFERENCE)\dependencies\" &amp;&amp; if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\dependencies\"</PostBuildEvent>
<PostBuildEvent>
if not "$(EXILED_DEV_PLUGINAPI_REFERENCE)"=="" (
copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_PLUGINAPI_REFERENCE)\dependencies\"
)
if not "$(EXILED_DEV_REFERENCES)"=="" (
copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\dependencies\"
)
if not "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)"=="" (
if not exist "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)\dependencies\global" mkdir "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)\dependencies\global"
copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)\dependencies\global\"
)
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Unix' ">
<PostBuildEvent>if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/dependencies/"; fi</PostBuildEvent>
Expand Down
110 changes: 108 additions & 2 deletions EXILED/Exiled.API/Features/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,25 @@
/// <summary>
/// Gets the <see cref="ZoneType"/> in which the room is located.
/// </summary>
public ZoneType Zone { get; private set; } = ZoneType.Unspecified;
public ZoneType ZoneValue = ZoneType.Unspecified;

Check failure on line 70 in EXILED/Exiled.API/Features/Room.cs

View workflow job for this annotation

GitHub Actions / build

Check failure on line 70 in EXILED/Exiled.API/Features/Room.cs

View workflow job for this annotation

GitHub Actions / build

private bool isLift = false;

/// <summary>
/// Gets the <see cref="ZoneType"/> in which the room is located.
/// </summary>
public ZoneType Zone
{
get
{
if (!isLift)
{
return ZoneValue;
}
LiftLocationIdentifier();
return ZoneValue;
}
private set => ZoneValue = value;
}

/// <summary>
/// Gets the <see cref="MapGeneration.RoomName"/> enum representing this room.
Expand Down Expand Up @@ -301,8 +319,29 @@
room = FindParentRoom(role.Camera.GameObject);
}

// Is it a lift? If so.. here we go.
Lift lift = Lift.Get(objectInRoom.transform.position);
if (lift == null)
{
return room ?? Get(objectInRoom.transform.position);
}

room = lift.GameObject.GetComponent<Room>();
if (room == null)
{
lift.GameObject.AddComponent<RoomIdentifier>();
if (RoomIdentifierToRoom.TryGetValue(lift.GameObject.GetComponent<RoomIdentifier>(), out Room currentRoom))
{
return currentRoom;
}
}
else
{
room.LiftLocationIdentifier();
}

// Finally, try for objects that aren't children, like players and pickups.
return room ?? Get(objectInRoom.transform.position) ?? default;
return room ?? Get(objectInRoom.transform.position);
}

/// <summary>
Expand Down Expand Up @@ -424,12 +463,17 @@
Zone = Identifier.Zone.GetZone();
#if DEBUG
if (Zone is ZoneType.Unspecified)
{
Log.Error($"[ZONETYPE UNKNOWN] {this} Zone : {Identifier?.Zone}");
}
#endif
Type = FindType(gameObject);
#if DEBUG
if (Type is RoomType.Unknown)
{
Log.Error($"[ROOMTYPE UNKNOWN] {this} Name : {gameObject?.name} Shape : {Identifier?.Shape}");
LiftLocationIdentifier();
}
#endif

RoomLightControllers = RoomLightControllersValue.AsReadOnly();
Expand All @@ -451,6 +495,68 @@
Cameras = CamerasValue.AsReadOnly();
}

private void LiftLocationIdentifier()
{
float currentHeight = gameObject.transform.position.y;
if (gameObject.name.Contains("ElevatorChamber Gates"))
{
// 53, 294, -30 - surface 300 > pos > 290
// 174, -99, 17 - entrance 90 < pos > 110
// lcz - 100 - lcz -101 > pos > -80

switch (currentHeight)
{
case > 290 and < 300:
Type = RoomType.SurfaceToEntranceElevator;
Zone = ZoneType.Surface;
break;
case > -101 and < -80:
Type = RoomType.EntranceToSurfaceElevator;
Zone = ZoneType.Entrance;
break;
}
isLift = true;
}
else if (gameObject.name.Contains("ElevatorChamberNuke"))
{
// 53, 294, -30 - surface 300 > pos > 290
// 174, -99, 17 - entrance 90 < pos > 110
// lcz - 100 - lcz -101 > pos > -80

switch (currentHeight)
{
case > -180 and < -140:
Type = RoomType.NukeToHczElevator;
Zone = ZoneType.Nuke;
break;
case > -141 and < -90:
Type = RoomType.HczToNukeElevator;
Zone = ZoneType.HeavyContainment;
break;
}
isLift = true;
}
else if (gameObject.name.Contains("ElevatorChamber"))
{

switch (currentHeight)
{
// //53, 294, -30 - surface 300 > pos > 290
// //174, -99, 17 - entrance 90 < pos > 110
// //lcz - 100 - lcz -101 > pos > -80
case > 70 and < 110:
Type = RoomType.LczToHczElevator;
Zone = ZoneType.LightContainment;
break;
case > -101 and < -80:
Type = RoomType.HczToLczElevator;
Zone = ZoneType.HeavyContainment;
break;
}
isLift = true;
}
}

private static RoomType FindType(GameObject gameObject)
{
// Try to remove brackets if they exist.
Expand Down
Loading