From a6afd7d53e28760b8125da7c9b5a4b319e11a896 Mon Sep 17 00:00:00 2001
From: Kashargul <144968721+Kashargul@users.noreply.github.com>
Date: Fri, 6 Sep 2024 14:55:28 +0200
Subject: [PATCH] Adds config Input to the colorMatrix
---
code/datums/colormate.dm | 10 +
code/game/machinery/painter_vr.dm | 10 +
.../interfaces/ColorMate/ColorMateMatrix.tsx | 466 +++++++++---------
3 files changed, 264 insertions(+), 222 deletions(-)
diff --git a/code/datums/colormate.dm b/code/datums/colormate.dm
index 2149191543f..06460069a07 100644
--- a/code/datums/colormate.dm
+++ b/code/datums/colormate.dm
@@ -108,6 +108,16 @@
if("set_matrix_color")
color_matrix_last[params["color"]] = params["value"]
return TRUE
+ if("set_matrix_string")
+ if(params["value"])
+ var/list/colours = splittext(params["value"], ",")
+ if(colours.len > 12)
+ colours.Cut(13)
+ for(var/i = 1, i <= colours.len, i++)
+ var/number = text2num(colours[i])
+ if(isnum(number))
+ color_matrix_last[i] = clamp(number, -10, 10)
+ return TRUE
if("set_hue")
build_hue = clamp(text2num(params["buildhue"]), 0, 360)
return TRUE
diff --git a/code/game/machinery/painter_vr.dm b/code/game/machinery/painter_vr.dm
index 53614b2f904..c34eeb8f97c 100644
--- a/code/game/machinery/painter_vr.dm
+++ b/code/game/machinery/painter_vr.dm
@@ -189,6 +189,16 @@
if("set_matrix_color")
color_matrix_last[params["color"]] = params["value"]
return TRUE
+ if("set_matrix_string")
+ if(params["value"])
+ var/list/colours = splittext(params["value"], ",")
+ if(colours.len > 12)
+ colours.Cut(13)
+ for(var/i = 1, i <= colours.len, i++)
+ var/number = text2num(colours[i])
+ if(isnum(number))
+ color_matrix_last[i] = clamp(number, -10, 10)
+ return TRUE
if("set_hue")
build_hue = clamp(text2num(params["buildhue"]), 0, 360)
return TRUE
diff --git a/tgui/packages/tgui/interfaces/ColorMate/ColorMateMatrix.tsx b/tgui/packages/tgui/interfaces/ColorMate/ColorMateMatrix.tsx
index dc6be8c92a8..903d4c4a025 100644
--- a/tgui/packages/tgui/interfaces/ColorMate/ColorMateMatrix.tsx
+++ b/tgui/packages/tgui/interfaces/ColorMate/ColorMateMatrix.tsx
@@ -1,7 +1,14 @@
import { toFixed } from 'common/math';
import { useBackend } from '../../backend';
-import { Icon, NumberInput, Table } from '../../components';
+import {
+ Box,
+ Icon,
+ Input,
+ LabeledList,
+ NumberInput,
+ Table,
+} from '../../components';
import { Data } from './types';
export const ColorMateMatrix = (props) => {
@@ -10,226 +17,241 @@ export const ColorMateMatrix = (props) => {
const { matrixcolors } = data;
return (
-
-
-
- RR:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 1,
- value,
- })
- }
- />
-
-
- GR:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 4,
- value,
- })
- }
- />
-
-
- BR:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 7,
- value,
- })
- }
- />
-
-
-
-
- RG:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 2,
- value,
- })
- }
- />
-
-
- GG:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 5,
- value,
- })
- }
- />
-
-
- BG:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 8,
- value,
- })
- }
- />
-
-
-
-
- RB:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 3,
- value,
- })
- }
- />
-
-
- GB:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 6,
- value,
- })
- }
- />
-
-
- BB:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 9,
- value,
- })
- }
- />
-
-
-
-
- CR:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 10,
- value,
- })
- }
- />
-
-
- CG:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 11,
- value,
- })
- }
- />
-
-
- CB:
- toFixed(value, 2)}
- onChange={(value: number) =>
- act('set_matrix_color', {
- color: 12,
- value,
- })
- }
- />
-
-
-
- RG means red will become
- this much green.
-
- CR means this much red will
- be added.
-
-
+ <>
+
+
+
+ RR:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 1,
+ value,
+ })
+ }
+ />
+
+
+ GR:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 4,
+ value,
+ })
+ }
+ />
+
+
+ BR:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 7,
+ value,
+ })
+ }
+ />
+
+
+
+
+ RG:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 2,
+ value,
+ })
+ }
+ />
+
+
+ GG:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 5,
+ value,
+ })
+ }
+ />
+
+
+ BG:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 8,
+ value,
+ })
+ }
+ />
+
+
+
+
+ RB:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 3,
+ value,
+ })
+ }
+ />
+
+
+ GB:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 6,
+ value,
+ })
+ }
+ />
+
+
+ BB:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 9,
+ value,
+ })
+ }
+ />
+
+
+
+
+ CR:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 10,
+ value,
+ })
+ }
+ />
+
+
+ CG:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 11,
+ value,
+ })
+ }
+ />
+
+
+ CB:
+ toFixed(value, 2)}
+ onChange={(value: number) =>
+ act('set_matrix_color', {
+ color: 12,
+ value,
+ })
+ }
+ />
+
+
+
+ RG means red will become
+ this much green.
+
+ CR means this much red
+ will be added.
+
+
+
+
+
+
+ act('set_matrix_string', { value })
+ }
+ />
+
+
+
+ >
);
};