Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saline drips have a valid icon again, Update Icon Blocker modernization #605

Merged
merged 1 commit into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading