This commit is contained in:
silicons
2020-12-11 05:06:44 -07:00
parent 76e7caad33
commit 599a1f0419
3 changed files with 35 additions and 20 deletions

View File

@@ -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)

View File

@@ -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, "<span class='warning'>[I] is stuck to your hand!</span>")
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, "<span class='notice'>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 = "<TITLE>Color Mate Control Panel</TITLE><BR>"
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, "<span class='warning'>[color] is far too dark!</span>")
to_chat(user, "<span class='warning'>[cm] is far too dark (min lightness [minimum_normal_lightness]!</span>")
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, "<span class='warning'>[english_list(color)] is not allowed.</span>")
to_chat(user, "<span class='warning'>[english_list(color)] is not allowed (pased [passed] out of 4, minimum [minimum_matrix_tests], minimum lightness [minimum_matrix_lightness]).</span>")
return FALSE
return TRUE

View File

@@ -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"