Merge pull request #11697 from Ghommie/Ghommie-cit655

Ports "Obliterates item_color: new washing machine functionality edition"
This commit is contained in:
kevinz000
2020-04-12 16:16:37 -07:00
committed by GitHub
127 changed files with 586 additions and 1055 deletions
+148 -101
View File
@@ -1,3 +1,111 @@
//dye registry, add dye colors and their resulting output here if you want the sprite to change instead of just the color.
GLOBAL_LIST_INIT(dye_registry, list(
DYE_REGISTRY_UNDER = list(
DYE_RED = /obj/item/clothing/under/color/red,
DYE_ORANGE = /obj/item/clothing/under/color/orange,
DYE_YELLOW = /obj/item/clothing/under/color/yellow,
DYE_GREEN = /obj/item/clothing/under/color/green,
DYE_BLUE = /obj/item/clothing/under/color/blue,
DYE_PURPLE = /obj/item/clothing/under/color/lightpurple,
DYE_BLACK = /obj/item/clothing/under/color/black,
DYE_WHITE = /obj/item/clothing/under/color/white,
DYE_RAINBOW = /obj/item/clothing/under/color/rainbow,
DYE_MIME = /obj/item/clothing/under/rank/civilian/mime,
DYE_CLOWN = /obj/item/clothing/under/rank/civilian/clown,
DYE_QM = /obj/item/clothing/under/rank/cargo/qm,
DYE_LAW = /obj/item/clothing/under/suit/black,
DYE_CAPTAIN = /obj/item/clothing/under/rank/captain,
DYE_HOP = /obj/item/clothing/under/rank/civilian/head_of_personnel,
DYE_HOS = /obj/item/clothing/under/rank/security/head_of_security,
DYE_CE = /obj/item/clothing/under/rank/engineering/chief_engineer,
DYE_RD = /obj/item/clothing/under/rank/rnd/research_director,
DYE_CMO = /obj/item/clothing/under/rank/medical/chief_medical_officer,
DYE_REDCOAT = /obj/item/clothing/under/costume/redcoat
),
DYE_REGISTRY_JUMPSKIRT = list(
DYE_RED = /obj/item/clothing/under/color/jumpskirt/red,
DYE_ORANGE = /obj/item/clothing/under/color/jumpskirt/orange,
DYE_YELLOW = /obj/item/clothing/under/color/jumpskirt/yellow,
DYE_GREEN = /obj/item/clothing/under/color/jumpskirt/green,
DYE_BLUE = /obj/item/clothing/under/color/jumpskirt/blue,
DYE_PURPLE = /obj/item/clothing/under/color/jumpskirt/lightpurple,
DYE_BLACK = /obj/item/clothing/under/color/jumpskirt/black,
DYE_WHITE = /obj/item/clothing/under/color/jumpskirt/white,
DYE_RAINBOW = /obj/item/clothing/under/color/jumpskirt/rainbow
),
DYE_REGISTRY_GLOVES = list(
DYE_RED = /obj/item/clothing/gloves/color/red,
DYE_ORANGE = /obj/item/clothing/gloves/color/orange,
DYE_YELLOW = /obj/item/clothing/gloves/color/yellow,
DYE_GREEN = /obj/item/clothing/gloves/color/green,
DYE_BLUE = /obj/item/clothing/gloves/color/blue,
DYE_PURPLE = /obj/item/clothing/gloves/color/purple,
DYE_BLACK = /obj/item/clothing/gloves/color/black,
DYE_WHITE = /obj/item/clothing/gloves/color/white,
DYE_RAINBOW = /obj/item/clothing/gloves/color/rainbow,
DYE_MIME = /obj/item/clothing/gloves/color/white,
DYE_CLOWN = /obj/item/clothing/gloves/color/rainbow,
DYE_QM = /obj/item/clothing/gloves/color/brown,
DYE_CAPTAIN = /obj/item/clothing/gloves/color/captain,
DYE_HOP = /obj/item/clothing/gloves/color/grey,
DYE_HOS = /obj/item/clothing/gloves/color/black,
DYE_CE = /obj/item/clothing/gloves/color/black,
DYE_RD = /obj/item/clothing/gloves/color/grey,
DYE_CMO = /obj/item/clothing/gloves/color/latex/nitrile,
DYE_REDCOAT = /obj/item/clothing/gloves/color/white
),
DYE_REGISTRY_SNEAKERS = list(
DYE_RED = /obj/item/clothing/shoes/sneakers/red,
DYE_ORANGE = /obj/item/clothing/shoes/sneakers/orange,
DYE_YELLOW = /obj/item/clothing/shoes/sneakers/yellow,
DYE_GREEN = /obj/item/clothing/shoes/sneakers/green,
DYE_BLUE = /obj/item/clothing/shoes/sneakers/blue,
DYE_PURPLE = /obj/item/clothing/shoes/sneakers/purple,
DYE_BLACK = /obj/item/clothing/shoes/sneakers/black,
DYE_WHITE = /obj/item/clothing/shoes/sneakers/white,
DYE_RAINBOW = /obj/item/clothing/shoes/sneakers/rainbow,
DYE_MIME = /obj/item/clothing/shoes/sneakers/black,
DYE_QM = /obj/item/clothing/shoes/sneakers/brown,
DYE_CAPTAIN = /obj/item/clothing/shoes/sneakers/brown,
DYE_HOP = /obj/item/clothing/shoes/sneakers/brown,
DYE_CE = /obj/item/clothing/shoes/sneakers/brown,
DYE_RD = /obj/item/clothing/shoes/sneakers/brown,
DYE_CMO = /obj/item/clothing/shoes/sneakers/brown
),
DYE_REGISTRY_FANNYPACK = list(
DYE_RED = /obj/item/storage/belt/fannypack/red,
DYE_ORANGE = /obj/item/storage/belt/fannypack/orange,
DYE_YELLOW = /obj/item/storage/belt/fannypack/yellow,
DYE_GREEN = /obj/item/storage/belt/fannypack/green,
DYE_BLUE = /obj/item/storage/belt/fannypack/blue,
DYE_PURPLE = /obj/item/storage/belt/fannypack/purple,
DYE_BLACK = /obj/item/storage/belt/fannypack/black,
DYE_WHITE = /obj/item/storage/belt/fannypack/white
),
DYE_REGISTRY_BEDSHEET = list(
DYE_RED = /obj/item/bedsheet/red,
DYE_ORANGE = /obj/item/bedsheet/orange,
DYE_YELLOW = /obj/item/bedsheet/yellow,
DYE_GREEN = /obj/item/bedsheet/green,
DYE_BLUE = /obj/item/bedsheet/blue,
DYE_PURPLE = /obj/item/bedsheet/purple,
DYE_BLACK = /obj/item/bedsheet/black,
DYE_WHITE = /obj/item/bedsheet,
DYE_RAINBOW = /obj/item/bedsheet/rainbow,
DYE_MIME = /obj/item/bedsheet/mime,
DYE_CLOWN = /obj/item/bedsheet/clown,
DYE_QM = /obj/item/bedsheet/qm,
DYE_LAW = /obj/item/bedsheet/black,
DYE_CAPTAIN = /obj/item/bedsheet/captain,
DYE_HOP = /obj/item/bedsheet/hop,
DYE_HOS = /obj/item/bedsheet/hos,
DYE_CE = /obj/item/bedsheet/ce,
DYE_RD = /obj/item/bedsheet/rd,
DYE_CMO = /obj/item/bedsheet/cmo,
DYE_COSMIC = /obj/item/bedsheet/cosmos
)
))
/obj/machinery/washing_machine
name = "washing machine"
desc = "Gets rid of those pesky bloodstains, or your money back!"
@@ -13,27 +121,22 @@
/obj/machinery/washing_machine/examine(mob/user)
. = ..()
. += "<span class='notice'>Alt-click it to start a wash cycle.</span>"
if(!busy)
. += "<span class='notice'><b>Alt-click</b> it to start a wash cycle.</span>"
/obj/machinery/washing_machine/AltClick(mob/user)
. = ..()
if(!user.canUseTopic(src))
return
if(busy)
return
if(state_open)
to_chat(user, "<span class='notice'>Close the door first</span>")
return TRUE
if(bloody_mess)
to_chat(user, "<span class='warning'>[src] must be cleaned up first.</span>")
return TRUE
if(has_corgi)
bloody_mess = 1
busy = TRUE
update_icon()
addtimer(CALLBACK(src, .proc/wash_cycle), 200)
@@ -76,6 +179,28 @@
color_source = null
update_icon()
/obj/item/proc/dye_item(dye_color)
if(undyeable)
return FALSE
if(dying_key)
if(!GLOB.dye_registry[dying_key])
log_runtime("Item just tried to be dyed with an invalid registry key: [dying_key]")
return FALSE
var/obj/item/target_type = GLOB.dye_registry[dying_key][dye_color]
if(target_type)
icon = initial(target_type.icon)
icon_state = initial(target_type.icon_state)
lefthand_file = initial(target_type.lefthand_file)
righthand_file = initial(target_type.righthand_file)
item_state = initial(target_type.item_state)
mob_overlay_icon = initial(target_type.mob_overlay_icon)
inhand_x_dimension = initial(target_type.inhand_x_dimension)
inhand_y_dimension = initial(target_type.inhand_y_dimension)
name = initial(target_type.name)
desc = "[initial(target_type.desc)] The colors look a little dodgy."
return target_type //successfully "appearance copy" dyed something; returns the target type as a hacky way of extending
add_atom_colour(dye_color, FIXED_COLOUR_PRIORITY)
return FALSE
//what happens to this object when washed inside a washing machine
/atom/movable/proc/machine_wash(obj/machinery/washing_machine/WM)
@@ -89,105 +214,27 @@
new /obj/item/reagent_containers/food/snacks/meat/slab/corgi(loc)
qdel(src)
/obj/item/paper/machine_wash(obj/machinery/washing_machine/WM)
if(WM.color_source)
if(istype(WM.color_source, /obj/item/toy/crayon))
var/obj/item/toy/crayon/CR = WM.color_source
add_atom_colour(CR.paint_color, WASHABLE_COLOUR_PRIORITY)
/obj/item/reagents_containers/rag/towel/machine_wash(obj/machinery/washing_machine/WM)
if(WM.color_source)
if(istype(WM.color_source, /obj/item/toy/crayon))
var/obj/item/toy/crayon/CR = WM.color_source
add_atom_colour(CR.paint_color, WASHABLE_COLOUR_PRIORITY)
/mob/living/simple_animal/pet/dog/corgi/machine_wash(obj/machinery/washing_machine/WM)
gib()
/obj/item/clothing/under/color/machine_wash(obj/machinery/washing_machine/WM)
jumpsuit_wash(WM)
/obj/item/clothing/under/rank/machine_wash(obj/machinery/washing_machine/WM)
jumpsuit_wash(WM)
/obj/item/clothing/under/proc/jumpsuit_wash(obj/machinery/washing_machine/WM)
/obj/item/machine_wash(obj/machinery/washing_machine/WM)
if(WM.color_source)
var/wash_color = WM.color_source.item_color
var/obj/item/clothing/under/U
for(var/T in typesof(/obj/item/clothing/under/color))
var/obj/item/clothing/under/color/J = T
if(wash_color == initial(J.item_color))
U = J
break
if(!U)
for(var/T in typesof(/obj/item/clothing/under/rank))
var/obj/item/clothing/under/rank/R = T
if(wash_color == initial(R.item_color))
U = R
break
if(U)
item_state = initial(U.item_state)
icon_state = initial(U.icon_state)
item_color = wash_color
name = initial(U.name)
desc = "The colors are a bit dodgy."
can_adjust = initial(U.can_adjust)
if(!can_adjust && adjusted) //we deadjust the uniform if it's now unadjustable
toggle_jumpsuit_adjust()
dye_item(WM.color_source.dye_color)
/obj/item/clothing/gloves/color/machine_wash(obj/machinery/washing_machine/WM)
if(WM.color_source)
var/wash_color = WM.color_source.item_color
for(var/T in typesof(/obj/item/clothing/gloves/color))
var/obj/item/clothing/gloves/color/G = T
if(wash_color == initial(G.item_color))
item_state = initial(G.item_state)
icon_state = initial(G.icon_state)
item_color = wash_color
name = initial(G.name)
desc = "The colors are a bit dodgy."
break
/obj/item/clothing/under/dye_item(dye_color, dye_key)
. = ..()
if(.)
var/obj/item/clothing/under/U = .
can_adjust = initial(U.can_adjust)
if(!can_adjust && adjusted) //we deadjust the uniform if it's now unadjustable
toggle_jumpsuit_adjust()
/obj/item/clothing/shoes/sneakers/machine_wash(obj/machinery/washing_machine/WM)
if(chained)
chained = 0
slowdown = SHOES_SLOWDOWN
new /obj/item/restraints/handcuffs(loc)
if(WM.color_source)
var/wash_color = WM.color_source.item_color
for(var/T in typesof(/obj/item/clothing/shoes/sneakers))
var/obj/item/clothing/shoes/sneakers/S = T
if(wash_color == initial(S.item_color))
icon_state = initial(S.icon_state)
item_color = wash_color
name = initial(S.name)
desc = "The colors are a bit dodgy."
break
/obj/item/bedsheet/machine_wash(obj/machinery/washing_machine/WM)
if(WM.color_source)
var/wash_color = WM.color_source.item_color
for(var/T in typesof(/obj/item/bedsheet))
var/obj/item/bedsheet/B = T
if(wash_color == initial(B.item_color))
icon_state = initial(B.icon_state)
item_color = wash_color
name = initial(B.name)
desc = "The colors are a bit dodgy."
break
/obj/item/clothing/head/soft/machine_wash(obj/machinery/washing_machine/WM)
if(WM.color_source)
var/wash_color = WM.color_source.item_color
for(var/T in typesof(/obj/item/clothing/head/soft))
var/obj/item/clothing/head/soft/H = T
if(wash_color == initial(H.item_color))
icon_state = initial(H.icon_state)
item_color = wash_color
name = initial(H.name)
desc = "The colors are a bit dodgy."
break
..()
/obj/machinery/washing_machine/relaymove(mob/user)
container_resist(user)
@@ -223,27 +270,27 @@
if(istype(W, /obj/item/clothing/head/mob_holder))
to_chat(user, "<span class='warning'>It's too unwieldly to put in this way.</span>")
return 1
return TRUE
else if(user.a_intent != INTENT_HARM)
if (!state_open)
to_chat(user, "<span class='warning'>Open the door first!</span>")
return 1
return TRUE
if(bloody_mess)
to_chat(user, "<span class='warning'>[src] must be cleaned up first.</span>")
return 1
return TRUE
if(contents.len >= max_wash_capacity)
to_chat(user, "<span class='warning'>The washing machine is full!</span>")
return 1
return TRUE
if(!user.transferItemToLoc(W, src))
to_chat(user, "<span class='warning'>\The [W] is stuck to your hand, you cannot put it in the washing machine!</span>")
return 1
return TRUE
if(istype(W, /obj/item/toy/crayon) || istype(W, /obj/item/stamp))
if(W.dye_color)
color_source = W
update_icon()