Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion EXILED/Exiled.API/Features/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ public bool IsBeingUsed
set => Base.IsActive = value;
}

/// <summary>
/// Converts Scp079Camera to Camera.
/// </summary>
/// <param name="scp079Camera">The Scp079Camera.</param>
/// <returns>EXILED Camera.</returns>
public static implicit operator Camera(Scp079Camera scp079Camera) => Get(scp079Camera);

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Camera"/> which contains all the <see cref="Camera"/> instances given a <see cref="IEnumerable{T}"/> of <see cref="Scp079Camera"/>.
/// </summary>
Expand All @@ -274,7 +281,7 @@ public bool IsBeingUsed
/// </summary>
/// <param name="camera079">The base <see cref="Scp079Camera"/>.</param>
/// <returns>A <see cref="Camera"/> or <see langword="null"/> if not found.</returns>
public static Camera Get(Scp079Camera camera079) => camera079 != null ? Camera079ToCamera.TryGetValue(camera079, out Camera camera) ? camera : new(camera079) : null;
public static Camera Get(Scp079Camera camera079) => camera079 == null ? null : Camera079ToCamera.TryGetValue(camera079, out Camera camera) ? camera : new(camera079);

/// <summary>
/// Gets a <see cref="Camera"/> given the specified <paramref name="cameraId"/>.
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ public Vector3 Scale
/// </summary>
internal List<Room> RoomsValue { get; } = new List<Room>();

/// <summary>
/// Converts DoorVariant to Door.
/// </summary>
/// <param name="doorVariant">The DoorVariant.</param>
/// <returns>EXILED Door.</returns>
public static implicit operator Door(DoorVariant doorVariant) => Get(doorVariant);

/// <summary>
/// Gets the door object associated with a specific <see cref="DoorVariant"/>, or creates a new one if there isn't one.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,13 @@ public KeycardPermissions KeycardPermissions
set => Base._requiredPermission = (DoorPermissionFlags)value;
}

/// <summary>
/// Converts Scp079Generator to Generator.
/// </summary>
/// <param name="scp079Generator">The Scp079Generator.</param>
/// <returns>EXILED Generator.</returns>
public static implicit operator Generator(Scp079Generator scp079Generator) => Get(scp079Generator);

/// <summary>
/// Gets the <see cref="Generator"/> belonging to the <see cref="Scp079Generator"/>, if any.
/// </summary>
Expand Down
9 changes: 8 additions & 1 deletion EXILED/Exiled.API/Features/Hazards/Hazard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,19 @@ public Vector3 Position
set => Base.SourcePosition = value;
}

/// <summary>
/// Converts EnvironmentalHazard to Hazard.
/// </summary>
/// <param name="environmentalHazard">The EnvironmentalHazard.</param>
/// <returns>EXILED Hazard.</returns>
public static implicit operator Hazard(EnvironmentalHazard environmentalHazard) => Get(environmentalHazard);

/// <summary>
/// Gets the <see cref="Hazard"/> by <see cref="EnvironmentalHazard"/>.
/// </summary>
/// <param name="environmentalHazard">The <see cref="EnvironmentalHazard"/> instance.</param>
/// <returns><see cref="Hazard"/> for <see cref="EnvironmentalHazard"/>.</returns>
public static Hazard Get(EnvironmentalHazard environmentalHazard) =>
public static Hazard Get(EnvironmentalHazard environmentalHazard) => environmentalHazard == null ? null :
EnvironmentalHazardToHazard.TryGetValue(environmentalHazard, out Hazard hazard) ? hazard
: environmentalHazard switch
{
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ public ItemAddReason AddReason
/// </summary>
public ItemIdentifier Identifier => Base.ItemId;

/// <summary>
/// Converts ItemBase to Item.
/// </summary>
/// <param name="itemBase">The ItemBase.</param>
/// <returns>EXILED Item.</returns>
public static implicit operator Item(ItemBase itemBase) => Get(itemBase);

/// <summary>
/// Gets an existing <see cref="Item"/> or creates a new instance of one.
/// </summary>
Expand Down
17 changes: 14 additions & 3 deletions EXILED/Exiled.API/Features/Lift.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ public ElevatorSequence Status
};

