forked from Exiled-Official/EXILED
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: RoomLightControllersValue Fix (#346)
* RoomLightControllersValue Fix * remove non used using
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
EXILED/Exiled.Events/Patches/Generic/RoomLightControllersList.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="RoomLightControllersList.cs" company="ExMod Team"> | ||
// Copyright (c) ExMod Team. All rights reserved. | ||
// Licensed under the CC BY-SA 3.0 license. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
namespace Exiled.Events.Patches.Generic | ||
{ | ||
using Exiled.API.Features; | ||
#pragma warning disable SA1313 | ||
#pragma warning disable SA1402 | ||
|
||
using HarmonyLib; | ||
|
||
/// <summary> | ||
/// Patch for adding <see cref="RoomLightController"/> to list. | ||
/// </summary> | ||
[HarmonyPatch(typeof(RoomLightController), nameof(RoomLightController.Start))] | ||
internal class RoomLightControllersList | ||
{ | ||
private static void Postfix(RoomLightController __instance) | ||
{ | ||
Room.Get(__instance.Room).RoomLightControllersValue.Add(__instance); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Patch for removing <see cref="RoomLightController"/> to list. | ||
/// </summary> | ||
[HarmonyPatch(typeof(RoomLightController), nameof(RoomLightController.OnDestroy))] | ||
internal class RoomLightControllersList2 | ||
{ | ||
private static void Postfix(RoomLightController __instance) | ||
{ | ||
Room.Get(__instance.Room).RoomLightControllersValue.Remove(__instance); | ||
} | ||
} | ||
} |