From 2bfcaa498101acae0a189199aa0314e2dad406dc Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Tue, 11 Feb 2025 20:40:35 +0100
Subject: [PATCH 01/12] YIPPIE!
---
LabApi/Features/Console/Logger.cs | 2 +-
.../Interfaces/IScp914ItemProcessor.cs | 4 +--
.../Permissions/Providers/PermissionGroup.cs | 4 +--
.../Wrappers/Facility/Doors/BreakableDoor.cs | 15 +++--------
.../Wrappers/Facility/Doors/BulkheadDoor.cs | 2 +-
.../Wrappers/Facility/Doors/CheckpointDoor.cs | 15 +++--------
.../Features/Wrappers/Facility/Doors/Door.cs | 26 +++++--------------
.../Wrappers/Facility/Doors/DummyDoor.cs | 2 +-
.../Facility/Doors/Extensions/DoorCrusher.cs | 2 +-
.../Features/Wrappers/Facility/Doors/Gate.cs | 7 ++---
.../Facility/Doors/NonInteractableDoor.cs | 2 +-
LabApi/Loader/Features/Misc/AssemblyUtils.cs | 4 +--
12 files changed, 28 insertions(+), 57 deletions(-)
diff --git a/LabApi/Features/Console/Logger.cs b/LabApi/Features/Console/Logger.cs
index 05a54c94..0be65923 100644
--- a/LabApi/Features/Console/Logger.cs
+++ b/LabApi/Features/Console/Logger.cs
@@ -25,7 +25,7 @@ public static class Logger
/// Logs a debug message to the server console.
///
/// The message to log.
- /// Whether or not the message can be printed.
+ /// Whether the message can be printed.
public static void Debug(object message, bool canBePrinted = true)
{
if (!canBePrinted)
diff --git a/LabApi/Features/Interfaces/IScp914ItemProcessor.cs b/LabApi/Features/Interfaces/IScp914ItemProcessor.cs
index 1e039000..ce9f8f9f 100644
--- a/LabApi/Features/Interfaces/IScp914ItemProcessor.cs
+++ b/LabApi/Features/Interfaces/IScp914ItemProcessor.cs
@@ -9,7 +9,7 @@ namespace LabApi.Features.Interfaces;
public interface IScp914ItemProcessor
{
///
- /// Whether or not to use the for inventory items and skip using .
+ /// Whether to use the for inventory items and skip using .
///
public bool UsePickupMethodOnly { get; }
@@ -21,7 +21,7 @@ public interface IScp914ItemProcessor
/// The upgrade result.
///
/// This is not called if is true.
- /// Instead items are converted to pickups and is used, and then the pickups are converted back to items.
+ /// Instead, items are converted to pickups and is used, and then the pickups are converted back to items.
///
public Scp914Result UpgradeItem(Scp914KnobSetting setting, Item item);
diff --git a/LabApi/Features/Permissions/Providers/PermissionGroup.cs b/LabApi/Features/Permissions/Providers/PermissionGroup.cs
index 21e66229..5aeea9e2 100644
--- a/LabApi/Features/Permissions/Providers/PermissionGroup.cs
+++ b/LabApi/Features/Permissions/Providers/PermissionGroup.cs
@@ -12,10 +12,10 @@ public class PermissionGroup
///
/// Constructor for deserialization.
///
- #pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public PermissionGroup()
- #pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
{
+ InheritedGroups = [];
+ Permissions = [];
}
///
diff --git a/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
index cfbf7440..d123254c 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
@@ -46,7 +46,7 @@ internal override void OnRemove()
public new BaseBreakableDoor Base { get; }
///
- /// Gets or sets whether or not SCP-106 can pass through the door when its not closed and locked.
+ /// Gets or sets whether SCP-106 can pass through the door when its not closed and locked.
///
public bool Is106Passable
{
@@ -100,9 +100,7 @@ public DoorDamageType IgnoreDamageSources
/// The to apply.
/// True if the doors took damage, otherwise false.
public bool TryDamage(float damage, DoorDamageType type = DoorDamageType.ServerCommand)
- {
- return Base.ServerDamage(damage, type);
- }
+ => Base.ServerDamage(damage, type);
///
/// Break the door.
@@ -110,19 +108,14 @@ public bool TryDamage(float damage, DoorDamageType type = DoorDamageType.ServerC
/// The to apply.
/// True if the doors took damage, otherwise false.
public bool TryBreak(DoorDamageType type = DoorDamageType.ServerCommand)
- {
- return Base.ServerDamage(float.MaxValue, type);
- }
+ => TryDamage(float.MaxValue, type);
///
/// Tries to repair the door.
/// Sets the doors health back to if the door is broken otherwise it does nothing.
///
/// True if the door was repaired, otherwise false.
- public bool TryRepair()
- {
- return Base.ServerRepair();
- }
+ public bool TryRepair() => Base.ServerRepair();
///
/// Gets the wrapper from the , or creates a new one if it doesn't exist.
diff --git a/LabApi/Features/Wrappers/Facility/Doors/BulkheadDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/BulkheadDoor.cs
index 48609f4e..a3061dcf 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/BulkheadDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/BulkheadDoor.cs
@@ -30,7 +30,7 @@ internal BulkheadDoor(PryableDoor pryableDoor)
Dictionary.Add(pryableDoor, this);
Base = pryableDoor;
DoorCrusherExtension extension = pryableDoor.gameObject.GetComponent();
- if(extension != null)
+ if (extension != null)
Crusher = new DoorCrusher(extension);
}
diff --git a/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
index ece427de..f0fbe128 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
@@ -55,7 +55,7 @@ internal override void OnRemove()
public Door[] SubDoors { get; }
///
- /// Gets or sets whether or not all the sub doors are open.
+ /// Gets or sets whether all the sub doors are open.
///
public bool IsSubOpened
{
@@ -172,9 +172,7 @@ public float SequenceTime
/// The to apply.
/// True if the doors took damage, otherwise false.
public bool TryDamage(float damage, DoorDamageType type = DoorDamageType.ServerCommand)
- {
- return Base.ServerDamage(damage, type);
- }
+ => Base.ServerDamage(damage, type);
///
/// Break all the sub doors.
@@ -182,17 +180,12 @@ public bool TryDamage(float damage, DoorDamageType type = DoorDamageType.ServerC
/// The to apply.
/// True if the doors took damage, otherwise false.
public bool TryBreak(DoorDamageType type = DoorDamageType.ServerCommand)
- {
- return Base.ServerDamage(float.MaxValue, type);
- }
+ => TryDamage(float.MaxValue, type);
///
/// Plays a sound and sets the panel state to error. Error state can not be undone.
///
- public void PlayErrorAnimation()
- {
- Base.RpcPlayBeepSound(2);
- }
+ public void PlayErrorAnimation() => Base.RpcPlayBeepSound(2);
///
/// Gets the wrapper from the , or creates a new one if it doesn't exist.
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Door.cs b/LabApi/Features/Wrappers/Facility/Doors/Door.cs
index b89633bd..b161cca9 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Door.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Door.cs
@@ -27,13 +27,7 @@ internal static void Initialize()
Register(x => new BreakableDoor(x));
Register(x => new ElevatorDoor(x));
Register(x => new Timed173Gate(x));
- Register(x =>
- {
- if (x.name.StartsWith("HCZ BulkDoor"))
- return new BulkheadDoor(x);
- else
- return new Gate(x);
- });
+ Register(x => x.name.StartsWith("HCZ BulkDoor") ? new BulkheadDoor(x) : new Gate(x));
Register(x => new NonInteractableDoor(x));
Register(x => new CheckpointDoor(x));
Register(x => new DummyDoor(x));
@@ -107,7 +101,7 @@ protected Door(DoorVariant doorVariant)
Dictionary.Add(doorVariant, this);
Base = doorVariant;
- if(doorVariant.TryGetComponent(out DoorNametagExtension nametag) && !string.IsNullOrEmpty(nametag.GetName))
+ if (doorVariant.TryGetComponent(out DoorNametagExtension nametag) && !string.IsNullOrEmpty(nametag.GetName))
{
if (doorNameDictionary.TryGetValue(nametag.GetName, out DoorName doorName))
DoorName = doorName;
@@ -165,7 +159,7 @@ public bool IsOpened
}
///
- /// Gets whether or not the door can be interacted with by a .
+ /// Gets whether the door can be interacted with by a .
///
public bool CanInteract => Base.AllowInteracting(null, 0);
@@ -196,7 +190,7 @@ public bool IsLocked
/// Locks the door.
///
/// The reason.
- /// Whether or not the door lock reason is new.
+ /// Whether the door lock reason is new.
public void Lock(DoorLockReason reason, bool enabled) => Base.ServerChangeLock(reason, enabled);
///
@@ -209,7 +203,7 @@ public KeycardPermissions Permissions
}
///
- /// Gets or sets whether or not the door will bypass 2176.
+ /// Gets or sets whether the door will bypass 2176.
///
public bool Bypass2176
{
@@ -240,18 +234,12 @@ public bool Bypass2176
///
/// Plays a sound that indicates that lock bypass was denied.
///
- public void PlayLockBypassDeniedSound()
- {
- Base.LockBypassDenied(null, 0);
- }
+ public void PlayLockBypassDeniedSound() => Base.LockBypassDenied(null, 0);
///
/// Plays a sound and flashes permission denied on the panel.
///
- public void PlayPermissionDeniedAnimation()
- {
- Base.PermissionsDenied(null, 0);
- }
+ public void PlayPermissionDeniedAnimation() => Base.PermissionsDenied(null, 0);
///
/// Gets the door wrapper from the , or creates a new one if it doesn't exist.
diff --git a/LabApi/Features/Wrappers/Facility/Doors/DummyDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/DummyDoor.cs
index c32cde66..e9947feb 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/DummyDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/DummyDoor.cs
@@ -24,7 +24,7 @@ public class DummyDoor : Door
///
/// The base object.
internal DummyDoor(BaseDummyDoor baseDummyDoor)
- :base(baseDummyDoor)
+ : base(baseDummyDoor)
{
Dictionary.Add(baseDummyDoor, this);
Base = baseDummyDoor;
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Extensions/DoorCrusher.cs b/LabApi/Features/Wrappers/Facility/Doors/Extensions/DoorCrusher.cs
index 9924873d..fdcd92a9 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Extensions/DoorCrusher.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Extensions/DoorCrusher.cs
@@ -55,7 +55,7 @@ public float ScpDamage
}
///
- /// Gets or sets whether or not SCPs should be excluded from taking damage from the crusher.
+ /// Gets or sets whether SCPs should be excluded from taking damage from the crusher.
///
public bool IgnoreScps
{
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Gate.cs b/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
index f53c4f8b..0eded059 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
@@ -45,7 +45,7 @@ internal override void OnRemove()
public new PryableDoor Base { get; }
///
- /// Gets or sets whether or not SCP-106 can pass through the door when its not closed and locked.
+ /// Gets or sets whether SCP-106 can pass through the door when its not closed and locked.
///
public bool Is106Passable
{
@@ -66,10 +66,7 @@ public bool TryPry(Player player)
///
/// Play the Pry animation.
///
- public void Pry()
- {
- Base.RpcPryGate();
- }
+ public void Pry() => Base.RpcPryGate();
///
/// Gets the wrapper from the , or creates a new one if it doesn't exist.
diff --git a/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs
index 3154e961..15980a83 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs
@@ -45,7 +45,7 @@ internal override void OnRemove()
public new BasicNonInteractableDoor Base { get; }
///
- /// Gets or sets whether or not SCP-106 can pass through the door when its not closed and locked.
+ /// Gets or sets whether SCP-106 can pass through the door when its not closed and locked.
///
public bool Is106Passable
{
diff --git a/LabApi/Loader/Features/Misc/AssemblyUtils.cs b/LabApi/Loader/Features/Misc/AssemblyUtils.cs
index f306e89b..4ef27ba8 100644
--- a/LabApi/Loader/Features/Misc/AssemblyUtils.cs
+++ b/LabApi/Loader/Features/Misc/AssemblyUtils.cs
@@ -18,12 +18,12 @@ public static class AssemblyUtils
private const string LoggerPrefix = "[ASSEMBLY_LOADER]";
///
- /// Checks whether or not the specified has missing dependencies and gets the types if it is loaded.
+ /// Checks whether the specified has missing dependencies and gets the types if it is loaded.
///
/// The assembly to check missing dependencies for.
/// The path of the assembly to log an error message.
/// The types of the assembly if it is loaded.
- /// Whether or not the specified has missing dependencies.
+ /// Whether the specified has missing dependencies.
public static bool HasMissingDependencies(Assembly assembly, string assemblyPath, [NotNullWhen(false)] out Type[]? types)
{
// We convert the missing dependencies to an array to avoid multiple iterations.
From 3e5bc2554b1755ba7b6cdb98cd2cc2487c5cc7e5 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Tue, 11 Feb 2025 21:11:50 +0100
Subject: [PATCH 02/12] Changes
---
LabApi/Features/Wrappers/Facility/Cassie.cs | 4 +--
.../Wrappers/Facility/Doors/Timed173Gate.cs | 2 +-
.../Facility/Hazards/AmnesticCloudHazard.cs | 1 +
.../Facility/Hazards/DecayableHazard.cs | 5 +--
.../Wrappers/Facility/Hazards/Hazard.cs | 3 +-
.../Facility/Hazards/SinkholeHazard.cs | 2 +-
.../Wrappers/Facility/Hazards/Tesla.cs | 4 +--
LabApi/Features/Wrappers/Facility/Map.cs | 1 -
.../Rooms/PocketDimension/PocketDimension.cs | 35 +++++--------------
.../Rooms/PocketDimension/PocketItem.cs | 6 ++--
.../Features/Wrappers/Facility/Rooms/Room.cs | 21 ++---------
.../Rooms/Scp914/BaseGameItemProcessor.cs | 8 ++---
.../Rooms/Scp914/ItemProcessorAdapter.cs | 8 ++---
.../Wrappers/Facility/Rooms/Scp914/Scp914.cs | 23 ++++++------
LabApi/Features/Wrappers/Facility/Round.cs | 15 ++------
.../Structures/ExperimentalWeaponLocker.cs | 4 +--
.../Wrappers/Facility/Structures/Generator.cs | 7 ++--
.../Facility/Structures/LargeLocker.cs | 6 ++--
.../Wrappers/Facility/Structures/Locker.cs | 12 +++----
.../Facility/Structures/LockerChamber.cs | 15 ++++----
.../Facility/Structures/PedestalLocker.cs | 2 +-
.../Facility/Structures/RifleRackLocker.cs | 2 +-
.../Wrappers/Facility/Structures/Structure.cs | 8 +----
.../Facility/Structures/Workstation.cs | 4 +--
LabApi/Features/Wrappers/Facility/Warhead.cs | 9 ++---
LabApi/Features/Wrappers/Players/Player.cs | 28 ++++-----------
LabApi/Features/Wrappers/Players/Ragdoll.cs | 5 +--
LabApi/Features/Wrappers/Players/Server.cs | 13 +++++--
28 files changed, 86 insertions(+), 167 deletions(-)
diff --git a/LabApi/Features/Wrappers/Facility/Cassie.cs b/LabApi/Features/Wrappers/Facility/Cassie.cs
index a38dc3f3..191ccb16 100644
--- a/LabApi/Features/Wrappers/Facility/Cassie.cs
+++ b/LabApi/Features/Wrappers/Facility/Cassie.cs
@@ -29,7 +29,7 @@ public static class Cassie
///
/// Checks whether a specified word is valid for cassie.
- /// String comparison is case insensitive.
+ /// String comparison is case-insensitive.
///
/// The word to check.
/// Whether the word is valid.
@@ -93,7 +93,7 @@ public static class Cassie
///
/// Converts player's into an SCP number identifier.
///
- /// The target role id.
+ /// The target .
/// The SCP number without spaces between. Used by Cassie.
/// The SCP number with spaces between. Used by Subtitles.
public static void ConvertSCP(RoleTypeId role, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(role, out withoutSpace, out withSpace);
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs b/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
index db6a0142..753982f6 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
@@ -54,7 +54,7 @@ internal override void OnRemove()
public Stopwatch Stopwatch => Base.Stopwatch;
///
- /// Gets or sets whether or not the gate will open if a SCP-173 is present.
+ /// Gets or sets whether the gate will open if a SCP-173 is present.
///
///
/// The gate is still unlocked after the specified time regardless of this setting.
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
index 0064347a..822ba9a4 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
@@ -156,6 +156,7 @@ internal override void OnRemove()
base.OnRemove();
Dictionary.Remove(Base);
}
+
///
/// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
///
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
index 521e6083..008fdfd1 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
@@ -68,10 +68,7 @@ protected DecayableHazard(TemporaryHazard hazard) : base(hazard)
/// Destroys this hazard.
/// Do note that subclasses usually implement few seconds delay before the actual object is destroyed. (Usually to wait for animations to finish on clients)
///
- public override void Destroy()
- {
- Base.ServerDestroy();
- }
+ public override void Destroy() => Base.ServerDestroy();
///
internal override void OnRemove()
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
index c0784fda..e0856070 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
@@ -132,7 +132,6 @@ internal static void Initialize()
///
internal virtual void OnRemove()
{
-
}
///
@@ -156,7 +155,7 @@ public static Hazard Spawn(EnvironmentalHazard prefab, Vector3 position, Quatern
/// Attempts to get the prefab from .
///
/// Type of the hazard.
- /// Prefab gameobject if it was found. Otherwise
+ /// Prefab if it was found. Otherwise
protected static T? GetPrefab() where T : EnvironmentalHazard
{
foreach (GameObject prefab in NetworkClient.prefabs.Values)
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
index 2f553407..9c00047a 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
@@ -62,7 +62,7 @@ internal override void OnRemove()
public static SinkholeHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale)
{
if (BasePrefab == null)
- BasePrefab = Hazard.GetPrefab();
+ BasePrefab = GetPrefab();
SinkholeHazard hazard = (SinkholeHazard)Hazard.Spawn(BasePrefab, position, rotation, scale);
hazard.IsActive = true;
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs b/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
index 4391eae0..79e4cc16 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
@@ -148,8 +148,6 @@ private Tesla(TeslaGate tesla)
/// The tesla to be returned.
/// Whether the tesla is in out parameter.
public static bool TryGet(Room room, [NotNullWhen(true)] out Tesla? tesla)
- {
- return TeslaByRoom.TryGetValue(room.Base, out tesla);
- }
+ => TeslaByRoom.TryGetValue(room.Base, out tesla);
}
}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Map.cs b/LabApi/Features/Wrappers/Facility/Map.cs
index 3a3da1da..67a0cd18 100644
--- a/LabApi/Features/Wrappers/Facility/Map.cs
+++ b/LabApi/Features/Wrappers/Facility/Map.cs
@@ -344,7 +344,6 @@ public static void TurnOffLights(float duration)
lc.FlickerLights(duration);
}
-
///
/// Turns off all lights.
///
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
index a00aee29..84ac4d78 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
@@ -87,20 +87,14 @@ internal override void OnRemoved()
/// Force a inside the pocket dimension.
///
/// The to send.
- public static void ForceInside(Player player)
- {
- player.EnableEffect();
- }
+ public static void ForceInside(Player player) => player.EnableEffect();
///
- /// Gets whether or not a is considered inside the pocket dimension.
+ /// Gets whether a is considered inside the pocket dimension.
///
/// The to check.
/// True if inside otherwise false.
- public static bool IsPlayerInside(Player player)
- {
- return player.HasEffect();
- }
+ public static bool IsPlayerInside(Player player) => player.HasEffect();
///
/// Force a player to exit the pocket dimension.
@@ -134,17 +128,12 @@ public static void ForceKill(Player player)
/// The to check.
/// True if inside otherwise false.
public static bool IsPickupInside(Pickup pickup)
- {
- return Scp106PocketItemManager.TrackedItems.ContainsKey(pickup.Base);
- }
+ => Scp106PocketItemManager.TrackedItems.ContainsKey(pickup.Base);
///
/// Randomizes which pocket dimension's teleports are exits.
///
- public static void RandomizeExits()
- {
- PocketDimensionGenerator.RandomizeTeleports();
- }
+ public static void RandomizeExits() => PocketDimensionGenerator.RandomizeTeleports();
///
/// Gets the poses used for exits for the pocket dimension.
@@ -152,9 +141,7 @@ public static void RandomizeExits()
/// The zone that the exits are associated with.
/// A collection of exit instances.
public static IReadOnlyCollection GetExitPosesForZone(FacilityZone zone)
- {
- return Scp106PocketExitFinder.GetPosesForZone(zone);
- }
+ => Scp106PocketExitFinder.GetPosesForZone(zone);
///
/// Adds the specified poses to be used as exits for the pocket dimension.
@@ -210,12 +197,10 @@ public static void RemoveExitPosesForZone(FacilityZone zone, IEnumerable p
///
/// Gets the rarity of the item using its wrapper see .
///
- /// The to get the rarity from.
+ /// The to get the rarity from.
/// The rarity of the item.
public static int GetRarity(Pickup pickup)
- {
- return GetRarity(InventoryItemLoader.AvailableItems[pickup.Type]);
- }
+ => GetRarity(InventoryItemLoader.AvailableItems[pickup.Type]);
///
/// Gets the rarity of the item using its wrapper see .
@@ -230,7 +215,5 @@ public static int GetRarity(Pickup pickup)
/// The to get the rarity from.
/// The rarity of the item.
public static int GetRarity(ItemBase item)
- {
- return Scp106PocketItemManager.GetRarity(item);
- }
+ => Scp106PocketItemManager.GetRarity(item);
}
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs
index 45a3f82a..cc274848 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs
@@ -69,7 +69,7 @@ public double TriggerDelay
}
///
- /// Gets or sets whether or not the item pickup is destroyed after the .
+ /// Gets or sets whether the item pickup is destroyed after the .
///
public bool WillBeDestroyed
{
@@ -98,9 +98,7 @@ public Vector3 DropPosition
/// The associated with or null if it doesn't exists.
/// Whether the was successfully retrieved.
public static bool TryGet(Pickup pickup, [NotNullWhen(true)] out PocketItem? pocketItem)
- {
- return Dictionary.TryGetValue(pickup.Base, out pocketItem);
- }
+ => Dictionary.TryGetValue(pickup.Base, out pocketItem);
///
/// Gets the associated with the .
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/Room.cs b/LabApi/Features/Wrappers/Facility/Rooms/Room.cs
index 9eaf246e..2ae1abda 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/Room.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/Room.cs
@@ -90,25 +90,13 @@ public IEnumerable Doors
/// Gets the first light controller for this room.
/// Please see if you wish to modify all lights in this room.
///
- public LightsController? LightController
- {
- get
- {
- return Base.LightControllers.Count > 0 ? LightsController.Get(Base.LightControllers[0]) : null;
- }
- }
+ public LightsController? LightController => Base.LightControllers.Count > 0 ? LightsController.Get(Base.LightControllers[0]) : null;
///
/// Gets all light controllers for this specified room.
/// Some rooms such as 049, warhead and etc may have multiple light controllers as they are split by the elevator.
///
- public IEnumerable AllLightControllers
- {
- get
- {
- return Base.LightControllers.Select(LightsController.Get);
- }
- }
+ public IEnumerable AllLightControllers => Base.LightControllers.Select(LightsController.Get);
///
/// Gets the room's .
@@ -215,10 +203,7 @@ public static bool TryGetRoomAtPosition(Vector3 position, [NotNullWhen(true)] ou
// TODO: use factory instead.
private static void AddRoom(RoomIdentifier roomIdentifier)
{
- if (roomIdentifier.Name == RoomName.Pocket)
- _ = new PocketDimension(roomIdentifier);
- else
- _ = new Room(roomIdentifier);
+ _ = roomIdentifier.Name == RoomName.Pocket ? new PocketDimension(roomIdentifier) : (PocketDimension)new Room(roomIdentifier);
}
///
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/BaseGameItemProcessor.cs b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/BaseGameItemProcessor.cs
index ee233d8e..7a42cefb 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/BaseGameItemProcessor.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/BaseGameItemProcessor.cs
@@ -30,13 +30,9 @@ internal BaseGameItemProcessor(Scp914ItemProcessor processor)
///
public Scp914Result UpgradeItem(Scp914KnobSetting setting, Item item)
- {
- return Processor.UpgradeInventoryItem(setting, item.Base);
- }
+ => Processor.UpgradeInventoryItem(setting, item.Base);
///
public Scp914Result UpgradePickup(Scp914KnobSetting setting, Pickup pickup)
- {
- return Processor.UpgradePickup(setting, pickup.Base);
- }
+ => Processor.UpgradePickup(setting, pickup.Base);
}
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/ItemProcessorAdapter.cs b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/ItemProcessorAdapter.cs
index 0e10ae9b..8a127b83 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/ItemProcessorAdapter.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/ItemProcessorAdapter.cs
@@ -23,15 +23,13 @@ public override Scp914Result UpgradeInventoryItem(Scp914KnobSetting setting, Ite
{
if (Processor.UsePickupMethodOnly)
return base.UpgradeInventoryItem(setting, item);
- else
- return Processor.UpgradeItem(setting, Item.Get(item));
+
+ return Processor.UpgradeItem(setting, Item.Get(item));
}
///
/// Used internally by the base game.
///
public override Scp914Result UpgradePickup(Scp914KnobSetting setting, ItemPickupBase pickup)
- {
- return Processor.UpgradePickup(setting, Pickup.Get(pickup));
- }
+ => Processor.UpgradePickup(setting, Pickup.Get(pickup));
}
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
index 614a943f..141bfee2 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
@@ -95,9 +95,9 @@ public static bool IsUpgrading
{
Scp914Controller.Singleton.IsUpgrading = value;
SequenceCooldown = 0.0f;
+ }
}
}
- }
///
/// Gets or sets the used by SCP-914 for upgrading.
@@ -213,9 +213,7 @@ public static void Interact(Scp914InteractCode interactCode, Player? player = nu
///
/// The sound to play.
public static void PlaySound(Scp914Sound sound)
- {
- Scp914Controller.Singleton.RpcPlaySound((byte)sound);
- }
+ => Scp914Controller.Singleton.RpcPlaySound((byte)sound);
///
/// Gets the for the specified type.
@@ -232,17 +230,16 @@ public static void PlaySound(Scp914Sound sound)
if (ItemProcessorCache.TryGetValue(item, out var processor))
return processor;
- else if(item.TryGetComponent(out Scp914ItemProcessor baseProcessor))
- {
- if (baseProcessor is ItemProcessorAdapter adaptor)
- ItemProcessorCache[item] = adaptor.Processor;
- else
- ItemProcessorCache[item] = new BaseGameItemProcessor(baseProcessor);
- return ItemProcessorCache[item];
- }
- else
+ if (!item.TryGetComponent(out Scp914ItemProcessor baseProcessor))
return null;
+
+ if (baseProcessor is ItemProcessorAdapter adaptor)
+ ItemProcessorCache[item] = adaptor.Processor;
+ else
+ ItemProcessorCache[item] = new BaseGameItemProcessor(baseProcessor);
+
+ return ItemProcessorCache[item];
}
///
diff --git a/LabApi/Features/Wrappers/Facility/Round.cs b/LabApi/Features/Wrappers/Facility/Round.cs
index f1f74a9c..f9e4b18d 100644
--- a/LabApi/Features/Wrappers/Facility/Round.cs
+++ b/LabApi/Features/Wrappers/Facility/Round.cs
@@ -16,18 +16,12 @@ public static class Round
///
/// Gets or sets whether the round has started or not.
///
- public static bool IsRoundStarted
- {
- get => RoundSummary.RoundInProgress();
- }
+ public static bool IsRoundStarted => RoundSummary.RoundInProgress();
///
/// Gets a value indicating whether the round is ended or not.
///
- public static bool IsRoundEnded
- {
- get => !IsRoundStarted && Duration.Seconds > 1;
- }
+ public static bool IsRoundEnded => !IsRoundStarted && Duration.Seconds > 1;
///
/// Gets whether the round can end if there is only 1 team alive remaining.
@@ -40,10 +34,7 @@ public static bool CanRoundEnd
if (IsLocked || KeepRoundOnOne && ReferenceHub.AllHubs.Count(x => x.authManager.InstanceMode != ClientInstanceMode.DedicatedServer) < 2 || !IsRoundStarted)
return false;
- if (!IsRoundStarted || IsLocked)
- return false;
-
- return true;
+ return IsRoundStarted && !IsLocked;
}
}
diff --git a/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs
index 34f07bda..9e6ef95c 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs
@@ -52,7 +52,7 @@ internal override void OnRemove()
public LockerChamber Chamber => Chambers.First();
///
- /// Gets or sets whether or not the experimental weapon locker is open.
+ /// Gets or sets whether the experimental weapon locker is open.
///
public bool IsOpen
{
@@ -61,7 +61,7 @@ public bool IsOpen
}
///
- /// Gets whether or not the experimental weapon locker can be interacted with by a .
+ /// Gets whether the experimental weapon locker can be interacted with by a .
///
public bool CanInteract => Chamber.CanInteract;
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Generator.cs b/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
index 818ab0f8..25706b98 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
@@ -39,15 +39,14 @@ internal Generator(Scp079Generator generator)
Base = generator;
if (generator.Room == null)
- {
return;
- }
if (!GeneratorsByRoom.TryGetValue(generator.Room, out List list))
{
list = new List();
GeneratorsByRoom.Add(generator.Room, list);
}
+
list.Add(this);
}
@@ -123,7 +122,7 @@ public KeycardPermissions RequiredPermissions
public bool ActivationReady => Base.ActivationReady;
///
- /// Gets or sets whether or not the generator is opened.
+ /// Gets or sets whether the generator is opened.
///
public bool IsOpen
{
@@ -132,7 +131,7 @@ public bool IsOpen
}
///
- /// Gets or sets whether or not the generator is unlocked.
+ /// Gets or sets whether the generator is unlocked.
///
public bool IsUnlocked
{
diff --git a/LabApi/Features/Wrappers/Facility/Structures/LargeLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/LargeLocker.cs
index 4d4073d9..ecd5e3db 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/LargeLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/LargeLocker.cs
@@ -23,7 +23,7 @@ public class LargeLocker : Locker
///
/// The base object.
internal LargeLocker(BaseLocker baseLocker)
- :base(baseLocker)
+ : base(baseLocker)
{
Dictionary.Add(baseLocker, this);
}
@@ -68,9 +68,9 @@ internal override void OnRemove()
public LockerChamber MiddleLeft => Chambers[5];
///
- /// Gets the small chamber that is at the middle middle.
+ /// Gets the small chamber that is at the center.
///
- public LockerChamber MiddleMiddle => Chambers[6];
+ public LockerChamber Center => Chambers[6];
///
/// Gets the small chamber that is at the middle right.
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Locker.cs b/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
index 3bc3521a..25cc622f 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
@@ -42,7 +42,7 @@ internal override void OnRemove()
base.OnRemove();
Dictionary.Remove(Base);
- foreach(var chamber in Chambers)
+ foreach (LockerChamber chamber in Chambers)
chamber.OnRemove();
}
@@ -92,7 +92,7 @@ public int MaxChambersToFill
}
///
- /// Gets whether or not all the are .
+ /// Gets whether all the are .
///
public bool IsEmpty => Chambers.All(x => x.IsEmpty);
@@ -166,7 +166,7 @@ public void FillChambers()
///
public void FillAllChambers()
{
- foreach (var chamber in Chambers)
+ foreach (LockerChamber chamber in Chambers)
chamber.Fill();
}
@@ -175,7 +175,7 @@ public void FillAllChambers()
///
public void ClearAllChambers()
{
- foreach (var chamber in Chambers)
+ foreach (LockerChamber chamber in Chambers)
chamber.RemoveAllItems();
}
@@ -184,7 +184,7 @@ public void ClearAllChambers()
///
public void OpenAllChambers()
{
- foreach (var chamber in Chambers)
+ foreach (LockerChamber chamber in Chambers)
chamber.IsOpen = true;
}
@@ -193,7 +193,7 @@ public void OpenAllChambers()
///
public void CloseAllChambers()
{
- foreach (var chamber in Chambers)
+ foreach (LockerChamber chamber in Chambers)
chamber.IsOpen = false;
}
}
diff --git a/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs b/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs
index fb6e9405..03df0a7b 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs
@@ -59,7 +59,7 @@ internal void OnRemove()
public byte Id { get; }
///
- /// Gets or sets whether or not the chamber door is open.
+ /// Gets or sets whether the chamber door is open.
///
public bool IsOpen
{
@@ -72,12 +72,12 @@ public bool IsOpen
}
///
- /// Gets whether or not the chamber can be interacted by a .
+ /// Gets whether the chamber can be interacted by a .
///
public bool CanInteract => Base.CanInteract;
///
- /// Gets whether or not the chamber contains no items.
+ /// Gets whether the chamber contains no items.
///
public bool IsEmpty => Base.Content.All(x => x == null);
@@ -103,7 +103,7 @@ public float TargetCooldown
}
///
- /// Gets whether or not instances are spawned on the client only when the chamber is first opened.
+ /// Gets whether instances are spawned on the client only when the chamber is first opened.
///
public bool SpawnOnFirstOpening => Base.SpawnOnFirstChamberOpening;
@@ -125,7 +125,7 @@ public ItemType[] AcceptableItems
public void Fill()
{
Locker.Base.FillChamber(Base);
- foreach(ItemPickupBase pickupBase in Base.Content)
+ foreach (ItemPickupBase pickupBase in Base.Content)
{
if (!pickupBase.TryGetComponent(out Rigidbody rigidbody))
continue;
@@ -221,10 +221,7 @@ public void Interact(Player player)
///
/// Plays the Access Denied sound for this chamber.
///
- public void PlayDeniedSound()
- {
- Locker.Base.RpcPlayDenied(Id);
- }
+ public void PlayDeniedSound() => Locker.Base.RpcPlayDenied(Id);
///
/// Gets the locker chamber wrapper from the or creates a new if it doesn't exist and the provided was not null.
diff --git a/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
index 7bdc126e..5cfa4abd 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
@@ -59,7 +59,7 @@ public bool IsOpen
}
///
- /// Gets whether or not the pedestal can be interacted with by a .
+ /// Gets whether the pedestal can be interacted with by a .
///
public bool CanInteract => Chamber.CanInteract;
diff --git a/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs
index ccf7952a..00aefada 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs
@@ -48,7 +48,7 @@ public bool IsOpen
}
///
- /// Gets whether or not the rifle rack can be interacted with by a .
+ /// Gets whether the rifle rack can be interacted with by a .
///
public bool CanInteract => MainChamber.CanInteract;
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Structure.cs b/LabApi/Features/Wrappers/Facility/Structures/Structure.cs
index ebe86f83..fd72312a 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Structure.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Structure.cs
@@ -22,13 +22,7 @@ internal static void Initialize()
SpawnableStructure.OnAdded += OnAdded;
SpawnableStructure.OnRemoved += OnRemoved;
- Register(x =>
- {
- if (x.StructureType == StructureType.Workstation)
- return new Workstation(x);
-
- return null!;
- });
+ Register(x => x.StructureType == StructureType.Workstation ? new Workstation(x) : null!);
Register(x => new Generator(x));
Register(x =>
{
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs b/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs
index eed4363a..7b5985b0 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs
@@ -68,10 +68,10 @@ public Player KnownUser
}
///
- /// Gets whether or not the specified is close enough to the workstation to keep it on.
+ /// Gets whether the specified is close enough to the workstation to keep it on.
///
/// The to test.
- /// Whether or not the player was close enough.
+ /// Whether the player was close enough.
public bool IsInRange(Player player)
{
return BaseController.IsInRange(player.ReferenceHub);
diff --git a/LabApi/Features/Wrappers/Facility/Warhead.cs b/LabApi/Features/Wrappers/Facility/Warhead.cs
index 74357773..6b9c2605 100644
--- a/LabApi/Features/Wrappers/Facility/Warhead.cs
+++ b/LabApi/Features/Wrappers/Facility/Warhead.cs
@@ -236,7 +236,7 @@ public static void Detonate()
///
public static void OpenBlastDoors()
{
- foreach (var door in BlastDoor.Instances)
+ foreach (BlastDoor door in BlastDoor.Instances)
door.ServerSetTargetState(true);
}
@@ -245,17 +245,14 @@ public static void OpenBlastDoors()
///
public static void CloseBlastDoors()
{
- foreach (var door in BlastDoor.Instances)
+ foreach (BlastDoor door in BlastDoor.Instances)
door.ServerSetTargetState(false);
}
///
/// Plays the warhead detonation effect on all clients in the facility.
///
- public static void Shake()
- {
- BaseController?.RpcShake(false);
- }
+ public static void Shake() => BaseController?.RpcShake(false);
///
/// Handles the creation of the warhead components.
diff --git a/LabApi/Features/Wrappers/Players/Player.cs b/LabApi/Features/Wrappers/Players/Player.cs
index 51dc78b3..05d9507c 100644
--- a/LabApi/Features/Wrappers/Players/Player.cs
+++ b/LabApi/Features/Wrappers/Players/Player.cs
@@ -87,7 +87,7 @@ internal static void Initialize()
}
///
- /// A internal constructor to prevent external instantiation.
+ /// An internal constructor to prevent external instantiation.
///
/// The reference hub of the player.
internal Player(ReferenceHub referenceHub)
@@ -230,7 +230,7 @@ public float MaxHealth
///
/// Gets or sets the player's current artificial health.
- /// Setting the value will clear all of the current "processes" (each process is responsible for decaying AHP value separately. Eg 2 processes blue candy AHP, which doesn't decay and adrenaline proccess, where AHP does decay).
+ /// Setting the value will clear all the current "processes" (each process is responsible for decaying AHP value separately. Eg 2 processes blue candy AHP, which doesn't decay and adrenaline proccess, where AHP does decay).
/// Note: This value cannot be greater than . Set it to your desired value first if its over and then set this one.
///
public float ArtificialHealth
@@ -398,7 +398,7 @@ public List CurrentSpectators
///
/// Gets or sets the player's current item.
///
- public Item CurrentItem
+ public Item? CurrentItem
{
get => Item.Get(Inventory.CurInstance);
set
@@ -661,19 +661,8 @@ public Player? DisarmedBy
///
public Vector3 Position
{
- get
- {
- if (ReferenceHub.roleManager.CurrentRole is not IFpcRole fpcRole)
- {
- return Vector3.zero;
- }
-
- return fpcRole.FpcModule.Position;
- }
- set
- {
- ReferenceHub.TryOverridePosition(value);
- }
+ get => ReferenceHub.roleManager.CurrentRole is not IFpcRole fpcRole ? Vector3.zero : fpcRole.FpcModule.Position;
+ set => ReferenceHub.TryOverridePosition(value);
}
///
@@ -694,17 +683,12 @@ public Vector2 LookRotation
get
{
if (ReferenceHub.roleManager.CurrentRole is not IFpcRole fpcRole)
- {
return Vector2.zero;
- }
FpcMouseLook mouseLook = fpcRole.FpcModule.MouseLook;
return new Vector2(mouseLook.CurrentVertical, mouseLook.CurrentHorizontal);
}
- set
- {
- ReferenceHub.TryOverrideRotation(value);
- }
+ set => ReferenceHub.TryOverrideRotation(value);
}
///
diff --git a/LabApi/Features/Wrappers/Players/Ragdoll.cs b/LabApi/Features/Wrappers/Players/Ragdoll.cs
index a963ba5c..c69dc90b 100644
--- a/LabApi/Features/Wrappers/Players/Ragdoll.cs
+++ b/LabApi/Features/Wrappers/Players/Ragdoll.cs
@@ -153,10 +153,7 @@ public void Destroy()
///
/// Forcefully freezes this ragdoll for all clients.
///
- public void Freeze()
- {
- Base.ClientFreezeRpc();
- }
+ public void Freeze() => Base.ClientFreezeRpc();
///
/// Unfreezes this ragdoll by spawning a copy of it and destroying the original. Reference to the changes, but no other action is required if you are referencing this object.
diff --git a/LabApi/Features/Wrappers/Players/Server.cs b/LabApi/Features/Wrappers/Players/Server.cs
index d767c596..47f13417 100644
--- a/LabApi/Features/Wrappers/Players/Server.cs
+++ b/LabApi/Features/Wrappers/Players/Server.cs
@@ -76,7 +76,16 @@ public static int ReservedSlots
///
/// Gets the Ticks Per Second of the server.
///
- public static double TPS => Math.Round(1f / Time.smoothDeltaTime);
+ public static double Tps => Math.Round(1f / Time.smoothDeltaTime);
+
+ ///
+ /// Gets the max Ticks Per Second of the server.
+ ///
+ public static short MaxTps
+ {
+ get => ServerStatic.ServerTickrate;
+ set => ServerStatic.ServerTickrate = value;
+ }
///
/// Gets or sets the spawn protection duration for players.
@@ -88,7 +97,7 @@ public static float SpawnProtectDuration
}
///
- /// Gets whether or not the server is in Idle Mode.
+ /// Gets whether the server is in Idle Mode.
///
public static bool IdleModeActive => IdleMode.IdleModeActive;
From af818d7f04acd4b6a1b07ed72997dc33ebfd4b8a Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Tue, 11 Feb 2025 21:43:15 +0100
Subject: [PATCH 03/12] MORE
---
LabApi/Events/Arguments/Interfaces/IItemEvent.cs | 1 +
LabApi/Events/Arguments/Interfaces/IPickupEvent.cs | 1 +
LabApi/Events/Arguments/Interfaces/IPlayerEvent.cs | 1 +
LabApi/Events/Arguments/Interfaces/IUsableItem.cs | 2 +-
LabApi/Features/LabApiProperties.cs | 2 +-
LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs | 4 ++--
.../Features/Wrappers/Facility/Hazards/DecayableHazard.cs | 2 +-
LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs | 2 +-
LabApi/Features/Wrappers/Facility/Warhead.cs | 5 +++--
LabApi/LabApi.csproj | 2 +-
LabApi/Loader/CommandLoader.cs | 4 ++--
LabApi/Loader/ConfigurationLoader.cs | 6 +++---
LabApi/Loader/Features/Misc/AssemblyUtils.cs | 2 +-
LabApi/Loader/PluginLoader.cs | 2 +-
14 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/LabApi/Events/Arguments/Interfaces/IItemEvent.cs b/LabApi/Events/Arguments/Interfaces/IItemEvent.cs
index 5c3b2901..cea0e79b 100644
--- a/LabApi/Events/Arguments/Interfaces/IItemEvent.cs
+++ b/LabApi/Events/Arguments/Interfaces/IItemEvent.cs
@@ -1,4 +1,5 @@
using LabApi.Features.Wrappers;
+
namespace LabApi.Events.Arguments.Interfaces;
///
diff --git a/LabApi/Events/Arguments/Interfaces/IPickupEvent.cs b/LabApi/Events/Arguments/Interfaces/IPickupEvent.cs
index 78745bd1..06e6fb4c 100644
--- a/LabApi/Events/Arguments/Interfaces/IPickupEvent.cs
+++ b/LabApi/Events/Arguments/Interfaces/IPickupEvent.cs
@@ -1,4 +1,5 @@
using LabApi.Features.Wrappers;
+
namespace LabApi.Events.Arguments.Interfaces;
///
diff --git a/LabApi/Events/Arguments/Interfaces/IPlayerEvent.cs b/LabApi/Events/Arguments/Interfaces/IPlayerEvent.cs
index 8b667313..8a87a73c 100644
--- a/LabApi/Events/Arguments/Interfaces/IPlayerEvent.cs
+++ b/LabApi/Events/Arguments/Interfaces/IPlayerEvent.cs
@@ -1,4 +1,5 @@
using LabApi.Features.Wrappers;
+
namespace LabApi.Events.Arguments.Interfaces;
///
diff --git a/LabApi/Events/Arguments/Interfaces/IUsableItem.cs b/LabApi/Events/Arguments/Interfaces/IUsableItem.cs
index a032b63c..26ee0ed8 100644
--- a/LabApi/Events/Arguments/Interfaces/IUsableItem.cs
+++ b/LabApi/Events/Arguments/Interfaces/IUsableItem.cs
@@ -3,7 +3,7 @@
namespace LabApi.Events.Arguments.Interfaces;
///
-/// Represents an event that involves an usable item.
+/// Represents an event that involves a usable item.
///
public interface IUsableItem
{
diff --git a/LabApi/Features/LabApiProperties.cs b/LabApi/Features/LabApiProperties.cs
index c2042463..c75063c9 100644
--- a/LabApi/Features/LabApiProperties.cs
+++ b/LabApi/Features/LabApiProperties.cs
@@ -4,7 +4,7 @@ namespace LabApi.Features;
///
/// Contains LabAPI properties which can be accessed by plugins.
-///
+
/// Those properties are a mix of constants and static fields such as .
///
public static class LabApiProperties
diff --git a/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
index d123254c..b730f0ac 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
@@ -21,7 +21,7 @@ public class BreakableDoor : Door
public new static IReadOnlyCollection List => Dictionary.Values;
///
- /// An internal constructor the prevent external instantiation.
+ /// An internal constructor to prevent external instantiation.
///
/// The base object.
internal BreakableDoor(BaseBreakableDoor baseBreakableDoor)
@@ -46,7 +46,7 @@ internal override void OnRemove()
public new BaseBreakableDoor Base { get; }
///
- /// Gets or sets whether SCP-106 can pass through the door when its not closed and locked.
+ /// Gets or sets whether SCP-106 can pass through the door when it's not closed and locked.
///
public bool Is106Passable
{
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
index 008fdfd1..185820ff 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
@@ -52,7 +52,7 @@ public float Elapsed
///
/// The base object.
///
- public TemporaryHazard Base { get; private set; }
+ public new TemporaryHazard Base { get; private set; }
///
/// An internal constructor to prevent external instantiation.
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
index 9c00047a..a913c8e2 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
@@ -30,7 +30,7 @@ public class SinkholeHazard : Hazard
///
/// The base object.
///
- public SinkholeEnvironmentalHazard Base { get; private set; }
+ public new SinkholeEnvironmentalHazard Base { get; private set; }
///
/// An internal constructor to prevent external instantiation.
diff --git a/LabApi/Features/Wrappers/Facility/Warhead.cs b/LabApi/Features/Wrappers/Facility/Warhead.cs
index 6b9c2605..5eec95e6 100644
--- a/LabApi/Features/Wrappers/Facility/Warhead.cs
+++ b/LabApi/Features/Wrappers/Facility/Warhead.cs
@@ -286,8 +286,9 @@ public readonly struct DetonationScenario
///
/// Internal constructor to prevent external instantiation.
///
- ///
- ///
+ ///
+ ///
+ ///
internal DetonationScenario(AlphaWarheadController.DetonationScenario detonationScenario, byte id, WarheadScenarioType type)
{
TimeToDetonate = detonationScenario.TimeToDetonate;
diff --git a/LabApi/LabApi.csproj b/LabApi/LabApi.csproj
index c7cb7164..b5bc73c3 100644
--- a/LabApi/LabApi.csproj
+++ b/LabApi/LabApi.csproj
@@ -39,5 +39,5 @@
-
+
\ No newline at end of file
diff --git a/LabApi/Loader/CommandLoader.cs b/LabApi/Loader/CommandLoader.cs
index 52ec9a57..e9bbe8b4 100644
--- a/LabApi/Loader/CommandLoader.cs
+++ b/LabApi/Loader/CommandLoader.cs
@@ -148,7 +148,7 @@ public static IEnumerable RegisterCommands(Type type, string logName =
/// The registered command if the command was successfully registered.
public static bool TryRegisterCommand(Type commandType, Type commandHandlerType, [NotNullWhen(true)] out ICommand? command, string logName)
{
- command = default;
+ command = null;
if (CommandHandlers.ContainsKey(commandType))
{
@@ -192,7 +192,7 @@ public static bool TryRegisterCommand(Type commandType, Type commandHandlerType,
/// The to register.
/// The to register the command to.
/// The name of the plugin to log to use when logging errors.
- /// Whether or not the command was successfully registered.
+ /// Whether the command was successfully registered.
public static bool TryRegisterCommand(ICommand command, CommandHandler commandHandler, string logName)
{
try
diff --git a/LabApi/Loader/ConfigurationLoader.cs b/LabApi/Loader/ConfigurationLoader.cs
index 66f6004a..8723b0c1 100644
--- a/LabApi/Loader/ConfigurationLoader.cs
+++ b/LabApi/Loader/ConfigurationLoader.cs
@@ -63,7 +63,7 @@ public static bool TrySaveConfig(this Plugin plugin, TConfig config, st
public static bool TryReadConfig(this Plugin plugin, string fileName, [NotNullWhen(true)] out TConfig? config)
where TConfig : class, new()
{
- config = default;
+ config = null;
try
{
@@ -101,7 +101,7 @@ public static bool TryReadConfig(this Plugin plugin, string fileName, [
public static bool TryLoadConfig(this Plugin plugin, string fileName, [NotNullWhen(true)] out TConfig? config)
where TConfig : class, new()
{
- config = default;
+ config = null;
// We retrieve the path of the configuration file.
string path = plugin.GetConfigPath(fileName);
@@ -167,7 +167,7 @@ public static void SaveConfig(this Plugin plugin, TConfig config, strin
public static bool TryCreateDefaultConfig(this Plugin plugin, [NotNullWhen(true)] out TConfig? config)
where TConfig : class, new()
{
- config = default;
+ config = null;
try
{
diff --git a/LabApi/Loader/Features/Misc/AssemblyUtils.cs b/LabApi/Loader/Features/Misc/AssemblyUtils.cs
index 4ef27ba8..21f55b96 100644
--- a/LabApi/Loader/Features/Misc/AssemblyUtils.cs
+++ b/LabApi/Loader/Features/Misc/AssemblyUtils.cs
@@ -53,7 +53,7 @@ public static bool HasMissingDependencies(Assembly assembly, string assemblyPath
Logger.Error(exception.ToString());
- types = default;
+ types = null;
return true; // True = missing dependencies.
}
}
diff --git a/LabApi/Loader/PluginLoader.cs b/LabApi/Loader/PluginLoader.cs
index a8e39199..cc9a223e 100644
--- a/LabApi/Loader/PluginLoader.cs
+++ b/LabApi/Loader/PluginLoader.cs
@@ -23,7 +23,7 @@ public static partial class PluginLoader
private const string PdbFileExtension = ".pdb";
///
- /// Whether or not the has been initialized.
+ /// Whether the has been initialized.
///
public static bool Initialized { get; private set; }
From 7e62dfc075e1ab7799e439e051674996b5392dd2 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Tue, 11 Feb 2025 21:53:03 +0100
Subject: [PATCH 04/12] Room.Players & Warhead.DetonationScenario docs
---
LabApi/Features/Wrappers/Facility/Rooms/Room.cs | 16 +++++++---------
LabApi/Features/Wrappers/Facility/Warhead.cs | 6 +++---
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/Room.cs b/LabApi/Features/Wrappers/Facility/Rooms/Room.cs
index 2ae1abda..bb1a4586 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/Room.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/Room.cs
@@ -76,15 +76,9 @@ internal virtual void OnRemoved()
public HashSet ConnectedRooms => Base.ConnectedRooms;
///
- /// Gets the doors that are a part of this room.
+ /// Gets the doors that are a part of this room. TODO: Cache in base game code?
///
- public IEnumerable Doors
- {
- get
- {
- return Doors.Where(n => n.Rooms.Contains(Base)); // TODO: Cache the result in base game code?
- }
- }
+ public IEnumerable Doors => Door.List.Where(d => d.Rooms.Contains(Base));
///
/// Gets the first light controller for this room.
@@ -118,6 +112,11 @@ public IEnumerable Doors
///
public Quaternion Rotation => Transform.rotation;
+ ///
+ /// Gets a collection of players in the room.
+ ///
+ public IEnumerable Players => Player.List.Where(p => p.Room == this);
+
///
/// Gets the room wrapper from the , or creates a new one if it doesn't exist.
///
@@ -158,7 +157,6 @@ public static IEnumerable Get(FacilityZone facilityZone) =>
public static IEnumerable Get(IEnumerable roomIdentifiers) =>
roomIdentifiers.Select(Get);
-
///
/// Gets the closest to the specified player.
///
diff --git a/LabApi/Features/Wrappers/Facility/Warhead.cs b/LabApi/Features/Wrappers/Facility/Warhead.cs
index 5eec95e6..f080fd14 100644
--- a/LabApi/Features/Wrappers/Facility/Warhead.cs
+++ b/LabApi/Features/Wrappers/Facility/Warhead.cs
@@ -286,9 +286,9 @@ public readonly struct DetonationScenario
///
/// Internal constructor to prevent external instantiation.
///
- ///
- ///
- ///
+ /// The .
+ /// The id of the scenario.
+ /// The .
internal DetonationScenario(AlphaWarheadController.DetonationScenario detonationScenario, byte id, WarheadScenarioType type)
{
TimeToDetonate = detonationScenario.TimeToDetonate;
From e38d9b0fb00f016f617a5de48bde9c666a39356f Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Wed, 12 Feb 2025 00:59:27 +0100
Subject: [PATCH 05/12] more changes
---
LabApi/Features/Permissions/PermissionsManager.cs | 4 ++--
LabApi/Features/Wrappers/Facility/Cassie.cs | 6 +++---
.../Features/Wrappers/Facility/Doors/BreakableDoor.cs | 2 +-
.../Wrappers/Facility/Doors/CheckpointDoor.cs | 2 +-
LabApi/Features/Wrappers/Facility/Doors/Door.cs | 4 ++--
LabApi/Features/Wrappers/Facility/Doors/Gate.cs | 2 +-
.../Features/Wrappers/Facility/Doors/Timed173Gate.cs | 2 +-
LabApi/Features/Wrappers/Facility/Elevator.cs | 2 +-
.../Wrappers/Facility/Hazards/AmnesticCloudHazard.cs | 5 +++--
.../Wrappers/Facility/Hazards/DecayableHazard.cs | 5 +++--
LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs | 2 +-
.../Wrappers/Facility/Hazards/SinkholeHazard.cs | 5 +++--
.../Wrappers/Facility/Hazards/TantrumHazard.cs | 5 +++--
LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs | 11 ++++-------
.../Wrappers/Facility/Rooms/LightsController.cs | 6 +++---
.../Facility/Rooms/PocketDimension/PocketDimension.cs | 6 +++---
.../Facility/Rooms/PocketDimension/PocketItem.cs | 6 +++---
.../Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs | 2 +-
.../Facility/Structures/ExperimentalWeaponLocker.cs | 1 -
.../Wrappers/Facility/Structures/Generator.cs | 9 +++++----
.../Features/Wrappers/Facility/Structures/Locker.cs | 4 ++--
.../Wrappers/Facility/Structures/LockerChamber.cs | 2 +-
.../Wrappers/Facility/Structures/PedestalLocker.cs | 2 +-
.../Wrappers/Facility/Structures/RifleRackLocker.cs | 2 +-
.../Wrappers/Facility/Structures/StandardLocker.cs | 2 +-
.../Wrappers/Facility/Structures/Workstation.cs | 8 ++------
LabApi/Loader/ConfigurationLoader.cs | 6 +++---
27 files changed, 55 insertions(+), 58 deletions(-)
diff --git a/LabApi/Features/Permissions/PermissionsManager.cs b/LabApi/Features/Permissions/PermissionsManager.cs
index 330c68b5..d10822cf 100644
--- a/LabApi/Features/Permissions/PermissionsManager.cs
+++ b/LabApi/Features/Permissions/PermissionsManager.cs
@@ -16,7 +16,7 @@ public static class PermissionsManager
///
/// Internal dictionary to store the registered permission providers.
///
- private static readonly Dictionary PermissionProviders = new ();
+ private static readonly Dictionary PermissionProviders = new();
///
/// Registers the given .
@@ -62,7 +62,7 @@ public static class PermissionsManager
return provider;
Logger.Warn($"{LoggerPrefix} The permission provider of type {typeof(T).FullName} is not registered.");
- return default;
+ return null;
}
///
diff --git a/LabApi/Features/Wrappers/Facility/Cassie.cs b/LabApi/Features/Wrappers/Facility/Cassie.cs
index 191ccb16..0c3e7667 100644
--- a/LabApi/Features/Wrappers/Facility/Cassie.cs
+++ b/LabApi/Features/Wrappers/Facility/Cassie.cs
@@ -38,7 +38,7 @@ public static class Cassie
///
/// Calculates duration of specific message.
///
- /// The message.
+ /// The message.
/// Raw numbers.
/// The speed of message.
/// Duration of the specific message in seconds.
@@ -96,7 +96,7 @@ public static class Cassie
/// The target .
/// The SCP number without spaces between. Used by Cassie.
/// The SCP number with spaces between. Used by Subtitles.
- public static void ConvertSCP(RoleTypeId role, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(role, out withoutSpace, out withSpace);
+ public static void ConvertScp(RoleTypeId role, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(role, out withoutSpace, out withSpace);
///
/// Converts player's role name into an SCP number identifier.
@@ -104,6 +104,6 @@ public static class Cassie
/// The targets role name
/// The SCP number without spaces between. Used by Cassie.
/// The SCP number with spaces between. Used by Subtitles.
- public static void ConvertSCP(string roleName, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(roleName, out withoutSpace, out withSpace);
+ public static void ConvertScp(string roleName, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(roleName, out withoutSpace, out withSpace);
}
}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
index b730f0ac..03d0d0f3 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/BreakableDoor.cs
@@ -73,7 +73,7 @@ public float Health
}
///
- /// Gets or sets whether or not the door is broken.
+ /// Gets or sets whether the door is broken.
///
///
/// Some doors can not be unbroken.
diff --git a/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
index f0fbe128..2ea21c7e 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
@@ -64,7 +64,7 @@ public bool IsSubOpened
}
///
- /// Gets or sets whether or not the doors are broken.
+ /// Gets or sets whether the doors are broken.
///
///
/// Some doors can not be unbroken.
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Door.cs b/LabApi/Features/Wrappers/Facility/Doors/Door.cs
index b161cca9..34d63683 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Door.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Door.cs
@@ -150,7 +150,7 @@ internal virtual void OnRemove()
public FacilityZone Zone => Rooms.FirstOrDefault()?.Zone ?? FacilityZone.Other;
///
- /// Gets or sets whether or not the door is open.
+ /// Gets or sets whether the door is open.
///
public bool IsOpened
{
@@ -173,7 +173,7 @@ public bool IsOpened
public float ExactState => Base.GetExactState();
///
- /// Gets or sets whether or not the door is locked.
+ /// Gets or sets whether the door is locked.
///
public bool IsLocked
{
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Gate.cs b/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
index 0eded059..3918c0a7 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
@@ -24,7 +24,7 @@ public class Gate : Door
///
/// The base object.
internal Gate(PryableDoor pryableDoor)
- :base(pryableDoor)
+ : base(pryableDoor)
{
Dictionary.Add(pryableDoor, this);
Base = pryableDoor;
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs b/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
index 753982f6..f9a5a99a 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
@@ -28,7 +28,7 @@ public class Timed173Gate : Gate
///
/// The base object.
internal Timed173Gate(Timed173PryableDoor timed173PryableDoor)
- :base(timed173PryableDoor)
+ : base(timed173PryableDoor)
{
Dictionary.Add(timed173PryableDoor, this);
Base = timed173PryableDoor;
diff --git a/LabApi/Features/Wrappers/Facility/Elevator.cs b/LabApi/Features/Wrappers/Facility/Elevator.cs
index 7c005180..05b34fc9 100644
--- a/LabApi/Features/Wrappers/Facility/Elevator.cs
+++ b/LabApi/Features/Wrappers/Facility/Elevator.cs
@@ -180,5 +180,5 @@ public static Elevator Get(ElevatorChamber elevatorChamber) =>
///
/// The specified elevator group.
/// Enumerable where the group is equal to the one specified.
- public static IEnumerable? GetByGroup(ElevatorGroup group) => List.Where(n => n.Group == group);
+ public static IEnumerable GetByGroup(ElevatorGroup group) => List.Where(n => n.Group == group);
}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
index 822ba9a4..1b8552bb 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
@@ -89,13 +89,14 @@ public CloudState State
///
/// The base object.
///
- public new Scp939AmnesticCloudInstance Base { get; private set; }
+ public new Scp939AmnesticCloudInstance Base { get; }
///
/// Internal constructor preventing external instantiation.
///
/// The base amnestic cloud hazard.
- internal AmnesticCloudHazard(Scp939AmnesticCloudInstance hazard) : base(hazard)
+ internal AmnesticCloudHazard(Scp939AmnesticCloudInstance hazard)
+ : base(hazard)
{
Base = hazard;
Dictionary.Add(hazard, this);
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
index 185820ff..da9c5ddf 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
@@ -52,13 +52,14 @@ public float Elapsed
///
/// The base object.
///
- public new TemporaryHazard Base { get; private set; }
+ public new TemporaryHazard Base { get; }
///
/// An internal constructor to prevent external instantiation.
///
/// The base game object.
- protected DecayableHazard(TemporaryHazard hazard) : base(hazard)
+ protected DecayableHazard(TemporaryHazard hazard)
+ : base(hazard)
{
Base = hazard;
Dictionary.Add(hazard, this);
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
index e0856070..8d2cce5f 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
@@ -103,7 +103,7 @@ public virtual Vector3 SourcePosition
public Room? Room => Room.GetRoomAtPosition(SourcePosition);
///
- /// Initializes the class to subscribe to events and handle the item caching.
+ /// Initializes the class to subscribe to events and handle the item caching.
///
protected Hazard(EnvironmentalHazard hazard)
{
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
index a913c8e2..5a68407a 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
@@ -30,13 +30,14 @@ public class SinkholeHazard : Hazard
///
/// The base object.
///
- public new SinkholeEnvironmentalHazard Base { get; private set; }
+ public new SinkholeEnvironmentalHazard Base { get; }
///
/// An internal constructor to prevent external instantiation.
///
/// The base object.
- internal SinkholeHazard(SinkholeEnvironmentalHazard hazard) : base(hazard)
+ internal SinkholeHazard(SinkholeEnvironmentalHazard hazard)
+ : base(hazard)
{
Base = hazard;
Dictionary.Add(hazard, this);
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs
index aac49ae5..3973bc33 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs
@@ -50,13 +50,14 @@ public bool PlaySizzle
///
/// The base object.
///
- public new TantrumEnvironmentalHazard Base { get; private set; }
+ public new TantrumEnvironmentalHazard Base { get; }
///
/// An internal constructor to prevent external instantiation.
///
/// The base game tantrum hazard.
- internal TantrumHazard(TantrumEnvironmentalHazard hazard) : base(hazard)
+ internal TantrumHazard(TantrumEnvironmentalHazard hazard)
+ : base(hazard)
{
Base = hazard;
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs b/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
index 79e4cc16..51da0822 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
@@ -72,7 +72,7 @@ public float InactiveTime
/// Returns if is in range where tesla gate starts idling.
///
/// The player to check on.
- /// Whethet the player is in idle range.
+ /// Whether the player is in idle range.
public bool IsPlayerInIdleRange(Player player) => Base.IsInIdleRange(player.ReferenceHub);
///
@@ -86,21 +86,18 @@ public float InactiveTime
/// Returns if any is in range where tesla gate starts idling.
///
/// Whether any player is within the idle range.
- public bool IsAnyPlayerInIdleRange() => HashsetExtensions.Any(ReferenceHub.AllHubs, Base.IsInIdleRange);
+ public bool IsAnyPlayerInIdleRange() => ReferenceHub.AllHubs.Any(Base.IsInIdleRange);
///
/// Returns if any is in range where tesla gate starts to burst.
///
/// Whether any player is within activation range.
- public bool IsAnyPlayerInRange() => HashsetExtensions.Any(ReferenceHub.AllHubs, Base.PlayerInRange);
+ public bool IsAnyPlayerInRange() => ReferenceHub.AllHubs.Any(Base.PlayerInRange);
///
/// Tesla gate electric burst. Will not do anything if burst is being active.
///
- public void Trigger()
- {
- Base.ServerSideCode();
- }
+ public void Trigger() => Base.ServerSideCode();
///
/// Tesla gate instant burst.
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs b/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs
index c99bc37e..713b0323 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs
@@ -38,10 +38,11 @@ internal static void Initialize()
RoomLightController.OnAdded += (roomLightController) => _ = new LightsController(roomLightController);
RoomLightController.OnRemoved += (roomLightController) => Dictionary.Remove(roomLightController);
}
+
///
/// The base game object.
///
- public RoomLightController Base { get; private set; }
+ public RoomLightController Base { get; }
///
/// The room this controller is assigned to.
@@ -70,8 +71,7 @@ public Color OverrideLightsColor
/// Blackouts the room for specified duration.
///
/// Duration of light shutdown in seconds.
- public void FlickerLights(float duration) =>
- Base.ServerFlickerLights(duration);
+ public void FlickerLights(float duration) => Base.ServerFlickerLights(duration);
///
/// Gets the controller wrapper from , or creates a new one if it doesnt exists.
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
index 84ac4d78..1d8fd13a 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
@@ -69,7 +69,7 @@ public static float MaxPocketItemTriggerDelay
///
/// The room identifier for the pocket dimension.
internal PocketDimension(RoomIdentifier room)
- :base(room)
+ : base(room)
{
Instance = this;
}
@@ -172,12 +172,12 @@ public static void RemoveAllExitPosesForZone(FacilityZone zone)
{
Scp106PocketExitFinder.PosesForZoneCache[zone] = [];
}
-
+
///
/// Removes the specified poses from use as exits for the pocket dimension.
///
/// The zone to remove exits from.
- /// the poses to remove.
+ /// the poses to remove.
public static void RemoveExitPosesForZone(FacilityZone zone, IEnumerable poses)
{
// Attempts to generate the pose array as it could be empty.
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs
index cc274848..97870095 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketItem.cs
@@ -41,7 +41,7 @@ internal static void Initialize()
///
/// An internal constructor to prevent external instantiation.
///
- /// The item pickup in the pocket dimension.
+ /// The item pickup in the pocket dimension.
internal PocketItem(ItemPickupBase pickup, Scp106PocketItemManager.PocketItem pocketItem)
{
Dictionary.Add(pickup, this);
@@ -105,7 +105,7 @@ public static bool TryGet(Pickup pickup, [NotNullWhen(true)] out PocketItem? poc
///
/// The inside the pocket dimension to get the from.
/// The associated for the or null if it doesn't exist.
- public static PocketItem? Get(Pickup pickup) => TryGet(pickup, out var pocketItem) ? pocketItem : null;
+ public static PocketItem? Get(Pickup pickup) => TryGet(pickup, out PocketItem? pocketItem) ? pocketItem : null;
///
/// Gets or adds a .
@@ -117,7 +117,7 @@ public static bool TryGet(Pickup pickup, [NotNullWhen(true)] out PocketItem? poc
///
public static PocketItem GetOrAdd(Pickup pickup)
{
- if (Dictionary.TryGetValue(pickup.Base, out var pocketItem))
+ if (Dictionary.TryGetValue(pickup.Base, out PocketItem? pocketItem))
return pocketItem;
pickup.Position = PocketDimension.Instance!.Position + Vector3.up;
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
index 141bfee2..98c850bc 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
@@ -35,7 +35,7 @@ public class Scp914 : Room
///
/// The room identifier for the pocket dimension.
internal Scp914(RoomIdentifier roomIdentifier)
- :base(roomIdentifier)
+ : base(roomIdentifier)
{
Instance = this;
}
diff --git a/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs
index 9e6ef95c..bc4ba26d 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/ExperimentalWeaponLocker.cs
@@ -45,7 +45,6 @@ internal override void OnRemove()
///
public new BaseExperimentalWeaponLocler Base { get; }
-
///
/// The experimental weapon's chamber.
///
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Generator.cs b/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
index 25706b98..aaa81f80 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
@@ -181,15 +181,16 @@ public short RemainingTime
///
/// Gets the generator wrapper from the , or creates a new one if it doesn't exist.
///
- /// The of the generator.
+ /// The of the generator.
/// The requested generator.
- public static Generator Get(Scp079Generator scp079generator) =>
- Dictionary.TryGetValue(scp079generator, out Generator generator) ? generator : new Generator(scp079generator);
+ public static Generator Get(Scp079Generator scp079Generator) =>
+ Dictionary.TryGetValue(scp079Generator, out Generator generator) ? generator : new Generator(scp079Generator);
///
/// Gets the generator wrapper from the or returns if specified room does not have any.
///
/// Target room.
+ /// Generators found.
/// Whether the generator was found.
- public static bool TryGetFromRoom(Room room, [NotNullWhen(true)] out List? generator) => GeneratorsByRoom.TryGetValue(room.Base, out generator);
+ public static bool TryGetFromRoom(Room room, [NotNullWhen(true)] out List? generators) => GeneratorsByRoom.TryGetValue(room.Base, out generators);
}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Locker.cs b/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
index 25cc622f..6483f3bd 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
@@ -27,7 +27,7 @@ public class Locker : Structure
///
/// The base object.
internal Locker(BaseLocker baseLocker)
- :base(baseLocker)
+ : base(baseLocker)
{
Dictionary.Add(baseLocker, this);
Base = baseLocker;
@@ -152,7 +152,7 @@ public void FillChambers()
chambers.RemoveAt(Random.Range(0, chambers.Count));
}
- foreach (var chamber in chambers)
+ foreach (LockerChamber chamber in chambers)
chamber.Fill();
ListPool.Shared.Return(chambers);
diff --git a/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs b/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs
index 03df0a7b..ddba1ba3 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/LockerChamber.cs
@@ -26,7 +26,7 @@ public class LockerChamber
///
/// The base object.
/// The that has this chamber.
- /// The Id of the chamber inside the locker.
+ /// The id of the chamber inside the locker.
internal LockerChamber(BaseLockerChamber baseLockerChamber, Locker locker, byte id)
{
Dictionary.Add(baseLockerChamber, this);
diff --git a/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
index 5cfa4abd..1032c486 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
@@ -50,7 +50,7 @@ internal override void OnRemove()
public LockerChamber Chamber => Chambers.First();
///
- /// Gets or sets whether or not the pedestal is open.
+ /// Gets or sets whether the pedestal is open.
///
public bool IsOpen
{
diff --git a/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs
index 00aefada..10788235 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/RifleRackLocker.cs
@@ -39,7 +39,7 @@ internal override void OnRemove()
}
///
- /// Gets or sets whether or not the rifle rack is open.
+ /// Gets or sets whether the rifle rack is open.
///
public bool IsOpen
{
diff --git a/LabApi/Features/Wrappers/Facility/Structures/StandardLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/StandardLocker.cs
index 6041fa0d..b8ada6fc 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/StandardLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/StandardLocker.cs
@@ -23,7 +23,7 @@ public class StandardLocker : Locker
///
/// The base object.
internal StandardLocker(BaseLocker baseLocker)
- :base(baseLocker)
+ : base(baseLocker)
{
Dictionary.Add(baseLocker, this);
}
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs b/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs
index 7b5985b0..fa3d9306 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Workstation.cs
@@ -73,16 +73,12 @@ public Player KnownUser
/// The to test.
/// Whether the player was close enough.
public bool IsInRange(Player player)
- {
- return BaseController.IsInRange(player.ReferenceHub);
- }
+ => BaseController.IsInRange(player.ReferenceHub);
///
/// Interact with the workstation.
///
/// The that interacted.
public void Interact(Player player)
- {
- BaseController.ServerInteract(player.ReferenceHub, BaseController.ActivateCollider.ColliderId);
- }
+ => BaseController.ServerInteract(player.ReferenceHub, BaseController.ActivateCollider.ColliderId);
}
diff --git a/LabApi/Loader/ConfigurationLoader.cs b/LabApi/Loader/ConfigurationLoader.cs
index 8723b0c1..72e8ef2d 100644
--- a/LabApi/Loader/ConfigurationLoader.cs
+++ b/LabApi/Loader/ConfigurationLoader.cs
@@ -119,7 +119,7 @@ public static bool TryLoadConfig(this Plugin plugin, string fileName, [
// We try to read the configuration from its file.
else if (plugin.TryReadConfig(fileName, out config))
{
- // We save the configuration to update new properties and return whether or not it was successfully saved.
+ // We save the configuration to update new properties and return whether it was successfully saved.
return plugin.TrySaveConfig(config, fileName);
}
@@ -145,7 +145,7 @@ public static void SaveConfig(this Plugin plugin, TConfig config, strin
/// The type of the configuration to read.
/// The read configuration of the specified if successful, otherwise .
public static TConfig? ReadConfig(this Plugin plugin, string fileName)
- where TConfig : class, new() => plugin.TryReadConfig(fileName, out TConfig? config) ? config : default;
+ where TConfig : class, new() => plugin.TryReadConfig(fileName, out TConfig? config) ? config : null;
///
/// Reads the configuration of the specified and creates a default instance if it doesn't exist.
@@ -155,7 +155,7 @@ public static void SaveConfig(this Plugin plugin, TConfig config, strin
/// The type of the configuration to load.
/// The loaded configuration of the specified if successful, otherwise .
public static TConfig? LoadConfig(this Plugin plugin, string fileName)
- where TConfig : class, new() => plugin.TryLoadConfig(fileName, out TConfig? config) ? config : default;
+ where TConfig : class, new() => plugin.TryLoadConfig(fileName, out TConfig? config) ? config : null;
///
/// Tries to create a default instance of the specified configuration.
From 395c21667cf8db816cfc7831ccd51d31558f1574 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Wed, 12 Feb 2025 13:16:07 +0100
Subject: [PATCH 06/12] Revert trinary operator in Player::Position
---
LabApi/Features/Wrappers/Players/Player.cs | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/LabApi/Features/Wrappers/Players/Player.cs b/LabApi/Features/Wrappers/Players/Player.cs
index 05d9507c..226d0161 100644
--- a/LabApi/Features/Wrappers/Players/Player.cs
+++ b/LabApi/Features/Wrappers/Players/Player.cs
@@ -661,7 +661,13 @@ public Player? DisarmedBy
///
public Vector3 Position
{
- get => ReferenceHub.roleManager.CurrentRole is not IFpcRole fpcRole ? Vector3.zero : fpcRole.FpcModule.Position;
+ get
+ {
+ if (RoleBase is not IFpcRole fpcRole)
+ return Vector3.zero;
+
+ return fpcRole.FpcModule.Position;
+ }
set => ReferenceHub.TryOverridePosition(value);
}
From 061e9bf265e1602f62e5fd4d2c8f7a722c224489 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Wed, 12 Feb 2025 13:16:37 +0100
Subject: [PATCH 07/12] Server::Host is already null default, no need to = null
---
LabApi/Features/Wrappers/Players/Server.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LabApi/Features/Wrappers/Players/Server.cs b/LabApi/Features/Wrappers/Players/Server.cs
index 47f13417..923d9ebb 100644
--- a/LabApi/Features/Wrappers/Players/Server.cs
+++ b/LabApi/Features/Wrappers/Players/Server.cs
@@ -33,7 +33,7 @@ internal static void Initialize()
///
/// The Instance.
///
- public static Player? Host { get; private set; } = null;
+ public static Player? Host { get; private set; }
///
/// Gets the IP address of the server.
From 21cadfcb39342af86cff10715a54760451858233 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Wed, 12 Feb 2025 13:23:08 +0100
Subject: [PATCH 08/12] more complaining
---
LabApi/Features/Wrappers/Players/Server.cs | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/LabApi/Features/Wrappers/Players/Server.cs b/LabApi/Features/Wrappers/Players/Server.cs
index 923d9ebb..7f4ffd0a 100644
--- a/LabApi/Features/Wrappers/Players/Server.cs
+++ b/LabApi/Features/Wrappers/Players/Server.cs
@@ -256,7 +256,7 @@ public static bool BanUserId(string userId, string reason, long duration, string
/// The ban reason.
/// The duration of the ban.
/// The nickname of the banned player.
- /// Whether or not the ban was successful.
+ /// Whether the ban was successful.
public static bool BanUserId(string userId, Player issuer, string reason, long duration, string bannedPlayerNickname = "UnknownName")
{
if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(reason) || issuer == null)
@@ -280,7 +280,7 @@ public static bool BanUserId(string userId, Player issuer, string reason, long d
/// The ban reason.
/// The duration of the ban.
/// The nickname of the banned player.
- /// Whether or not the ban was successful.
+ /// Whether the ban was successful.
public static bool BanIpAddress(string ipAddress, string reason, long duration, string bannedPlayerNickname = "UnknownName") =>
BanIpAddress(ipAddress, Host!, reason, duration, bannedPlayerNickname);
@@ -292,7 +292,7 @@ public static bool BanIpAddress(string ipAddress, string reason, long duration,
/// The ban reason.
/// The duration of the ban.
/// The nickname of the banned player.
- /// Whether or not the ban was successful.
+ /// Whether the ban was successful.
public static bool BanIpAddress(string ipAddress, Player issuer, string reason, long duration, string bannedPlayerNickname = "UnknownName")
{
if (string.IsNullOrEmpty(ipAddress) || string.IsNullOrEmpty(reason) || issuer == null)
@@ -313,7 +313,7 @@ public static bool BanIpAddress(string ipAddress, Player issuer, string reason,
/// Unbans a player from the server.
///
/// The User ID of the player to unban.
- /// Whether or not the unban was successful.
+ /// Whether the unban was successful.
public static bool UnbanUserId(string userId)
{
if (string.IsNullOrEmpty(userId) || !IsPlayerBanned(userId))
@@ -338,10 +338,10 @@ public static bool UnbanIpAddress(string ipAddress)
}
///
- /// Checks whether or not a player is banned.
+ /// Checks whether a player is banned.
///
/// The User ID or IP address of the player.
- /// Whether or not the player is banned.
+ /// Whether the player is banned.
public static bool IsPlayerBanned(string value)
{
if (string.IsNullOrEmpty(value))
@@ -499,10 +499,7 @@ private class CategoryLimitsSynchronizer : ILimit
///
public sbyte this[ItemCategory category]
{
- get
- {
- return InventoryLimits.StandardCategoryLimits[category];
- }
+ get => InventoryLimits.StandardCategoryLimits[category];
set
{
if (!InventoryLimits.StandardCategoryLimits.ContainsKey(category))
From 1af4b6e551294a330be4ec1b3495f8b543bdc1e8 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Wed, 12 Feb 2025 15:20:49 +0100
Subject: [PATCH 09/12] Player::GroupName docs improved
---
LabApi/Features/Wrappers/Players/Player.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LabApi/Features/Wrappers/Players/Player.cs b/LabApi/Features/Wrappers/Players/Player.cs
index 226d0161..8d3e2136 100644
--- a/LabApi/Features/Wrappers/Players/Player.cs
+++ b/LabApi/Features/Wrappers/Players/Player.cs
@@ -445,7 +445,7 @@ public string GroupColor
}
///
- /// Gets or sets the player's group name.
+ /// Gets or sets what is displayed for the player's group.
///
public string GroupName
{
From 9e3da11478abf825f928a5579cbd3bd90e08b0d0 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Wed, 12 Feb 2025 17:49:45 +0100
Subject: [PATCH 10/12] agafgafegs
---
LabApi/Features/Wrappers/Facility/Doors/Door.cs | 4 +---
LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs | 2 +-
.../Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs | 1 +
.../Facility/Rooms/PocketDimension/PocketDimension.cs | 2 +-
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Door.cs b/LabApi/Features/Wrappers/Facility/Doors/Door.cs
index 34d63683..96ee677e 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Door.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Door.cs
@@ -3,10 +3,8 @@
using Interactables.Interobjects.DoorUtils;
using LabApi.Features.Enums;
using MapGeneration;
-using MapGeneration.RoomConnectors;
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using UnityEngine;
@@ -42,7 +40,7 @@ internal static void Initialize()
///
/// Contains all the values for the associated .
///
- private readonly static Dictionary doorNameDictionary = new()
+ private static readonly Dictionary doorNameDictionary = new()
{
{ "LCZ_CAFE", DoorName.LczPc },
{ "LCZ_WC", DoorName.LczWc },
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs b/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
index f9a5a99a..1c9f63ee 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Timed173Gate.cs
@@ -54,7 +54,7 @@ internal override void OnRemove()
public Stopwatch Stopwatch => Base.Stopwatch;
///
- /// Gets or sets whether the gate will open if a SCP-173 is present.
+ /// Gets or sets whether the gate will open if an SCP-173 is present.
///
///
/// The gate is still unlocked after the specified time regardless of this setting.
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
index 1b8552bb..27a394ef 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
@@ -111,6 +111,7 @@ internal AmnesticCloudHazard(Scp939AmnesticCloudInstance hazard)
/// The target scale to spawn with.
/// The duration in seconds for which this cloud will be alive for.
/// The size of the cloud.
+ /// The owner of the cloud.
/// A new hazard.
public static AmnesticCloudHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale, float duration = 90f, byte size = 255, Player? owner = null)
{
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
index 1d8fd13a..42996aeb 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
@@ -36,7 +36,7 @@ public class PocketDimension : Room
/// Gets an array of the recycle chances.
///
///
- /// Indexing the array by the rarity of the item see gives the chance for the item to be dropped from 0.0 to 1.0.
+ /// Indexing the array by the rarity of the item see gives the chance for the item to be dropped from 0.0 to 1.0.
///
public static float[] RecycleChances => Scp106PocketItemManager.RecycleChances;
From 06860c993c56823fdeb8ffb665d8a3963686a9c6 Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Fri, 14 Feb 2025 19:38:04 +0100
Subject: [PATCH 11/12] a whole lot more nitpicking
---
.../PlayerAimedWeaponEventArgs.cs | 4 +-
.../PlayerCancelledUsingItemEventArgs.cs | 3 +-
.../PlayerCancellingUsingItemEventArgs.cs | 3 +-
.../PlayerEffectUpdatedEventArgs.cs | 2 +-
.../PlayerEvents/PlayerEscapedEventArgs.cs | 3 +-
.../PlayerEvents/PlayerEscapingEventArgs.cs | 3 +-
.../PlayerLeavingPocketDimensionEventArgs.cs | 2 +-
.../PlayerPickingUpAmmoEventArgs.cs | 6 +-
.../PlayerPreAuthenticatedEventArgs.cs | 1 -
.../PlayerPreAuthenticatingEventArgs.cs | 2 +-
.../PlayerReportedPlayerEventArgs.cs | 2 +-
.../PlayerReportingCheaterEventArgs.cs | 2 +-
.../PlayerTogglingNoclipEventArgs.cs | 4 +-
.../Scp079BlackingOutZoneEventArgs.cs | 1 +
.../Scp079ChangedCameraEventArgs.cs | 1 +
.../ServerEvents/GrenadeExplodedEventArgs.cs | 2 +-
.../ServerEvents/GrenadeExplodingEventArgs.cs | 2 +-
.../ServerEvents/WaveRespawningEventArgs.cs | 4 +-
LabApi/Features/Wrappers/Facility/Cassie.cs | 171 ++++---
.../Wrappers/Facility/Doors/CheckpointDoor.cs | 6 +-
.../Wrappers/Facility/Doors/ElevatorDoor.cs | 2 +-
.../Features/Wrappers/Facility/Doors/Gate.cs | 5 +-
.../Facility/Doors/NonInteractableDoor.cs | 2 +-
.../Facility/Hazards/AmnesticCloudHazard.cs | 292 ++++++-----
.../Facility/Hazards/DecayableHazard.cs | 151 +++---
.../Wrappers/Facility/Hazards/Hazard.cs | 452 +++++++++---------
.../Facility/Hazards/SinkholeHazard.cs | 135 +++---
.../Facility/Hazards/TantrumHazard.cs | 173 ++++---
.../Wrappers/Facility/Hazards/Tesla.cs | 257 +++++-----
.../Facility/Rooms/LightsController.cs | 135 +++---
.../Rooms/PocketDimension/PocketDimension.cs | 12 +-
.../Rooms/PocketDimension/PocketTeleport.cs | 5 +-
.../Wrappers/Facility/Rooms/Scp914/Scp914.cs | 7 +-
LabApi/Features/Wrappers/Facility/Round.cs | 271 ++++++-----
.../Wrappers/Facility/Structures/Generator.cs | 6 +-
.../Wrappers/Facility/Structures/Locker.cs | 10 +-
.../Facility/Structures/PedestalLocker.cs | 2 +-
.../Wrappers/Facility/Structures/Structure.cs | 2 +-
.../Facility/Structures/WallCabinet.cs | 2 +-
.../Wrappers/Items/Usable/Scp1344Item.cs | 101 ++--
LabApi/Features/Wrappers/Pickups/Pickup.cs | 17 +-
LabApi/Features/Wrappers/Players/Player.cs | 11 +-
LabApi/Features/Wrappers/Players/Server.cs | 2 +-
LabApi/Loader/Features/Misc/AssemblyUtils.cs | 2 +-
.../Plugins/Configuration/Properties.cs | 2 +-
45 files changed, 1129 insertions(+), 1151 deletions(-)
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerAimedWeaponEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerAimedWeaponEventArgs.cs
index 1a3c908b..8fc57473 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerAimedWeaponEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerAimedWeaponEventArgs.cs
@@ -16,7 +16,7 @@ public class PlayerAimedWeaponEventArgs : EventArgs, IPlayerEvent, IWeaponEvent
///
/// The player who aimed the weapon.
/// The weapon that the player aimed.
- /// Whether or not the player was aiming or unaiming their weapon.
+ /// Whether the player was aiming or unaiming their weapon.
public PlayerAimedWeaponEventArgs(ReferenceHub player, ItemBase weapon, bool aiming)
{
Player = Player.Get(player);
@@ -30,7 +30,7 @@ public PlayerAimedWeaponEventArgs(ReferenceHub player, ItemBase weapon, bool aim
public Player Player { get; }
///
- /// Whether or not the player is aiming or unaiming.
+ /// Whether the player is aiming or unaiming.
///
public bool Aiming { get; }
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerCancelledUsingItemEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerCancelledUsingItemEventArgs.cs
index 5daefbd6..b93f29db 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerCancelledUsingItemEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerCancelledUsingItemEventArgs.cs
@@ -1,5 +1,4 @@
-using InventorySystem.Items.Usables;
-using LabApi.Events.Arguments.Interfaces;
+using LabApi.Events.Arguments.Interfaces;
using LabApi.Features.Wrappers;
using System;
using UsableItem = InventorySystem.Items.Usables.UsableItem;
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerCancellingUsingItemEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerCancellingUsingItemEventArgs.cs
index dbf7848c..62b40adf 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerCancellingUsingItemEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerCancellingUsingItemEventArgs.cs
@@ -1,5 +1,4 @@
-using InventorySystem.Items.Usables;
-using LabApi.Events.Arguments.Interfaces;
+using LabApi.Events.Arguments.Interfaces;
using LabApi.Features.Wrappers;
using System;
using UsableItem = InventorySystem.Items.Usables.UsableItem;
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerEffectUpdatedEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerEffectUpdatedEventArgs.cs
index 4bf3a4d6..8f40efab 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerEffectUpdatedEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerEffectUpdatedEventArgs.cs
@@ -6,7 +6,7 @@
namespace LabApi.Events.Arguments.PlayerEvents;
///
-/// Represents the arguments for the event.
+/// Represents the arguments for the event.
///
public class PlayerEffectUpdatedEventArgs : EventArgs, IPlayerEvent
{
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerEscapedEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerEscapedEventArgs.cs
index 7aebc7e2..bd427268 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerEscapedEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerEscapedEventArgs.cs
@@ -16,11 +16,12 @@ public class PlayerEscapedEventArgs : EventArgs, IPlayerEvent
///
/// The player who escaped.
/// The new role.
- /// The amount of tokens granted to team after escape.
+ /// The scenario of the escape.
public PlayerEscapedEventArgs(ReferenceHub player, RoleTypeId newRole, EscapeScenarioType escapeScenarioType)
{
Player = Player.Get(player);
NewRole = newRole;
+ EscapeScenarioType = escapeScenarioType;
}
///
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerEscapingEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerEscapingEventArgs.cs
index 284a1889..44db8e60 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerEscapingEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerEscapingEventArgs.cs
@@ -16,8 +16,7 @@ public class PlayerEscapingEventArgs : EventArgs, ICancellableEvent
///
/// The player who is escaping.
/// The new role that is set after escape.
- /// The team that will be granted tickets.
- /// The amount of tokens granted to team after escape.
+ /// The scenario of the escape.
public PlayerEscapingEventArgs(ReferenceHub player, RoleTypeId newRole, EscapeScenarioType escapeScenario)
{
IsAllowed = true;
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerLeavingPocketDimensionEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerLeavingPocketDimensionEventArgs.cs
index 572ba421..e480979c 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerLeavingPocketDimensionEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerLeavingPocketDimensionEventArgs.cs
@@ -37,7 +37,7 @@ public PlayerLeavingPocketDimensionEventArgs(ReferenceHub player, PocketDimensio
public PocketTeleport? Teleport { get; }
///
- /// Gets whether it is gonna be success.
+ /// Gets or sets whether it is going to be success.
///
public bool IsSuccessful { get; set; }
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerPickingUpAmmoEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerPickingUpAmmoEventArgs.cs
index 3bc89c21..b37758f2 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerPickingUpAmmoEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerPickingUpAmmoEventArgs.cs
@@ -13,8 +13,8 @@ public class PlayerPickingUpAmmoEventArgs : EventArgs, ICancellableEvent
///
/// Initializes a new instance of the class.
///
- /// The player who is pickup the the ammo pickup.
- /// Type of the ammo./param>
+ /// The player who is pickup the ammo pickup.
+ /// Type of the ammo.
/// Amount of ammo that is being picked up.
/// Ammo pickup.
public PlayerPickingUpAmmoEventArgs(ReferenceHub player, ItemType ammoType, ushort ammoAmount, ItemPickupBase pickup)
@@ -27,7 +27,7 @@ public PlayerPickingUpAmmoEventArgs(ReferenceHub player, ItemType ammoType, usho
}
///
- /// Gets the player who is pickup the the ammo pickup.
+ /// Gets the player who is picking up the ammo pickup.
///
public Player Player { get; }
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatedEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatedEventArgs.cs
index 50e385b0..05b2294d 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatedEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatedEventArgs.cs
@@ -11,7 +11,6 @@ public class PlayerPreAuthenticatedEventArgs : EventArgs
///
/// Initializes a new instance of the class.
///
- /// Whenever the player can join.
/// User ID of the player.
/// IP Address the of player.
/// Expiration of the authentication.
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatingEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatingEventArgs.cs
index d6953c93..7eace2d9 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatingEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerPreAuthenticatingEventArgs.cs
@@ -13,7 +13,7 @@ public class PlayerPreAuthenticatingEventArgs : EventArgs, ICancellableEvent
///
/// Initializes a new instance of the class.
///
- /// Whenever the player can join.
+ /// Whether the player can join.
/// User ID of the player.
/// IP Address the of player.
/// Expiration of the authentication.
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerReportedPlayerEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerReportedPlayerEventArgs.cs
index bacbe4f8..c2fa1535 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerReportedPlayerEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerReportedPlayerEventArgs.cs
@@ -7,7 +7,7 @@ namespace LabApi.Events.Arguments.PlayerEvents;
///
/// Represents the arguments for the event.
///
-public class PlayerReportedPlayerEventArgs : EventArgs, IPlayerEvent
+public class PlayerReportedPlayerEventArgs : EventArgs, IPlayerEvent, ITargetEvent
{
///
/// Initializes a new instance of the class.
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerReportingCheaterEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerReportingCheaterEventArgs.cs
index 0e373c6c..a0415daa 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerReportingCheaterEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerReportingCheaterEventArgs.cs
@@ -7,7 +7,7 @@ namespace LabApi.Events.Arguments.PlayerEvents;
///
/// Represents the arguments for the event.
///
-public class PlayerReportingCheaterEventArgs : EventArgs, IPlayerEvent, ICancellableEvent
+public class PlayerReportingCheaterEventArgs : EventArgs, IPlayerEvent, ITargetEvent, ICancellableEvent
{
///
/// Initializes a new instance of the class.
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs
index d6bd3a53..acac925f 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs
@@ -31,8 +31,8 @@ public PlayerTogglingNoclipEventArgs(ReferenceHub player, bool newState)
public bool NewNoclipState { get; }
///
- /// Whether the event is allowed to run.
- /// This value is assigned on based on whether the player has noclip permitted. So it may not be allowed by default for some players.
+ /// Whether the event is allowed to run.
+ /// This value is assigned on based on whether the player has noclip permitted. So it may not be allowed by default for some players.
///
public bool IsAllowed { get; set; }
}
diff --git a/LabApi/Events/Arguments/Scp079Events/Scp079BlackingOutZoneEventArgs.cs b/LabApi/Events/Arguments/Scp079Events/Scp079BlackingOutZoneEventArgs.cs
index 9ee4f724..c5094b39 100644
--- a/LabApi/Events/Arguments/Scp079Events/Scp079BlackingOutZoneEventArgs.cs
+++ b/LabApi/Events/Arguments/Scp079Events/Scp079BlackingOutZoneEventArgs.cs
@@ -21,6 +21,7 @@ public Scp079BlackingOutZoneEventArgs(ReferenceHub player, FacilityZone zone)
Zone = zone;
IsAllowed = true;
}
+
///
/// The SCP-079 player instance.
///
diff --git a/LabApi/Events/Arguments/Scp079Events/Scp079ChangedCameraEventArgs.cs b/LabApi/Events/Arguments/Scp079Events/Scp079ChangedCameraEventArgs.cs
index 0efb0af4..eb14eb65 100644
--- a/LabApi/Events/Arguments/Scp079Events/Scp079ChangedCameraEventArgs.cs
+++ b/LabApi/Events/Arguments/Scp079Events/Scp079ChangedCameraEventArgs.cs
@@ -20,6 +20,7 @@ public Scp079ChangedCameraEventArgs(ReferenceHub player, Scp079Camera camera)
Player = Player.Get(player);
Camera = camera;
}
+
///
/// The SCP-079 player instance.
///
diff --git a/LabApi/Events/Arguments/ServerEvents/GrenadeExplodedEventArgs.cs b/LabApi/Events/Arguments/ServerEvents/GrenadeExplodedEventArgs.cs
index 58f21278..666c2e4c 100644
--- a/LabApi/Events/Arguments/ServerEvents/GrenadeExplodedEventArgs.cs
+++ b/LabApi/Events/Arguments/ServerEvents/GrenadeExplodedEventArgs.cs
@@ -40,6 +40,6 @@ public GrenadeExplodedEventArgs(ExplosionGrenade grenade, ReferenceHub player, V
///
/// Gets if grenade should destroy doors.
- ///
+ ///
public bool ExplodeDoors { get; }
}
diff --git a/LabApi/Events/Arguments/ServerEvents/GrenadeExplodingEventArgs.cs b/LabApi/Events/Arguments/ServerEvents/GrenadeExplodingEventArgs.cs
index 64fc449f..7b0c72b3 100644
--- a/LabApi/Events/Arguments/ServerEvents/GrenadeExplodingEventArgs.cs
+++ b/LabApi/Events/Arguments/ServerEvents/GrenadeExplodingEventArgs.cs
@@ -42,7 +42,7 @@ public GrenadeExplodingEventArgs(ExplosionGrenade grenade, ReferenceHub player,
///
/// Gets or sets if grenade should destroy doors.
- ///
+ ///
public bool ExplodeDoors { get; set; } = true;
///
diff --git a/LabApi/Events/Arguments/ServerEvents/WaveRespawningEventArgs.cs b/LabApi/Events/Arguments/ServerEvents/WaveRespawningEventArgs.cs
index e4dd6a56..e5263217 100644
--- a/LabApi/Events/Arguments/ServerEvents/WaveRespawningEventArgs.cs
+++ b/LabApi/Events/Arguments/ServerEvents/WaveRespawningEventArgs.cs
@@ -12,6 +12,8 @@ namespace LabApi.Events.Arguments.ServerEvents;
///
public class WaveRespawningEventArgs : EventArgs, ICancellableEvent
{
+ private readonly Dictionary _roles;
+
///
/// Initializes a new instance of the class.
///
@@ -37,8 +39,6 @@ public WaveRespawningEventArgs(Team team, Dictionary r
///
public IEnumerable SpawningPlayers => _roles.Keys.Select(n => Player.Get(n));
- private readonly Dictionary _roles;
-
///
/// Gets whether is this player spawning.
///
diff --git a/LabApi/Features/Wrappers/Facility/Cassie.cs b/LabApi/Features/Wrappers/Facility/Cassie.cs
index 0c3e7667..256517e8 100644
--- a/LabApi/Features/Wrappers/Facility/Cassie.cs
+++ b/LabApi/Features/Wrappers/Facility/Cassie.cs
@@ -5,105 +5,104 @@
using System.Linq;
using static NineTailedFoxAnnouncer;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// The wrapper for in game Cassie announcer.
+///
+public static class Cassie
{
///
- /// The wrapper for in game Cassie announcer.
+ /// Gets whether Cassie is currently speaking.
///
- public static class Cassie
- {
- ///
- /// Gets whether Cassie is currently speaking.
- ///
- public static bool IsSpeaking => singleton.queue.Count != 0;
+ public static bool IsSpeaking => singleton.queue.Count != 0;
- ///
- /// Gets all available voice lines for Cassie.
- ///
- public static VoiceLine[] AllLines => singleton.voiceLines;
+ ///
+ /// Gets all available voice lines for Cassie.
+ ///
+ public static VoiceLine[] AllLines => singleton.voiceLines;
- ///
- /// Gets all collection names in which voicelines are in.
- ///
- public static string[] CollectionNames => singleton.voiceLines.Select(n => n.collection).Distinct().ToArray();
+ ///
+ /// Gets all collection names in which voicelines are in.
+ ///
+ public static string[] CollectionNames => singleton.voiceLines.Select(n => n.collection).Distinct().ToArray();
- ///
- /// Checks whether a specified word is valid for cassie.
- /// String comparison is case-insensitive.
- ///
- /// The word to check.
- /// Whether the word is valid.
- public static bool IsValid(string word) => singleton.voiceLines.Any(line => line.apiName.Equals(word, StringComparison.InvariantCultureIgnoreCase));
+ ///
+ /// Checks whether a specified word is valid for cassie.
+ /// String comparison is case-insensitive.
+ ///
+ /// The word to check.
+ /// Whether the word is valid.
+ public static bool IsValid(string word) => singleton.voiceLines.Any(line => line.apiName.Equals(word, StringComparison.InvariantCultureIgnoreCase));
- ///
- /// Calculates duration of specific message.
- ///
- /// The message.
- /// Raw numbers.
- /// The speed of message.
- /// Duration of the specific message in seconds.
- public static float CalculateDuration(string message, bool rawNumber = false) => singleton.CalculateDuration(message, rawNumber);
+ ///
+ /// Calculates duration of specific message.
+ ///
+ /// The message.
+ /// Raw numbers.
+ /// The speed of message.
+ /// Duration of the specific message in seconds.
+ public static float CalculateDuration(string message, bool rawNumber = false) => singleton.CalculateDuration(message, rawNumber);
- ///
- /// Plays a custom announcement.
- ///
- /// The sentence Cassie is supposed to say.
- /// Sets a minimal 3-second moment of silence before the announcement. For most cases you wanna keep it true.
- /// Whether the background noises play.
- /// Show subtitles.
- /// Custom subtitles to appear instead of the actual message.
- //TODO: Perhaps add the custom subtitles functionality to RA & base game commands?
- public static void Message(string message, bool isHeld = false, bool isNoisy = true, bool isSubtitles = false, string customSubtitles = "") => RespawnEffectsController.PlayCassieAnnouncement(message, isHeld, isNoisy, isSubtitles, customSubtitles);
+ ///
+ /// Plays a custom announcement.
+ ///
+ /// The sentence Cassie is supposed to say.
+ /// Sets a minimal 3-second moment of silence before the announcement. For most cases you wanna keep it true.
+ /// Whether the background noises play.
+ /// Show subtitles.
+ /// Custom subtitles to appear instead of the actual message.
+ //TODO: Perhaps add the custom subtitles functionality to RA & base game commands?
+ public static void Message(string message, bool isHeld = false, bool isNoisy = true, bool isSubtitles = false, string customSubtitles = "") => RespawnEffectsController.PlayCassieAnnouncement(message, isHeld, isNoisy, isSubtitles, customSubtitles);
- ///
- /// Plays the custom announcement with chance of 0f to 1f of adding a glitch or jam before each word. Values closer to 1f are higher chances.
- ///
- /// The sentence Cassie is supposed to say.
- /// The chance for glitch sound to be added before each word. Range from 0f to 1f.
- /// The chance for jam sound to be added before each word. Range from 0f to 1f.
- public static void GlitchyMessage(string message, float glitchChance, float jamChance) => singleton.ServerOnlyAddGlitchyPhrase(message, glitchChance, jamChance);
+ ///
+ /// Plays the custom announcement with chance of 0f to 1f of adding a glitch or jam before each word. Values closer to 1f are higher chances.
+ ///
+ /// The sentence Cassie is supposed to say.
+ /// The chance for glitch sound to be added before each word. Range from 0f to 1f.
+ /// The chance for jam sound to be added before each word. Range from 0f to 1f.
+ public static void GlitchyMessage(string message, float glitchChance, float jamChance) => singleton.ServerOnlyAddGlitchyPhrase(message, glitchChance, jamChance);
- ///
- /// Plays the termination announcement of a SCP player. If the specified player does not have an SCP role then nothing is played.
- ///
- /// The player who is being terminated as an SCP.
- /// Damage handler causing the death of the player.
- public static void ScpTermination(Player player, DamageHandlerBase info) => AnnounceScpTermination(player.ReferenceHub, info);
+ ///
+ /// Plays the termination announcement of a SCP player. If the specified player does not have an SCP role then nothing is played.
+ ///
+ /// The player who is being terminated as an SCP.
+ /// Damage handler causing the death of the player.
+ public static void ScpTermination(Player player, DamageHandlerBase info) => AnnounceScpTermination(player.ReferenceHub, info);
- ///
- /// Clears the Cassie announcements queue.
- ///
- public static void Clear() => singleton.ClearQueue();
+ ///
+ /// Clears the Cassie announcements queue.
+ ///
+ public static void Clear() => singleton.ClearQueue();
- ///
- /// Converts player's team into Cassie-able word. Unit names are converted into NATO_X words, followed by a number. For example "Alpha-5" is converted to "NATO_A 5".
- ///
- /// Target team.
- /// MTF Unit name (for team ).
- /// Converted name.
- public static string ConvertTeam(Team team, string unitName) => NineTailedFoxAnnouncer.ConvertTeam(team, unitName);
+ ///
+ /// Converts player's team into Cassie-able word. Unit names are converted into NATO_X words, followed by a number. For example "Alpha-5" is converted to "NATO_A 5".
+ ///
+ /// Target team.
+ /// MTF Unit name (for team ).
+ /// Converted name.
+ public static string ConvertTeam(Team team, string unitName) => NineTailedFoxAnnouncer.ConvertTeam(team, unitName);
- ///
- /// Converts number into string.
- ///
- /// The number.
- /// Number converted to string.
- public static string ConvertNumber(int num) => NineTailedFoxAnnouncer.ConvertNumber(num);
+ ///
+ /// Converts number into string.
+ ///
+ /// The number.
+ /// Number converted to string.
+ public static string ConvertNumber(int num) => NineTailedFoxAnnouncer.ConvertNumber(num);
- ///
- /// Converts player's into an SCP number identifier.
- ///
- /// The target .
- /// The SCP number without spaces between. Used by Cassie.
- /// The SCP number with spaces between. Used by Subtitles.
- public static void ConvertScp(RoleTypeId role, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(role, out withoutSpace, out withSpace);
+ ///
+ /// Converts player's into an SCP number identifier.
+ ///
+ /// The target .
+ /// The SCP number without spaces between. Used by Cassie.
+ /// The SCP number with spaces between. Used by Subtitles.
+ public static void ConvertScp(RoleTypeId role, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(role, out withoutSpace, out withSpace);
- ///
- /// Converts player's role name into an SCP number identifier.
- ///
- /// The targets role name
- /// The SCP number without spaces between. Used by Cassie.
- /// The SCP number with spaces between. Used by Subtitles.
- public static void ConvertScp(string roleName, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(roleName, out withoutSpace, out withSpace);
- }
+ ///
+ /// Converts player's role name into an SCP number identifier.
+ ///
+ /// The targets role name
+ /// The SCP number without spaces between. Used by Cassie.
+ /// The SCP number with spaces between. Used by Subtitles.
+ public static void ConvertScp(string roleName, out string withoutSpace, out string withSpace) => NineTailedFoxAnnouncer.ConvertSCP(roleName, out withoutSpace, out withSpace);
}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
index 2ea21c7e..705bfebc 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/CheckpointDoor.cs
@@ -74,7 +74,7 @@ public bool IsBroken
get => Base.IsDestroyed;
set
{
- foreach(DoorVariant doorVariant in Base.SubDoors)
+ foreach (DoorVariant doorVariant in Base.SubDoors)
{
if (doorVariant is not IDamageableDoor damageableDoor)
continue;
@@ -115,7 +115,7 @@ public BaseCheckpointDoor.CheckpointSequenceStage SequenceState
/// Gets or sets the time in seconds to open the doors after the was set to .
///
///
- /// Does not effect the speed of the animations of the door it only influences the timing of when when to move on to the next stage.
+ /// Does not affect the speed of the animations of the door it only influences the timing of when when to move on to the next stage.
/// is set to after the delay.
///
public float OpeningDuration
@@ -152,7 +152,7 @@ public float WarningDuration
/// Gets or sets the current sequence time in seconds.
///
///
- /// Represents the value of the internal timer used to switch depending on , and .
+ /// Represents the value of the internal timer used to switch depending on , and .
///
public float SequenceTime
{
diff --git a/LabApi/Features/Wrappers/Facility/Doors/ElevatorDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/ElevatorDoor.cs
index 1d4a1a38..342499dd 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/ElevatorDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/ElevatorDoor.cs
@@ -26,7 +26,7 @@ public class ElevatorDoor : Door
///
/// The base object.
internal ElevatorDoor(BaseElevatorDoor baseElevatorDoor)
- :base(baseElevatorDoor)
+ : base(baseElevatorDoor)
{
Dictionary.Add(baseElevatorDoor, this);
Base = baseElevatorDoor;
diff --git a/LabApi/Features/Wrappers/Facility/Doors/Gate.cs b/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
index 3918c0a7..da0e144c 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/Gate.cs
@@ -58,10 +58,7 @@ public bool Is106Passable
///
/// The player to pry the gate.
/// True if the player can pry the gate, otherwise false.
- public bool TryPry(Player player)
- {
- return Base.TryPryGate(player.ReferenceHub);
- }
+ public bool TryPry(Player player) => Base.TryPryGate(player.ReferenceHub);
///
/// Play the Pry animation.
diff --git a/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs b/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs
index 15980a83..632e7a03 100644
--- a/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs
+++ b/LabApi/Features/Wrappers/Facility/Doors/NonInteractableDoor.cs
@@ -24,7 +24,7 @@ public class NonInteractableDoor : Door
///
/// The base object.
internal NonInteractableDoor(BasicNonInteractableDoor basicNonInteractableDoor)
- :base(basicNonInteractableDoor)
+ : base(basicNonInteractableDoor)
{
Dictionary.Add(basicNonInteractableDoor, this);
Base = basicNonInteractableDoor;
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
index 27a394ef..2f2d6d11 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/AmnesticCloudHazard.cs
@@ -4,173 +4,171 @@
using UnityEngine;
using static PlayerRoles.PlayableScps.Scp939.Scp939AmnesticCloudInstance;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+public class AmnesticCloudHazard : DecayableHazard
{
- public class AmnesticCloudHazard : DecayableHazard
+ ///
+ /// Contains all the cached items, accessible through their .
+ ///
+ public new static Dictionary Dictionary { get; } = [];
+
+ ///
+ /// Gets all currently active tantrum hazards.
+ ///
+ public new IReadOnlyCollection List => Dictionary.Values;
+
+ ///
+ /// Prefab used to spawn the hazard.
+ ///
+ protected static new Scp939AmnesticCloudInstance? BasePrefab;
+
+ ///
+ /// Gets or sets the world position of the hazard as it is synchronized with the client.
+ /// Note that this value is slightly inaccurate and is purely for visual effects.
+ /// For actual world position used to calculate whether the player is inside of this hazard use .
+ ///
+ public Vector3 SyncedPosition
{
- ///
- /// Contains all the cached items, accessible through their .
- ///
- public new static Dictionary Dictionary { get; } = [];
-
- ///
- /// Gets all currently active tantrum hazards.
- ///
- public new IReadOnlyCollection List => Dictionary.Values;
-
- ///
- /// Prefab used to spawn the hazard.
- ///
- protected static new Scp939AmnesticCloudInstance? BasePrefab;
-
- ///
- /// Gets or sets the world position of the hazard as it is synchronized with the client.
- /// Note that this value is slightly inaccurate and is purely for visual effects.
- /// For actual world position used to calculate whether the player is inside of this hazard use .
- ///
- public Vector3 SyncedPosition
- {
- get => Base.SyncedPosition.Position;
- set => Base.SyncedPosition = new RelativePositioning.RelativePosition(value);
- }
+ get => Base.SyncedPosition.Position;
+ set => Base.SyncedPosition = new RelativePositioning.RelativePosition(value);
+ }
- ///
- /// Gets or sets the visual size of the amnestic cloud. Only visible to SCP-939. For actual effect size use .
- ///
- public byte VisualSize
- {
- get => Base.HoldDuration;
- set => Base.HoldDuration = value;
- }
- ///
- /// Pause duration that the uses.
- ///
- public float PauseDuration
- {
- get => Base.PauseDuration;
- set => Base.PauseDuration = value;
- }
+ ///
+ /// Gets or sets the visual size of the amnestic cloud. Only visible to SCP-939. For actual effect size use .
+ ///
+ public byte VisualSize
+ {
+ get => Base.HoldDuration;
+ set => Base.HoldDuration = value;
+ }
- ///
- /// Duration of the amnesia that is applied when the player is inside this hazard.
- ///
- public float AmnesiaDuration
- {
- get => Base.AmnesiaDuration;
- set => Base.AmnesiaDuration = value;
- }
+ ///
+ /// Pause duration that the uses.
+ ///
+ public float PauseDuration
+ {
+ get => Base.PauseDuration;
+ set => Base.PauseDuration = value;
+ }
+
+ ///
+ /// Duration of the amnesia that is applied when the player is inside this hazard.
+ ///
+ public float AmnesiaDuration
+ {
+ get => Base.AmnesiaDuration;
+ set => Base.AmnesiaDuration = value;
+ }
- ///
- /// Gets or sets the owner of this amnestic cloud.
- ///
- public Player? Owner
+ ///
+ /// Gets or sets the owner of this amnestic cloud.
+ ///
+ public Player? Owner
+ {
+ get => Player.Get(Base.Owner);
+ set
{
- get => Player.Get(Base.Owner);
- set
+ if (value == null)
{
- if (value == null)
- {
- Base.Network_syncOwner = 0;
- return;
- }
-
- Base.Owner = value.ReferenceHub;
+ Base.Network_syncOwner = 0;
+ return;
}
- }
- ///
- /// Gets the state of this amnestic cloud.
- ///
- public CloudState State
- {
- get => Base.State;
+ Base.Owner = value.ReferenceHub;
}
+ }
- ///
- /// The base object.
- ///
- public new Scp939AmnesticCloudInstance Base { get; }
-
- ///
- /// Internal constructor preventing external instantiation.
- ///
- /// The base amnestic cloud hazard.
- internal AmnesticCloudHazard(Scp939AmnesticCloudInstance hazard)
- : base(hazard)
- {
- Base = hazard;
- Dictionary.Add(hazard, this);
- }
+ ///
+ /// Gets the state of this amnestic cloud.
+ ///
+ public CloudState State => Base.State;
+
+ ///
+ /// The base object.
+ ///
+ public new Scp939AmnesticCloudInstance Base { get; }
+
+ ///
+ /// Internal constructor preventing external instantiation.
+ ///
+ /// The base amnestic cloud hazard.
+ internal AmnesticCloudHazard(Scp939AmnesticCloudInstance hazard)
+ : base(hazard)
+ {
+ Base = hazard;
+ Dictionary.Add(hazard, this);
+ }
- ///
- /// Spawns a at specified position with specified rotation, scale duration and size.
- /// Do note that changing scale doesn't change the effect size. Use the and to match the visual size.
- ///
- /// The target position to spawn this hazard at.
- /// The target rotation to spawn this hazard with.
- /// The target scale to spawn with.
- /// The duration in seconds for which this cloud will be alive for.
- /// The size of the cloud.
- /// The owner of the cloud.
- /// A new hazard.
- public static AmnesticCloudHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale, float duration = 90f, byte size = 255, Player? owner = null)
- {
- if (BasePrefab == null)
- BasePrefab = Hazard.GetPrefab();
+ ///
+ /// Spawns a at specified position with specified rotation, scale duration and size.
+ /// Do note that changing scale doesn't change the effect size. Use the and to match the visual size.
+ ///
+ /// The target position to spawn this hazard at.
+ /// The target rotation to spawn this hazard with.
+ /// The target scale to spawn with.
+ /// The duration in seconds for which this cloud will be alive for.
+ /// The size of the cloud.
+ /// The owner of the cloud.
+ /// A new hazard.
+ public static AmnesticCloudHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale, float duration = 90f, byte size = 255, Player? owner = null)
+ {
+ if (BasePrefab == null)
+ BasePrefab = GetPrefab();
- AmnesticCloudHazard hazard = (AmnesticCloudHazard)Hazard.Spawn(BasePrefab, position, rotation, scale);
- hazard.Base.State = CloudState.Created;
- hazard.LiveDuration = duration;
- hazard.VisualSize = size;
- hazard.SyncedPosition = position;
+ AmnesticCloudHazard hazard = (AmnesticCloudHazard)Hazard.Spawn(BasePrefab, position, rotation, scale);
+ hazard.Base.State = CloudState.Created;
+ hazard.LiveDuration = duration;
+ hazard.VisualSize = size;
+ hazard.SyncedPosition = position;
- Vector2 minMax = hazard.Base.MinMaxTime;
- hazard.MaxDistance = Mathf.Lerp(minMax.x, minMax.y, size / byte.MaxValue);
+ Vector2 minMax = hazard.Base.MinMaxTime;
+ hazard.MaxDistance = Mathf.Lerp(minMax.x, minMax.y, size / byte.MaxValue);
- if (owner != null)
- hazard.Owner = owner;
- return hazard;
- }
+ if (owner != null)
+ hazard.Owner = owner;
+ return hazard;
+ }
- ///
- /// Temporary pauses all amnesia effects based on or custom time.
- ///
- /// Custom duration of the pause. Values less than 0 will use the
- public void Pause(float customDuration = -1f)
+ ///
+ /// Temporary pauses all amnesia effects based on or custom time.
+ ///
+ /// Custom duration of the pause. Values less than 0 will use the
+ public void Pause(float customDuration = -1f)
+ {
+ if (customDuration > 0f)
{
- if (customDuration > 0f)
- {
- float prev = PauseDuration;
- PauseDuration = customDuration;
- Base.PauseAll();
- PauseDuration = prev;
-
- return;
- }
+ float prev = PauseDuration;
+ PauseDuration = customDuration;
Base.PauseAll();
- }
+ PauseDuration = prev;
- ///
- /// An internal method to remove itself from the cache when the base object is destroyed.
- ///
- internal override void OnRemove()
- {
- base.OnRemove();
- Dictionary.Remove(Base);
+ return;
}
- ///
- /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
- ///
- /// The of the hazard.
- /// The requested hazard or .
- [return: NotNullIfNotNull(nameof(hazard))]
- public static AmnesticCloudHazard? Get(Scp939AmnesticCloudInstance? hazard)
- {
- if (hazard == null)
- return null;
+ Base.PauseAll();
+ }
- return Dictionary.TryGetValue(hazard, out AmnesticCloudHazard decHazard) ? decHazard : (AmnesticCloudHazard)CreateItemWrapper(hazard);
- }
+ ///
+ /// An internal method to remove itself from the cache when the base object is destroyed.
+ ///
+ internal override void OnRemove()
+ {
+ base.OnRemove();
+ Dictionary.Remove(Base);
+ }
+
+ ///
+ /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
+ ///
+ /// The of the hazard.
+ /// The requested hazard or .
+ [return: NotNullIfNotNull(nameof(hazard))]
+ public static AmnesticCloudHazard? Get(Scp939AmnesticCloudInstance? hazard)
+ {
+ if (hazard == null)
+ return null;
+
+ return Dictionary.TryGetValue(hazard, out AmnesticCloudHazard decHazard) ? decHazard : (AmnesticCloudHazard)CreateItemWrapper(hazard);
}
-}
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
index da9c5ddf..9f16f9a1 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/DecayableHazard.cs
@@ -3,93 +3,92 @@
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// A class representing the .
+///
+public class DecayableHazard : Hazard
{
///
- /// A class representing the .
+ /// Contains all the cached items, accessible through their .
///
- public class DecayableHazard : Hazard
- {
- ///
- /// Contains all the cached items, accessible through their .
- ///
- public new static Dictionary Dictionary { get; } = [];
+ public new static Dictionary Dictionary { get; } = [];
- ///
- /// Gets all currently active decayable hazards.
- ///
- public new IReadOnlyCollection List => Dictionary.Values;
+ ///
+ /// Gets all currently active decayable hazards.
+ ///
+ public new IReadOnlyCollection List => Dictionary.Values;
- ///
- /// Gets or sets the modifier applied to when calculating how much time has passed.
- /// Setting this value will override any subclass modifiers. Setting it to values less than 0 will remove the override.
- ///
- public float DecaySpeed
- {
- get => Base.DecaySpeed;
- set => Base.DecaySpeed = value;
- }
+ ///
+ /// Gets or sets the modifier applied to when calculating how much time has passed.
+ /// Setting this value will override any subclass modifiers. Setting it to values less than 0 will remove the override.
+ ///
+ public float DecaySpeed
+ {
+ get => Base.DecaySpeed;
+ set => Base.DecaySpeed = value;
+ }
- ///
- /// Gets or sets the amount of time this object will persist for (in seconds) before disappearing.
- ///
- public float LiveDuration
- {
- get => Base.HazardDuration;
- set => Base.HazardDuration = value;
- }
+ ///
+ /// Gets or sets the amount of time this object will persist for (in seconds) before disappearing.
+ ///
+ public float LiveDuration
+ {
+ get => Base.HazardDuration;
+ set => Base.HazardDuration = value;
+ }
- ///
- /// Gets or sets the amount of time in seconds this hazard is being active.
- /// Doesn't progress if the is set to .
- ///
- public float Elapsed
- {
- get => Base.Elapsed;
- set => Base.Elapsed = value;
- }
+ ///
+ /// Gets or sets the amount of time in seconds this hazard is being active.
+ /// Doesn't progress if the is set to .
+ ///
+ public float Elapsed
+ {
+ get => Base.Elapsed;
+ set => Base.Elapsed = value;
+ }
- ///
- /// The base object.
- ///
- public new TemporaryHazard Base { get; }
+ ///
+ /// The base object.
+ ///
+ public new TemporaryHazard Base { get; }
- ///
- /// An internal constructor to prevent external instantiation.
- ///
- /// The base game object.
- protected DecayableHazard(TemporaryHazard hazard)
- : base(hazard)
- {
- Base = hazard;
- Dictionary.Add(hazard, this);
- }
+ ///
+ /// An internal constructor to prevent external instantiation.
+ ///
+ /// The base game object.
+ protected DecayableHazard(TemporaryHazard hazard)
+ : base(hazard)
+ {
+ Base = hazard;
+ Dictionary.Add(hazard, this);
+ }
- ///
- /// Destroys this hazard.
- /// Do note that subclasses usually implement few seconds delay before the actual object is destroyed. (Usually to wait for animations to finish on clients)
- ///
- public override void Destroy() => Base.ServerDestroy();
+ ///
+ /// Destroys this hazard.
+ /// Do note that subclasses usually implement few seconds delay before the actual object is destroyed. (Usually to wait for animations to finish on clients)
+ ///
+ public override void Destroy() => Base.ServerDestroy();
- ///
- internal override void OnRemove()
- {
- base.OnRemove();
- Dictionary.Remove(Base);
- }
+ ///
+ internal override void OnRemove()
+ {
+ base.OnRemove();
+ Dictionary.Remove(Base);
+ }
- ///
- /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
- ///
- /// The of the hazard.
- /// The requested hazard or .
- [return: NotNullIfNotNull(nameof(hazard))]
- public static DecayableHazard? Get(TemporaryHazard? hazard)
- {
- if (hazard == null)
- return null;
+ ///
+ /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
+ ///
+ /// The of the hazard.
+ /// The requested hazard or .
+ [return: NotNullIfNotNull(nameof(hazard))]
+ public static DecayableHazard? Get(TemporaryHazard? hazard)
+ {
+ if (hazard == null)
+ return null;
- return Dictionary.TryGetValue(hazard, out DecayableHazard decHazard) ? decHazard : (DecayableHazard)CreateItemWrapper(hazard);
- }
+ return Dictionary.TryGetValue(hazard, out DecayableHazard decHazard) ? decHazard : (DecayableHazard)CreateItemWrapper(hazard);
}
-}
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
index 8d2cce5f..e06e96d4 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/Hazard.cs
@@ -9,267 +9,265 @@
using System.Diagnostics.CodeAnalysis;
using PlayerRoles.PlayableScps.Scp939;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// A class representing all static and temporary .
+///
+public class Hazard
{
///
- /// A class representing all static and temporary .
+ /// Contains all the handlers for constructing wrappers for the associated base game types.
+ ///
+ private static readonly Dictionary> typeWrappers = [];
+
+ ///
+ /// Contains all the cached items, accessible through their .
+ ///
+ public static Dictionary Dictionary { get; } = [];
+
+ ///
+ /// A reference to all instances of or its subclasses.
+ ///
+ public static IReadOnlyCollection List => Dictionary.Values;
+
+ ///
+ /// Prefab used to spawn the hazard.
+ ///
+ protected static EnvironmentalHazard? BasePrefab;
+
+ ///
+ /// Base game object.
+ ///
+ public EnvironmentalHazard Base { get; private set; }
+
+ ///
+ /// Gets all affected players by this hazard.
///
- public class Hazard
+ public IEnumerable AffectedPlayers => Base.AffectedPlayers.Select(n => Player.Get(n));
+
+ ///
+ /// Gets or sets the maximum distance players have to be at, for this hazard to affect them.
+ ///
+ public float MaxDistance
{
- ///
- /// Contains all the handlers for constructing wrappers for the associated base game types.
- ///
- private static readonly Dictionary> typeWrappers = [];
-
- ///
- /// Contains all the cached items, accessible through their .
- ///
- public static Dictionary Dictionary { get; } = [];
-
- ///
- /// A reference to all instances of or its subclasses.
- ///
- public static IReadOnlyCollection List => Dictionary.Values;
-
- ///
- /// Prefab used to spawn the hazard.
- ///
- protected static EnvironmentalHazard? BasePrefab;
-
- ///
- /// Base game object.
- ///
- public EnvironmentalHazard Base { get; private set; }
-
- ///
- /// Gets all affected players by this hazard.
- ///
- public IEnumerable AffectedPlayers => Base.AffectedPlayers.Select(n => Player.Get(n));
-
- ///
- /// Gets or sets the maximum distance players have to be at, for this hazard to affect them.
- ///
- public float MaxDistance
- {
- get => Base.MaxDistance;
- set => Base.MaxDistance = value;
- }
+ get => Base.MaxDistance;
+ set => Base.MaxDistance = value;
+ }
- ///
- /// Gets or sets the maximum height players have to be at, for this hazard to affect them.
- ///
- public float MaxHeightDistance
- {
- get => Base.MaxHeightDistance;
- set => Base.MaxHeightDistance = value;
- }
+ ///
+ /// Gets or sets the maximum height players have to be at, for this hazard to affect them.
+ ///
+ public float MaxHeightDistance
+ {
+ get => Base.MaxHeightDistance;
+ set => Base.MaxHeightDistance = value;
+ }
- ///
- /// Gets or sets the offset applied to the .
- ///
- public virtual Vector3 SourceOffset
- {
- get => Base.SourceOffset;
- set => Base.SourceOffset = value;
- }
+ ///
+ /// Gets or sets the offset applied to the .
+ ///
+ public virtual Vector3 SourceOffset
+ {
+ get => Base.SourceOffset;
+ set => Base.SourceOffset = value;
+ }
- ///
- /// Gets whether this environmental hazard and it's effects is enabled.
- /// Setting to false also stops the decay of temporary hazards.
- ///
- public virtual bool IsActive
- {
- get => Base.IsActive;
- set => Base.IsActive = value;
- }
+ ///
+ /// Gets whether this environmental hazard and it's effects is enabled.
+ /// Setting to false also stops the decay of temporary hazards.
+ ///
+ public virtual bool IsActive
+ {
+ get => Base.IsActive;
+ set => Base.IsActive = value;
+ }
- ///
- /// Gets or sets the origin point from which the AoE effect will start.
- ///
- public virtual Vector3 SourcePosition
- {
- get => Base.SourcePosition;
- set => Base.SourcePosition = value;
- }
+ ///
+ /// Gets or sets the origin point from which the AoE effect will start.
+ ///
+ public virtual Vector3 SourcePosition
+ {
+ get => Base.SourcePosition;
+ set => Base.SourcePosition = value;
+ }
- ///
- /// Gets whether the hazard is destroyed.
- ///
- public bool IsDestroyed => Base.gameObject != null;
+ ///
+ /// Gets whether the hazard is destroyed.
+ ///
+ public bool IsDestroyed => Base.gameObject != null;
- ///
- /// Gets the room in which this hazard is in.
- ///
- public Room? Room => Room.GetRoomAtPosition(SourcePosition);
+ ///
+ /// Gets the room in which this hazard is in.
+ ///
+ public Room? Room => Room.GetRoomAtPosition(SourcePosition);
- ///
- /// Initializes the class to subscribe to events and handle the item caching.
- ///
- protected Hazard(EnvironmentalHazard hazard)
- {
- Base = hazard;
- Dictionary.Add(hazard, this);
- }
+ ///
+ /// Initializes the class to subscribe to events and handle the item caching.
+ ///
+ protected Hazard(EnvironmentalHazard hazard)
+ {
+ Base = hazard;
+ Dictionary.Add(hazard, this);
+ }
- ///
- /// Initializes the class to subscribe to events and handle the item caching.
- ///
- [InitializeWrapper]
- internal static void Initialize()
- {
- Dictionary.Clear();
+ ///
+ /// Initializes the class to subscribe to events and handle the item caching.
+ ///
+ [InitializeWrapper]
+ internal static void Initialize()
+ {
+ Dictionary.Clear();
- EnvironmentalHazard.OnAdded += AddHazard;
- EnvironmentalHazard.OnRemoved += RemoveHazard;
+ EnvironmentalHazard.OnAdded += AddHazard;
+ EnvironmentalHazard.OnRemoved += RemoveHazard;
- Register(x => new SinkholeHazard(x));
- Register(x => new TantrumHazard(x));
- Register(x => new AmnesticCloudHazard(x));
- }
+ Register(x => new SinkholeHazard(x));
+ Register(x => new TantrumHazard(x));
+ Register(x => new AmnesticCloudHazard(x));
+ }
- ///
- /// An internal virtual method to signal to derived implementations to uncache when the base object is destroyed.
- ///
- internal virtual void OnRemove()
- {
- }
+ ///
+ /// An internal virtual method to signal to derived implementations to uncache when the base object is destroyed.
+ ///
+ internal virtual void OnRemove()
+ {
+ }
+
+ ///
+ /// Spawns a at specified position with specified rotation and scale.
+ ///
+ /// The target prefab.
+ /// The target position to spawn this hazard at.
+ /// The target rotation to spawn this hazard with.
+ /// The target scale to spawn with.
+ /// A new hazard.
+ public static Hazard Spawn(EnvironmentalHazard prefab, Vector3 position, Quaternion rotation, Vector3 scale)
+ {
+ EnvironmentalHazard hazard = GameObject.Instantiate(prefab);
+ hazard.transform.SetPositionAndRotation(position, rotation);
+ hazard.transform.localScale = scale;
- ///
- /// Spawns a at specified position with specified rotation and scale.
- ///
- /// The target prefab.
- /// The target position to spawn this hazard at.
- /// The target rotation to spawn this hazard with.
- /// The target scale to spawn with.
- /// A new hazard.
- public static Hazard Spawn(EnvironmentalHazard prefab, Vector3 position, Quaternion rotation, Vector3 scale)
+ return Get(hazard);
+ }
+
+ ///
+ /// Attempts to get the prefab from .
+ ///
+ /// Type of the hazard.
+ /// Prefab if it was found. Otherwise
+ protected static T? GetPrefab() where T : EnvironmentalHazard
+ {
+ foreach (GameObject prefab in NetworkClient.prefabs.Values)
{
- EnvironmentalHazard hazard = GameObject.Instantiate(prefab);
- hazard.transform.SetPositionAndRotation(position, rotation);
- hazard.transform.localScale = scale;
+ if (!prefab.TryGetComponent(out T hazard))
+ continue;
- return Get(hazard);
+ return hazard;
}
- ///
- /// Attempts to get the prefab from .
- ///
- /// Type of the hazard.
- /// Prefab if it was found. Otherwise
- protected static T? GetPrefab() where T : EnvironmentalHazard
- {
- foreach (GameObject prefab in NetworkClient.prefabs.Values)
- {
- if (!prefab.TryGetComponent(out T hazard))
- continue;
+ return null;
+ }
- return hazard;
- }
+ ///
+ /// Gets whether the player is in the hazard area.
+ ///
+ /// Target player to check on.
+ /// Whether the player is within hazard area.
+ public bool IsInArea(Player player) => Base.IsInArea(SourcePosition, player.Position);
- return null;
- }
+ ///
+ /// Destroys this hazard.
+ ///
+ public virtual void Destroy()
+ {
+ if (Base.gameObject != null)
+ NetworkServer.Destroy(Base.gameObject);
+ }
- ///
- /// Gets whether the player is in the hazard area.
- ///
- /// Target player to check on.
- /// Whether the player is within hazard area.
- public bool IsInArea(Player player) => Base.IsInArea(SourcePosition, player.Position);
-
- ///
- /// Destroys this hazard.
- ///
- public virtual void Destroy()
- {
- if (Base.gameObject != null)
- NetworkServer.Destroy(Base.gameObject);
- }
+ ///
+ /// A private method to handle the creation of new hazards in the server.
+ ///
+ /// The created instance.
+ private static void AddHazard(EnvironmentalHazard hazard)
+ {
+ if (!Dictionary.ContainsKey(hazard))
+ _ = CreateItemWrapper(hazard);
+ }
- ///
- /// A private method to handle the creation of new hazards in the server.
- ///
- /// The created instance.
- private static void AddHazard(EnvironmentalHazard hazard)
+ ///
+ /// A private method to handle the removal of hazards from the server.
+ ///
+ /// The to be destroyed instance.
+ private static void RemoveHazard(EnvironmentalHazard hazard)
+ {
+ if (Dictionary.Remove(hazard, out Hazard item))
{
- if (!Dictionary.ContainsKey(hazard))
- _ = CreateItemWrapper(hazard);
+ item.OnRemove();
}
+ }
- ///
- /// A private method to handle the removal of hazards from the server.
- ///
- /// The to be destroyed instance.
- private static void RemoveHazard(EnvironmentalHazard hazard)
- {
- if (Dictionary.TryGetValue(hazard, out Hazard item))
- {
- Dictionary.Remove(hazard);
- item.OnRemove();
- }
- }
+ ///
+ /// A private method to handle the addition of wrapper handlers.
+ ///
+ /// The derived base game type to handle.
+ /// A handler to construct the wrapper with the base game instance.
+ private static void Register(Func constructor) where T : EnvironmentalHazard
+ {
+ typeWrappers.Add(typeof(T), x => constructor((T)x));
+ }
- ///
- /// A private method to handle the addition of wrapper handlers.
- ///
- /// The derived base game type to handle.
- /// A handler to construct the wrapper with the base game instance.
- private static void Register(Func constructor) where T : EnvironmentalHazard
- {
- typeWrappers.Add(typeof(T), x => constructor((T)x));
- }
+ ///
+ /// Creates a new wrapper from the base envronental hazard object.
+ ///
+ /// The base object.
+ /// The newly created wrapper.
+ protected static Hazard CreateItemWrapper(EnvironmentalHazard hazard)
+ {
+ return typeWrappers[hazard.GetType()].Invoke(hazard);
+ }
- ///
- /// Creates a new wrapper from the base envronental hazard object.
- ///
- /// The base object.
- /// The newly created wrapper.
- protected static Hazard CreateItemWrapper(EnvironmentalHazard hazard)
- {
- return typeWrappers[hazard.GetType()].Invoke(hazard);
- }
+ ///
+ /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
+ ///
+ /// The of the hazard.
+ /// The requested hazard or .
+ [return: NotNullIfNotNull(nameof(hazard))]
+ public static Hazard? Get(EnvironmentalHazard? hazard)
+ {
+ if (hazard == null)
+ return null;
- ///
- /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
- ///
- /// The of the hazard.
- /// The requested hazard or .
- [return: NotNullIfNotNull(nameof(hazard))]
- public static Hazard? Get(EnvironmentalHazard? hazard)
- {
- if (hazard == null)
- return null;
+ return Dictionary.TryGetValue(hazard, out Hazard wrapper) ? wrapper : CreateItemWrapper(hazard);
+ }
- return Dictionary.TryGetValue(hazard, out Hazard wrapper) ? wrapper : CreateItemWrapper(hazard);
- }
+ ///
+ /// Tries to get the hazard wrapper from the .
+ ///
+ /// The of the hazard.
+ /// The requested hazard.
+ /// if the item exists, otherwise .
+ public static bool TryGet(EnvironmentalHazard? envHazard, [NotNullWhen(true)] out Hazard? wrapper)
+ {
+ wrapper = Get(envHazard);
+ return wrapper != null;
+ }
- ///
- /// Tries to get the hazard wrapper from the .
- ///
- /// The of the hazard.
- /// The requested hazard.
- /// if the item exists, otherwise .
- public static bool TryGet(EnvironmentalHazard? envHazard, [NotNullWhen(true)] out Hazard? wrapper)
- {
- wrapper = Get(envHazard);
- return wrapper != null;
- }
+ ///
+ /// Gets all hazards in a specified room.
+ ///
+ /// The target room to check on.
+ /// Hazards in specified room.
+ public static IEnumerable Get(Room? room)
+ {
+ if (room == null)
+ yield break;
- ///
- /// Gets all hazards in a specified room.
- ///
- /// The target room to check on.
- /// Hazards in specified room.
- public static IEnumerable Get(Room? room)
+ foreach (Hazard hazard in List)
{
- if (room == null)
- yield break;
-
- foreach (Hazard hazard in List)
- {
- if (hazard.Room == room)
- yield return hazard;
- }
+ if (hazard.Room == room)
+ yield return hazard;
}
}
-}
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
index 5a68407a..3264a331 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/SinkholeHazard.cs
@@ -4,84 +4,83 @@
using Mirror;
using System.Diagnostics.CodeAnalysis;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// A class representing the .
+/// Note that this is static hazard and position, rotation and scale isn't applied on clients unless you respawn this object via .
+///
+public class SinkholeHazard : Hazard
{
///
- /// A class representing the .
- /// Note that this is static hazard and position, rotation and scale isn't applied on clients unless you respawn this object via .
+ /// Contains all the cached items, accessible through their .
///
- public class SinkholeHazard : Hazard
- {
- ///
- /// Contains all the cached items, accessible through their .
- ///
- public new static Dictionary Dictionary { get; } = [];
+ public new static Dictionary Dictionary { get; } = [];
- ///
- /// Gets all currently active sinkholes.
- ///
- public new IReadOnlyCollection List => Dictionary.Values;
+ ///
+ /// Gets all currently active sinkholes.
+ ///
+ public new IReadOnlyCollection List => Dictionary.Values;
- ///
- /// Prefab used to spawn the hazard.
- ///
- protected static new SinkholeEnvironmentalHazard BasePrefab;
+ ///
+ /// Prefab used to spawn the hazard.
+ ///
+ protected static new SinkholeEnvironmentalHazard? BasePrefab;
- ///
- /// The base object.
- ///
- public new SinkholeEnvironmentalHazard Base { get; }
+ ///
+ /// The base object.
+ ///
+ public new SinkholeEnvironmentalHazard Base { get; }
- ///
- /// An internal constructor to prevent external instantiation.
- ///
- /// The base object.
- internal SinkholeHazard(SinkholeEnvironmentalHazard hazard)
- : base(hazard)
- {
- Base = hazard;
- Dictionary.Add(hazard, this);
- }
+ ///
+ /// An internal constructor to prevent external instantiation.
+ ///
+ /// The base object.
+ internal SinkholeHazard(SinkholeEnvironmentalHazard hazard)
+ : base(hazard)
+ {
+ Base = hazard;
+ Dictionary.Add(hazard, this);
+ }
- ///
- /// An internal method to remove itself from the cache when the base object is destroyed.
- ///
- internal override void OnRemove()
- {
- base.OnRemove();
- Dictionary.Remove(Base);
- }
+ ///
+ /// An internal method to remove itself from the cache when the base object is destroyed.
+ ///
+ internal override void OnRemove()
+ {
+ base.OnRemove();
+ Dictionary.Remove(Base);
+ }
- ///
- /// Spawns a at specified position with specified rotation and scale.
- /// Do note that changing scale doesn't change the effect size. Use the and to match the visual size.
- ///
- /// The target position to spawn this hazard at.
- /// The target rotation to spawn this hazard with.
- /// The target scale to spawn with. Also affects the size of the decal.
- /// A new hazard.
- public static SinkholeHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale)
- {
- if (BasePrefab == null)
- BasePrefab = GetPrefab();
+ ///
+ /// Spawns a at specified position with specified rotation and scale.
+ /// Do note that changing scale doesn't change the effect size. Use the and to match the visual size.
+ ///
+ /// The target position to spawn this hazard at.
+ /// The target rotation to spawn this hazard with.
+ /// The target scale to spawn with. Also affects the size of the decal.
+ /// The newly created hazard.
+ public static SinkholeHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale)
+ {
+ if (BasePrefab == null)
+ BasePrefab = GetPrefab();
- SinkholeHazard hazard = (SinkholeHazard)Hazard.Spawn(BasePrefab, position, rotation, scale);
- hazard.IsActive = true;
- return hazard;
- }
+ SinkholeHazard hazard = (SinkholeHazard)Hazard.Spawn(BasePrefab, position, rotation, scale);
+ hazard.IsActive = true;
+ return hazard;
+ }
- ///
- /// Gets the sinkhole wrapper from the or creates a new one if it doesn't exist and the provided was not .
- ///
- /// The of the hazard.
- /// The requested hazard or .
- [return: NotNullIfNotNull(nameof(hazard))]
- public static SinkholeHazard? Get(SinkholeEnvironmentalHazard? hazard)
- {
- if (hazard == null)
- return null;
+ ///
+ /// Gets the sinkhole wrapper from the or creates a new one if it doesn't exist and the provided was not .
+ ///
+ /// The of the hazard.
+ /// The requested hazard or .
+ [return: NotNullIfNotNull(nameof(hazard))]
+ public static SinkholeHazard? Get(SinkholeEnvironmentalHazard? hazard)
+ {
+ if (hazard == null)
+ return null;
- return Dictionary.TryGetValue(hazard, out SinkholeHazard sinkhole) ? sinkhole : (SinkholeHazard)CreateItemWrapper(hazard);
- }
+ return Dictionary.TryGetValue(hazard, out SinkholeHazard sinkhole) ? sinkhole : (SinkholeHazard)CreateItemWrapper(hazard);
}
-}
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs b/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs
index 3973bc33..185b05de 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/TantrumHazard.cs
@@ -3,106 +3,105 @@
using System.Diagnostics.CodeAnalysis;
using UnityEngine;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// A class representing the .
+///
+public class TantrumHazard : DecayableHazard
{
///
- /// A class representing the .
+ /// Contains all the cached items, accessible through their .
///
- public class TantrumHazard : DecayableHazard
- {
- ///
- /// Contains all the cached items, accessible through their .
- ///
- public new static Dictionary Dictionary { get; } = [];
+ public new static Dictionary Dictionary { get; } = [];
- ///
- /// Gets all currently active tantrum hazards.
- ///
- public new IReadOnlyCollection List => Dictionary.Values;
+ ///
+ /// Gets all currently active tantrum hazards.
+ ///
+ public new IReadOnlyCollection List => Dictionary.Values;
- ///
- /// Prefab used to spawn the hazard.
- ///
- protected static new TantrumEnvironmentalHazard? BasePrefab;
+ ///
+ /// Prefab used to spawn the hazard.
+ ///
+ protected static new TantrumEnvironmentalHazard? BasePrefab;
- ///
- /// Gets or sets the world position of the hazard as it is synchronized with the client.
- /// Note that this value is slightly inaccurate and is purely for visual effects.
- /// For actual world position used to calculate whether the player is inside of this hazard use .
- ///
- public Vector3 SyncedPosition
- {
- get => Base.SynchronizedPosition.Position;
- set => Base.SynchronizedPosition = new RelativePositioning.RelativePosition(value);
- }
+ ///
+ /// Gets or sets the world position of the hazard as it is synchronized with the client.
+ /// Note that this value is slightly inaccurate and is purely for visual effects.
+ /// For actual world position used to calculate whether the player is inside of this hazard use .
+ ///
+ public Vector3 SyncedPosition
+ {
+ get => Base.SynchronizedPosition.Position;
+ set => Base.SynchronizedPosition = new RelativePositioning.RelativePosition(value);
+ }
- ///
- /// Gets or sets whether a slight sizzle sound effect will be played when this object is destroyed.
- /// It is played by default if the tantrum gets destroyed by an explosion or by .
- /// Note that this state may change right before it is destroyed by standard game means.
- ///
- public bool PlaySizzle
- {
- get => Base.PlaySizzle;
- set => Base.PlaySizzle = value;
- }
+ ///
+ /// Gets or sets whether a slight sizzle sound effect will be played when this object is destroyed.
+ /// It is played by default if the tantrum gets destroyed by an explosion or by .
+ /// Note that this state may change right before it is destroyed by standard game means.
+ ///
+ public bool PlaySizzle
+ {
+ get => Base.PlaySizzle;
+ set => Base.PlaySizzle = value;
+ }
- ///
- /// The base object.
- ///
- public new TantrumEnvironmentalHazard Base { get; }
+ ///
+ /// The base object.
+ ///
+ public new TantrumEnvironmentalHazard Base { get; }
- ///
- /// An internal constructor to prevent external instantiation.
- ///
- /// The base game tantrum hazard.
- internal TantrumHazard(TantrumEnvironmentalHazard hazard)
- : base(hazard)
- {
- Base = hazard;
+ ///
+ /// An internal constructor to prevent external instantiation.
+ ///
+ /// The base game tantrum hazard.
+ internal TantrumHazard(TantrumEnvironmentalHazard hazard)
+ : base(hazard)
+ {
+ Base = hazard;
- Dictionary.Add(hazard, this);
- }
+ Dictionary.Add(hazard, this);
+ }
- ///
- /// Spawns a at specified position with specified rotation and scale.
- /// Do note that changing scale doesn't change the effect size. Use the and to match the visual size.
- ///
- /// The target position to spawn this hazard at.
- /// The target rotation to spawn this hazard with.
- /// The target scale to spawn with.
- /// A new tantrum hazard.
- public static TantrumHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale)
- {
- if (BasePrefab == null)
- BasePrefab = Hazard.GetPrefab();
+ ///
+ /// Spawns a at specified position with specified rotation and scale.
+ /// Do note that changing scale doesn't change the effect size. Use the and to match the visual size.
+ ///
+ /// The target position to spawn this hazard at.
+ /// The target rotation to spawn this hazard with.
+ /// The target scale to spawn with.
+ /// A new tantrum hazard.
+ public static TantrumHazard Spawn(Vector3 position, Quaternion rotation, Vector3 scale)
+ {
+ if (BasePrefab == null)
+ BasePrefab = Hazard.GetPrefab();
- TantrumHazard hazard = (TantrumHazard)Hazard.Spawn(BasePrefab, position, rotation, scale);
- hazard.SyncedPosition = position;
- return hazard;
- }
+ TantrumHazard hazard = (TantrumHazard)Hazard.Spawn(BasePrefab, position, rotation, scale);
+ hazard.SyncedPosition = position;
+ return hazard;
+ }
- ///
- /// An internal method to remove itself from the cache when the base object is destroyed.
- ///
- internal override void OnRemove()
- {
- base.OnRemove();
- Dictionary.Remove(Base);
- }
+ ///
+ /// An internal method to remove itself from the cache when the base object is destroyed.
+ ///
+ internal override void OnRemove()
+ {
+ base.OnRemove();
+ Dictionary.Remove(Base);
+ }
- ///
- /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
- ///
- /// The of the hazard.
- /// The requested hazard or
- [return: NotNullIfNotNull(nameof(hazard))]
- public static DecayableHazard? Get(TantrumEnvironmentalHazard? hazard)
- {
- if (hazard == null)
- return null;
+ ///
+ /// Gets the hazard wrapper from the or creates a new one if it doesn't exist and the provided was not .
+ ///
+ /// The of the hazard.
+ /// The requested hazard or
+ [return: NotNullIfNotNull(nameof(hazard))]
+ public static DecayableHazard? Get(TantrumEnvironmentalHazard? hazard)
+ {
+ if (hazard == null)
+ return null;
- return Dictionary.TryGetValue(hazard, out TantrumHazard decHazard) ? decHazard : (TantrumHazard)CreateItemWrapper(hazard);
- }
+ return Dictionary.TryGetValue(hazard, out TantrumHazard decHazard) ? decHazard : (TantrumHazard)CreateItemWrapper(hazard);
}
-}
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs b/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
index 51da0822..42908351 100644
--- a/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
+++ b/LabApi/Features/Wrappers/Facility/Hazards/Tesla.cs
@@ -5,146 +5,145 @@
using Generators;
using MapGeneration;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// The wrapper representing tesla gate.
+///
+public class Tesla
{
///
- /// The wrapper representing tesla gate.
+ /// Contains all the cached tesla gates, accessible through their .
+ ///
+ public static Dictionary Dictionary { get; } = [];
+
+ ///
+ /// Cached tesla gates by they are in.
+ ///
+ private static Dictionary TeslaByRoom { get; } = [];
+
+ ///
+ /// A reference to all instances of .
+ ///
+ public static IReadOnlyCollection List => Dictionary.Values;
+
+ ///
+ /// The base of the tesla.
+ ///
+ public TeslaGate Base { get; }
+
+ ///
+ /// Gets tesla gate's position.
+ ///
+ public Vector3 Position => Base.Position;
+
+ ///
+ /// Gets tesla gate's rotation.
+ ///
+ public Quaternion Rotation => Base.transform.rotation;
+
+ ///
+ /// Gets or sets the inactive time of tesla gate.
+ ///
+ /// Inactive time is in seconds and is automatically decreased over time.
+ /// Any value greater than 0 will result in tesla gate not activating.
+ ///
///
- public class Tesla
+ public float InactiveTime
{
- ///
- /// Contains all the cached tesla gates, accessible through their .
- ///
- public static Dictionary Dictionary { get; } = [];
-
- ///
- /// Cached tesla gates by they are in.
- ///
- private static Dictionary TeslaByRoom { get; } = [];
-
- ///
- /// A reference to all instances of .
- ///
- public static IReadOnlyCollection List => Dictionary.Values;
-
- ///
- /// The base of the tesla.
- ///
- public TeslaGate Base { get; }
-
- ///
- /// Gets tesla gate's position.
- ///
- public Vector3 Position => Base.Position;
-
- ///
- /// Gets tesla gate's rotation.
- ///
- public Quaternion Rotation => Base.transform.rotation;
-
- ///
- /// Gets or sets the inactive time of tesla gate.
- ///
- /// Inactive time is in seconds and is automatically decreased over time.
- /// Any value greater than 0 will result in tesla gate not activating.
- ///
- ///
- public float InactiveTime
+ get => Base.NetworkInactiveTime;
+ set
{
- get => Base.NetworkInactiveTime;
- set
- {
- Base.NetworkInactiveTime = value;
+ Base.NetworkInactiveTime = value;
- if (value > 0f)
- {
- Base.ServerSideIdle(false);
- }
+ if (value > 0f)
+ {
+ Base.ServerSideIdle(false);
}
}
+ }
- ///
- /// Gets the room the tesla gate is in.
- ///
- public Room Room => Room.Get(Base.Room);
-
- ///
- /// Returns if is in range where tesla gate starts idling.
- ///
- /// The player to check on.
- /// Whether the player is in idle range.
- public bool IsPlayerInIdleRange(Player player) => Base.IsInIdleRange(player.ReferenceHub);
-
- ///
- /// Returns if is in range where tesla gate starts to burst.
- ///
- /// The player to check on.
- /// Whether the player is within activation range.
- public bool IsPlayerInRange(Player player) => Base.PlayerInRange(player.ReferenceHub);
-
- ///
- /// Returns if any is in range where tesla gate starts idling.
- ///
- /// Whether any player is within the idle range.
- public bool IsAnyPlayerInIdleRange() => ReferenceHub.AllHubs.Any(Base.IsInIdleRange);
-
- ///
- /// Returns if any is in range where tesla gate starts to burst.
- ///
- /// Whether any player is within activation range.
- public bool IsAnyPlayerInRange() => ReferenceHub.AllHubs.Any(Base.PlayerInRange);
-
- ///
- /// Tesla gate electric burst. Will not do anything if burst is being active.
- ///
- public void Trigger() => Base.ServerSideCode();
-
- ///
- /// Tesla gate instant burst.
- ///
- public void InstantTrigger() => Base.RpcInstantBurst();
-
- ///
- /// Initializes the class to subscribe to events and handle the tesla caching.
- ///
- [InitializeWrapper]
- internal static void Initialize()
- {
- Dictionary.Clear();
- TeslaByRoom.Clear();
- TeslaGate.OnAdded += (tesla) => _ = new Tesla(tesla);
- TeslaGate.OnRemoved += (tesla) =>
- {
- Dictionary.Remove(tesla);
- TeslaByRoom.Remove(tesla.Room);
- };
- }
+ ///
+ /// Gets the room the tesla gate is in.
+ ///
+ public Room Room => Room.Get(Base.Room);
+
+ ///
+ /// Returns if is in range where tesla gate starts idling.
+ ///
+ /// The player to check on.
+ /// Whether the player is in idle range.
+ public bool IsPlayerInIdleRange(Player player) => Base.IsInIdleRange(player.ReferenceHub);
- ///
- /// A private constructor to prevent external instantiation.
- ///
- /// The of the item.
- private Tesla(TeslaGate tesla)
+ ///
+ /// Returns if is in range where tesla gate starts to burst.
+ ///
+ /// The player to check on.
+ /// Whether the player is within activation range.
+ public bool IsPlayerInRange(Player player) => Base.PlayerInRange(player.ReferenceHub);
+
+ ///
+ /// Returns if any is in range where tesla gate starts idling.
+ ///
+ /// Whether any player is within the idle range.
+ public bool IsAnyPlayerInIdleRange() => ReferenceHub.AllHubs.Any(Base.IsInIdleRange);
+
+ ///
+ /// Returns if any is in range where tesla gate starts to burst.
+ ///
+ /// Whether any player is within activation range.
+ public bool IsAnyPlayerInRange() => ReferenceHub.AllHubs.Any(Base.PlayerInRange);
+
+ ///
+ /// Tesla gate electric burst. Will not do anything if burst is being active.
+ ///
+ public void Trigger() => Base.ServerSideCode();
+
+ ///
+ /// Tesla gate instant burst.
+ ///
+ public void InstantTrigger() => Base.RpcInstantBurst();
+
+ ///
+ /// Initializes the class to subscribe to events and handle the tesla caching.
+ ///
+ [InitializeWrapper]
+ internal static void Initialize()
+ {
+ Dictionary.Clear();
+ TeslaByRoom.Clear();
+ TeslaGate.OnAdded += (tesla) => _ = new Tesla(tesla);
+ TeslaGate.OnRemoved += (tesla) =>
{
- Dictionary.Add(tesla, this);
- TeslaByRoom.Add(tesla.Room, this);
- Base = tesla;
- }
+ Dictionary.Remove(tesla);
+ TeslaByRoom.Remove(tesla.Room);
+ };
+ }
- ///
- /// Gets the tesla wrapper from the or creates a new one if it doesn't exist.
- ///
- /// The of the tesla.
- /// The requested tesla.
- public static Tesla Get(TeslaGate teslaGate) => Dictionary.TryGetValue(teslaGate, out Tesla tesla) ? tesla : new Tesla(teslaGate);
-
- ///
- /// Gets the tesla wrapper inside of from the .
- ///
- /// The with the tesla.
- /// The tesla to be returned.
- /// Whether the tesla is in out parameter.
- public static bool TryGet(Room room, [NotNullWhen(true)] out Tesla? tesla)
- => TeslaByRoom.TryGetValue(room.Base, out tesla);
+ ///
+ /// A private constructor to prevent external instantiation.
+ ///
+ /// The of the item.
+ private Tesla(TeslaGate tesla)
+ {
+ Dictionary.Add(tesla, this);
+ TeslaByRoom.Add(tesla.Room, this);
+ Base = tesla;
}
+
+ ///
+ /// Gets the tesla wrapper from the or creates a new one if it doesn't exist.
+ ///
+ /// The of the tesla.
+ /// The requested tesla.
+ public static Tesla Get(TeslaGate teslaGate) => Dictionary.TryGetValue(teslaGate, out Tesla tesla) ? tesla : new Tesla(teslaGate);
+
+ ///
+ /// Gets the tesla wrapper inside of from the .
+ ///
+ /// The with the tesla.
+ /// The tesla to be returned.
+ /// Whether the tesla is in out parameter.
+ public static bool TryGet(Room room, [NotNullWhen(true)] out Tesla? tesla)
+ => TeslaByRoom.TryGetValue(room.Base, out tesla);
}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs b/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs
index 713b0323..eb7b3f45 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/LightsController.cs
@@ -2,83 +2,82 @@
using System.Collections.Generic;
using UnityEngine;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// The wrapper representing room light controller.
+///
+public class LightsController
{
///
- /// The wrapper representing room light controller.
+ /// Contains all the cached rooms in the game, accessible through their .
///
- public class LightsController
- {
- ///
- /// Contains all the cached rooms in the game, accessible through their .
- ///
- private static Dictionary Dictionary { get; } = [];
+ private static Dictionary Dictionary { get; } = [];
- ///
- /// A reference to all instances currently in the game.
- ///
- public static IReadOnlyCollection List => Dictionary.Values;
+ ///
+ /// A reference to all instances currently in the game.
+ ///
+ public static IReadOnlyCollection List => Dictionary.Values;
- ///
- /// A private constructor to prevent external instantiation.
- ///
- /// The original object.
- private LightsController(RoomLightController original)
- {
- Dictionary.Add(original, this);
- Base = original;
- }
+ ///
+ /// A private constructor to prevent external instantiation.
+ ///
+ /// The original object.
+ private LightsController(RoomLightController original)
+ {
+ Dictionary.Add(original, this);
+ Base = original;
+ }
- ///
- /// Initializes the Room wrapper by subscribing to the events.
- ///
- [InitializeWrapper]
- internal static void Initialize()
- {
- RoomLightController.OnAdded += (roomLightController) => _ = new LightsController(roomLightController);
- RoomLightController.OnRemoved += (roomLightController) => Dictionary.Remove(roomLightController);
- }
+ ///
+ /// Initializes the Room wrapper by subscribing to the events.
+ ///
+ [InitializeWrapper]
+ internal static void Initialize()
+ {
+ RoomLightController.OnAdded += (roomLightController) => _ = new LightsController(roomLightController);
+ RoomLightController.OnRemoved += (roomLightController) => Dictionary.Remove(roomLightController);
+ }
- ///
- /// The base game object.
- ///
- public RoomLightController Base { get; }
+ ///
+ /// The base game object.
+ ///
+ public RoomLightController Base { get; }
- ///
- /// The room this controller is assigned to.
- ///
- public Room Room => Room.Get(Base.Room);
+ ///
+ /// The room this controller is assigned to.
+ ///
+ public Room Room => Room.Get(Base.Room);
- ///
- /// Gets or sets whether the lights are enabled in this room.
- ///
- public bool LightsEnabled
- {
- get => Base.NetworkLightsEnabled;
- set => Base.NetworkLightsEnabled = value;
- }
+ ///
+ /// Gets or sets whether the lights are enabled in this room.
+ ///
+ public bool LightsEnabled
+ {
+ get => Base.NetworkLightsEnabled;
+ set => Base.NetworkLightsEnabled = value;
+ }
- ///
- /// Gets or sets the overriden room light color. Set the value to to reset override color.
- ///
- public Color OverrideLightsColor
- {
- get => Base.NetworkOverrideColor;
- set => Base.NetworkOverrideColor = value;
- }
+ ///
+ /// Gets or sets the overriden room light color. Set the value to to reset override color.
+ ///
+ public Color OverrideLightsColor
+ {
+ get => Base.NetworkOverrideColor;
+ set => Base.NetworkOverrideColor = value;
+ }
- ///
- /// Blackouts the room for specified duration.
- ///
- /// Duration of light shutdown in seconds.
- public void FlickerLights(float duration) => Base.ServerFlickerLights(duration);
+ ///
+ /// Blackouts the room for specified duration.
+ ///
+ /// Duration of light shutdown in seconds.
+ public void FlickerLights(float duration) => Base.ServerFlickerLights(duration);
- ///
- /// Gets the controller wrapper from , or creates a new one if it doesnt exists.
- ///
- /// The original light controller.
- /// The requested light controller wrapper.
- public static LightsController Get(RoomLightController roomLightController) =>
- Dictionary.TryGetValue(roomLightController, out LightsController lightController) ? lightController : new LightsController(roomLightController);
- }
-}
+ ///
+ /// Gets the controller wrapper from , or creates a new one if it doesnt exists.
+ ///
+ /// The original light controller.
+ /// The requested light controller wrapper.
+ public static LightsController Get(RoomLightController roomLightController) =>
+ Dictionary.TryGetValue(roomLightController, out LightsController lightController) ? lightController : new LightsController(roomLightController);
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
index 42996aeb..071e4197 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketDimension.cs
@@ -105,9 +105,7 @@ internal override void OnRemoved()
/// Triggers pocket dimension leaving/left events.
///
public static void ForceExit(Player player)
- {
- PocketDimensionTeleport.Exit(null, player.ReferenceHub);
- }
+ => PocketDimensionTeleport.Exit(null, player.ReferenceHub);
///
/// Force a player to be killed by the pocket dimension.
@@ -118,9 +116,7 @@ public static void ForceExit(Player player)
/// Triggers pocket dimension leaving/left events.
///
public static void ForceKill(Player player)
- {
- PocketDimensionTeleport.Kill(null, player.ReferenceHub);
- }
+ => PocketDimensionTeleport.Kill(null, player.ReferenceHub);
///
/// Gets whether a is inside the pocket dimension.
@@ -169,9 +165,7 @@ public static void AddExitPosesForZone(FacilityZone zone, IEnumerable pose
///
/// The zone to remove exits from.
public static void RemoveAllExitPosesForZone(FacilityZone zone)
- {
- Scp106PocketExitFinder.PosesForZoneCache[zone] = [];
- }
+ => Scp106PocketExitFinder.PosesForZoneCache[zone] = [];
///
/// Removes the specified poses from use as exits for the pocket dimension.
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketTeleport.cs b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketTeleport.cs
index 75b0862e..46160e95 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketTeleport.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/PocketDimension/PocketTeleport.cs
@@ -124,10 +124,7 @@ public PocketTeleport Spawn(Vector3 localPosition)
///
/// Destroys the removing it from the server.
///
- public void Destroy()
- {
- Object.Destroy(Base);
- }
+ public void Destroy() => Object.Destroy(Base);
///
/// Gets the wrapper given the base game instance.
diff --git a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
index 98c850bc..4b770262 100644
--- a/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
+++ b/LabApi/Features/Wrappers/Facility/Rooms/Scp914/Scp914.cs
@@ -92,7 +92,7 @@ public static bool IsUpgrading
if (value)
Scp914Controller.Singleton.Upgrade();
else
- {
+ {
Scp914Controller.Singleton.IsUpgrading = value;
SequenceCooldown = 0.0f;
}
@@ -202,8 +202,7 @@ public static float DoorOpenDelay
///
public static void Interact(Scp914InteractCode interactCode, Player? player = null)
{
- if (player == null)
- player = Server.Host;
+ player ??= Server.Host;
Scp914Controller.Singleton.ServerInteract(player.ReferenceHub, (byte)interactCode);
}
@@ -328,7 +327,7 @@ public static void SetItemProcessor(Func- predicate, T processor)
///
public static void SetItemProcessor(Func
- predicate) where T : Scp914ItemProcessor, new()
{
- foreach(ItemType type in Enum.GetValues(typeof(ItemType)))
+ foreach (ItemType type in Enum.GetValues(typeof(ItemType)))
{
if (!InventoryItemLoader.TryGetItem(type, out ItemBase item) || !predicate(Item.Get(item)))
continue;
diff --git a/LabApi/Features/Wrappers/Facility/Round.cs b/LabApi/Features/Wrappers/Facility/Round.cs
index f9e4b18d..9fb8c14a 100644
--- a/LabApi/Features/Wrappers/Facility/Round.cs
+++ b/LabApi/Features/Wrappers/Facility/Round.cs
@@ -6,159 +6,158 @@
using Utils.NonAllocLINQ;
using static ServerStatic;
-namespace LabApi.Features.Wrappers
+namespace LabApi.Features.Wrappers;
+
+///
+/// A static wrapper for any round related features.
+///
+public static class Round
{
///
- /// A static wrapper for any round related features.
+ /// Gets or sets whether the round has started or not.
+ ///
+ public static bool IsRoundStarted => RoundSummary.RoundInProgress();
+
+ ///
+ /// Gets a value indicating whether the round is ended or not.
+ ///
+ public static bool IsRoundEnded => !IsRoundStarted && Duration.Seconds > 1;
+
+ ///
+ /// Gets whether the round can end if there is only 1 team alive remaining.
+ /// IMPORTANT: This does NOT check win conditions! Only whether the round is locked and if there is a required amount of players.
///
- public static class Round
+ public static bool CanRoundEnd
{
- ///
- /// Gets or sets whether the round has started or not.
- ///
- public static bool IsRoundStarted => RoundSummary.RoundInProgress();
-
- ///
- /// Gets a value indicating whether the round is ended or not.
- ///
- public static bool IsRoundEnded => !IsRoundStarted && Duration.Seconds > 1;
-
- ///
- /// Gets whether the round can end if there is only 1 team alive remaining.
- /// IMPORTANT: This does NOT check win conditions! Only whether the round is locked and if there is a required amount of players.
- ///
- public static bool CanRoundEnd
+ get
{
- get
- {
- if (IsLocked || KeepRoundOnOne && ReferenceHub.AllHubs.Count(x => x.authManager.InstanceMode != ClientInstanceMode.DedicatedServer) < 2 || !IsRoundStarted)
- return false;
+ if (IsLocked || KeepRoundOnOne && ReferenceHub.AllHubs.Count(x => x.authManager.InstanceMode != ClientInstanceMode.DedicatedServer) < 2 || !IsRoundStarted)
+ return false;
- return IsRoundStarted && !IsLocked;
- }
+ return IsRoundStarted && !IsLocked;
}
+ }
- ///
- /// Gets or sets whether the round should end if is active and there is only one player on the server.
- ///
- public static bool KeepRoundOnOne
- {
- get => RoundSummary.singleton.KeepRoundOnOne;
- set => RoundSummary.singleton.KeepRoundOnOne = value;
- }
+ ///
+ /// Gets or sets whether the round should end if is active and there is only one player on the server.
+ ///
+ public static bool KeepRoundOnOne
+ {
+ get => RoundSummary.singleton.KeepRoundOnOne;
+ set => RoundSummary.singleton.KeepRoundOnOne = value;
+ }
- ///
- /// Gets or sets a value indicating whether the round is locked or not.
- ///
- public static bool IsLocked
- {
- get => RoundSummary.RoundLock;
- set => RoundSummary.RoundLock = value;
- }
+ ///
+ /// Gets or sets a value indicating whether the round is locked or not.
+ ///
+ public static bool IsLocked
+ {
+ get => RoundSummary.RoundLock;
+ set => RoundSummary.RoundLock = value;
+ }
- ///
- /// Gets or sets a value indicating whether the lobby is locked or not.
- ///
- public static bool IsLobbyLocked
- {
- get => RoundStart.LobbyLock;
- set => RoundStart.LobbyLock = value;
- }
+ ///
+ /// Gets or sets a value indicating whether the lobby is locked or not.
+ ///
+ public static bool IsLobbyLocked
+ {
+ get => RoundStart.LobbyLock;
+ set => RoundStart.LobbyLock = value;
+ }
- ///
- /// Gets or sets the current extra targets count for SCPs.
- ///
- public static int ExtraTargets
- {
- get => RoundSummary.singleton.Network_extraTargets;
- set => RoundSummary.singleton.Network_extraTargets = value;
- }
+ ///
+ /// Gets or sets the current extra targets count for SCPs.
+ ///
+ public static int ExtraTargets
+ {
+ get => RoundSummary.singleton.Network_extraTargets;
+ set => RoundSummary.singleton.Network_extraTargets = value;
+ }
- ///
- /// Gets the current amount of targets for SCPs. Use to add/remove any extra.
- ///
- public static int ScpTargetsAmount => ReferenceHub.AllHubs.Count(hub => hub.GetFaction() is Faction.FoundationStaff or Faction.FoundationEnemy) + ExtraTargets;
-
- ///
- /// Gets the amount of total deaths during the round.
- ///
- public static int TotalDeaths => RoundSummary.Kills;
-
- ///
- /// Gets the amount of total kills by SCPs.
- ///
- public static int KilledBySCPs => RoundSummary.KilledBySCPs;
-
- ///
- /// Gets the amount of escaped Class D.
- ///
- public static int EscapedClassD => RoundSummary.EscapedClassD;
-
- ///
- /// Gets rhe amount of escaped Scientists.
- ///
- public static int EscapedScientists => RoundSummary.EscapedScientists;
-
- ///
- /// Gets the amount of SCPs alive at the end of round.
- ///
- public static int SurvivingSCPs => RoundSummary.SurvivingSCPs;
-
- ///
- /// Gets the amount of people that turned into zombies.
- ///
- public static int ChangedIntoZombies => RoundSummary.ChangedIntoZombies;
-
- ///
- /// Gets the duration of the current round.
- ///
- public static TimeSpan Duration => RoundStart.RoundLength;
-
- ///
- /// Start the round.
- ///
- public static void Start() => CharacterClassManager.ForceRoundStart();
-
- ///
- /// Restarts the round.
- ///
- /// Whether or not it fast restart is enabled.
- /// Overrides stop next round action.
- /// The restart action.
- public static void Restart(bool fastRestart = false, bool overrideRestartAction = false, NextRoundAction restartAction = NextRoundAction.DoNothing)
- {
- if (overrideRestartAction)
- StopNextRound = restartAction;
+ ///
+ /// Gets the current amount of targets for SCPs. Use to add/remove any extra.
+ ///
+ public static int ScpTargetsAmount => ReferenceHub.AllHubs.Count(hub => hub.GetFaction() is Faction.FoundationStaff or Faction.FoundationEnemy) + ExtraTargets;
- bool prevValue = CustomNetworkManager.EnableFastRestart;
- CustomNetworkManager.EnableFastRestart = fastRestart;
- RoundRestart.InitiateRoundRestart();
- CustomNetworkManager.EnableFastRestart = prevValue;
- }
+ ///
+ /// Gets the amount of total deaths during the round.
+ ///
+ public static int TotalDeaths => RoundSummary.Kills;
- ///
- /// Restarts the round silently.
- ///
- public static void RestartSilently() => Restart(true, true, NextRoundAction.DoNothing);
-
- ///
- /// Attempts to end the current round.
- ///
- /// Whether the round should be forced to end.
- /// If the round was ended.
- public static bool End(bool force = false)
- {
- if (force)
- {
- RoundSummary.singleton.ForceEnd();
- return true;
- }
+ ///
+ /// Gets the amount of total kills by SCPs.
+ ///
+ public static int KilledBySCPs => RoundSummary.KilledBySCPs;
- if (!CanRoundEnd)
- return false;
+ ///
+ /// Gets the amount of escaped Class D.
+ ///
+ public static int EscapedClassD => RoundSummary.EscapedClassD;
+
+ ///
+ /// Gets rhe amount of escaped Scientists.
+ ///
+ public static int EscapedScientists => RoundSummary.EscapedScientists;
+
+ ///
+ /// Gets the amount of SCPs alive at the end of round.
+ ///
+ public static int SurvivingSCPs => RoundSummary.SurvivingSCPs;
+
+ ///
+ /// Gets the amount of people that turned into zombies.
+ ///
+ public static int ChangedIntoZombies => RoundSummary.ChangedIntoZombies;
+
+ ///
+ /// Gets the duration of the current round.
+ ///
+ public static TimeSpan Duration => RoundStart.RoundLength;
+ ///
+ /// Start the round.
+ ///
+ public static void Start() => CharacterClassManager.ForceRoundStart();
+
+ ///
+ /// Restarts the round.
+ ///
+ /// Whether or not it fast restart is enabled.
+ /// Overrides stop next round action.
+ /// The restart action.
+ public static void Restart(bool fastRestart = false, bool overrideRestartAction = false, NextRoundAction restartAction = NextRoundAction.DoNothing)
+ {
+ if (overrideRestartAction)
+ StopNextRound = restartAction;
+
+ bool prevValue = CustomNetworkManager.EnableFastRestart;
+ CustomNetworkManager.EnableFastRestart = fastRestart;
+ RoundRestart.InitiateRoundRestart();
+ CustomNetworkManager.EnableFastRestart = prevValue;
+ }
+
+ ///
+ /// Restarts the round silently.
+ ///
+ public static void RestartSilently() => Restart(true, true, NextRoundAction.DoNothing);
+
+ ///
+ /// Attempts to end the current round.
+ ///
+ /// Whether the round should be forced to end.
+ /// If the round was ended.
+ public static bool End(bool force = false)
+ {
+ if (force)
+ {
RoundSummary.singleton.ForceEnd();
return true;
}
+
+ if (!CanRoundEnd)
+ return false;
+
+ RoundSummary.singleton.ForceEnd();
+ return true;
}
-}
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Generator.cs b/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
index aaa81f80..bef896d1 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Generator.cs
@@ -1,5 +1,4 @@
-using Generators;
-using Interactables.Interobjects.DoorUtils;
+using Interactables.Interobjects.DoorUtils;
using MapGeneration;
using MapGeneration.Distributors;
using System.Collections.Generic;
@@ -33,7 +32,7 @@ public class Generator : Structure
///
/// The of the generator.
internal Generator(Scp079Generator generator)
- :base(generator)
+ : base(generator)
{
Dictionary.Add(generator, this);
Base = generator;
@@ -71,6 +70,7 @@ internal override void OnRemove()
GeneratorsByRoom.Remove(Base.Room);
}
}
+
Dictionary.Remove(Base);
}
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Locker.cs b/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
index 6483f3bd..1b8c0839 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Locker.cs
@@ -126,18 +126,12 @@ public void AddLockerLoot(ItemType type, int remainingUses, int probabilityPoint
/// Removes an existing from the possible spawnable .
///
/// The instance to remove.
- public void RemoveLockerLoot(LockerLoot loot)
- {
- Base.Loot = Base.Loot.Except([loot]).ToArray();
- }
+ public void RemoveLockerLoot(LockerLoot loot) => Base.Loot = Base.Loot.Except([loot]).ToArray();
///
/// Removes all instances from .
///
- public void ClearLockerLoot()
- {
- Base.Loot = [];
- }
+ public void ClearLockerLoot() => Base.Loot = [];
///
/// Fill chambers randomly with items chosen from .
diff --git a/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs b/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
index 1032c486..9c4929ac 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/PedestalLocker.cs
@@ -24,7 +24,7 @@ public class PedestalLocker : Locker
///
/// The base object.
internal PedestalLocker(PedestalScpLocker pedestalScpLocker)
- :base(pedestalScpLocker)
+ : base(pedestalScpLocker)
{
Base = pedestalScpLocker;
Dictionary.Add(pedestalScpLocker, this);
diff --git a/LabApi/Features/Wrappers/Facility/Structures/Structure.cs b/LabApi/Features/Wrappers/Facility/Structures/Structure.cs
index fd72312a..d0003681 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/Structure.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/Structure.cs
@@ -188,7 +188,7 @@ protected static Structure CreateStructureWrapper(SpawnableStructure structure)
if (!typeWrappers.TryGetValue(structure.GetType(), out Func handler))
Console.Logger.Error($"Failed to create structure wrapper. Missing constructor handler for type {structure.GetType()}");
- Structure wrapper = handler.Invoke(structure);
+ Structure? wrapper = handler?.Invoke(structure);
if (wrapper == null)
Console.Logger.Error($"Failed to create structure wrapper. A handler returned null for type {structure.GetType()}");
diff --git a/LabApi/Features/Wrappers/Facility/Structures/WallCabinet.cs b/LabApi/Features/Wrappers/Facility/Structures/WallCabinet.cs
index d478dc77..c70f31a7 100644
--- a/LabApi/Features/Wrappers/Facility/Structures/WallCabinet.cs
+++ b/LabApi/Features/Wrappers/Facility/Structures/WallCabinet.cs
@@ -48,7 +48,7 @@ public bool IsOpen
}
///
- /// Gets or sets whether the or not the wall cabinet can be interacted with by a .
+ /// Gets or sets whether the wall cabinet can be interacted with by a .
///
public bool CanInteract => MainChamber.CanInteract;
diff --git a/LabApi/Features/Wrappers/Items/Usable/Scp1344Item.cs b/LabApi/Features/Wrappers/Items/Usable/Scp1344Item.cs
index 6c7830d9..0ce28b83 100644
--- a/LabApi/Features/Wrappers/Items/Usable/Scp1344Item.cs
+++ b/LabApi/Features/Wrappers/Items/Usable/Scp1344Item.cs
@@ -2,59 +2,58 @@
using System.Diagnostics.CodeAnalysis;
using BaseScp1344Item = InventorySystem.Items.Usables.Scp1344.Scp1344Item;
-namespace LabApi.Features.Wrappers.Items.Usable
+namespace LabApi.Features.Wrappers.Items.Usable;
+
+///
+/// The wrapper representing .
+///
+public class Scp1344Item : UsableItem
{
///
- /// The wrapper representing .
+ /// Contains all the cached SCP-1344 items, accessible through their .
+ ///
+ public new static Dictionary Dictionary { get; } = [];
+
+ ///
+ /// A reference to all instances of .
+ ///
+ public new static IReadOnlyCollection List => Dictionary.Values;
+
+ ///
+ /// The base object.
+ ///
+ public new BaseScp1344Item Base { get; }
+
+ ///
+ /// An internal constructor to prevent external instantiation.
+ ///
+ /// The base object.
+ internal Scp1344Item(BaseScp1344Item baseItem) : base(baseItem)
+ {
+ Dictionary.Add(baseItem, this);
+ Base = baseItem;
+ }
+
+ ///
+ /// Gets the SCP-1576 item wrapper from the or creates a new one if it doesn't exist and the provided was not null.
+ ///
+ /// The of the item.
+ /// The requested item or null.
+ [return: NotNullIfNotNull(nameof(baseItem))]
+ public static Scp1344Item? Get(BaseScp1344Item? baseItem)
+ {
+ if (baseItem == null)
+ return null;
+
+ return Dictionary.TryGetValue(baseItem, out Scp1344Item item) ? item : (Scp1344Item)CreateItemWrapper(baseItem);
+ }
+
+ ///
+ /// An internal method to remove itself from the cache when the base object is destroyed.
///
- public class Scp1344Item : UsableItem
+ internal override void OnRemove()
{
- ///
- /// Contains all the cached SCP-1344 items, accessible through their .
- ///
- public new static Dictionary Dictionary { get; } = [];
-
- ///
- /// A reference to all instances of .
- ///
- public new static IReadOnlyCollection List => Dictionary.Values;
-
- ///
- /// The base object.
- ///
- public new BaseScp1344Item Base { get; }
-
- ///
- /// An internal constructor to prevent external instantiation.
- ///
- /// The base object.
- internal Scp1344Item(BaseScp1344Item baseItem) : base(baseItem)
- {
- Dictionary.Add(baseItem, this);
- Base = baseItem;
- }
-
- ///
- /// Gets the SCP-1576 item wrapper from the or creates a new one if it doesn't exist and the provided was not null.
- ///
- /// The of the item.
- /// The requested item or null.
- [return: NotNullIfNotNull(nameof(baseItem))]
- public static Scp1344Item? Get(BaseScp1344Item? baseItem)
- {
- if (baseItem == null)
- return null;
-
- return Dictionary.TryGetValue(baseItem, out Scp1344Item item) ? item : (Scp1344Item)CreateItemWrapper(baseItem);
- }
-
- ///
- /// An internal method to remove itself from the cache when the base object is destroyed.
- ///
- internal override void OnRemove()
- {
- base.OnRemove();
- Dictionary.Remove(Base);
- }
+ base.OnRemove();
+ Dictionary.Remove(Base);
}
-}
+}
\ No newline at end of file
diff --git a/LabApi/Features/Wrappers/Pickups/Pickup.cs b/LabApi/Features/Wrappers/Pickups/Pickup.cs
index 97473011..8bfbba9f 100644
--- a/LabApi/Features/Wrappers/Pickups/Pickup.cs
+++ b/LabApi/Features/Wrappers/Pickups/Pickup.cs
@@ -187,7 +187,8 @@ public Quaternion Rotation
/// Gets the pickup wrapper from the or creates a new one if it doesn't exist.
///
/// The of the pickup.
- /// The requested item .
+ /// The requested item
+ [return: NotNullIfNotNull("itemPickupBase")]
public static Pickup? Get(ItemPickupBase itemPickupBase)
{
if (itemPickupBase == null)
@@ -312,12 +313,12 @@ private static Pickup AddPickup(ItemPickupBase itemPickupBase)
/// The being removed.
private static void RemovePickup(ItemPickupBase itemPickupBase)
{
- if (Dictionary.TryGetValue(itemPickupBase, out Pickup pickup))
- {
- pickup.UnsubscribeEvents();
- Dictionary.Remove(itemPickupBase);
- if (itemPickupBase.Info.Serial != 0)
- SerialCache.Remove(itemPickupBase.Info.Serial);
- }
+ if (!Dictionary.TryGetValue(itemPickupBase, out Pickup pickup))
+ return;
+
+ pickup.UnsubscribeEvents();
+ Dictionary.Remove(itemPickupBase);
+ if (itemPickupBase.Info.Serial != 0)
+ SerialCache.Remove(itemPickupBase.Info.Serial);
}
}
diff --git a/LabApi/Features/Wrappers/Players/Player.cs b/LabApi/Features/Wrappers/Players/Player.cs
index 8d3e2136..cdc9cb07 100644
--- a/LabApi/Features/Wrappers/Players/Player.cs
+++ b/LabApi/Features/Wrappers/Players/Player.cs
@@ -373,7 +373,7 @@ public Player? CurrentlySpectating
if (!ReferenceHub.TryGetHubNetID(sr.SyncedSpectatedNetId, out ReferenceHub hub))
return null;
- return Player.Get(hub);
+ return Get(hub);
}
}
@@ -1331,6 +1331,15 @@ public void EnableEffect(byte intensity = 1, float duration = 0f, bool addDur
public bool TryGetEffect([NotNullWhen(true)] out T? effect)
where T : StatusEffectBase => ReferenceHub.playerEffectsController.TryGetEffect(out effect) && effect != null;
+ ///
+ /// Tries to get a specific based on its name.
+ ///
+ /// The name of the effect to get.
+ /// The effect found.
+ /// Whether the was successfully found.
+ public bool TryGetEffect(string effectName, [NotNullWhen(true)] out StatusEffectBase? effect)
+ => ReferenceHub.playerEffectsController.TryGetEffect(effectName, out effect) && effect != null;
+
///
/// Gets a specific status effect.
///
diff --git a/LabApi/Features/Wrappers/Players/Server.cs b/LabApi/Features/Wrappers/Players/Server.cs
index 7f4ffd0a..bf29848b 100644
--- a/LabApi/Features/Wrappers/Players/Server.cs
+++ b/LabApi/Features/Wrappers/Players/Server.cs
@@ -327,7 +327,7 @@ public static bool UnbanUserId(string userId)
/// Unbans a player from the server.
///
/// The IP address of the player.
- /// Whether or not the unban was successful.
+ /// Whether the unban was successful.
public static bool UnbanIpAddress(string ipAddress)
{
if (string.IsNullOrEmpty(ipAddress) || !IsPlayerBanned(ipAddress))
diff --git a/LabApi/Loader/Features/Misc/AssemblyUtils.cs b/LabApi/Loader/Features/Misc/AssemblyUtils.cs
index 21f55b96..a4b9f5d9 100644
--- a/LabApi/Loader/Features/Misc/AssemblyUtils.cs
+++ b/LabApi/Loader/Features/Misc/AssemblyUtils.cs
@@ -171,7 +171,7 @@ public static bool TryGetDataStream(Assembly target, string name, [NotNullWhen(t
///
/// The to get the assembly from.
/// The assembly of the loaded .
- /// Whether or not the assembly was successfully retrieved.
+ /// Whether the assembly was successfully retrieved.
public static bool TryGetLoadedAssembly(this Plugin plugin, out Assembly assembly)
{
// We try to get the assembly of the specified plugin inside the plugin loader.
diff --git a/LabApi/Loader/Features/Plugins/Configuration/Properties.cs b/LabApi/Loader/Features/Plugins/Configuration/Properties.cs
index 87c584da..5706fb11 100644
--- a/LabApi/Loader/Features/Plugins/Configuration/Properties.cs
+++ b/LabApi/Loader/Features/Plugins/Configuration/Properties.cs
@@ -14,7 +14,7 @@ public class Properties
public static Properties CreateDefault() => new();
///
- /// Whether or not the is enabled.
+ /// Whether the is enabled.
///
[Description("Whether or not the plugin is enabled.")]
public bool IsEnabled { get; set; } = true;
From d9780067eda86510b029f94f65c583c03c166a1a Mon Sep 17 00:00:00 2001
From: Misfiy <85962933+Misfiy@users.noreply.github.com>
Date: Fri, 14 Feb 2025 20:49:23 +0100
Subject: [PATCH 12/12] someone nitpicked my nitpick :(
---
.../Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs b/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs
index acac925f..da70a0de 100644
--- a/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs
+++ b/LabApi/Events/Arguments/PlayerEvents/PlayerTogglingNoclipEventArgs.cs
@@ -32,8 +32,8 @@ public PlayerTogglingNoclipEventArgs(ReferenceHub player, bool newState)
///
/// Whether the event is allowed to run.
- /// This value is assigned on based on whether the player has noclip permitted. So it may not be allowed by default for some players.
///
+ /// This value is assigned on based on whether the player has noclip permitted. So it may not be allowed by default for some players.
public bool IsAllowed { get; set; }
}
}