/// <summary>
/// Gets the <see cref="ElevatorGroup"/>.
/// Gets or sets the <see cref="ElevatorGroup"/>.
/// </summary>
public ElevatorGroup Group => Base.AssignedGroup;
public ElevatorGroup Group
{
get => Base.NetworkAssignedGroup;
set => Base.NetworkAssignedGroup = value;
}

/// <summary>
/// Gets a value indicating whether the lift is operative.
Expand Down Expand Up @@ -220,6 +224,13 @@ public float AnimationTime
/// </summary>
public Doors.ElevatorDoor CurrentDestination => Door.Get<Doors.ElevatorDoor>(Base.DestinationDoor);

/// <summary>
/// Converts ElevatorChamber to Lift.
/// </summary>
/// <param name="elevatorChamber">The ElevatorChamber.</param>
/// <returns>EXILED Lift.</returns>
public static implicit operator Lift(ElevatorChamber elevatorChamber) => Get(elevatorChamber);

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Lift"/> which contains all the <see cref="Lift"/> instances from the specified <see cref="Status"/>.
/// </summary>
Expand All @@ -232,7 +243,7 @@ public float AnimationTime
/// </summary>
/// <param name="elevator">The <see cref="ElevatorChamber"/> instance.</param>
/// <returns>A <see cref="Lift"/> or <see langword="null"/> if not found.</returns>
public static Lift Get(ElevatorChamber elevator) => ElevatorChamberToLift.TryGetValue(elevator, out Lift lift) ? lift : new(elevator);
public static Lift Get(ElevatorChamber elevator) => elevator == null ? null : ElevatorChamberToLift.TryGetValue(elevator, out Lift lift) ? lift : new(elevator);

/// <summary>
/// Gets the <see cref="Lift"/> corresponding to the specified <see cref="ElevatorType"/>, if any.
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Lockers/Chamber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ public bool IsOpen
/// </summary>
public bool CanInteract => Base.CanInteract;

/// <summary>
/// Converts LockerChamber to Chamber.
/// </summary>
/// <param name="lockerChamber">The LockerChamber.</param>
/// <returns>EXILED Chamber.</returns>
public static implicit operator Chamber(LockerChamber lockerChamber) => Get(lockerChamber);

/// <summary>
/// Adds an item to the current chamber.
/// </summary>
Expand Down
9 changes: 8 additions & 1 deletion EXILED/Exiled.API/Features/Lockers/Locker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Quaternion Rotation
/// </summary>
public ushort OpenedChambers
{
get => Base.OpenedChambers;
get => Base.NetworkOpenedChambers;
set => Base.NetworkOpenedChambers = value;
}

Expand All @@ -148,6 +148,13 @@ public Vector3 RandomChamberPosition
}
}

/// <summary>
/// Converts BaseLocker to Locker.
/// </summary>
/// <param name="baseLocker">The BaseLocker.</param>
/// <returns>EXILED Locker.</returns>
public static implicit operator Locker?(BaseLocker baseLocker) => Get(baseLocker);

/// <summary>
/// Gets the <see cref="Locker"/> belonging to the <see cref="BaseLocker"/>, if any.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Pickups/Pickup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,13 @@ public Quaternion Rotation
/// </summary>
public bool IsSpawned => NetworkServer.spawned.ContainsValue(Base.netIdentity);

/// <summary>
/// Converts ItemPickupBase to Pickup.
/// </summary>
/// <param name="itemPickupBase">The ItemPickupBase.</param>
/// <returns>EXILED Pickup.</returns>
public static implicit operator Pickup(ItemPickupBase itemPickupBase) => Get(itemPickupBase);

/// <summary>
/// Gets an existing <see cref="Pickup"/> or creates a new instance of one.
/// </summary>
Expand Down
15 changes: 11 additions & 4 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,17 +1312,24 @@ public bool IsSpawnProtected
protected HealthStat CustomHealthStat { get; set; }

