Merge pull request #11391 from Ghommie/Ghommie-cit612
Porting "Further update_icon splitup"
This commit is contained in:
@@ -144,14 +144,14 @@
|
||||
..()
|
||||
icon_state = "[(nopower_state && !powered()) ? nopower_state : initial(icon_state)]"
|
||||
|
||||
/obj/machinery/chem_dispenser/update_icon()
|
||||
cut_overlays()
|
||||
/obj/machinery/chem_dispenser/update_overlays()
|
||||
. = ..()
|
||||
if(has_panel_overlay && panel_open)
|
||||
add_overlay(mutable_appearance(icon, "[initial(icon_state)]_panel-o"))
|
||||
. += mutable_appearance(icon, "[initial(icon_state)]_panel-o")
|
||||
|
||||
if(beaker)
|
||||
beaker_overlay = display_beaker()
|
||||
add_overlay(beaker_overlay)
|
||||
. += beaker_overlay
|
||||
|
||||
/obj/machinery/chem_dispenser/emag_act(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
beaker = null
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/chem_heater/update_icon()
|
||||
/obj/machinery/chem_heater/update_icon_state()
|
||||
if(beaker)
|
||||
icon_state = "mixer1b"
|
||||
else
|
||||
|
||||
@@ -67,15 +67,17 @@
|
||||
bottle = null
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/chem_master/update_icon()
|
||||
cut_overlays()
|
||||
if (stat & BROKEN)
|
||||
add_overlay("waitlight")
|
||||
/obj/machinery/chem_master/update_icon_state()
|
||||
if(beaker)
|
||||
icon_state = "mixer1"
|
||||
else
|
||||
icon_state = "mixer0"
|
||||
|
||||
/obj/machinery/chem_master/update_overlays()
|
||||
. = ..()
|
||||
if (stat & BROKEN)
|
||||
. += "waitlight"
|
||||
|
||||
/obj/machinery/chem_master/blob_act(obj/structure/blob/B)
|
||||
if (prob(50))
|
||||
qdel(src)
|
||||
|
||||
@@ -109,16 +109,16 @@
|
||||
update_icon()
|
||||
playsound(loc, 'sound/machines/ping.ogg', 30, 1)
|
||||
|
||||
/obj/machinery/computer/pandemic/update_icon()
|
||||
/obj/machinery/computer/pandemic/update_icon_state()
|
||||
if(stat & BROKEN)
|
||||
icon_state = (beaker ? "mixer1_b" : "mixer0_b")
|
||||
return
|
||||
|
||||
icon_state = "mixer[(beaker) ? "1" : "0"][powered() ? "" : "_nopower"]"
|
||||
if(wait)
|
||||
add_overlay("waitlight")
|
||||
else
|
||||
cut_overlays()
|
||||
icon_state = "mixer[(beaker) ? "1" : "0"][powered() ? "" : "_nopower"]"
|
||||
|
||||
/obj/machinery/computer/pandemic/update_overlays()
|
||||
. = ..()
|
||||
if(!(stat & BROKEN) && wait)
|
||||
. += "waitlight"
|
||||
|
||||
/obj/machinery/computer/pandemic/ui_interact(mob/user, ui_key = "main", datum/tgui/ui, force_open = FALSE, datum/tgui/master_ui, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
AM.forceMove(drop_location())
|
||||
holdingitems = list()
|
||||
|
||||
/obj/machinery/reagentgrinder/update_icon()
|
||||
/obj/machinery/reagentgrinder/update_icon_state()
|
||||
if(beaker)
|
||||
icon_state = "juicer1"
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
for(var/obj/item/stock_parts/matter_bin/B in component_parts)
|
||||
reagents.maximum_volume += REAGENTS_BASE_VOLUME * B.rating
|
||||
|
||||
/obj/machinery/smoke_machine/update_icon()
|
||||
/obj/machinery/smoke_machine/update_icon_state()
|
||||
if((!is_operational()) || (!on) || (reagents.total_volume == 0))
|
||||
if (panel_open)
|
||||
icon_state = "smoke0-o"
|
||||
@@ -42,7 +42,6 @@
|
||||
icon_state = "smoke0"
|
||||
else
|
||||
icon_state = "smoke1"
|
||||
return ..()
|
||||
|
||||
/obj/machinery/smoke_machine/RefreshParts()
|
||||
var/new_volume = REAGENTS_BASE_VOLUME
|
||||
|
||||
@@ -34,15 +34,11 @@
|
||||
else
|
||||
name = "blood pack"
|
||||
|
||||
/obj/item/reagent_containers/blood/update_icon()
|
||||
cut_overlays()
|
||||
|
||||
/obj/item/reagent_containers/blood/update_overlays()
|
||||
. = ..()
|
||||
var/v = min(round(reagents.total_volume / volume * 10), 10)
|
||||
if(v > 0)
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "bloodpack1")
|
||||
filling.icon_state = "bloodpack[v]"
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling)
|
||||
. += mutable_appearance('icons/obj/reagentfillings.dmi', "bloodpack[v]", color = mix_color_from_reagents(reagents.reagent_list))
|
||||
|
||||
/obj/item/reagent_containers/blood/random
|
||||
icon_state = "random_bloodpack"
|
||||
@@ -120,7 +116,7 @@
|
||||
else
|
||||
if(!do_mob(user, C, 10))
|
||||
return
|
||||
|
||||
|
||||
to_chat(user, "<span class='notice'>You take a sip from the [src].</span>")
|
||||
user.visible_message("<span class='notice'>[user] puts the [src] up to their mouth.</span>")
|
||||
if(reagents.total_volume <= 0) // Safety: In case you spam clicked the blood bag on yourself, and it is now empty (below will divide by zero)
|
||||
|
||||
@@ -18,26 +18,27 @@
|
||||
/obj/item/reagent_containers/glass/bottle/on_reagent_change(changetype)
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/update_icon()
|
||||
cut_overlays()
|
||||
/obj/item/reagent_containers/glass/bottle/update_overlays()
|
||||
. = ..()
|
||||
if(!cached_icon)
|
||||
cached_icon = icon_state
|
||||
if(reagents.total_volume)
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[icon_state]-10")
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[cached_icon]-10", color = mix_color_from_reagents(reagents.reagent_list))
|
||||
|
||||
var/percent = round((reagents.total_volume / volume) * 100)
|
||||
switch(percent)
|
||||
if(0 to 9)
|
||||
filling.icon_state = "[icon_state]-10"
|
||||
filling.icon_state = "[cached_icon]-10"
|
||||
if(10 to 29)
|
||||
filling.icon_state = "[icon_state]25"
|
||||
filling.icon_state = "[cached_icon]25"
|
||||
if(30 to 49)
|
||||
filling.icon_state = "[icon_state]50"
|
||||
filling.icon_state = "[cached_icon]50"
|
||||
if(50 to 69)
|
||||
filling.icon_state = "[icon_state]75"
|
||||
filling.icon_state = "[cached_icon]75"
|
||||
if(70 to INFINITY)
|
||||
filling.icon_state = "[icon_state]100"
|
||||
filling.icon_state = "[cached_icon]100"
|
||||
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling)
|
||||
. += filling
|
||||
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/epinephrine
|
||||
|
||||
@@ -86,12 +86,10 @@
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/dropper/update_icon()
|
||||
cut_overlays()
|
||||
/obj/item/reagent_containers/dropper/update_overlays()
|
||||
. = ..()
|
||||
if(reagents.total_volume)
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "dropper")
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling)
|
||||
. += mutable_appearance('icons/obj/reagentfillings.dmi', "dropper", color = mix_color_from_reagents(reagents.reagent_list))
|
||||
|
||||
/obj/item/reagent_containers/dropper/get_belt_overlay()
|
||||
return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', "pouch")
|
||||
|
||||
@@ -133,13 +133,13 @@
|
||||
/obj/item/reagent_containers/glass/beaker/on_reagent_change(changetype)
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/update_icon()
|
||||
/obj/item/reagent_containers/glass/beaker/update_overlays()
|
||||
. = ..()
|
||||
if(!cached_icon)
|
||||
cached_icon = icon_state
|
||||
cut_overlays()
|
||||
|
||||
if(reagents.total_volume)
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[cached_icon]10")
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "[cached_icon]10", color = mix_color_from_reagents(reagents.reagent_list))
|
||||
|
||||
var/percent = round((reagents.total_volume / volume) * 100)
|
||||
switch(percent)
|
||||
@@ -157,9 +157,7 @@
|
||||
filling.icon_state = "[cached_icon]80"
|
||||
if(91 to INFINITY)
|
||||
filling.icon_state = "[cached_icon]100"
|
||||
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling)
|
||||
. += filling
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/jar
|
||||
name = "honey jar"
|
||||
@@ -215,11 +213,7 @@
|
||||
amount_per_transfer_from_this = 10
|
||||
possible_transfer_amounts = list(5,10,15,20,25,30,40,50,60,120,180)
|
||||
container_flags = TEMP_WEAK|APTFT_ALTCLICK|APTFT_VERB
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/plastic/update_icon()
|
||||
icon_state = "beakerlarge" // hack to lets us reuse the large beaker reagent fill states
|
||||
..()
|
||||
icon_state = "beakerwhite"
|
||||
cached_icon = "beakerlarge"
|
||||
|
||||
/obj/item/reagent_containers/glass/beaker/meta
|
||||
name = "metamaterial beaker"
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
reagents.add_reagent_list(list_reagents)
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/hypospray/medipen/update_icon()
|
||||
/obj/item/reagent_containers/hypospray/medipen/update_icon_state()
|
||||
if(reagents.total_volume > 0)
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
@@ -282,13 +282,12 @@
|
||||
vial = new start_vial
|
||||
update_icon()
|
||||
|
||||
/obj/item/hypospray/mkii/update_icon()
|
||||
..()
|
||||
/obj/item/hypospray/mkii/ComponentInitialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/update_icon_updates_onmob)
|
||||
|
||||
/obj/item/hypospray/mkii/update_icon_state()
|
||||
icon_state = "[initial(icon_state)][vial ? "" : "-e"]"
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.update_inv_hands()
|
||||
return
|
||||
|
||||
/obj/item/hypospray/mkii/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -19,37 +19,15 @@
|
||||
"pink hypovial" = "hypovial-pink"
|
||||
)
|
||||
always_reskinnable = TRUE
|
||||
cached_icon = "hypovial"
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/vial/Initialize()
|
||||
. = ..()
|
||||
if(!icon_state)
|
||||
icon_state = "hypovial"
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/vial/on_reagent_change()
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/vial/update_icon()
|
||||
cut_overlays()
|
||||
if(reagents.total_volume)
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypovial10")
|
||||
|
||||
var/percent = round((reagents.total_volume / volume) * 100)
|
||||
switch(percent)
|
||||
if(0 to 9)
|
||||
filling.icon_state = "hypovial10"
|
||||
if(10 to 29)
|
||||
filling.icon_state = "hypovial25"
|
||||
if(30 to 49)
|
||||
filling.icon_state = "hypovial50"
|
||||
if(50 to 85)
|
||||
filling.icon_state = "hypovial75"
|
||||
if(86 to INFINITY)
|
||||
filling.icon_state = "hypovial100"
|
||||
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling)
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/vial/tiny
|
||||
name = "small hypovial"
|
||||
//Shouldn't be possible to get this without adminbuse
|
||||
@@ -80,27 +58,7 @@
|
||||
"large purple hypovial" = "hypoviallarge-p",
|
||||
"large black hypovial" = "hypoviallarge-t"
|
||||
)
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/vial/large/update_icon()
|
||||
cut_overlays()
|
||||
if(reagents.total_volume)
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/reagentfillings.dmi', "hypoviallarge10")
|
||||
|
||||
var/percent = round((reagents.total_volume / volume) * 100)
|
||||
switch(percent)
|
||||
if(0 to 9)
|
||||
filling.icon_state = "hypoviallarge10"
|
||||
if(10 to 29)
|
||||
filling.icon_state = "hypoviallarge25"
|
||||
if(30 to 49)
|
||||
filling.icon_state = "hypoviallarge50"
|
||||
if(50 to 85)
|
||||
filling.icon_state = "hypoviallarge75"
|
||||
if(86 to INFINITY)
|
||||
filling.icon_state = "hypoviallarge100"
|
||||
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling)
|
||||
cached_icon = "hypoviallarge"
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/vial/large/bluespace
|
||||
possible_transfer_amounts = list(1,2,5,10,20)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
var/mode = SYRINGE_DRAW
|
||||
var/busy = FALSE // needed for delayed drawing of blood
|
||||
var/proj_piercing = 0 //does it pierce through thick clothes when shot with syringe gun
|
||||
var/show_filling = TRUE
|
||||
custom_materials = list(/datum/material/iron=10, /datum/material/glass=20)
|
||||
reagent_flags = TRANSPARENT
|
||||
|
||||
@@ -21,6 +22,10 @@
|
||||
mode = SYRINGE_INJECT
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/syringe/ComponentInitialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/update_icon_updates_onmob)
|
||||
|
||||
/obj/item/reagent_containers/syringe/on_reagent_change(changetype)
|
||||
update_icon()
|
||||
|
||||
@@ -152,29 +157,32 @@
|
||||
mode = SYRINGE_DRAW
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/reagent_containers/syringe/update_icon()
|
||||
cut_overlays()
|
||||
var/rounded_vol
|
||||
if(reagents && reagents.total_volume)
|
||||
rounded_vol = CLAMP(round((reagents.total_volume / volume * 15),5), 1, 15)
|
||||
var/image/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]")
|
||||
filling_overlay.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling_overlay)
|
||||
else
|
||||
rounded_vol = 0
|
||||
/obj/item/reagent_containers/syringe/update_icon_state()
|
||||
var/rounded_vol = get_rounded_vol()
|
||||
icon_state = "[rounded_vol]"
|
||||
item_state = "syringe_[rounded_vol]"
|
||||
|
||||
/obj/item/reagent_containers/syringe/update_overlays()
|
||||
. = ..()
|
||||
if(show_filling)
|
||||
var/rounded_vol = get_rounded_vol()
|
||||
if(reagents && reagents.total_volume)
|
||||
. += mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]", color = mix_color_from_reagents(reagents.reagent_list))
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
var/injoverlay
|
||||
switch(mode)
|
||||
if (SYRINGE_DRAW)
|
||||
injoverlay = "draw"
|
||||
if (SYRINGE_INJECT)
|
||||
injoverlay = "inject"
|
||||
add_overlay(injoverlay)
|
||||
M.update_inv_hands()
|
||||
. += injoverlay
|
||||
|
||||
///Used by update_icon() and update_overlays()
|
||||
/obj/item/reagent_containers/syringe/proc/get_rounded_vol()
|
||||
if(reagents && reagents.total_volume)
|
||||
return CLAMP(round((reagents.total_volume / volume * 15),5), 1, 15)
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/item/reagent_containers/syringe/epinephrine
|
||||
name = "syringe (epinephrine)"
|
||||
@@ -267,6 +275,7 @@
|
||||
amount_per_transfer_from_this = 20
|
||||
icon_state = "empty"
|
||||
item_state = "syringe_empty"
|
||||
show_filling = FALSE
|
||||
var/emptrig = FALSE
|
||||
|
||||
/obj/item/reagent_containers/syringe/dart/afterattack(atom/target, mob/user , proximity)
|
||||
@@ -317,28 +326,13 @@
|
||||
/obj/item/reagent_containers/syringe/dart/attack_self(mob/user)
|
||||
return
|
||||
|
||||
/obj/item/reagent_containers/syringe/dart/update_icon()
|
||||
cut_overlays()
|
||||
var/rounded_vol
|
||||
|
||||
rounded_vol = "empty"
|
||||
if(reagents && reagents.total_volume)
|
||||
if(volume/round(reagents.total_volume, 1) == 1)
|
||||
rounded_vol="full"
|
||||
mode = SYRINGE_INJECT
|
||||
|
||||
icon_state = "[rounded_vol]"
|
||||
item_state = "syringe_[rounded_vol]"
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
var/injoverlay
|
||||
switch(mode)
|
||||
if (SYRINGE_DRAW)
|
||||
injoverlay = "draw"
|
||||
if (SYRINGE_INJECT)
|
||||
injoverlay = "ready"
|
||||
add_overlay(injoverlay)
|
||||
M.update_inv_hands()
|
||||
/obj/item/reagent_containers/syringe/dart/update_icon_state()
|
||||
var/empty_full = "empty"
|
||||
if(round(reagents.total_volume, 1) == reagents.maximum_volume)
|
||||
empty_full = "full"
|
||||
mode = SYRINGE_INJECT
|
||||
icon_state = "[empty_full]"
|
||||
item_state = "syringe_[empty_full]"
|
||||
|
||||
/obj/item/reagent_containers/syringe/dart/emp_act(severity)
|
||||
emptrig = TRUE
|
||||
|
||||
Reference in New Issue
Block a user