Skip to content

Commit

Permalink
makes crayons have min color (yogstation13#14841)
Browse files Browse the repository at this point in the history
* makes crayons have min color

* typo

Co-authored-by: TheGamerdk <[email protected]>

Co-authored-by: TheGamerdk <[email protected]>
  • Loading branch information
ynot01 and TheGamerdk authored Jul 23, 2022
1 parent eda7996 commit e208ded
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion code/game/objects/items/crayons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,25 @@
user.visible_message(span_suicide("[user] is jamming [src] up [user.p_their()] nose and into [user.p_their()] brain. It looks like [user.p_theyre()] trying to commit suicide!"))
return (BRUTELOSS|OXYLOSS)

/obj/item/toy/crayon/proc/min_value() // Makes the paint color brighter if it is below quarter bright (V < 64)
var/list/read = ReadRGB(paint_color) // Converts the RGB string into a list
var/value = max(read) // Reads the V from HSV, essentially the brightness

if(value >= 64) // Min V is 64, 3 quarters to black from white
return

if(value > 0) // Div by zero avoidance
var/difference = 64/value
read[1] *= difference
read[2] *= difference
read[3] *= difference
else
read[1] = 64
read[2] = 64
read[3] = 64

paint_color = rgb(read[1], read[2], read[3])

/obj/item/toy/crayon/Initialize()
. = ..()
// Makes crayons identifiable in things like grinders
Expand Down Expand Up @@ -234,6 +253,7 @@
if("select_colour")
if(can_change_colour)
paint_color = input(usr,"","Choose Color",paint_color) as color|null
min_value()
. = TRUE
if("enter_text")
var/txt = stripped_input(usr,"Choose what to write.",
Expand Down Expand Up @@ -465,7 +485,7 @@

/obj/item/toy/crayon/black
icon_state = "crayonblack"
paint_color = "#1C1C1C" //Not completely black because total black looks bad. So Mostly Black.
paint_color = "#404040" //Not completely black because total black looks bad. So Mostly Black.
crayon_color = "black"
reagent_contents = list(/datum/reagent/consumable/nutriment = 1, /datum/reagent/colorful_reagent/crayonpowder/black = 1)
dye_color = DYE_BLACK
Expand Down Expand Up @@ -498,6 +518,7 @@

/obj/item/toy/crayon/rainbow/afterattack(atom/target, mob/user, proximity, params)
paint_color = rgb(rand(0,255), rand(0,255), rand(0,255))
min_value()
. = ..()

/*
Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/reagents/other_reagents.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@
/datum/reagent/colorful_reagent/crayonpowder/black
name = "Black Crayon Powder"
colorname = "black"
color = "#1C1C1C" // not quite black
color = "#404040" // not quite black
random_color_list = list("#404040")

/datum/reagent/colorful_reagent/crayonpowder/white
Expand Down

0 comments on commit e208ded

Please sign in to comment.