/// <summary>
/// Converts LabApi player to EXILED player.
/// Converts ReferenceHub to Player.
/// </summary>
/// <param name="player">The LabApi player.</param>
/// <param name="hub">The ReferenceHub.</param>
/// <returns>EXILED player.</returns>
public static implicit operator Player(LabApi.Features.Wrappers.Player player) => Get(player);
public static implicit operator Player(ReferenceHub hub) => Get(hub);

/// <summary>
/// Converts LabApi player to EXILED player.
/// </summary>
/// <param name="player">The LabApi player.</param>
/// <returns>EXILED player.</returns>
public static implicit operator Player(LabApi.Features.Wrappers.Player player) => Get(player);

/// <summary>
/// Converts EXILED player to LabApi player.
/// </summary>
/// <param name="player">The EXILED player.</param>
/// <returns>LabApi player.</returns>
public static implicit operator LabApi.Features.Wrappers.Player(Player player) => LabApi.Features.Wrappers.Player.Get(player?.ReferenceHub);

/// <summary>
Expand Down Expand Up @@ -1518,7 +1525,7 @@ public static Player Get(string args)
/// </summary>
/// <param name="apiPlayer">The <see cref="LabApi.Features.Wrappers.Player"/> class.</param>
/// <returns>A <see cref="Player"/> or <see langword="null"/> if not found.</returns>
public static Player Get(LabApi.Features.Wrappers.Player apiPlayer) => Get(apiPlayer.ReferenceHub);
public static Player Get(LabApi.Features.Wrappers.Player apiPlayer) => Get(apiPlayer?.ReferenceHub);

/// <summary>
/// Try-get a player given a <see cref="CommandSystem.ICommandSender"/>.
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Ragdoll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ public Vector3 RagdollScale
/// </summary>
internal static HashSet<BasicRagdoll> IgnoredRagdolls { get; set; } = new();

/// <summary>
/// Converts BasicRagdoll to Ragdoll.
/// </summary>
/// <param name="basicRagdoll">The BasicRagdoll.</param>
/// <returns>EXILED Ragdoll.</returns>
public static implicit operator Ragdoll(BasicRagdoll basicRagdoll) => Get(basicRagdoll);

/// <summary>
/// Gets the last ragdoll of the player.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ public bool AreLightsOff
/// </summary>
internal List<Room> NearestRoomsValue { get; } = new();

/// <summary>
/// Converts RoomIdentifier to Room.
/// </summary>
/// <param name="roomIdentifier">The RoomIdentifier.</param>
/// <returns>EXILED Room.</returns>
public static implicit operator Room(RoomIdentifier roomIdentifier) => Get(roomIdentifier);

/// <summary>
/// Gets a <see cref="Room"/> given the specified <see cref="RoomType"/>.
/// </summary>
Expand Down
15 changes: 11 additions & 4 deletions EXILED/Exiled.API/Features/Scp559.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static Vector3 PedestalOffset
/// </summary>
public byte RemainingSlices
{
get => Base._remainingSlices;
get => Base.Network_remainingSlices;
set => Base.Network_remainingSlices = value;
}

Expand All @@ -99,7 +99,7 @@ public byte RemainingSlices
/// </summary>
public bool IsSpawned
{
get => Base._isSpawned;
get => Base.Network_isSpawned;
set => Base.Network_isSpawned = value;
}

Expand All @@ -124,16 +124,23 @@ public float RespawnTime
/// <inheritdoc/>
public Vector3 Position
{
get => Base._position;
get => Base.Network_position;
set => Base.Network_position = value;
}

/// <summary>
/// Converts Scp559Cake to Scp559.
/// </summary>
/// <param name="scp559Cake">The Scp559Cake.</param>
/// <returns>EXILED Scp559.</returns>
public static implicit operator Scp559(Scp559Cake scp559Cake) => Get(scp559Cake);

/// <summary>
/// Gets the <see cref="Scp559"/> by it's game instance.
/// </summary>
/// <param name="cake">Game instance.</param>
/// <returns><see cref="Scp559"/>.</returns>
public static Scp559 Get(Scp559Cake cake) => CakeToWrapper.TryGetValue(cake, out Scp559 scp559) ? scp559 : new Scp559(cake);
public static Scp559 Get(Scp559Cake cake) => cake == null ? null : CakeToWrapper.TryGetValue(cake, out Scp559 scp559) ? scp559 : new Scp559(cake);

