Skip to content

Commit ef84925

Browse files
committed
HasUnlimitedStamina toggle
1 parent 9847da7 commit ef84925

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

LabExtended/API/Containers/SwitchContainer.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using LabExtended.Extensions;
77

88
using YamlDotNet.Serialization;
9+
using LabExtended.Events.Player;
10+
using LabExtended.Events;
911

1012
namespace LabExtended.API.Containers;
1113

@@ -332,6 +334,11 @@ public static SwitchContainer GetNewNpcToggles(bool useConfigValues = true)
332334
/// </summary>
333335
public bool HasUnlimitedAmmo { get; set; }
334336

337+
/// <summary>
338+
/// Gets or sets a value indicating whether or not the player should use stamina.
339+
/// </summary>
340+
public bool HasUnlimitedStamina { get; set; }
341+
335342
/// <summary>
336343
/// Whether or not players with instant kill should also be able to kill players with god mode.
337344
/// </summary>
@@ -428,6 +435,7 @@ public void Copy(SwitchContainer other)
428435

429436
HasInstantKill = other.HasInstantKill;
430437
HasUnlimitedAmmo = other.HasUnlimitedAmmo;
438+
HasUnlimitedStamina = other.HasUnlimitedStamina;
431439

432440
InstantKillIgnoresGodMode = other.InstantKillIgnoresGodMode;
433441

@@ -468,11 +476,19 @@ private static void Internal_PickingUpScp330(PlayerPickingUpScp330EventArgs args
468476
}
469477
}
470478

479+
private static void Internal_RefreshingModifiers(PlayerRefreshingModifiersEventArgs args)
480+
{
481+
if (args.Player.Toggles.HasUnlimitedStamina)
482+
args.StaminaUsageMultiplier = 0f;
483+
}
484+
471485
internal static void Internal_Init()
472486
{
473487
PlayerEvents.PickingUpAmmo += Internal_PickingUpAmmo;
474488
PlayerEvents.PickingUpItem += Internal_PickingUpItem;
475489
PlayerEvents.PickingUpArmor += Internal_PickingUpArmor;
476490
PlayerEvents.PickingUpScp330 += Internal_PickingUpScp330;
491+
492+
ExPlayerEvents.RefreshingModifiers += Internal_RefreshingModifiers;
477493
}
478494
}

0 commit comments

Comments
 (0)