diff --git a/code/__HELPERS/matrices.dm b/code/__HELPERS/matrices.dm
index af8efd425d..59fbb4ffc0 100644
--- a/code/__HELPERS/matrices.dm
+++ b/code/__HELPERS/matrices.dm
@@ -177,3 +177,9 @@ round(cos_inv_third+sqrt3_sin, 0.001), round(cos_inv_third-sqrt3_sin, 0.001), ro
for(x in 1 to 4)
output[offset+x] = round(A[offset+1]*B[x] + A[offset+2]*B[x+4] + A[offset+3]*B[x+8] + A[offset+4]*B[x+12]+(y==5?B[x+16]:0), 0.001)
return output
+
+/**
+ * Assembles a color matrix, defaulting to identity
+ */
+/proc/rgb_construct_color_matrix(rr = 1, rg, rb, gr, gg = 1, gb, br, bg, bb = 1, cr, cg, cb)
+ return list(rr, rg, rb, gr, gg, gb, br, bg, bb, cr, cg, cb)
diff --git a/code/game/machinery/colormate.dm b/code/game/machinery/colormate.dm
index 522cf17468..314cf3fa96 100644
--- a/code/game/machinery/colormate.dm
+++ b/code/game/machinery/colormate.dm
@@ -30,10 +30,10 @@
0, 0, 0
)
-/obj/machinery/gear_painter/update_icon()
+/obj/machinery/gear_painter/update_icon_state()
if(panel_open)
icon_state = "colormate_open"
- else if(inoperable())
+ else if(!is_operational())
icon_state = "colormate_off"
else if(inserted)
icon_state = "colormate_active"
@@ -57,7 +57,7 @@
if(user.a_intent == INTENT_HARM)
return ..()
- if(is_type_in_list(I, allowed_types) && !inoperable())
+ if(is_type_in_list(I, allowed_types) && is_operational())
if(!user.transferItemToLoc(I, src))
to_chat(user, "[I] is stuck to your hand!")
return
@@ -66,12 +66,24 @@
inserted = I
update_icon()
+/obj/machinery/gear_painter/AltClick(mob/user)
+ . = ..()
+ if(!user.CanReach(src))
+ return
+ if(!inserted)
+ return
+ to_chat(user, "You remove [inserted] from [src]")
+ inserted.forceMove(drop_location())
+ inserted = null
+ update_icon()
+ updateUsrDialog()
+
/obj/machinery/gear_painter/ui_interact(mob/user)
- if(inoperable())
+ if(!is_operational())
return
user.set_machine(src)
var/list/dat = "Color Mate Control Panel
"
- if(!processing.len)
+ if(!inserted)
dat += "No item inserted."
else
for(var/atom/movable/O in processing)
@@ -180,11 +192,11 @@
update_icon()
updateUsrDialog()
-/obj/machinery/gear_painter/proc/check_valid_color(list/color, mob/user)
- if(!islist(color)) // normal
- var/list/HSV = ReadHSV(color)
+/obj/machinery/gear_painter/proc/check_valid_color(list/cm, mob/user)
+ if(!islist(cm)) // normal
+ var/list/HSV = ReadHSV(cm)
if(HSV[3] < minimum_normal_lightness)
- to_chat(user, "[color] is far too dark!")
+ to_chat(user, "[cm] is far too dark (min lightness [minimum_normal_lightness]!")
return FALSE
return TRUE
else // matrix
@@ -192,17 +204,13 @@
// A predefined number of them must pass to be considered valid
var/passed = 0
var/list/HSV
-#define TEST(color) \
- HSV = ReadHSV(RGBMatrixTransform(testing, color)); \
- if(HSV[3] >= minimum_matrix_lightness) { \
- passed++; \
- }
- TEST("FF0000")
- TEST("00FF00")
- TEST("0000FF")
- TEST("FFFFFF")
-#undef TEST
+#define COLORTEST(thestring, thematrix) passed += (ReadHSV(RGBMatrixTransform(thestring, thematrix)) >= minimum_matrix_lightness)
+ COLORTEST("FF0000", cm)
+ COLORTEST("00FF00", cm)
+ COLORTEST("0000FF", cm)
+ COLORTEST("FFFFFF", cm)
+#undef COLORTEST
if(passed < minimum_matrix_tests)
- to_chat(user, "[english_list(color)] is not allowed.")
+ to_chat(user, "[english_list(color)] is not allowed (pased [passed] out of 4, minimum [minimum_matrix_tests], minimum lightness [minimum_matrix_lightness]).")
return FALSE
return TRUE
diff --git a/tgstation.dme b/tgstation.dme
index 1387748839..7532417d32 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -792,6 +792,7 @@
#include "code\game\machinery\buttons.dm"
#include "code\game\machinery\cell_charger.dm"
#include "code\game\machinery\cloning.dm"
+#include "code\game\machinery\colormate.dm"
#include "code\game\machinery\constructable_frame.dm"
#include "code\game\machinery\cryopod.dm"
#include "code\game\machinery\dance_machine.dm"