/// <summary>
/// Gets the <see cref="IEnumerable{T}"/> of SCP-559 which matches the predicate.
Expand Down
9 changes: 8 additions & 1 deletion EXILED/Exiled.API/Features/TeslaGate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,19 @@ public bool UseInstantBurst
/// </summary>
public IEnumerable<Player> PlayersInTriggerRange => Player.List.Where(IsPlayerInTriggerRange);

/// <summary>
/// Converts BaseTeslaGate to TeslaGate.
/// </summary>
/// <param name="baseTeslaGate">The BaseTeslaGate.</param>
/// <returns>EXILED TeslaGate.</returns>
public static implicit operator TeslaGate(BaseTeslaGate baseTeslaGate) => Get(baseTeslaGate);

/// <summary>
/// Gets the <see cref="TeslaGate"/> belonging to the <see cref="BaseTeslaGate"/>.
/// </summary>
/// <param name="baseTeslaGate">The <see cref="BaseTeslaGate"/> instance.</param>
/// <returns>The corresponding <see cref="TeslaGate"/> instance.</returns>
public static TeslaGate Get(BaseTeslaGate baseTeslaGate) => BaseTeslaGateToTeslaGate.TryGetValue(baseTeslaGate, out TeslaGate teslagate) ?
public static TeslaGate Get(BaseTeslaGate baseTeslaGate) => baseTeslaGate == null ? null : BaseTeslaGateToTeslaGate.TryGetValue(baseTeslaGate, out TeslaGate teslagate) ?
teslagate :
new(baseTeslaGate, Room.FindParentRoom(baseTeslaGate.gameObject));

Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Toys/AdminToy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ public bool IsStatic
set => AdminToyBase.NetworkIsStatic = value;
}

/// <summary>
/// Converts AdminToyBase to AdminToy.
/// </summary>
/// <param name="adminToyBase">The AdminToyBase.</param>
/// <returns>EXILED AdminToy.</returns>
public static implicit operator AdminToy(AdminToyBase adminToyBase) => Get(adminToyBase);

/// <summary>
/// Gets the <see cref="AdminToy"/> belonging to the <see cref="AdminToys.AdminToyBase"/>.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Toys/CameraToy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ public string Name
set => Base.NetworkLabel = value;
}

/// <summary>
/// Converts Scp079CameraToy to CameraToy.
/// </summary>
/// <param name="scp079CameraToy">The Scp079CameraToy.</param>
/// <returns>EXILED CameraToy.</returns>
public static implicit operator CameraToy(Scp079CameraToy scp079CameraToy) => (CameraToy)Get(scp079CameraToy);

/// <summary>
/// Creates a new <see cref="CameraToy"/> with a specified type.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Toys/Capybara.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public bool Collidable
set => Base.NetworkCollisionsEnabled = value;
}

/// <summary>
/// Converts CapybaraToy to Capybara.
/// </summary>
/// <param name="capybaraToy">The CapybaraToy.</param>
/// <returns>EXILED Capybara.</returns>
public static implicit operator Capybara(CapybaraToy capybaraToy) => (Capybara)Get(capybaraToy);

/// <summary>
/// Creates a new <see cref="Capybara"/> at the specified position.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Toys/InteractableToy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ public bool IsLocked
set => Base.NetworkIsLocked = value;
}

/// <summary>
/// Converts InvisibleInteractableToy to InteractableToy.
/// </summary>
/// <param name="invisibleInteractableToy">The InvisibleInteractableToy.</param>
/// <returns>EXILED InteractableToy.</returns>
public static implicit operator InteractableToy(InvisibleInteractableToy invisibleInteractableToy) => (InteractableToy)Get(invisibleInteractableToy);

/// <summary>
/// Creates a new <see cref="InteractableToy"/>.
/// </summary>
Expand Down
Loading
Loading