Skip to content

Commit

Permalink
Saline drips have a valid icon again (#605)
Browse files Browse the repository at this point in the history
Update Icon Blocker can now specify what to block specifically.
  • Loading branch information
francinum committed Sep 16, 2023
1 parent 83798d8 commit d227ca6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
16 changes: 13 additions & 3 deletions code/datums/elements/update_icon_blocker.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
//Prevents calling anything in update_icon() like update_icon_state() or update_overlays()

/datum/element/update_icon_blocker/Attach(datum/target)
/datum/element/update_icon_blocker
element_flags = ELEMENT_BESPOKE
id_arg_index = 2

/// Set of COMSIG_ATOM_UPDATE_ICON to return. See [signals_atom_main.dm]
var/blocking_flags

/datum/element/update_icon_blocker/Attach(datum/target, blocking_flags = COMSIG_ATOM_NO_UPDATE_ICON_STATE | COMSIG_ATOM_NO_UPDATE_OVERLAYS)
. = ..()
if(!istype(target, /atom))
if(!isatom(target))
return ELEMENT_INCOMPATIBLE
if(!blocking_flags)
CRASH("Attempted to block icon updates with a null blocking_flags argument. Why?")
src.blocking_flags = blocking_flags
RegisterSignal(target, COMSIG_ATOM_UPDATE_ICON, PROC_REF(block_update_icon))

/datum/element/update_icon_blocker/proc/block_update_icon()
SIGNAL_HANDLER

return COMSIG_ATOM_NO_UPDATE_ICON_STATE | COMSIG_ATOM_NO_UPDATE_OVERLAYS
return blocking_flags
11 changes: 8 additions & 3 deletions code/game/machinery/iv_drip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
var/obj/item/reagent_container
///Set false to block beaker use and instead use an internal reagent holder
var/use_internal_storage = FALSE
///If use_internal_storage is true, this is the created volume of the container
var/internal_storage_volume = 100
///Typecache of containers we accept
var/static/list/drip_containers = typecacheof(list(
/obj/item/reagent_containers/blood,
Expand All @@ -38,7 +40,7 @@
. = ..()
update_appearance()
if(use_internal_storage)
create_reagents(100, TRANSPARENT)
create_reagents(internal_storage_volume, TRANSPARENT)
interaction_flags_machine |= INTERACT_MACHINE_OFFLINE

/obj/machinery/iv_drip/Destroy()
Expand Down Expand Up @@ -312,13 +314,16 @@
desc = "An all-you-can-drip saline canister designed to supply a hospital without running out, with a scary looking pump rigged to inject saline into containers, but filling people directly might be a bad idea."
icon_state = "saline"
base_icon_state = "saline"
use_internal_storage = TRUE
internal_storage_volume = 5000
density = TRUE
inject_only = TRUE

/obj/machinery/iv_drip/saline/Initialize(mapload)
AddElement(/datum/element/update_icon_blocker, COMSIG_ATOM_NO_UPDATE_OVERLAYS)
. = ..()
reagent_container = new /obj/item/reagent_containers/glass/saline(src)
AddElement(/datum/element/update_icon_blocker)
// Parent call creates our container. Fill it up to max.
reagents.add_reagent(/datum/reagent/medicine/saline_glucose, internal_storage_volume)

/obj/machinery/iv_drip/saline/eject_beaker()
return
Expand Down
5 changes: 0 additions & 5 deletions code/modules/reagents/reagent_containers/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,3 @@
grinded = I
return
to_chat(user, span_warning("You can't grind this!"))

/obj/item/reagent_containers/glass/saline
name = "saline canister"
volume = 5000
list_reagents = list(/datum/reagent/medicine/saline_glucose = 5000)
Binary file modified icons/obj/iv_drip.dmi
Binary file not shown.

0 comments on commit d227ca6

Please sign in to comment.