Skip to content

Commit

Permalink
feat: Fetching Dev (#387)
Browse files Browse the repository at this point in the history
* feat: ``Lift::Get(ElevatorGroup)`` (#372)

Lift::Get(ElevatorGroup)

* fix: PlacingBulletHoleEventArgs::Position (#377)

Fix

* fix: DryFiring fired constantly (#378)

Fix DryFiring fired constantly

* feat: Unbanned event addition (#185)

* Option A

* Style cop happy

* Sigh stylecop

* For Yamato

* Done, not tested

* Stylecop

---------

Co-authored-by: Yamato <[email protected]>

* feat: Adding CustomKeycard for CustomItems (#98)

* uwu

* itemtype check

* bruh bruh brrr ☠

* fix

* fix

* fix no.2

* some events

* ExMod Team copyright

---------

Co-authored-by: Yamato <[email protected]>
Co-authored-by: Yamato <[email protected]>

* feat: ShadowType (#382)

More features for the Light wrapper

* fix: remove var & fix FF for explosions

* feat: DroppingAmmo, DroppedAmmo and InteractingDoor (#371)

* fix: DoorType and RoomType for Checkpoint (#379)

Fix DoorType and RoomType for Checkpoint

* feat: CustomStats (#363)

* CustomStats

* replace Mathf.Clamp01 by Mathf.Clamp

* Remove CustomStaminaStat.cs

---------

Co-authored-by: Yamato <[email protected]>

* fix: NPC Spawn using wrong SpawnType (#375)

Update Npc.cs

* fix: Fix FF for explosions (#383)

* fix: nre fix

* fix: respawningteam event fix

* fix: fix explosion ff

* feat: LockerType extension (#384)

* feat: LockerType extension

* fix: fix of fix

* fix: init fix for play gun sound

* Revert "fix: init fix for play gun sound"

This reverts commit f4d5541.

* feat: Fix OnInternalSpawning & Added ChargingJailbird setter (by BlackSerperior6) (#368)

BlackSerperior6

Co-authored-by: BlackSerperior6 <[email protected]>

* feat: `ExplodingGrenadeEventArgs::ExplosionType` (#385)

* ExplosionType

* ExplodingGrenadeEventArgs::ExplosionType

---------

Co-authored-by: Yamato <[email protected]>
Co-authored-by: scp252arc <[email protected]>
Co-authored-by: X <[email protected]>
Co-authored-by: Yamato <[email protected]>
Co-authored-by: Trevlouw <[email protected]>
Co-authored-by: Misfiy <[email protected]>
Co-authored-by: Cosmos Zvezdochkin <[email protected]>
Co-authored-by: Rysik5318 <[email protected]>
Co-authored-by: BlackSerperior6 <[email protected]>
  • Loading branch information
10 people authored Jan 10, 2025
1 parent ee03ca1 commit b728a97
Show file tree
Hide file tree
Showing 26 changed files with 550 additions and 60 deletions.
63 changes: 63 additions & 0 deletions EXILED/Exiled.API/Enums/LockerType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

namespace Exiled.API.Enums
{
using System;

/// <summary>
/// Unique identifier for different types of <see cref="Features.Lockers.Locker"/>s.
/// </summary>
Expand All @@ -15,6 +17,7 @@ public enum LockerType
/// <summary>
/// The pedestal used by SCP items.
/// </summary>
[Obsolete("This value is not used.")]
Pedestal,

/// <summary>
Expand Down Expand Up @@ -46,5 +49,65 @@ public enum LockerType
/// Unknow type of locker.
/// </summary>
Unknow,

/// <summary>
/// MircoHid pedestal.
/// </summary>
MicroHid,

/// <summary>
/// Experimental weapon locker.
/// </summary>
ExperimentalWeapon,

/// <summary>
/// SCP-500 pedestal.
/// </summary>
Scp500Pedestal,

/// <summary>
/// SCP-207? (Anti SCP-207) pedestal.
/// </summary>
AntiScp207Pedestal,

/// <summary>
/// SCP-207 pedestal.
/// </summary>
Scp207Pedestal,

/// <summary>
/// SCP-268 pedestal.
/// </summary>
Scp268Pedestal,

/// <summary>
/// SCP-1344 pedestal.
/// </summary>
Scp1344Pedestal,

/// <summary>
/// SCP-018 pedestal.
/// </summary>
Scp018Pedestal,

/// <summary>
/// SCP-1576 pedestal.
/// </summary>
Scp1576Pedestal,

/// <summary>
/// SCP-244 pedestal.
/// </summary>
Scp244Pedestal,

/// <summary>
/// SCP-2176 pedestal.
/// </summary>
Scp2176Pedestal,

/// <summary>
/// SCP-1853 pedestal.
/// </summary>
Scp1853Pedestal,
}
}
16 changes: 16 additions & 0 deletions EXILED/Exiled.API/Extensions/BitwiseExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,21 @@ public static T ModifyFlags<T>(this T flags, bool value, params T[] changeFlags)

return (T)Enum.ToObject(typeof(T), currentValue);
}

/// <summary>
/// Checks if flag has specified value.
/// </summary>
/// <param name="flag">Flag to check.</param>
/// <param name="value">Value to check in flag.</param>
/// <typeparam name="T">The type of the enum.</typeparam>
/// <returns><see langword="true"/> if value is presented in flag. Otherwise, <see langword="false"/>.</returns>
public static bool HasFlagFast<T>(this T flag, T value)
where T : Enum
{
long flagValue = Convert.ToInt64(flag);
long valueValue = Convert.ToInt64(value);

return (flagValue & valueValue) == valueValue;
}
}
}
15 changes: 13 additions & 2 deletions EXILED/Exiled.API/Extensions/LockerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,25 @@ public static class LockerExtensions
/// </summary>
/// <param name="name">The name to check.</param>
/// <returns>The corresponding <see cref="LockerType"/>.</returns>
public static LockerType GetLockerTypeByName(this string name) => name.Replace("(Clone)", string.Empty) switch
public static LockerType GetLockerTypeByName(this string name) => name.Split('(')[0].Trim() switch
{
"Scp500PedestalStructure Variant" => LockerType.Pedestal,
"Scp500PedestalStructure Variant" => LockerType.Scp500Pedestal,
"AntiScp207PedestalStructure Variant" => LockerType.AntiScp207Pedestal,
"Scp207PedestalStructure Variant" => LockerType.Scp207Pedestal,
"Experimental Weapon Locker" => LockerType.ExperimentalWeapon,
"Scp1344PedestalStructure Variant" => LockerType.Scp1344Pedestal,
"Scp1576PedestalStructure Variant" => LockerType.Scp1576Pedestal,
"Scp2176PedestalStructure Variant" => LockerType.Scp2176Pedestal,
"Scp1853PedestalStructure Variant" => LockerType.Scp1853Pedestal,
"Scp268PedestalStructure Variant" => LockerType.Scp268Pedestal,
"Scp244PedestalStructure Variant" => LockerType.Scp244Pedestal,
"Scp018PedestalStructure Variant" => LockerType.Scp018Pedestal,
"LargeGunLockerStructure" => LockerType.LargeGun,
"RifleRackStructure" => LockerType.RifleRack,
"MiscLocker" => LockerType.Misc,
"RegularMedkitStructure" => LockerType.Medkit,
"AdrenalineMedkitStructure" => LockerType.Adrenaline,
"MicroHIDpedestal" => LockerType.MicroHid,
_ => LockerType.Unknow,
};
}
Expand Down
1 change: 1 addition & 0 deletions EXILED/Exiled.API/Features/CustomHealthStat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Exiled.API.Features

/// <summary>
/// A custom version of <see cref="HealthStat"/> which allows the player's max amount of health to be changed.
/// TODO: Move to Features.CustomStats.
/// </summary>
public class CustomHealthStat : HealthStat
{
Expand Down
79 changes: 79 additions & 0 deletions EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// -----------------------------------------------------------------------
// <copyright file="CustomHumeShieldStat.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.API.Features.CustomStats
{
using Mirror;
using PlayerRoles.PlayableScps.HumeShield;
using PlayerStatsSystem;
using UnityEngine;
using Utils.Networking;

/// <summary>
/// A custom version of <see cref="HumeShieldStat"/> which allows the player's max amount of HumeShield to be changed.
/// </summary>
public class CustomHumeShieldStat : HumeShieldStat
{
/// <inheritdoc />
public override float MaxValue => CustomMaxValue == -1 ? base.MaxValue : CustomMaxValue;

/// <summary>
/// Gets or sets the multiplier for gaining HumeShield.
/// </summary>
public float ShieldRegenerationMultiplier { get; set; } = 1;

/// <summary>
/// Gets or sets the maximum amount of HumeShield the player can have.
/// </summary>
public float CustomMaxValue { get; set; } = -1;

private float ShieldRegeneration => TryGetHsModule(out HumeShieldModuleBase controller) ? controller.HsRegeneration * ShieldRegenerationMultiplier : 0;

/// <inheritdoc/>
public override void Update()
{
if (MaxValue == -1 && ShieldRegenerationMultiplier is 1)
{
base.Update();
return;
}

if (!NetworkServer.active)
return;

if (_valueDirty)
{
new SyncedStatMessages.StatMessage()
{
Stat = this,
SyncedValue = CurValue,
}.SendToHubsConditionally(CanReceive);
_lastSent = CurValue;
_valueDirty = false;
}

if (ShieldRegeneration == 0)
return;

float delta = ShieldRegeneration * Time.deltaTime;

if (delta > 0)
{
if (CurValue >= MaxValue)
return;

CurValue = Mathf.MoveTowards(CurValue, MaxValue, delta);
return;
}

if (CurValue <= 0)
return;

CurValue += delta;
}
}
}
8 changes: 7 additions & 1 deletion EXILED/Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,13 @@ private DoorType GetDoorType()
// Doors contains the DoorNameTagExtension component
"CHECKPOINT_LCZ_A" => DoorType.CheckpointLczA,
"CHECKPOINT_LCZ_B" => DoorType.CheckpointLczB,
"CHECKPOINT_EZ_HCZ_A" => DoorType.CheckpointEzHczA,

// TODO: Remove when it's fix https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/782
"CHECKPOINT_EZ_HCZ_A" => Room?.Type switch
{
RoomType.HczEzCheckpointA => DoorType.CheckpointEzHczA,
_ => DoorType.CheckpointEzHczB,
},
"CHECKPOINT_EZ_HCZ_B" => DoorType.CheckpointEzHczB,
"106_PRIMARY" => DoorType.Scp106Primary,
"106_SECONDARY" => DoorType.Scp106Secondary,
Expand Down
7 changes: 7 additions & 0 deletions EXILED/Exiled.API/Features/Lift.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ public float AnimationTime
/// <returns>A <see cref="Lift"/> or <see langword="null"/> if not found.</returns>
public static Lift Get(ElevatorType type) => Get(lift => lift.Type == type).FirstOrDefault();

/// <summary>
/// Gets the <see cref="Lift"/> corresponding to the specified <see cref="ElevatorGroup"/>, if any.
/// </summary>
/// <param name="type">The <see cref="ElevatorGroup"/>.</param>
/// <returns>A <see cref="Lift"/> or <see langword="null"/> if not found.</returns>
public static Lift Get(ElevatorGroup type) => Get(lift => lift.Group == type).FirstOrDefault();

/// <summary>
/// Gets the <see cref="Lift"/> corresponding to the specified name, if any.
/// </summary>
Expand Down
11 changes: 9 additions & 2 deletions EXILED/Exiled.API/Features/Lockers/Locker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public Vector3 RandomChamberPosition
Chamber randomChamber = Chambers.GetRandomValue();

// Determine if the chamber uses multiple spawn points and has at least one available spawn point.
if (randomChamber.UseMultipleSpawnpoints && randomChamber.Spawnpoints.Count() > 0)
if (randomChamber.UseMultipleSpawnpoints && randomChamber.Spawnpoints.Any())
{
// Return the position of a random spawn point within the chamber.
return randomChamber.Spawnpoints.GetRandomValue().position;
Expand All @@ -136,11 +136,18 @@ public Vector3 RandomChamberPosition
/// <returns>The <see cref="Locker"/> with the given <see cref="ZoneType"/> or <see langword="null"/> if not found.</returns>
public static IEnumerable<Locker> Get(ZoneType zoneType) => Get(room => room.Zone.HasFlag(zoneType));

/// <summary>
/// Gets an <see cref="IEnumerable{T}"/> of <see cref="Locker"/> given the specified <see cref="LockerType"/>.
/// </summary>
/// <param name="lockerType">The <see cref="LockerType"/> to search for.</param>
/// <returns>An <see cref="IEnumerable{T}"/> of <see cref="Locker"/> which contains elements that satisfy the condition.</returns>
public static IEnumerable<Locker> Get(LockerType lockerType) => Get(x => x.Type == lockerType);

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of <see cref="Locker"/> filtered based on a predicate.
/// </summary>
/// <param name="predicate">The condition to satify.</param>
/// <returns>A <see cref="IEnumerable{T}"/> of <see cref="Locker"/> which contains elements that satify the condition.</returns>
/// <returns>A <see cref="IEnumerable{T}"/> of <see cref="Locker"/> which contains elements that satisfy the condition.</returns>
public static IEnumerable<Locker> Get(Func<Locker, bool> predicate) => List.Where(predicate);

/// <summary>
Expand Down
24 changes: 23 additions & 1 deletion EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Exiled.API.Features
using DamageHandlers;
using Enums;
using Exiled.API.Features.Core.Interfaces;
using Exiled.API.Features.CustomStats;
using Exiled.API.Features.Doors;
using Exiled.API.Features.Hazards;
using Exiled.API.Features.Items;
Expand Down Expand Up @@ -96,6 +97,7 @@ public class Player : TypeCastObject<Player>, IEntity, IWorldSpace

private ReferenceHub referenceHub;
private CustomHealthStat healthStat;
private CustomHumeShieldStat humeShieldStat;
private Role role;

/// <summary>
Expand Down Expand Up @@ -177,6 +179,7 @@ private set
CameraTransform = value.PlayerCameraReference;

value.playerStats._dictionarizedTypes[typeof(HealthStat)] = value.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HealthStat))] = healthStat = new CustomHealthStat { Hub = value };
value.playerStats._dictionarizedTypes[typeof(HumeShieldStat)] = value.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HumeShieldStat))] = humeShieldStat = new CustomHumeShieldStat { Hub = value };
}
}

Expand Down Expand Up @@ -930,15 +933,34 @@ public float HumeShield
set => HumeShieldStat.CurValue = value;
}

/// <summary>
/// Gets or sets the players maximum Hume Shield.
/// </summary>
public float MaxHumeShield
{
get => humeShieldStat.MaxValue;
set => humeShieldStat.CustomMaxValue = value;
}

/// <summary>
/// Gets or sets the players multiplier for gaining HumeShield.
/// </summary>
public float HumeShieldRegenerationMultiplier
{
get => humeShieldStat.ShieldRegenerationMultiplier;
set => humeShieldStat.ShieldRegenerationMultiplier = value;
}

/// <summary>
/// Gets a <see cref="IEnumerable{T}"/> of all active Artificial Health processes on the player.
/// </summary>
public IEnumerable<AhpStat.AhpProcess> ActiveArtificialHealthProcesses => ReferenceHub.playerStats.GetModule<AhpStat>()._activeProcesses;

/// <summary>
/// Gets the player's <see cref="PlayerStatsSystem.HumeShieldStat"/>.
/// TODO: Change to <see cref="CustomHumeShieldStat"/>.
/// </summary>
public HumeShieldStat HumeShieldStat => ReferenceHub.playerStats.GetModule<HumeShieldStat>();
public HumeShieldStat HumeShieldStat => humeShieldStat;

/// <summary>
/// Gets or sets the item in the player's hand. Value will be <see langword="null"/> if the player is not holding anything.
Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.API/Features/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,12 @@ private static RoomType FindType(GameObject gameObject)
"EZ_Shelter" => RoomType.EzShelter,
"EZ_HCZ_Checkpoint Part" => gameObject.transform.position.z switch
{
> 80 => RoomType.EzCheckpointHallwayA,
> 95 => RoomType.EzCheckpointHallwayA,
_ => RoomType.EzCheckpointHallwayB,
},
"HCZ_EZ_Checkpoint Part" => gameObject.transform.position.z switch
{
> 80 => RoomType.HczEzCheckpointA,
> 95 => RoomType.HczEzCheckpointA,
_ => RoomType.HczEzCheckpointB
},
_ => RoomType.Unknown,
Expand Down
9 changes: 9 additions & 0 deletions EXILED/Exiled.API/Features/Toys/Light.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ public LightType LightType
set => Base.NetworkLightType = value;
}

/// <summary>
/// Gets or sets the type of shadows the light casts.
/// </summary>
public LightShadows ShadowType
{
get => Base.NetworkShadowType;
set => Base.NetworkShadowType = value;
}

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

0 comments on commit b728a97

Please sign in to comment.