From cd6483a665a3e27c4659caec318a440729305bfc Mon Sep 17 00:00:00 2001 From: rhailrake <49613070+rhailrake@users.noreply.github.com> Date: Thu, 27 Apr 2023 06:04:21 +0600 Subject: [PATCH] [feat? i dunno] SetGlobalZoomCommand --- .../White/Commands/SetGlobalZoomCommand.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Content.Server/White/Commands/SetGlobalZoomCommand.cs diff --git a/Content.Server/White/Commands/SetGlobalZoomCommand.cs b/Content.Server/White/Commands/SetGlobalZoomCommand.cs new file mode 100644 index 0000000000..a513391905 --- /dev/null +++ b/Content.Server/White/Commands/SetGlobalZoomCommand.cs @@ -0,0 +1,38 @@ +using System.Linq; +using Content.Server.Administration; +using Content.Shared.Administration; +using Robust.Shared.Console; + +namespace Content.Client.Commands; + +[AdminCommand(AdminFlags.Debug)] +public sealed class SetGlobalZoomCommand : IConsoleCommand +{ + public string Command => "setglobalzoom"; + public string Description => "Sets the global zoom for all characters."; + public string Help => "setglobalzoom "; + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + if(args.Length != 1) + { + shell.WriteLine("Invalid number of arguments."); + return; + } + + if (!float.TryParse(args[0], out var zoom)) + { + shell.WriteLine("Invalid zoom value."); + return; + } + + var entityManager = IoCManager.Resolve(); + var eyes = entityManager.GetAllComponents(typeof(SharedEyeComponent), true).Cast().ToList(); + + foreach (var eye in eyes) + { + eye.Zoom = new Vector2(zoom, zoom); + entityManager.Dirty(eye); + } + + } +}