From 8b1a496e5320246b159c629a50eeda22cb0403c5 Mon Sep 17 00:00:00 2001 From: Undid-Iridium <24619207+Undid-Iridium@users.noreply.github.com> Date: Sat, 31 May 2025 13:22:43 -0400 Subject: [PATCH 1/4] maybe --- EXILED/Exiled.API/Features/Room.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs index e5bcc9c0d5..d6f3548dfc 100644 --- a/EXILED/Exiled.API/Features/Room.cs +++ b/EXILED/Exiled.API/Features/Room.cs @@ -301,8 +301,19 @@ public static Room FindParentRoom(GameObject objectInRoom) room = FindParentRoom(role.Camera.GameObject); } + Lift lift = Lift.Get(objectInRoom.transform.position); + if (lift != null) + { + Room componentInParent = lift.GameObject.GetComponent(); + if (componentInParent == null) + { + CreateComponent(lift.GameObject); + } + room = lift.GameObject.GetComponent(); + } + // 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); } /// From 76f27ea16c7c0cda33afe0a8c71e543c92ef0b5e Mon Sep 17 00:00:00 2001 From: Undid-Iridium <24619207+Undid-Iridium@users.noreply.github.com> Date: Sun, 1 Jun 2025 02:45:48 -0400 Subject: [PATCH 2/4] Idk --- EXILED/Exiled.API/Features/Room.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs index d6f3548dfc..b6aba3e0e3 100644 --- a/EXILED/Exiled.API/Features/Room.cs +++ b/EXILED/Exiled.API/Features/Room.cs @@ -304,12 +304,13 @@ public static Room FindParentRoom(GameObject objectInRoom) Lift lift = Lift.Get(objectInRoom.transform.position); if (lift != null) { - Room componentInParent = lift.GameObject.GetComponent(); - if (componentInParent == null) + room = lift.GameObject.GetComponent(); + if (room == null) { CreateComponent(lift.GameObject); + room = lift.GameObject.GetComponent(); } - room = lift.GameObject.GetComponent(); + } // Finally, try for objects that aren't children, like players and pickups. From dc8628cb02960a525af564fc9fc2869abb1e4712 Mon Sep 17 00:00:00 2001 From: Undid-Iridium <24619207+Undid-Iridium@users.noreply.github.com> Date: Sun, 1 Jun 2025 21:58:18 -0400 Subject: [PATCH 3/4] maybe --- EXILED/Exiled.API/Enums/RoomType.cs | 15 +++++++++ EXILED/Exiled.API/Exiled.API.csproj | 13 +++++++- EXILED/Exiled.API/Features/Room.cs | 50 +++++++++++++++++++++++++++-- 3 files changed, 74 insertions(+), 4 deletions(-) diff --git a/EXILED/Exiled.API/Enums/RoomType.cs b/EXILED/Exiled.API/Enums/RoomType.cs index 6e236c25d1..1e3f3a8655 100644 --- a/EXILED/Exiled.API/Enums/RoomType.cs +++ b/EXILED/Exiled.API/Enums/RoomType.cs @@ -338,5 +338,20 @@ public enum RoomType /// Heavy Containment Zone's storage / server room. /// HczServerRoom, + + /// + /// Surface Elevator to Entrance room. + /// + SurfaceToEntranceElevator, + + /// + /// Entrance Elevator to Surface room. + /// + EntranceToSurfaceElevator, + /// + /// Lcz Elevator to Hcz room. + /// + LczToHczElevator, + } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Exiled.API.csproj b/EXILED/Exiled.API/Exiled.API.csproj index c8737a790c..0d86a22672 100644 --- a/EXILED/Exiled.API/Exiled.API.csproj +++ b/EXILED/Exiled.API/Exiled.API.csproj @@ -41,7 +41,18 @@ - 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)"=="" ( + 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\" + ) + if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/dependencies/"; fi diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs index b6aba3e0e3..c2013e7b46 100644 --- a/EXILED/Exiled.API/Features/Room.cs +++ b/EXILED/Exiled.API/Features/Room.cs @@ -277,20 +277,26 @@ public static Room Get(RoomIdentifier roomIdentifier) => roomIdentifier == null /// public static Room FindParentRoom(GameObject objectInRoom) { + Log.Info("1"); if (objectInRoom == null) return default; Room room = null; const string playerTag = "Player"; + Log.Info("2"); // First try to find the room owner quickly. if (!objectInRoom.CompareTag(playerTag)) { + Log.Info("3"); + room = objectInRoom.GetComponentInParent(); } else { + Log.Info("4"); + // Check for SCP-079 if it's a player Player ply = Player.Get(objectInRoom); @@ -300,18 +306,34 @@ public static Room FindParentRoom(GameObject objectInRoom) if (ply.Role.Is(out Roles.Scp079Role role)) room = FindParentRoom(role.Camera.GameObject); } - + Log.Info("Pray"); Lift lift = Lift.Get(objectInRoom.transform.position); + Log.Info("Pray 1"); if (lift != null) { + Log.Info("Pray 2 "); room = lift.GameObject.GetComponent(); + Log.Info("Pray 3"); if (room == null) { - CreateComponent(lift.GameObject); - room = lift.GameObject.GetComponent(); + Log.Info($"Pray 4, lift null? {lift == null} or objet null {lift.GameObject == null}"); + // lift.GameObject.AddComponent(); + // CreateComponent(lift.GameObject); + + // CreateComponent(lift.GameObject); + lift.GameObject.AddComponent(); + Log.Info("Pray 5"); + if (RoomIdentifierToRoom.TryGetValue(lift.GameObject.GetComponent(), out Room currentRoom)) + { + Log.Info($"Pray 6 and what's the room {currentRoom.ToString()}"); + return currentRoom; + } + Log.Info("Pray 7"); + // room = lift.GameObject.GetComponent(); } } + Log.Info($"Pray complete - null? = {room != null}"); // Finally, try for objects that aren't children, like players and pickups. return room ?? Get(objectInRoom.transform.position); @@ -436,12 +458,34 @@ internal void InternalCreate() 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}"); + if (gameObject.name.Contains("ElevatorChamber Gates")) + { + //53, 294, -30 - surface 300 > pos > 290 + //174, -99, 17 - entrance -80 < pos > -101 + //lcz - 100 - lcz 110 > pos > 90 + if (gameObject.transform.position.y is > 290 and < 300) + { + Type = RoomType.SurfaceToEntranceElevator; + } + else if (gameObject.transform.position.y is > 90 and < 100) + { + Type = RoomType.EntranceToSurfaceElevator; + } + else if(gameObject.transform.position.y is > -101 and < -80) + { + Type = RoomType.LczToHczElevator; + } + } + } #endif RoomLightControllers = RoomLightControllersValue.AsReadOnly(); From bbcdefd3c61285bfff9837406fca650749809213 Mon Sep 17 00:00:00 2001 From: Undid-Iridium <24619207+Undid-Iridium@users.noreply.github.com> Date: Sun, 1 Jun 2025 23:39:12 -0400 Subject: [PATCH 4/4] Shit ass code that probably works --- EXILED/Exiled.API/Enums/RoomType.cs | 15 +++ EXILED/Exiled.API/Enums/ZoneType.cs | 5 + EXILED/Exiled.API/Features/Room.cs | 146 +++++++++++++++++++--------- 3 files changed, 118 insertions(+), 48 deletions(-) diff --git a/EXILED/Exiled.API/Enums/RoomType.cs b/EXILED/Exiled.API/Enums/RoomType.cs index 1e3f3a8655..839e571b2f 100644 --- a/EXILED/Exiled.API/Enums/RoomType.cs +++ b/EXILED/Exiled.API/Enums/RoomType.cs @@ -352,6 +352,21 @@ public enum RoomType /// Lcz Elevator to Hcz room. /// LczToHczElevator, + + /// + /// Hcz Elevator to Lcz room. + /// + HczToLczElevator, + + /// + /// Hcz Elevator to Nuke room. + /// + HczToNukeElevator, + + /// + /// Nuke Elevator to Hcz room. + /// + NukeToHczElevator, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/ZoneType.cs b/EXILED/Exiled.API/Enums/ZoneType.cs index 382833528c..813360eff6 100644 --- a/EXILED/Exiled.API/Enums/ZoneType.cs +++ b/EXILED/Exiled.API/Enums/ZoneType.cs @@ -60,5 +60,10 @@ public enum ZoneType /// An unknown type of zone. /// Other = 32, + + /// + /// Nuke Zone + /// + Nuke = 64, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs index c2013e7b46..9ddf3a8beb 100644 --- a/EXILED/Exiled.API/Features/Room.cs +++ b/EXILED/Exiled.API/Features/Room.cs @@ -67,7 +67,25 @@ public class Room : MonoBehaviour, IWorldSpace /// /// Gets the in which the room is located. /// - public ZoneType Zone { get; private set; } = ZoneType.Unspecified; + public ZoneType ZoneValue = ZoneType.Unspecified; + private bool isLift = false; + + /// + /// Gets the in which the room is located. + /// + public ZoneType Zone + { + get + { + if (!isLift) + { + return ZoneValue; + } + LiftLocationIdentifier(); + return ZoneValue; + } + private set => ZoneValue = value; + } /// /// Gets the enum representing this room. @@ -277,26 +295,20 @@ public static Room Get(RoomIdentifier roomIdentifier) => roomIdentifier == null /// public static Room FindParentRoom(GameObject objectInRoom) { - Log.Info("1"); if (objectInRoom == null) return default; Room room = null; const string playerTag = "Player"; - Log.Info("2"); // First try to find the room owner quickly. if (!objectInRoom.CompareTag(playerTag)) { - Log.Info("3"); - room = objectInRoom.GetComponentInParent(); } else { - Log.Info("4"); - // Check for SCP-079 if it's a player Player ply = Player.Get(objectInRoom); @@ -306,34 +318,27 @@ public static Room FindParentRoom(GameObject objectInRoom) if (ply.Role.Is(out Roles.Scp079Role role)) room = FindParentRoom(role.Camera.GameObject); } - Log.Info("Pray"); + + // Is it a lift? If so.. here we go. Lift lift = Lift.Get(objectInRoom.transform.position); - Log.Info("Pray 1"); - if (lift != null) + if (lift == null) + { + return room ?? Get(objectInRoom.transform.position); + } + + room = lift.GameObject.GetComponent(); + if (room == null) { - Log.Info("Pray 2 "); - room = lift.GameObject.GetComponent(); - Log.Info("Pray 3"); - if (room == null) + lift.GameObject.AddComponent(); + if (RoomIdentifierToRoom.TryGetValue(lift.GameObject.GetComponent(), out Room currentRoom)) { - Log.Info($"Pray 4, lift null? {lift == null} or objet null {lift.GameObject == null}"); - // lift.GameObject.AddComponent(); - // CreateComponent(lift.GameObject); - - // CreateComponent(lift.GameObject); - lift.GameObject.AddComponent(); - Log.Info("Pray 5"); - if (RoomIdentifierToRoom.TryGetValue(lift.GameObject.GetComponent(), out Room currentRoom)) - { - Log.Info($"Pray 6 and what's the room {currentRoom.ToString()}"); - return currentRoom; - } - Log.Info("Pray 7"); - // room = lift.GameObject.GetComponent(); + return currentRoom; } - } - Log.Info($"Pray complete - null? = {room != null}"); + else + { + room.LiftLocationIdentifier(); + } // Finally, try for objects that aren't children, like players and pickups. return room ?? Get(objectInRoom.transform.position); @@ -467,24 +472,7 @@ internal void InternalCreate() if (Type is RoomType.Unknown) { Log.Error($"[ROOMTYPE UNKNOWN] {this} Name : {gameObject?.name} Shape : {Identifier?.Shape}"); - if (gameObject.name.Contains("ElevatorChamber Gates")) - { - //53, 294, -30 - surface 300 > pos > 290 - //174, -99, 17 - entrance -80 < pos > -101 - //lcz - 100 - lcz 110 > pos > 90 - if (gameObject.transform.position.y is > 290 and < 300) - { - Type = RoomType.SurfaceToEntranceElevator; - } - else if (gameObject.transform.position.y is > 90 and < 100) - { - Type = RoomType.EntranceToSurfaceElevator; - } - else if(gameObject.transform.position.y is > -101 and < -80) - { - Type = RoomType.LczToHczElevator; - } - } + LiftLocationIdentifier(); } #endif @@ -507,6 +495,68 @@ internal void InternalCreate() 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.