Files
Yogstation/code/game/machinery/washing_machine.dm
SapphicOverload b13ed70f05 Replaces intents with combat mode (#21883)
* it begins

* Update gun.dm

* misc fixes

* Update gun.dm

* more fixes

* Update lightning_flow.dm

* i may be stupid

* Update suicide.dm

* fix mech strafing

* Update mecha.dm

* let there be qol

* ghost stuff

* Update screen_clockwork.dmi

* does the stuff

* stuff

* Update worldbreaker.dm

* moltial arts

* Update worldbreaker.dm

* CRITICAL FIX

* mech stuff

* Update tables_racks.dm

* stuff

* fix seismic arm

* buster/seismic arm fix 2

* saber + lockers

* stuff

* hand tele and pre_attack_secondary

* more right click acts

* Update closets.dm

* who did this

* heck

* Update mob.dm

* Update items.dm

* darkspawn fix

* fixes wound healing

* Update item_attack.dm

* minor qol stuff

* Update kinetic_crusher.dm

* Update kinetic_crusher.dm

* runtime fix

* Update kinetic_crusher.dm

* Update screen_plasmafire.dmi

* stuff

* syringes

* i am very silly

* death to /obj/item/toolset_handler

* Update assembly.dm

* surgery fix + hypo stuff

* mantis fix

* gas harpoon

* atmos machines

---------

Co-authored-by: Molti <gamingjoelouis@gmail.com>
2024-05-09 13:50:24 -05:00

342 lines
12 KiB
Plaintext

//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_LAW = /obj/item/clothing/under/rank/civilian/lawyer/blacksuit,
DYE_CAPTAIN = /obj/item/clothing/under/rank/command/captain,
DYE_HOP = /obj/item/clothing/under/rank/command/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_SYNDI = /obj/item/clothing/under/syndicate/tacticool,
DYE_CENT = /obj/item/clothing/under/rank/centcom/officer,
DYE_QM = /obj/item/clothing/under/rank/cargo/qm
),
DYE_REGISTRY_JUMPSKIRT = list(
DYE_RED = /obj/item/clothing/under/skirt/color/red,
DYE_ORANGE = /obj/item/clothing/under/skirt/color/orange,
DYE_YELLOW = /obj/item/clothing/under/skirt/color/yellow,
DYE_GREEN = /obj/item/clothing/under/skirt/color/green,
DYE_BLUE = /obj/item/clothing/under/skirt/color/blue,
DYE_PURPLE = /obj/item/clothing/under/skirt/color/lightpurple,
DYE_BLACK = /obj/item/clothing/under/skirt/color/black,
DYE_WHITE = /obj/item/clothing/under/skirt/color/white,
DYE_MIME = /obj/item/clothing/under/rank/civilian/mime/skirt,
DYE_LAW = /obj/item/clothing/under/rank/civilian/lawyer/blacksuit/skirt,
DYE_CAPTAIN = /obj/item/clothing/under/rank/command/captain/skirt,
DYE_HOP = /obj/item/clothing/under/rank/command/head_of_personnel/skirt,
DYE_HOS = /obj/item/clothing/under/rank/security/head_of_security/skirt,
DYE_CE = /obj/item/clothing/under/rank/engineering/chief_engineer/skirt,
DYE_RD = /obj/item/clothing/under/rank/rnd/research_director/skirt,
DYE_CMO = /obj/item/clothing/under/rank/medical/chief_medical_officer/skirt,
DYE_QM = /obj/item/clothing/under/rank/cargo/qm/skirt
),
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_CENT = /obj/item/clothing/gloves/color/captain/centcom
),
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_CENT = /obj/item/bedsheet/centcom,
DYE_SYNDI = /obj/item/bedsheet/syndie,
DYE_COSMIC = /obj/item/bedsheet/cosmos
)
))
/obj/machinery/washing_machine
name = "washing machine"
desc = "Gets rid of those pesky bloodstains, or your money back!"
icon = 'icons/obj/machines/washing_machine.dmi'
icon_state = "wm_1_0"
density = TRUE
state_open = TRUE
var/busy = FALSE
var/bloody_mess = 0
var/obj/item/color_source
var/max_wash_capacity = 5
/obj/machinery/washing_machine/examine(mob/user)
. = ..()
if(!busy)
. += span_notice("<b>Alt-click</b> it to start a wash cycle.")
/obj/machinery/washing_machine/AltClick(mob/user)
if(!user.canUseTopic(src, !issilicon(user)) || busy)
return
if(state_open)
to_chat(user, span_notice("Close the door first"))
return
if(bloody_mess)
to_chat(user, span_warning("[src] must be cleaned up first."))
return
busy = TRUE
update_appearance(UPDATE_ICON)
addtimer(CALLBACK(src, PROC_REF(wash_cycle)), 200)
START_PROCESSING(SSfastprocess, src)
/obj/machinery/washing_machine/process(delta_time)
if(!busy)
animate(src, transform=matrix(), time=0.2 SECONDS)
return PROCESS_KILL
if(anchored)
if(DT_PROB(2.5, delta_time))
var/matrix/M = new
M.Translate(rand(-1, 1), rand(0, 1))
animate(src, transform=M, time=0.1 SECONDS)
animate(transform=matrix(), time=0.1 SECONDS)
else
if(DT_PROB(0.5, delta_time))
step(src, pick(GLOB.cardinals))
var/matrix/M = new
M.Translate(rand(-3, 3), rand(-1, 3))
animate(src, transform=M, time=0.2 SECONDS)
/obj/machinery/washing_machine/wash(clean_types)
. = ..()
if(!busy && bloody_mess && (clean_types & CLEAN_TYPE_BLOOD))
bloody_mess = FALSE
update_appearance(UPDATE_ICON)
. = TRUE
/obj/machinery/washing_machine/proc/wash_cycle()
for(var/X in contents)
var/atom/movable/AM = X
AM.wash(CLEAN_WASH)
AM.machine_wash(src)
busy = FALSE
if(color_source)
qdel(color_source)
color_source = null
update_appearance(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)
worn_icon = initial(target_type.worn_icon)
worn_icon_state = initial(target_type.worn_icon_state)
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)
return
/obj/item/stack/sheet/hairlesshide/machine_wash(obj/machinery/washing_machine/WM)
new /obj/item/stack/sheet/wetleather(drop_location(), amount)
qdel(src)
/obj/item/clothing/suit/hooded/ian_costume/machine_wash(obj/machinery/washing_machine/WM)
new /obj/item/reagent_containers/food/snacks/meat/slab/corgi(loc)
qdel(src)
/mob/living/simple_animal/pet/dog/corgi/machine_wash(obj/machinery/washing_machine/WM)
WM.bloody_mess = TRUE
gib()
/obj/item/machine_wash(obj/machinery/washing_machine/WM)
if(WM.color_source)
dye_item(WM.color_source.dye_color)
/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/under/machine_wash(obj/machinery/washing_machine/WM)
freshly_laundered = TRUE
addtimer(VARSET_CALLBACK(src, freshly_laundered, FALSE), 5 MINUTES, TIMER_UNIQUE | TIMER_OVERRIDE)
..()
/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)
..()
/obj/machinery/washing_machine/relaymove(mob/user)
container_resist(user)
/obj/machinery/washing_machine/container_resist(mob/living/user)
if(!busy)
add_fingerprint(user)
open_machine()
/obj/machinery/washing_machine/update_icon_state()
. = ..()
if(busy)
icon_state = "wm_running_[bloody_mess]"
else if(bloody_mess)
icon_state = "wm_[state_open]_blood"
else
var/full = contents.len ? 1 : 0
icon_state = "wm_[state_open]_[full]"
/obj/machinery/washing_machine/update_overlays()
. = ..()
if(panel_open)
. += "wm_panel"
/obj/machinery/washing_machine/attackby(obj/item/W, mob/living/user, params)
if(panel_open && !busy && default_unfasten_wrench(user, W))
return
if(default_deconstruction_screwdriver(user, null, null, W))
update_appearance(UPDATE_ICON)
return
else if(!user.combat_mode)
if (!state_open)
to_chat(user, span_warning("Open the door first!"))
return TRUE
if(bloody_mess)
to_chat(user, span_warning("[src] must be cleaned up first."))
return TRUE
if(contents.len >= max_wash_capacity)
to_chat(user, span_warning("The washing machine is full!"))
return TRUE
if(!user.transferItemToLoc(W, src))
to_chat(user, span_warning("\The [W] is stuck to your hand, you cannot put it in the washing machine!"))
return TRUE
if(W.dye_color)
color_source = W
update_appearance(UPDATE_ICON)
else
return ..()
/obj/machinery/washing_machine/attack_hand(mob/living/user, modifiers)
. = ..()
if(.)
return
if(busy)
to_chat(user, span_warning("[src] is busy."))
return
if(!state_open)
open_machine()
else
state_open = FALSE //close the door
update_appearance(UPDATE_ICON)
/obj/machinery/washing_machine/MouseDrop_T(mob/living/dropped, mob/living/user)
. = ..()
if(!isliving(dropped))
return
if(dropped.buckled || dropped.has_buckled_mobs())
return
if(state_open && iscorgi(dropped))
dropped.forceMove(src)
update_appearance(UPDATE_ICON)
/obj/machinery/washing_machine/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/metal(drop_location(), 2)
qdel(src)
/obj/machinery/washing_machine/open_machine(drop = 1)
..()
density = TRUE //because machinery/open_machine() sets it to 0
color_source = null