diff --git a/EXILED/Exiled.API/Enums/RoomType.cs b/EXILED/Exiled.API/Enums/RoomType.cs index 6e236c25d1..839e571b2f 100644 --- a/EXILED/Exiled.API/Enums/RoomType.cs +++ b/EXILED/Exiled.API/Enums/RoomType.cs @@ -338,5 +338,35 @@ 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, + + /// + /// 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/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 e5bcc9c0d5..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. @@ -301,8 +319,29 @@ public static Room FindParentRoom(GameObject objectInRoom) 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(); + if (room == null) + { + lift.GameObject.AddComponent(); + if (RoomIdentifierToRoom.TryGetValue(lift.GameObject.GetComponent(), 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); } /// @@ -424,12 +463,17 @@ 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}"); + LiftLocationIdentifier(); + } #endif RoomLightControllers = RoomLightControllersValue.AsReadOnly(); @@ -451,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.