Skip to content

Commit 51f83c9

Browse files
add HasRemoteAdminAccess player property
1 parent 6889670 commit 51f83c9

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Code/ValueSystem/PlayerValue.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public enum PlayerProperty
5858
Team,
5959
Inventory,
6060
ItemCount,
61+
HeldItem,
6162
HeldItemRef,
6263
IsAlive,
6364
UserId,
@@ -112,7 +113,8 @@ public enum PlayerProperty
112113
UnitId,
113114
Unit,
114115
CRole,
115-
IsTransmitting
116+
IsTransmitting,
117+
HasRemoteAdminAccess
116118
}
117119

118120
private class Info<T>(Func<Player, T> handler, string? description)
@@ -131,6 +133,7 @@ private class Info<T>(Func<Player, T> handler, string? description)
131133
[PlayerProperty.Team] = new Info<EnumValue<Team>>(plr => plr.Team.ToEnumValue(), null),
132134
[PlayerProperty.Inventory] = new Info<CollectionValue<Item>>(plr => new(plr.Inventory.UserInventory.Items.Values.Select(Item.Get).RemoveNulls()), $"A collection of references to {nameof(Item)} objects"),
133135
[PlayerProperty.ItemCount] = new Info<NumberValue>(plr => (decimal)plr.Inventory.UserInventory.Items.Count, null),
136+
[PlayerProperty.HeldItem] = new Info<EnumValue<ItemType>>(plr => plr.CurrentItem?.Type ?? ItemType.None, null),
134137
[PlayerProperty.HeldItemRef] = new Info<ReferenceValue<Item>>(plr => new(plr.CurrentItem), "A reference to the item the player is holding"),
135138
[PlayerProperty.IsAlive] = new Info<BoolValue>(plr => plr.IsAlive, null),
136139
[PlayerProperty.UserId] = new Info<StaticTextValue>(plr => plr.UserId, "The ID of the account (like SteamID64)"),
@@ -224,12 +227,13 @@ private class Info<T>(Func<Player, T> handler, string? description)
224227
[PlayerProperty.IsGrounded] = new Info<BoolValue>(plr => plr.ReferenceHub.IsGrounded(), null),
225228
[PlayerProperty.Stamina] = new Info<NumberValue>(plr => (decimal)plr.StaminaRemaining, "Returns the player's remaining stamina."),
226229
[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."),
227-
[PlayerProperty.RoleColor] = new Info<ColorValue>(plr => plr.RoleBase.RoleColor, "Returns the hex value of the player's role color."),
230+
[PlayerProperty.RoleColor] = new Info<ColorValue>(plr => plr.RoleBase.RoleColor, "Returns a color value of the player's role color."),
228231
[PlayerProperty.LifeId] = new Info<NumberValue>(plr => plr.LifeId, null),
229232
[PlayerProperty.UnitId] = new Info<NumberValue>(plr => (decimal)plr.UnitId, null),
230233
[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."),
231-
[PlayerProperty.CRole] = new Info<ReferenceValue<CRole>>(plr => CRole.AssignedRoles.TryGetValue(plr, out var role) ? role : null, "Returns the player's CRole if player is a CRole, otherwise returns an empty reference value."),
232-
[PlayerProperty.IsTransmitting] = new Info<BoolValue>(plr => PersonalRadioPlayback.IsTransmitting(plr.ReferenceHub), "Returns true if player is speaking through a radio, otherwise false.")
234+
[PlayerProperty.CRole] = new Info<ReferenceValue<CRole>>(plr => CRole.LifeIdAssignedRoles.TryGetValue(plr.LifeId, out var role) ? role : null, "Returns the player's CRole if player is a CRole, otherwise returns an empty reference value."),
235+
[PlayerProperty.IsTransmitting] = new Info<BoolValue>(plr => PersonalRadioPlayback.IsTransmitting(plr.ReferenceHub), "Returns true if player is speaking through a radio, otherwise false."),
236+
[PlayerProperty.HasRemoteAdminAccess] = new Info<BoolValue>(plr => plr.RemoteAdminAccess, null)
233237
};
234238

235239
public override TryGet<object> ToCSharpObject(Type targetType)

0 commit comments

Comments
 (0)