Skip to content

Commit 29bd99d

Browse files
reimplement RetroReuls lost player properties
1 parent 68b862c commit 29bd99d

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

Code/ValueSystem/PlayerValue.cs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
using JetBrains.Annotations;
33
using LabApi.Features.Wrappers;
44
using PlayerRoles;
5+
using PlayerRoles.FirstPersonControl;
56
using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers;
67
using PlayerRoles.PlayableScps.Scp079;
8+
using Respawning.NamingRules;
79
using SER.Code.Exceptions;
810
using SER.Code.Extensions;
911
using SER.Code.ValueSystem.PropertySystem;
@@ -97,7 +99,17 @@ public enum PlayerProperty
9799
RelativeY,
98100
RelativeZ,
99101
IsNpc,
100-
IsDummy
102+
IsDummy,
103+
IsSpeaking,
104+
IsSpectatable,
105+
IsJumping,
106+
IsGrounded,
107+
Stamina,
108+
MovementState,
109+
RoleColor,
110+
LifeId,
111+
UnitId,
112+
Unit,
101113
}
102114

103115
private class Info<T>(Func<Player, T> handler, string? description)
@@ -202,6 +214,16 @@ private class Info<T>(Func<Player, T> handler, string? description)
202214
[PlayerProperty.RelativeY] = new Info<NumberValue>(plr => (decimal)plr.RelativeRoomPosition().y, "Returns the player's y relative to the current room or 0 if in no room"),
203215
[PlayerProperty.RelativeZ] = new Info<NumberValue>(plr => (decimal)plr.RelativeRoomPosition().z, "Returns the player's z relative to the current room or 0 if in no room"),
204216
[PlayerProperty.IsNpc] = new Info<BoolValue>(plr => plr.IsNpc, "True if it's a player without any client connected to it"),
205-
[PlayerProperty.IsDummy] = new Info<BoolValue>(plr => plr.IsDummy, null)
217+
[PlayerProperty.IsDummy] = new Info<BoolValue>(plr => plr.IsDummy, null),
218+
[PlayerProperty.IsSpeaking] = new Info<BoolValue>(plr => plr.IsSpeaking, null),
219+
[PlayerProperty.IsSpectatable] = new Info<BoolValue>(plr => plr.IsSpectatable, null),
220+
[PlayerProperty.IsJumping] = new Info<BoolValue>(plr => plr.RoleBase is IFpcRole currentRole && currentRole.FpcModule.Motor.JumpController.IsJumping, null),
221+
[PlayerProperty.IsGrounded] = new Info<BoolValue>(plr => plr.ReferenceHub.IsGrounded(), null),
222+
[PlayerProperty.Stamina] = new Info<NumberValue>(plr => (decimal)plr.StaminaRemaining, "Returns the player's remaining stamina."),
223+
[PlayerProperty.MovementState] = new Info<TextValue>(plr => plr.RoleBase is IFpcRole currentRole ? currentRole.FpcModule.CurrentMovementState.ToString().ToStaticTextValue() : new("None"), "Returns the player's movement state or 'None' if the player is not a first-person role."),
224+
[PlayerProperty.RoleColor] = new Info<StaticTextValue>(plr => plr.RoleBase.RoleColor.ToHex().ToStaticTextValue(), "Returns the hex value of the player's role color."),
225+
[PlayerProperty.LifeId] = new Info<NumberValue>(plr => plr.LifeId, null),
226+
[PlayerProperty.UnitId] = new Info<NumberValue>(plr => (decimal)plr.UnitId, null),
227+
[PlayerProperty.Unit] = new Info<TextValue>(plr => NamingRulesManager.ClientFetchReceived(plr.Team, plr.UnitId).ToStaticTextValue(), "Returns the player's unit (e.g FOXTROT-03) if player is NTF or Facility Guard, otherwise returns an empty text value."),
206228
};
207229
}

0 commit comments

Comments
 (0)