Files
Paradise/code/game/objects/structures/extinguisher.dm
Vi3trice f4b37b4177 Port TG updating appearances (#17943)
* Get pants that match or else you gonna look silly yo

* Posters

* Fix other hud elements

* Rereviewed

* Update shotglass.dm

* Fix for new merged PRs

* Typo

* Coming across other stuff

* Update theblob.dm

* No takebacksies

* smh i forget to leave a comment

* Updated for the detgun and cards

* Should have rerun langserver again

* No longer plastic, more in scope

* Damn you bluespace

* Reverting turret logic, out of scope at this point

* Tweak that part

* Went over energy guns again, and fixed UI White's sprite sheet

* Welding masks, glasses, and JUSTICE

* Update portable_atmospherics.dm

* Cleaning up, clearing things up

* Review and suggestions

* Update valve.dm

* More tweaks

* Missing character

* Not distinct lightmasks, so they can be overlays

* Update generator.dm

* Add parameter so holodeck doesn't try to make a perfect copy

* Update unsorted.dm

* Spiders

* Better fix for spiders, fix vamps too

* Ghosts

* Update telekinesis.dm

* Cleaning up old procs

* It's set up to not copy datums... Unless they're in a list

* Donuts, duct tape, and detgun. D3VR coming to Early Access

* Update procs that interact with doors so they call update_state instead

* Forgot one spot, and actually might as well just force lock

* Cleaning up other things... Sigh, and kitty ears

* oops

* Getting used to how it works

* blinds

* Going back to the suit obscuring thing, so it doesn't update all the time

* Missed that from merging master

* I made this PR and forgot about it

* Fix runtimes in cards

* Make things a bit more unified

* Update update_icons.dm

* yarn, really?

* Update library_equipment.dm

* Update shieldgen.dm

* Every time Charlie merges something, I go back and see if I can improve things further

* what's this? more?

* Update misc_special.dm

* wow, paper

* Review

* More reviews

* To be sure, seems like being broken messed something sometimes

* Brought airlocks closer to how TG works to iron out some stuff

* Pizza and morgue

* Doesn't seem to hurt, tried with holodeck

* Revert "Doesn't seem to hurt, tried with holodeck"

This reverts commit 158529302b.

* Icon conflict

* Fix organ damage

* Don't ask how. Why. It's like that on prod too.

* Cutting down on things and updating from TG.

* More flexible. Just in case the thing you stuck it on didn't destroy.

* Hydro was one the things I touched earlier on, better rework it

* Reviews

* Cleaning up further, also bri'ish

* Undo a change I did, and switch over to a more recent implementation

* Update biogenerator.dm

* Rolling back to old airlocks, but with new duct taped note

* Functionally the same. I'd just rather not have the smoothing happen there

* Went over APCs again

* Fix welding helmet names in species files

* Update airlock.dm

* Update persistent_overlay.dm

* Oh, topic
2022-07-21 08:11:59 +02:00

175 lines
5.2 KiB
Plaintext

#define NO_EXTINGUISHER 0
#define NORMAL_EXTINGUISHER 1
#define MINI_EXTINGUISHER 2
/obj/structure/extinguisher_cabinet
name = "extinguisher cabinet"
desc = "A small wall mounted cabinet designed to hold a fire extinguisher."
icon = 'icons/obj/closet.dmi'
icon_state = "extinguisher_closed"
anchored = TRUE
density = FALSE
max_integrity = 200
integrity_failure = 50
var/obj/item/extinguisher/has_extinguisher = null
var/extinguishertype
var/opened = FALSE
var/material_drop = /obj/item/stack/sheet/metal
/obj/structure/extinguisher_cabinet/Initialize(mapload, direction = null)
. = ..()
name = "extinguisher cabinet"
if(direction)
setDir(direction)
set_pixel_offsets_from_dir(28, -28, 30, -30)
switch(extinguishertype)
if(NO_EXTINGUISHER)
return
if(MINI_EXTINGUISHER)
has_extinguisher = new /obj/item/extinguisher/mini(src)
else
has_extinguisher = new /obj/item/extinguisher(src)
/obj/structure/extinguisher_cabinet/examine(mob/user)
. = ..()
. += "<span class='notice'>Alt-click to [opened ? "close":"open"] it.</span>"
/obj/structure/extinguisher_cabinet/AltClick(mob/living/user)
if(!istype(user) || user.incapacitated())
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(!in_range(src, user))
return
if(!iscarbon(usr) && !isrobot(usr))
return
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
opened = !opened
update_icon(UPDATE_ICON_STATE)
/obj/structure/extinguisher_cabinet/Destroy()
QDEL_NULL(has_extinguisher)
return ..()
/obj/structure/extinguisher_cabinet/ex_act(severity)
if(has_extinguisher)
has_extinguisher.ex_act(severity)
..()
/obj/structure/extinguisher_cabinet/handle_atom_del(atom/A)
if(A == has_extinguisher)
has_extinguisher = null
update_icon(UPDATE_ICON_STATE)
/obj/structure/extinguisher_cabinet/attackby(obj/item/O, mob/user, params)
if(isrobot(user) || isalien(user))
return
if(istype(O, /obj/item/extinguisher))
if(!has_extinguisher && opened)
if(!user.drop_item())
return
user.drop_item(O)
contents += O
has_extinguisher = O
update_icon(UPDATE_ICON_STATE)
to_chat(user, "<span class='notice'>You place [O] in [src].</span>")
return TRUE
else
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
opened = !opened
update_icon(UPDATE_ICON_STATE)
else if(user.a_intent != INTENT_HARM)
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
opened = !opened
update_icon(UPDATE_ICON_STATE)
else
return ..()
/obj/structure/extinguisher_cabinet/welder_act(mob/user, obj/item/I)
if(has_extinguisher)
to_chat(user, "<span class='warning'>You need to remove the extinguisher before deconstructing [src]!</span>")
return
if(!opened)
to_chat(user, "<span class='warning'>Open the cabinet before cutting it apart!</span>")
return
. = TRUE
if(!I.tool_use_check(user, 0))
return
WELDER_ATTEMPT_SLICING_MESSAGE
if(I.use_tool(src, user, 40, volume = I.tool_volume))
WELDER_SLICING_SUCCESS_MESSAGE
deconstruct(TRUE)
/obj/structure/extinguisher_cabinet/attack_hand(mob/user)
if(isrobot(user) || isalien(user))
to_chat(user, "<span class='notice'>You don't have the dexterity to do this!</span>")
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
var/obj/item/organ/external/temp = H.bodyparts_by_name["r_hand"]
if(user.hand)
temp = H.bodyparts_by_name["l_hand"]
if(temp && !temp.is_usable())
to_chat(user, "<span class='notice'>You try to move your [temp.name], but cannot!")
return
if(has_extinguisher)
if(icon_state == "extinguisher_closed")
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
user.put_in_hands(has_extinguisher)
to_chat(user, "<span class='notice'>You take [has_extinguisher] from [src].</span>")
has_extinguisher = null
opened = TRUE
else
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
opened = !opened
update_icon(UPDATE_ICON_STATE)
/obj/structure/extinguisher_cabinet/attack_tk(mob/user)
if(has_extinguisher)
if(icon_state == "extinguisher_closed")
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
has_extinguisher.loc = loc
to_chat(user, "<span class='notice'>You telekinetically remove [has_extinguisher] from [src].</span>")
has_extinguisher = null
opened = TRUE
else
playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3)
opened = !opened
update_icon(UPDATE_ICON_STATE)
/obj/structure/extinguisher_cabinet/obj_break(damage_flag)
if(!broken && !(flags & NODECONSTRUCT))
broken = TRUE
opened = TRUE
if(has_extinguisher)
has_extinguisher.forceMove(loc)
has_extinguisher = null
update_icon(UPDATE_ICON_STATE)
/obj/structure/extinguisher_cabinet/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
new /obj/item/stack/sheet/metal(loc)
if(has_extinguisher)
has_extinguisher.forceMove(loc)
has_extinguisher = null
qdel(src)
/obj/structure/extinguisher_cabinet/update_icon_state()
if(!opened)
icon_state = "extinguisher_closed"
return
if(has_extinguisher)
if(istype(has_extinguisher, /obj/item/extinguisher/mini))
icon_state = "extinguisher_mini"
else
icon_state = "extinguisher_full"
else
icon_state = "extinguisher_empty"
/obj/structure/extinguisher_cabinet/empty
extinguishertype = NO_EXTINGUISHER
#undef NO_EXTINGUISHER
#undef NORMAL_EXTINGUISHER
#undef MINI_EXTINGUISHER