forked from Exiled-Official/EXILED
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
ee03ca1
commit b728a97
Showing
26 changed files
with
550 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.