Skip to content

Commit 0292a8b

Browse files
make roleColor property return ColorValue
1 parent 29bd99d commit 0292a8b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Code/ValueSystem/ColorValue.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ private class Prop<T>(Func<ColorValue, T> handler, string? description)
2626
["a"] = new Prop<NumberValue>(c => (decimal)c.Value.a, "Alpha component of the color (0-1)"),
2727
["hex"] = new Prop<StaticTextValue>(c => c.Value.ToHex(), "Hexadecimal representation of the color")
2828
};
29+
30+
public static implicit operator ColorValue(Color color) => new(color);
2931
}

Code/ValueSystem/PlayerValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ private class Info<T>(Func<Player, T> handler, string? description)
221221
[PlayerProperty.IsGrounded] = new Info<BoolValue>(plr => plr.ReferenceHub.IsGrounded(), null),
222222
[PlayerProperty.Stamina] = new Info<NumberValue>(plr => (decimal)plr.StaminaRemaining, "Returns the player's remaining stamina."),
223223
[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."),
224+
[PlayerProperty.RoleColor] = new Info<ColorValue>(plr => plr.RoleBase.RoleColor, "Returns the hex value of the player's role color."),
225225
[PlayerProperty.LifeId] = new Info<NumberValue>(plr => plr.LifeId, null),
226226
[PlayerProperty.UnitId] = new Info<NumberValue>(plr => (decimal)plr.UnitId, null),
227227
[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."),

0 commit comments

Comments
 (0)