mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Color.TryFromHex returns a bool and outputs a color (#44581)
This commit is contained in:
parent
b57772c3ad
commit
2ab5af4052
2 changed files with 5 additions and 7 deletions
|
|
@ -28,8 +28,7 @@ namespace Content.Server.Administration.Commands
|
|||
if (string.IsNullOrEmpty(colorArg))
|
||||
return;
|
||||
|
||||
var color = Color.TryFromHex(colorArg);
|
||||
if (!color.HasValue)
|
||||
if (!Color.TryFromHex(colorArg, out var color))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-invalid-color-hex"));
|
||||
return;
|
||||
|
|
@ -37,10 +36,10 @@ namespace Content.Server.Administration.Commands
|
|||
|
||||
var userId = shell.Player.UserId;
|
||||
// Save the DB
|
||||
_dbManager.SaveAdminOOCColorAsync(userId, color.Value);
|
||||
_dbManager.SaveAdminOOCColorAsync(userId, color);
|
||||
// Update the cached preference
|
||||
var prefs = _preferenceManager.GetPreferences(userId);
|
||||
prefs.AdminOOCColor = color.Value;
|
||||
prefs.AdminOOCColor = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,14 +56,13 @@ namespace Content.Server.Sandbox.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
var color = Color.TryFromHex(args[2]);
|
||||
if (!color.HasValue)
|
||||
if (!Color.TryFromHex(args[2], out var color))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("shell-invalid-color-hex"));
|
||||
return;
|
||||
}
|
||||
|
||||
PaintNodes(nodeContainerComponent, nodeGroupId, color.Value);
|
||||
PaintNodes(nodeContainerComponent, nodeGroupId, color);
|
||||
}
|
||||
|
||||
private void PaintNodes(NodeContainerComponent nodeContainerComponent, NodeGroupID nodeGroupId, Color color)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue