Merge pull request #11259 from Ghommie/Ghommie-cit590

Porting update_icon improvements.
This commit is contained in:
kevinz000
2020-02-28 04:30:12 -07:00
committed by GitHub
122 changed files with 738 additions and 727 deletions

View File

@@ -139,13 +139,6 @@
/obj/effect/temp_visual/dir_setting/curse/hand
icon_state = "cursehand"
/obj/effect/temp_visual/dir_setting/curse/hand/Initialize(mapload, set_dir, handedness)
. = ..()
update_icon()
/obj/item/projectile/curse_hand/update_icon()
icon_state = "[icon_state][handedness]"
/obj/effect/temp_visual/wizard
name = "water"
icon = 'icons/mob/mob.dmi'
@@ -474,7 +467,7 @@
else
update_icon()
/obj/effect/constructing_effect/update_icon()
/obj/effect/constructing_effect/update_icon_state()
icon_state = "rcd"
if (delay < 10)
icon_state += "_shortest"

View File

@@ -552,8 +552,8 @@ RLD
explosion(src, 0, 0, 3, 1, flame_range = 1)
qdel(src)
/obj/item/construction/rcd/update_icon()
..()
/obj/item/construction/rcd/update_overlays()
. = ..()
if(has_ammobar)
var/ratio = CEILING((matter / max_matter) * ammo_sections, 1)
cut_overlays() //To prevent infinite stacking of overlays
@@ -707,11 +707,10 @@ RLD
else
..()
/obj/item/construction/rld/update_icon()
..()
/obj/item/construction/rld/update_overlays()
. = ..()
var/ratio = CEILING((matter / max_matter) * ammo_sections, 1)
cut_overlays() //To prevent infinite stacking of overlays
add_overlay("rld_light[ratio]")
. += "rld_light[ratio]"
/obj/item/construction/rld/attack_self(mob/user)
..()

View File

@@ -23,6 +23,10 @@
var/datum/radial_menu/persistent/wiring_gui_menu
var/mob/listeningTo
/obj/item/twohanded/rcl/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/twohanded/rcl/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = W
@@ -90,34 +94,20 @@
QDEL_NULL(wiring_gui_menu)
return ..()
/obj/item/twohanded/rcl/update_icon()
if(!loaded)
icon_state = "rcl-empty"
item_state = "rcl-empty"
/obj/item/twohanded/rcl/update_icon_state()
icon_state = initial(icon_state)
item_state = initial(item_state)
if(!loaded || !loaded.amount)
icon_state += "-empty"
item_state += "-0"
/obj/item/twohanded/rcl/update_overlays()
. = ..()
if(!loaded || !loaded.amount)
return
cut_overlays()
var/cable_amount = 0
switch(loaded.amount)
if(61 to INFINITY)
cable_amount = 3
if(31 to 60)
cable_amount = 2
if(1 to 30)
cable_amount = 1
else
cable_amount = 0
var/mutable_appearance/cable_overlay = mutable_appearance(icon, "rcl-[cable_amount]")
var/mutable_appearance/cable_overlay = mutable_appearance(icon, "rcl-[max(CEILING(loaded.amount/(max_amount/3), 1), 3)]")
cable_overlay.color = GLOB.cable_colors[colors[current_color_index]]
if(cable_amount >= 1)
icon_state = "rcl"
item_state = "rcl"
add_overlay(cable_overlay)
else
icon_state = "rcl-empty"
item_state = "rcl-0"
add_overlay(cable_overlay)
. += cable_overlay
/obj/item/twohanded/rcl/proc/is_empty(mob/user, loud = 1)
update_icon()
@@ -323,33 +313,6 @@ obj/item/twohanded/rcl/proc/getMobhook(mob/to_hook)
actions_types = list()
max_amount = 30
name = "makeshift rapid cable layer"
icon_state = "rclg"
item_state = "rclg"
ghetto = TRUE
/obj/item/twohanded/rcl/ghetto/update_icon()
if(!loaded)
icon_state = "rclg-empty"
item_state = "rclg-0"
return
cut_overlays()
var/cable_amount = 0
switch(loaded.amount)
if(20 to INFINITY)
cable_amount = 3
if(10 to 19)
cable_amount = 2
if(1 to 9)
cable_amount = 1
else
cable_amount = 0
var/mutable_appearance/cable_overlay = mutable_appearance(icon, "rcl-[cable_amount]")
cable_overlay.color = GLOB.cable_colors[colors[current_color_index]]
if(cable_amount >= 1)
icon_state = "rclg"
item_state = "rclg"
add_overlay(cable_overlay)
else
icon_state = "rclg-empty"
item_state = "rclg-0"
add_overlay(cable_overlay)

View File

@@ -37,7 +37,7 @@
SSjukeboxes.removejukebox(SSjukeboxes.findjukeboxindex(src))
. = ..()
/obj/item/boombox/update_icon()
/obj/item/boombox/update_icon_state()
icon_state = "[baseiconstate]_[boomingandboxing ? "on" : "off"]"
return
@@ -48,8 +48,11 @@
baseiconstate = "raiqbawks"
availabletrackids = list("hotline.ogg","chiptune.ogg","genesis.ogg")
/obj/item/boombox/raiq/update_icon()
/obj/item/boombox/raiq/Initialize()
. = ..()
RegisterSignal(src, COMSIG_ATOM_UPDATED_ICON, .proc/start_party)
/obj/item/boombox/raiq/proc/start_party()
if(boomingandboxing)
START_PROCESSING(SSobj, src)
else
@@ -58,4 +61,3 @@
/obj/item/boombox/raiq/process()
set_light(5,0.95,pick("#d87aff","#7a7aff","#89ecff","#b88eff","#ff59ad"))
return

View File

@@ -19,7 +19,7 @@
if(start_lit)
light()
/obj/item/candle/update_icon()
/obj/item/candle/update_icon_state()
icon_state = "candle[(wax > 400) ? ((wax > 750) ? 1 : 2) : 3][lit ? "_lit" : ""]"
/obj/item/candle/attackby(obj/item/W, mob/user, params)

View File

@@ -40,13 +40,13 @@
.=..()
update_icon()
/obj/item/card/data/update_icon()
cut_overlays()
/obj/item/card/data/update_overlays()
. = ..()
if(detail_color == COLOR_FLOORTILE_GRAY)
return
var/mutable_appearance/detail_overlay = mutable_appearance('icons/obj/card.dmi', "[icon_state]-color")
detail_overlay.color = detail_color
add_overlay(detail_overlay)
. += detail_overlay
/obj/item/card/data/attackby(obj/item/I, mob/living/user)
if(istype(I, /obj/item/integrated_electronics/detailer))
@@ -517,10 +517,16 @@ update_label("John Doe", "Clowny")
//Polychromatic Knight Badge
/obj/item/card/id/knight
var/id_color = "#00FF00" //defaults to green
name = "knight badge"
icon_state = "knight"
desc = "A badge denoting the owner as a knight! It has a strip for swiping like an ID"
var/id_color = "#00FF00" //defaults to green
var/mutable_appearance/id_overlay
/obj/item/card/id/knight/Initialize()
. = ..()
id_overlay = mutable_appearance(icon, "knight_overlay")
update_icon()
/obj/item/card/id/knight/update_label(newname, newjob)
if(newname || newjob)
@@ -529,14 +535,10 @@ update_label("John Doe", "Clowny")
name = "[(!registered_name) ? "knight badge" : "[registered_name]'s Knight Badge"][(!assignment) ? "" : " ([assignment])"]"
/obj/item/card/id/knight/update_icon()
var/mutable_appearance/id_overlay = mutable_appearance(icon, "knight_overlay")
if(id_color)
id_overlay.color = id_color
cut_overlays()
add_overlay(id_overlay)
/obj/item/card/id/knight/update_overlays()
. = ..()
id_overlay.color = id_color
. += id_overlay
/obj/item/card/id/knight/AltClick(mob/living/user)
. = ..()
@@ -556,10 +558,6 @@ update_label("John Doe", "Clowny")
update_icon()
return TRUE
/obj/item/card/id/knight/Initialize()
. = ..()
update_icon()
/obj/item/card/id/knight/examine(mob/user)
. = ..()
. += "<span class='notice'>Alt-click to recolor it.</span>"

View File

@@ -65,8 +65,9 @@
TED = new(src.loc)
return INITIALIZE_HINT_QDEL
/obj/item/gun/energy/chrono_gun/update_icon()
return
/obj/item/gun/energy/chrono_gun/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/gun/energy/chrono_gun/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0)
if(field)

View File

@@ -522,11 +522,13 @@ CIGARETTE PACKETS ARE IN FANCY.DM
user.visible_message("<span class='suicide'>[user] begins whacking [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return BRUTELOSS
/obj/item/lighter/update_icon()
cut_overlays()
var/mutable_appearance/lighter_overlay = mutable_appearance(icon,"lighter_overlay_[overlay_state][lit ? "-on" : ""]")
/obj/item/lighter/update_icon_state()
icon_state = "[initial(icon_state)][lit ? "-on" : ""]"
add_overlay(lighter_overlay)
/obj/item/lighter/update_overlays()
. = ..()
var/mutable_appearance/lighter_overlay = mutable_appearance(icon,"lighter_overlay_[overlay_state][lit ? "-on" : ""]")
. += lighter_overlay
/obj/item/lighter/ignition_effect(atom/A, mob/user)
if(get_temperature())
@@ -645,12 +647,14 @@ CIGARETTE PACKETS ARE IN FANCY.DM
lighter_color = pick(color_list)
update_icon()
/obj/item/lighter/greyscale/update_icon()
cut_overlays()
var/mutable_appearance/lighter_overlay = mutable_appearance(icon,"lighter_overlay_[overlay_state][lit ? "-on" : ""]")
/obj/item/lighter/greyscale/update_icon_state()
icon_state = "[initial(icon_state)][lit ? "-on" : ""]"
/obj/item/lighter/greyscale/update_overlays()
. = ..()
var/mutable_appearance/lighter_overlay = mutable_appearance(icon,"lighter_overlay_[overlay_state][lit ? "-on" : ""]")
lighter_overlay.color = lighter_color
add_overlay(lighter_overlay)
. += lighter_overlay
/obj/item/lighter/greyscale/ignition_effect(atom/A, mob/user)
if(get_temperature())

View File

@@ -577,8 +577,8 @@
new /obj/item/toy/crayon/black(src)
update_icon()
/obj/item/storage/crayons/update_icon()
cut_overlays()
/obj/item/storage/crayons/update_overlays()
. = ..()
for(var/obj/item/toy/crayon/crayon in contents)
add_overlay(mutable_appearance('icons/obj/crayons.dmi', crayon.item_color))
@@ -735,13 +735,15 @@
. = ..()
/obj/item/toy/crayon/spraycan/update_icon()
/obj/item/toy/crayon/spraycan/update_icon_state()
icon_state = is_capped ? icon_capped : icon_uncapped
/obj/item/toy/crayon/spraycan/update_overlays()
. = ..()
if(use_overlays)
cut_overlays()
var/mutable_appearance/spray_overlay = mutable_appearance('icons/obj/crayons.dmi', "[is_capped ? "spraycan_cap_colors" : "spraycan_colors"]")
spray_overlay.color = paint_color
add_overlay(spray_overlay)
. += spray_overlay
/obj/item/toy/crayon/spraycan/borg
name = "cyborg spraycan"

View File

@@ -20,7 +20,7 @@
var/safety = TRUE //if you can zap people with the defibs on harm mode
var/powered = FALSE //if there's a cell in the defib with enough power for a revive, blocks paddles from reviving otherwise
var/obj/item/twohanded/shockpaddles/paddles
var/obj/item/stock_parts/cell/high/cell
var/obj/item/stock_parts/cell/cell
var/combat = FALSE //can we revive through space suits?
var/grab_ghost = FALSE // Do we pull the ghost back into their body?
var/healdisk = FALSE // Will we shock people dragging the body?
@@ -35,19 +35,14 @@
/obj/item/defibrillator/Initialize() //starts without a cell for rnd
. = ..()
if(cell)
cell = new cell(src)
paddles = make_paddles()
update_icon()
return
/obj/item/defibrillator/loaded/Initialize() //starts with hicap
. = ..()
cell = new(src)
update_icon()
return
/obj/item/defibrillator/update_icon()
update_power()
return ..()
return
/obj/item/defibrillator/loaded
cell = /obj/item/stock_parts/cell/high
/obj/item/defibrillator/proc/update_power()
if(!QDELETED(cell))
@@ -57,6 +52,7 @@
powered = TRUE
else
powered = FALSE
update_icon()
/obj/item/defibrillator/update_overlays()
. = ..()
@@ -76,7 +72,7 @@
/obj/item/defibrillator/CheckParts(list/parts_list)
..()
cell = locate(/obj/item/stock_parts/cell) in contents
update_icon()
update_power()
/obj/item/defibrillator/ui_action_click()
toggle_paddles()
@@ -124,7 +120,7 @@
return
cell = W
to_chat(user, "<span class='notice'>You install a cell in [src].</span>")
update_icon()
update_power()
else if(istype(W, /obj/item/screwdriver))
if(cell)
@@ -132,7 +128,7 @@
cell.forceMove(get_turf(src))
cell = null
to_chat(user, "<span class='notice'>You remove the cell from [src].</span>")
update_icon()
update_power()
else
return ..()
@@ -157,7 +153,7 @@
safety = TRUE
visible_message("<span class='notice'>[src] beeps: Safety protocols enabled!</span>")
playsound(src, 'sound/machines/defib_saftyOn.ogg', 50, 0)
update_icon()
update_power()
/obj/item/defibrillator/proc/toggle_paddles()
set name = "Toggle Paddles"
@@ -170,14 +166,14 @@
if(!usr.put_in_hands(paddles))
on = FALSE
to_chat(user, "<span class='warning'>You need a free hand to hold the paddles!</span>")
update_icon()
update_power()
return
else
//Remove from their hands and back onto the defib unit
paddles.unwield()
remove_paddles(user)
update_icon()
update_power()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
@@ -189,7 +185,7 @@
..()
if((slot_flags == ITEM_SLOT_BACK && slot != SLOT_BACK) || (slot_flags == ITEM_SLOT_BELT && slot != SLOT_BELT))
remove_paddles(user)
update_icon()
update_power()
/obj/item/defibrillator/item_action_slot_check(slot, mob/user, datum/action/A)
if(slot == user.getBackSlot())
@@ -213,12 +209,12 @@
if(cell)
if(cell.charge < (paddles.revivecost+chrgdeductamt))
powered = FALSE
update_icon()
update_power()
if(cell.use(chrgdeductamt))
update_icon()
update_power()
return TRUE
else
update_icon()
update_power()
return FALSE
/obj/item/defibrillator/proc/cooldowncheck(mob/user)
@@ -232,7 +228,7 @@
playsound(src, 'sound/machines/defib_failed.ogg', 50, 0)
paddles.cooldown = FALSE
paddles.update_icon()
update_icon()
update_power()
/obj/item/defibrillator/compact
name = "compact defibrillator"
@@ -249,7 +245,7 @@
/obj/item/defibrillator/compact/loaded/Initialize()
. = ..()
cell = new(src)
update_icon()
update_power()
/obj/item/defibrillator/compact/combat
name = "combat defibrillator"
@@ -258,17 +254,12 @@
safety = FALSE
always_emagged = TRUE
disarm_shock_time = 0
/obj/item/defibrillator/compact/combat/loaded/Initialize()
. = ..()
cell = new /obj/item/stock_parts/cell/infinite(src)
update_icon()
cell = /obj/item/stock_parts/cell/infinite
/obj/item/defibrillator/compact/combat/loaded/attackby(obj/item/W, mob/user, params)
if(W == paddles)
paddles.unwield()
toggle_paddles()
update_icon()
return
//paddles
@@ -298,6 +289,10 @@
var/mob/listeningTo
/obj/item/twohanded/shockpaddles/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/twohanded/shockpaddles/equipped(mob/user, slot)
. = ..()
if(!req_defib)
@@ -339,14 +334,11 @@
busy = FALSE
update_icon()
/obj/item/twohanded/shockpaddles/update_icon()
/obj/item/twohanded/shockpaddles/update_icon_state()
icon_state = "defibpaddles[wielded]"
item_state = "defibpaddles[wielded]"
if(cooldown)
icon_state = "defibpaddles[wielded]_cooldown"
if(iscarbon(loc))
var/mob/living/carbon/C = loc
C.update_inv_hands()
/obj/item/twohanded/shockpaddles/suicide_act(mob/user)
user.visible_message("<span class='danger'>[user] is putting the live paddles on [user.p_their()] chest! It looks like [user.p_theyre()] trying to commit suicide!</span>")
@@ -373,7 +365,7 @@
return
defib.on = FALSE
forceMove(defib)
defib.update_icon()
defib.update_power()
/obj/item/twohanded/shockpaddles/proc/check_defib_exists(mainunit, mob/living/carbon/M, obj/O)
if(!req_defib)

View File

@@ -41,6 +41,11 @@ GLOBAL_LIST_EMPTY(PDAs)
var/mode = 0 //Controls what menu the PDA will display. 0 is hub; the rest are either built in or based on cartridge.
var/list/overlays_icons = list('icons/obj/pda_alt.dmi' = list("pda-r", "screen_default", "id_overlay", "insert_overlay", "light_overlay", "pai_overlay"))
var/current_overlays = PDA_STANDARD_OVERLAYS
//variables exclusively used on 'update_overlays' (which should never be called directly, and 'update_icon' doesn't use args anyway)
var/new_overlays = FALSE
var/new_alert = FALSE
var/font_index = 0 //This int tells DM which font is currently selected and lets DM know when the last font has been selected so that it can cycle back to the first font when "toggle font" is pressed again.
var/font_mode = "font-family:monospace;" //The currently selected font.
var/background_color = "#808000" //The currently selected background color.
@@ -123,7 +128,8 @@ GLOBAL_LIST_EMPTY(PDAs)
inserted_item = new inserted_item(src)
else
inserted_item = new /obj/item/pen(src)
update_icon(FALSE, TRUE)
new_overlays = TRUE
update_icon()
/obj/item/pda/CtrlShiftClick(mob/living/user)
. = ..()
@@ -144,7 +150,8 @@ GLOBAL_LIST_EMPTY(PDAs)
if(QDELETED(src) || isnull(new_icon) || new_icon == icon || !M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
icon = new_icon
update_icon(FALSE, TRUE)
new_overlays = TRUE
update_icon()
to_chat(M, "[src] is now skinned as '[choice]'.")
/obj/item/pda/proc/set_new_overlays()
@@ -188,7 +195,8 @@ GLOBAL_LIST_EMPTY(PDAs)
var/pref_skin = GLOB.pda_reskins[C.prefs.pda_skin]
if(icon != pref_skin)
icon = pref_skin
update_icon(FALSE, TRUE)
new_overlays = TRUE
update_icon()
equipped = TRUE
/obj/item/pda/proc/update_label()
@@ -215,25 +223,27 @@ GLOBAL_LIST_EMPTY(PDAs)
return TRUE
return FALSE
/obj/item/pda/update_icon(alert = FALSE, new_overlays = FALSE)
/obj/item/pda/update_overlays()
. = ..()
if(new_overlays)
set_new_overlays()
cut_overlays()
add_overlay(alert ? current_overlays[PDA_OVERLAY_ALERT] : current_overlays[PDA_OVERLAY_SCREEN])
. += new_alert ? current_overlays[PDA_OVERLAY_ALERT] : current_overlays[PDA_OVERLAY_SCREEN]
var/mutable_appearance/overlay = new()
overlay.pixel_x = overlays_x_offset
if(id)
overlay.icon_state = current_overlays[PDA_OVERLAY_ID]
add_overlay(new /mutable_appearance(overlay))
. += new /mutable_appearance(overlay)
if(inserted_item)
overlay.icon_state = current_overlays[PDA_OVERLAY_ITEM]
add_overlay(new /mutable_appearance(overlay))
. += new /mutable_appearance(overlay)
if(fon)
overlay.icon_state = current_overlays[PDA_OVERLAY_LIGHT]
add_overlay(new /mutable_appearance(overlay))
. += new /mutable_appearance(overlay)
if(pai)
overlay.icon_state = "[current_overlays[PDA_OVERLAY_PAI]][pai.pai ? "" : "_off"]"
add_overlay(new /mutable_appearance(overlay))
. += new /mutable_appearance(overlay)
new_overlays = FALSE
new_alert = FALSE
/obj/item/pda/MouseDrop(mob/over, src_location, over_location)
var/mob/M = usr
@@ -849,6 +859,7 @@ GLOBAL_LIST_EMPTY(PDAs)
to_chat(L, "[icon2html(src)] <b>Message from [hrefstart][signal.data["name"]] ([signal.data["job"]])[hrefend], </b>[inbound_message] (<a href='byond://?src=[REF(src)];choice=Message;skiprefresh=1;target=[REF(signal.source)]'>Reply</a>) (<a href='byond://?src=[REF(src)];choice=toggle_block;target=[signal.data["name"]]'>BLOCK/UNBLOCK</a>)")
new_alert = TRUE
update_icon(TRUE)
/obj/item/pda/proc/send_to_all(mob/living/U)

View File

@@ -454,7 +454,7 @@
on = FALSE
update_icon()
/obj/item/flashlight/glowstick/update_icon()
/obj/item/flashlight/glowstick/update_icon_state()
item_state = "glowstick"
cut_overlays()
if(!fuel)

View File

@@ -87,27 +87,25 @@
. += "<span class='notice'>The last radiation amount detected was [last_tick_amount]</span>"
/obj/item/geiger_counter/update_icon()
/obj/item/geiger_counter/update_icon_state()
if(!scanning)
icon_state = "geiger_off"
return 1
if(obj_flags & EMAGGED)
else if(obj_flags & EMAGGED)
icon_state = "geiger_on_emag"
return 1
switch(radiation_count)
if(-INFINITY to RAD_LEVEL_NORMAL)
icon_state = "geiger_on_1"
if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE)
icon_state = "geiger_on_2"
if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH)
icon_state = "geiger_on_3"
if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH)
icon_state = "geiger_on_4"
if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL)
icon_state = "geiger_on_4"
if(RAD_LEVEL_CRITICAL + 1 to INFINITY)
icon_state = "geiger_on_5"
..()
else
switch(radiation_count)
if(-INFINITY to RAD_LEVEL_NORMAL)
icon_state = "geiger_on_1"
if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE)
icon_state = "geiger_on_2"
if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH)
icon_state = "geiger_on_3"
if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH)
icon_state = "geiger_on_4"
if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL)
icon_state = "geiger_on_4"
if(RAD_LEVEL_CRITICAL + 1 to INFINITY)
icon_state = "geiger_on_5"
/obj/item/geiger_counter/proc/update_sound()
var/datum/looping_sound/geiger/loop = soundloop

View File

@@ -158,7 +158,7 @@
/obj/item/lightreplacer/attack_self(mob/user)
to_chat(user, status_string())
/obj/item/lightreplacer/update_icon()
/obj/item/lightreplacer/update_icon_state()
icon_state = "lightreplacer[(obj_flags & EMAGGED ? 1 : 0)]"
/obj/item/lightreplacer/proc/status_string()

View File

@@ -67,7 +67,7 @@
to_chat(user, "<span class='notice'>You clear the wired connection from the multitool.</span>")
update_icon()
/obj/item/multitool/update_icon()
/obj/item/multitool/update_icon_state()
if(selected_io)
icon_state = "multitool_red"
else
@@ -149,7 +149,7 @@
/obj/item/multitool/ai_detect/ui_action_click()
return
/obj/item/multitool/ai_detect/update_icon()
/obj/item/multitool/ai_detect/update_icon_state()
if(selected_io)
icon_state = "multitool_red"
else

View File

@@ -26,7 +26,7 @@
var/obj/structure/cable/attached // the attached cable
/obj/item/powersink/update_icon()
/obj/item/powersink/update_icon_state()
icon_state = "powersink[mode == OPERATING]"
/obj/item/powersink/proc/set_mode(value)

View File

@@ -27,7 +27,7 @@
qpad = null
return TRUE
/obj/item/quantum_keycard/update_icon()
/obj/item/quantum_keycard/update_icon_state()
if(qpad)
icon_state = "quantum_keycard_on"
else

View File

@@ -83,7 +83,7 @@
eject(usr)
/obj/item/taperecorder/update_icon()
/obj/item/taperecorder/update_icon_state()
if(!mytape)
icon_state = "taperecorder_empty"
else if(recording)

View File

@@ -134,8 +134,9 @@
w_class = WEIGHT_CLASS_SMALL
sides = 100
/obj/item/dice/d100/update_icon()
return
/obj/item/dice/d100/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/dice/eightbd20
name = "strange d20"
@@ -144,8 +145,9 @@
sides = 20
special_faces = list("It is certain","It is decidedly so","Without a doubt","Yes, definitely","You may rely on it","As I see it, yes","Most likely","Outlook good","Yes","Signs point to yes","Reply hazy try again","Ask again later","Better not tell you now","Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no","My sources say no","Outlook not so good","Very doubtful")
/obj/item/dice/eightbd20/update_icon()
return
/obj/item/dice/eightbd20/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/dice/fourdd6
name = "4d d6"
@@ -154,8 +156,9 @@
sides = 48
special_faces = list("Cube-Side: 1-1","Cube-Side: 1-2","Cube-Side: 1-3","Cube-Side: 1-4","Cube-Side: 1-5","Cube-Side: 1-6","Cube-Side: 2-1","Cube-Side: 2-2","Cube-Side: 2-3","Cube-Side: 2-4","Cube-Side: 2-5","Cube-Side: 2-6","Cube-Side: 3-1","Cube-Side: 3-2","Cube-Side: 3-3","Cube-Side: 3-4","Cube-Side: 3-5","Cube-Side: 3-6","Cube-Side: 4-1","Cube-Side: 4-2","Cube-Side: 4-3","Cube-Side: 4-4","Cube-Side: 4-5","Cube-Side: 4-6","Cube-Side: 5-1","Cube-Side: 5-2","Cube-Side: 5-3","Cube-Side: 5-4","Cube-Side: 5-5","Cube-Side: 5-6","Cube-Side: 6-1","Cube-Side: 6-2","Cube-Side: 6-3","Cube-Side: 6-4","Cube-Side: 6-5","Cube-Side: 6-6","Cube-Side: 7-1","Cube-Side: 7-2","Cube-Side: 7-3","Cube-Side: 7-4","Cube-Side: 7-5","Cube-Side: 7-6","Cube-Side: 8-1","Cube-Side: 8-2","Cube-Side: 8-3","Cube-Side: 8-4","Cube-Side: 8-5","Cube-Side: 8-6")
/obj/item/dice/fourdd6/update_icon()
return
/obj/item/dice/fourdd6/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/dice/attack_self(mob/user)
diceroll(user)
@@ -187,9 +190,9 @@
else if(!src.throwing) //Dice was thrown and is coming to rest
visible_message("<span class='notice'>[src] rolls to a stop, landing on [result]. [comment]</span>")
/obj/item/dice/update_icon()
cut_overlays()
add_overlay("[src.icon_state]-[src.result]")
/obj/item/dice/update_overlays()
. = ..()
. += "[icon_state]-[result]"
/obj/item/dice/microwave_act(obj/machinery/microwave/M)
if(can_be_rigged)

View File

@@ -27,6 +27,10 @@
var/igniter_type = /obj/item/assembly/igniter
trigger_guard = TRIGGER_GUARD_NORMAL
/obj/item/flamethrower/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/flamethrower/Destroy()
if(weldtool)
qdel(weldtool)
@@ -48,22 +52,17 @@
if(isturf(location)) //start a fire if possible
igniter.flamethrower_process(location)
/obj/item/flamethrower/update_icon_state()
item_state = "flamethrower_[lit]"
/obj/item/flamethrower/update_icon()
cut_overlays()
/obj/item/flamethrower/update_overlays()
. = ..()
if(igniter)
add_overlay("+igniter[status]")
. += "+igniter[status]"
if(ptank)
add_overlay("+ptank")
. += "+ptank"
if(lit)
add_overlay("+lit")
item_state = "flamethrower_1"
else
item_state = "flamethrower_0"
if(ismob(loc))
var/mob/M = loc
M.update_inv_hands()
return
. += "+lit"
/obj/item/flamethrower/afterattack(atom/target, mob/user, flag)
. = ..()

View File

@@ -158,7 +158,7 @@
user.gib(1, 1)
qdel(src)
/obj/item/grenade/plastic/update_icon()
/obj/item/grenade/plastic/update_icon_state()
if(nadeassembly)
icon_state = "[item_state]1"
else

View File

@@ -128,9 +128,6 @@
item_color = param_color || item_color || pick(cable_colors)
if(cable_colors[item_color])
item_color = cable_colors[item_color]
update_icon()
/obj/item/restraints/handcuffs/cable/update_icon()
color = null
add_atom_colour(item_color, FIXED_COLOUR_PRIORITY)

View File

@@ -154,7 +154,7 @@
colorize(null)
active = FALSE
/obj/item/hot_potato/update_icon()
/obj/item/hot_potato/update_icon_state()
icon_state = active? icon_on : icon_off
/obj/item/hot_potato/syndicate

View File

@@ -10,18 +10,14 @@
throw_range = 5
w_class = WEIGHT_CLASS_TINY
custom_materials = list(/datum/material/glass=500)
var/obj/item/implant/imp = null
var/obj/item/implant/imp
var/imp_type
/obj/item/implantcase/update_icon()
/obj/item/implantcase/update_icon_state()
if(imp)
icon_state = "implantcase-[imp.item_color]"
reagents = imp.reagents
else
icon_state = "implantcase-0"
reagents = null
/obj/item/implantcase/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen))
@@ -46,6 +42,7 @@
imp = I.imp
I.imp = null
update_icon()
reagents = imp.reagents
I.update_icon()
else
if(imp)
@@ -54,6 +51,7 @@
imp.forceMove(I)
I.imp = imp
imp = null
reagents = null
update_icon()
I.update_icon()

View File

@@ -96,16 +96,17 @@
visible_message("<span class='warning'>[M] has been implanted by [src].</span>")
return TRUE
/obj/machinery/implantchair/update_icon()
/obj/machinery/implantchair/update_icon_state()
icon_state = initial(icon_state)
if(state_open)
icon_state += "_open"
if(occupant)
icon_state += "_occupied"
/obj/machinery/implantchair/update_overlays()
. = ..()
if(ready)
add_overlay("ready")
else
cut_overlays()
. += "ready"
/obj/machinery/implantchair/proc/replenish()
if(ready_implants < max_implants)

View File

@@ -14,13 +14,12 @@
var/imp_type = null
/obj/item/implanter/update_icon()
/obj/item/implanter/update_icon_state()
if(imp)
icon_state = "implanter1"
else
icon_state = "implanter0"
/obj/item/implanter/attack(mob/living/M, mob/user)
if(!istype(M))
return

View File

@@ -18,7 +18,7 @@
if(case)
. += "<span class='notice'>Alt-click [src] to remove the inserted implant case.</span>"
/obj/item/implantpad/update_icon()
/obj/item/implantpad/update_icon_state()
icon_state = "implantpad-[case ? TRUE : FALSE]"
/obj/item/implantpad/AltClick(mob/user)

View File

@@ -163,13 +163,14 @@
if(opened)
. += "<span class='notice'>Its battery compartment is open.</span>"
/obj/item/inducer/update_icon()
cut_overlays()
if(opened)
if(!cell)
add_overlay("inducer-nobat")
else
add_overlay("inducer-bat")
/obj/item/inducer/update_overlays()
. = ..()
if(!opened)
return
if(!cell)
. += "inducer-nobat"
else
. += "inducer-bat"
/obj/item/inducer/sci
icon_state = "inducer-sci"

View File

@@ -259,6 +259,10 @@
light_color = "#37FFF7"
actions_types = list()
/obj/item/melee/transforming/energy/sword/cx/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/melee/transforming/energy/sword/cx/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes
altafterattack(A, user, TRUE, params)
return TRUE
@@ -301,7 +305,8 @@
if(!supress_message_text)
to_chat(user, "<span class='notice'>[src] [active ? "is now active":"can now be concealed"].</span>")
/obj/item/melee/transforming/energy/sword/cx/update_icon()
/obj/item/melee/transforming/energy/sword/cx/update_overlays()
. = ..()
var/mutable_appearance/blade_overlay = mutable_appearance(icon, "cxsword_blade")
var/mutable_appearance/gem_overlay = mutable_appearance(icon, "cxsword_gem")
@@ -309,15 +314,10 @@
blade_overlay.color = light_color
gem_overlay.color = light_color
cut_overlays() //So that it doesn't keep stacking overlays non-stop on top of each other
add_overlay(gem_overlay)
. += gem_overlay
if(active)
add_overlay(blade_overlay)
if(ismob(loc))
var/mob/M = loc
M.update_inv_hands()
. += blade_overlay
/obj/item/melee/transforming/energy/sword/cx/AltClick(mob/living/user)
. = ..()

View File

@@ -453,12 +453,10 @@
held_sausage = null
update_icon()
/obj/item/melee/roastingstick/update_icon()
/obj/item/melee/roastingstick/update_overlays()
. = ..()
cut_overlays()
if (held_sausage)
var/mutable_appearance/sausage = mutable_appearance(icon, "roastingstick_sausage")
add_overlay(sausage)
. += mutable_appearance(icon, "roastingstick_sausage")
/obj/item/melee/roastingstick/proc/extend(user)
to_chat(user, "<span class ='warning'>You extend [src].</span>")

View File

@@ -143,14 +143,16 @@
update_icon()
remove_occupant(user)
/obj/item/pet_carrier/update_icon()
cut_overlay("unlocked")
cut_overlay("locked")
/obj/item/pet_carrier/update_icon_state()
if(open)
icon_state = initial(icon_state)
else
icon_state = "pet_carrier_[!occupants.len ? "closed" : "occupied"]"
add_overlay("[locked ? "" : "un"]locked")
/obj/item/pet_carrier/update_overlays()
. = ..()
if(!open)
. += "[locked ? "" : "un"]locked"
/obj/item/pet_carrier/MouseDrop(atom/over_atom)
if(isopenturf(over_atom) && usr.canUseTopic(src, BE_CLOSE, ismonkey(usr)) && usr.Adjacent(over_atom) && open && occupants.len)

View File

@@ -49,29 +49,29 @@
/obj/item/pinpointer/proc/scan_for_target()
return
/obj/item/pinpointer/update_icon()
cut_overlays()
/obj/item/pinpointer/update_overlays()
. = ..()
if(!active)
return
if(!target)
add_overlay("pinon[alert ? "alert" : ""]null")
. += "pinon[alert ? "alert" : ""]null"
return
var/turf/here = get_turf(src)
var/turf/there = get_turf(target)
if(!here || !there || here.z != there.z)
add_overlay("pinon[alert ? "alert" : ""]null")
. += "pinon[alert ? "alert" : ""]null"
return
if(get_dist_euclidian(here,there) <= minimum_range)
add_overlay("pinon[alert ? "alert" : ""]direct")
. += "pinon[alert ? "alert" : ""]direct"
else
setDir(get_dir(here, there))
switch(get_dist(here, there))
if(1 to 8)
add_overlay("pinon[alert ? "alert" : "close"]")
. += "pinon[alert ? "alert" : "close"]"
if(9 to 16)
add_overlay("pinon[alert ? "alert" : "medium"]")
. += "pinon[alert ? "alert" : "medium"]"
if(16 to INFINITY)
add_overlay("pinon[alert ? "alert" : "far"]")
. += "pinon[alert ? "alert" : "far"]"
/obj/item/pinpointer/crew // A replacement for the old crew monitoring consoles
name = "crew pinpointer"

View File

@@ -241,11 +241,11 @@
tank = thetank
update_icon()
/obj/item/pneumatic_cannon/update_icon()
cut_overlays()
/obj/item/pneumatic_cannon/update_overlays()
. = ..()
if(!tank)
return
add_overlay(tank.icon_state)
. += tank.icon_state
/obj/item/pneumatic_cannon/proc/fill_with_type(type, amount)
if(!ispath(type, /obj) && !ispath(type, /mob))

View File

@@ -154,11 +154,7 @@
var/static/list/charge_machines = typecacheof(list(/obj/machinery/cell_charger, /obj/machinery/recharger, /obj/machinery/recharge_station, /obj/machinery/mech_bay_recharge_port))
var/static/list/charge_items = typecacheof(list(/obj/item/stock_parts/cell, /obj/item/gun/energy))
/obj/item/borg/charger/Initialize()
. = ..()
/obj/item/borg/charger/update_icon()
..()
/obj/item/borg/charger/update_icon_state()
icon_state = "charger_[mode]"
/obj/item/borg/charger/attack_self(mob/user)
@@ -596,7 +592,7 @@
update_icon()
to_chat(user, "<span class='boldnotice'>You [active? "activate":"deactivate"] [src].</span>")
/obj/item/borg/projectile_dampen/update_icon()
/obj/item/borg/projectile_dampen/update_icon_state()
icon_state = "[initial(icon_state)][active]"
/obj/item/borg/projectile_dampen/proc/activate_field()

View File

@@ -39,20 +39,20 @@
chest.cell = new /obj/item/stock_parts/cell/high/plus(chest)
..()
/obj/item/robot_suit/update_icon()
cut_overlays()
/obj/item/robot_suit/update_overlays()
. = ..()
if(l_arm)
add_overlay("[l_arm.icon_state]+o")
. += "[l_arm.icon_state]+o"
if(r_arm)
add_overlay("[r_arm.icon_state]+o")
. += "[r_arm.icon_state]+o"
if(chest)
add_overlay("[chest.icon_state]+o")
. += "[chest.icon_state]+o"
if(l_leg)
add_overlay("[l_leg.icon_state]+o")
. += "[l_leg.icon_state]+o"
if(r_leg)
add_overlay("[r_leg.icon_state]+o")
. += "[r_leg.icon_state]+o"
if(head)
add_overlay("[head.icon_state]+o")
. += "[head.icon_state]+o"
/obj/item/robot_suit/proc/check_completion()
if(src.l_arm && src.r_arm)

View File

@@ -364,12 +364,9 @@
to_chat(toggle_action.owner, "<span class='notice'>You activate the self-repair module.</span>")
activate_sr()
/obj/item/borg/upgrade/selfrepair/update_icon()
/obj/item/borg/upgrade/selfrepair/update_icon_state()
if(toggle_action)
icon_state = "selfrepair_[on ? "on" : "off"]"
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
else
icon_state = "cyborg_upgrade5"

View File

@@ -31,7 +31,7 @@
charged++
return
/obj/item/twohanded/singularityhammer/update_icon() //Currently only here to fuck with the on-mob icons.
/obj/item/twohanded/singularityhammer/update_icon_state() //Currently only here to fuck with the on-mob icons.
icon_state = "mjollnir[wielded]"
return
@@ -110,6 +110,6 @@
if(isliving(hit_atom))
shock(hit_atom)
/obj/item/twohanded/mjollnir/update_icon() //Currently only here to fuck with the on-mob icons.
/obj/item/twohanded/mjollnir/update_icon_state() //Currently only here to fuck with the on-mob icons.
icon_state = "mjollnir[wielded]"
return

View File

@@ -35,9 +35,9 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
. = ..()
. += GLOB.rod_recipes
/obj/item/stack/rods/update_icon()
/obj/item/stack/rods/update_icon_state()
var/amount = get_amount()
if((amount <= 5) && (amount > 0))
if(amount <= 5)
icon_state = "rods-[amount]"
else
icon_state = "rods"
@@ -77,8 +77,9 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
is_cyborg = 1
cost = 250
/obj/item/stack/rods/cyborg/update_icon()
return
/obj/item/stack/rods/cyborg/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/stack/rods/ten
amount = 10

View File

@@ -77,16 +77,15 @@
else
w_class = full_w_class
/obj/item/stack/update_icon()
/obj/item/stack/update_icon_state()
if(novariants)
return ..()
return
if(amount <= (max_amount * (1/3)))
icon_state = initial(icon_state)
else if (amount <= (max_amount * (2/3)))
icon_state = "[initial(icon_state)]_2"
else
icon_state = "[initial(icon_state)]_3"
..()
/obj/item/stack/Destroy()

View File

@@ -57,14 +57,16 @@
playsound(loc, 'sound/items/eatfood.ogg', 50, 1, -1)
return (TOXLOSS)
/obj/item/storage/bag/trash/update_icon()
if(contents.len == 0)
icon_state = "[initial(icon_state)]"
else if(contents.len < 12)
icon_state = "[initial(icon_state)]1"
else if(contents.len < 21)
icon_state = "[initial(icon_state)]2"
else icon_state = "[initial(icon_state)]3"
/obj/item/storage/bag/trash/update_icon_state()
switch(contents.len)
if(0)
icon_state = "[initial(icon_state)]"
if(0 to 11)
icon_state = "[initial(icon_state)]1"
if(11 to 20)
icon_state = "[initial(icon_state)]2"
else
icon_state = "[initial(icon_state)]3"
/obj/item/storage/bag/trash/cyborg
insertable = FALSE
@@ -354,10 +356,13 @@
M.Knockdown(40)
update_icon()
/obj/item/storage/bag/tray/update_icon()
cut_overlays()
/obj/item/storage/bag/tray/update_overlays()
. = ..()
for(var/obj/item/I in contents)
add_overlay(new /mutable_appearance(I))
var/mutable_appearance/I_copy = new(I)
I_copy.plane = FLOAT_PLANE
I_copy.layer = FLOAT_LAYER
. += I_copy
/obj/item/storage/bag/tray/Entered()
. = ..()

View File

@@ -10,23 +10,21 @@
attack_verb = list("whipped", "lashed", "disciplined")
max_integrity = 300
var/content_overlays = FALSE //If this is true, the belt will gain overlays based on what it's holding
var/worn_overlays = FALSE //worn counterpart of the above.
var/onmob_overlays = FALSE //worn counterpart of the above.
/obj/item/storage/belt/suicide_act(mob/living/carbon/user)
user.visible_message("<span class='suicide'>[user] begins belting [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return BRUTELOSS
/obj/item/storage/belt/update_icon()
cut_overlays()
/obj/item/storage/belt/update_overlays()
. = ..()
if(content_overlays)
for(var/obj/item/I in contents)
var/mutable_appearance/M = I.get_belt_overlay()
add_overlay(M)
..()
. += I.get_belt_overlay()
/obj/item/storage/belt/worn_overlays(isinhands, icon_file, style_flags = NONE)
. = ..()
if(!isinhands && worn_overlays)
if(!isinhands && onmob_overlays)
for(var/obj/item/I in contents)
. += I.get_worn_belt_overlay(icon_file)
@@ -34,6 +32,11 @@
. = ..()
update_icon()
/obj/item/storage/belt/ComponentInitialize()
. = ..()
if(onmob_overlays)
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/storage/belt/utility
name = "toolbelt" //Carn: utility belt is nicer, but it bamboozles the text parsing.
desc = "Holds tools."
@@ -769,7 +772,7 @@
item_state = "sheath"
w_class = WEIGHT_CLASS_BULKY
content_overlays = TRUE
worn_overlays = TRUE
onmob_overlays = TRUE
var/list/fitting_swords = list(/obj/item/melee/sabre, /obj/item/melee/baton/stunsword)
var/starting_sword = /obj/item/melee/sabre
@@ -787,12 +790,6 @@
if(length(contents))
. += "<span class='notice'>Alt-click it to quickly draw the blade.</span>"
/obj/item/storage/belt/sabre/update_icon()
. = ..()
if(isliving(loc))
var/mob/living/L = loc
L.regenerate_icons()
/obj/item/storage/belt/sabre/PopulateContents()
new starting_sword(src)

View File

@@ -50,11 +50,10 @@
user.visible_message("<span class='suicide'>[user] beating [user.p_them()]self with \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
return BRUTELOSS
/obj/item/storage/box/update_icon()
/obj/item/storage/box/update_overlays()
. = ..()
if(illustration)
cut_overlays()
add_overlay(illustration)
. += illustration
/obj/item/storage/box/attack_self(mob/user)
..()
@@ -866,10 +865,11 @@
foldable = null
var/design = NODESIGN
/obj/item/storage/box/papersack/update_icon()
/obj/item/storage/box/papersack/update_icon_state()
if(contents.len == 0)
icon_state = "[item_state]"
else icon_state = "[item_state]_closed"
else
icon_state = "[item_state]_closed"
/obj/item/storage/box/papersack/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen))

View File

@@ -30,7 +30,7 @@
for(var/i = 1 to STR.max_items)
new spawn_type(src)
/obj/item/storage/fancy/update_icon()
/obj/item/storage/fancy/update_icon_state()
if(fancy_open)
icon_state = "[icon_type]box[contents.len]"
else
@@ -160,30 +160,31 @@
to_chat(user, "<span class='notice'>There are no [icon_type]s left in the pack.</span>")
return TRUE
/obj/item/storage/fancy/cigarettes/update_icon()
if(fancy_open || !contents.len)
cut_overlays()
if(!contents.len)
icon_state = "[initial(icon_state)]_empty"
/obj/item/storage/fancy/cigarettes/update_icon_state()
if(!contents.len)
icon_state = "[initial(icon_state)]_empty"
else if(fancy_open)
icon_state = initial(icon_state)
/obj/item/storage/fancy/cigarettes/update_overlays()
. = ..()
if(!fancy_open || !contents.len)
return
. *= "[icon_state]_open"
var/cig_position = 1
for(var/C in contents)
var/mutable_appearance/inserted_overlay = mutable_appearance(icon)
if(istype(C, /obj/item/lighter/greyscale))
inserted_overlay.icon_state = "lighter_in"
else if(istype(C, /obj/item/lighter))
inserted_overlay.icon_state = "zippo_in"
else
icon_state = initial(icon_state)
add_overlay("[icon_state]_open")
var/cig_position = 1
for(var/C in contents)
var/mutable_appearance/inserted_overlay = mutable_appearance(icon)
inserted_overlay.icon_state = "cigarette"
if(istype(C, /obj/item/lighter/greyscale))
inserted_overlay.icon_state = "lighter_in"
else if(istype(C, /obj/item/lighter))
inserted_overlay.icon_state = "zippo_in"
else
inserted_overlay.icon_state = "cigarette"
inserted_overlay.icon_state = "[inserted_overlay.icon_state]_[cig_position]"
add_overlay(inserted_overlay)
cig_position++
else
cut_overlays()
inserted_overlay.icon_state = "[inserted_overlay.icon_state]_[cig_position]"
. += inserted_overlay
cig_position++
/obj/item/storage/fancy/cigarettes/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob)
if(!ismob(M))
@@ -282,10 +283,10 @@
STR.max_items = 10
STR.can_hold = typecacheof(list(/obj/item/rollingpaper))
/obj/item/storage/fancy/rollingpapers/update_icon()
cut_overlays()
/obj/item/storage/fancy/rollingpapers/update_overlays()
. = ..()
if(!contents.len)
add_overlay("[icon_state]_empty")
. += "[icon_state]_empty"
/////////////
//CIGAR BOX//
@@ -306,21 +307,23 @@
STR.max_items = 5
STR.can_hold = typecacheof(list(/obj/item/clothing/mask/cigarette/cigar))
/obj/item/storage/fancy/cigarettes/cigars/update_icon()
cut_overlays()
/obj/item/storage/fancy/cigarettes/cigars/update_icon_state()
if(fancy_open)
icon_state = "[initial(icon_state)]_open"
var/cigar_position = 0 //to keep track of the pixel_x offset of each new overlay.
for(var/obj/item/clothing/mask/cigarette/cigar/smokes in contents)
var/mutable_appearance/cigar_overlay = mutable_appearance(icon, "[smokes.icon_off]")
cigar_overlay.pixel_x = 3 * cigar_position
add_overlay(cigar_overlay)
cigar_position++
else
icon_state = "[initial(icon_state)]"
/obj/item/storage/fancy/cigarettes/cigars/update_overlays()
. = ..()
if(!fancy_open)
return
var/cigar_position = 0 //to keep track of the pixel_x offset of each new overlay.
for(var/obj/item/clothing/mask/cigarette/cigar/smokes in contents)
var/mutable_appearance/cigar_overlay = mutable_appearance(icon, "[smokes.icon_off]")
cigar_overlay.pixel_x = 3 * cigar_position
. += cigar_overlay
cigar_position++
/obj/item/storage/fancy/cigarettes/cigars/cohiba
name = "\improper Cohiba Robusto cigar case"
desc = "A case of imported Cohiba cigars, renowned for their strong flavor."
@@ -382,4 +385,4 @@
icon_state = "silver ringbox"
icon_type = "silver ring"
spawn_type = /obj/item/clothing/gloves/ring/silver

View File

@@ -132,29 +132,34 @@
for(var/i in 1 to 3)
new /obj/item/clothing/accessory/medal/conduct(src)
/obj/item/storage/lockbox/medal/update_icon()
cut_overlays()
/obj/item/storage/lockbox/medal/update_icon_state()
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if(locked)
icon_state = "medalbox+l"
open = FALSE
else
icon_state = "medalbox"
if(open)
icon_state += "open"
if(broken)
icon_state += "+b"
if(contents && open)
for (var/i in 1 to contents.len)
var/obj/item/clothing/accessory/medal/M = contents[i]
var/mutable_appearance/medalicon = mutable_appearance(initial(icon), M.medaltype)
if(i > 1 && i <= 5)
medalicon.pixel_x += ((i-1)*3)
else if(i > 5)
medalicon.pixel_y -= 7
medalicon.pixel_x -= 2
medalicon.pixel_x += ((i-6)*3)
add_overlay(medalicon)
/obj/item/storage/lockbox/medal/update_overlays()
. = ..()
if(!contents || !open)
return
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if(locked)
return
for (var/i in 1 to contents.len)
var/obj/item/clothing/accessory/medal/M = contents[i]
var/mutable_appearance/medalicon = mutable_appearance(initial(icon), M.medaltype)
if(i > 1 && i <= 5)
medalicon.pixel_x += ((i-1)*3)
else if(i > 5)
medalicon.pixel_y -= 7
medalicon.pixel_x -= 2
medalicon.pixel_x += ((i-6)*3)
. += medalicon
/obj/item/storage/lockbox/medal/sec
name = "security medal box"

View File

@@ -33,14 +33,11 @@ GLOBAL_LIST_EMPTY(rubber_toolbox_icons)
. = ..()
update_icon()
/obj/item/storage/toolbox/update_icon()
..()
cut_overlays()
if(length(blood_DNA))
add_blood_overlay()
/obj/item/storage/toolbox/update_overlays()
. = ..()
if(has_latches)
var/icon/I = icon('icons/obj/storage.dmi', latches)
add_overlay(I)
. += I
/obj/item/storage/toolbox/suicide_act(mob/user)

View File

@@ -66,7 +66,7 @@
. = ..()
refreshID()
/obj/item/storage/wallet/update_icon()
/obj/item/storage/wallet/update_icon_state()
var/new_state = "wallet"
if(front_id)
new_state = "wallet_id"

View File

@@ -84,7 +84,7 @@
/obj/item/melee/baton/process()
deductcharge(round(hitcost * STUNBATON_DEPLETION_RATE), FALSE, FALSE)
/obj/item/melee/baton/update_icon()
/obj/item/melee/baton/update_icon_state()
if(status)
icon_state = "[initial(name)]_active"
else if(!cell)
@@ -195,7 +195,7 @@
L.adjustStaminaLoss(stunpwr)
else
L.drop_all_held_items() //no knockdown/stamina damage, instead disarm.
L.apply_effect(EFFECT_STUTTER, stamforce)
SEND_SIGNAL(L, COMSIG_LIVING_MINOR_SHOCK)
if(user)

View File

@@ -246,7 +246,7 @@
QDEL_NULL(sliver)
return ..()
/obj/item/hemostat/supermatter/update_icon()
/obj/item/hemostat/supermatter/update_icon_state()
if(sliver)
icon_state = "supermatter_tongs_loaded"
else

View File

@@ -45,13 +45,13 @@
if(prob(75))
pixel_y = rand(0, 16)
/obj/item/screwdriver/update_icon()
/obj/item/screwdriver/update_overlays()
. = ..()
if(!random_color) //icon override
return
cut_overlays()
var/mutable_appearance/base_overlay = mutable_appearance(icon, "screwdriver_screwybits")
base_overlay.appearance_flags = RESET_COLOR
add_overlay(base_overlay)
. += base_overlay
/obj/item/screwdriver/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
. = list()

View File

@@ -40,24 +40,24 @@
reagents.add_reagent(/datum/reagent/fuel, max_fuel)
update_icon()
/obj/item/weldingtool/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/weldingtool/proc/update_torch()
/obj/item/weldingtool/update_icon_state()
if(welding)
add_overlay("[initial(icon_state)]-on")
item_state = "[initial(item_state)]1"
else
item_state = "[initial(item_state)]"
/obj/item/weldingtool/update_icon()
cut_overlays()
/obj/item/weldingtool/update_overlays()
. = ..()
if(change_icons)
var/ratio = get_fuel() / max_fuel
ratio = CEILING(ratio*4, 1) * 25
add_overlay("[initial(icon_state)][ratio]")
update_torch()
return
. += "[initial(icon_state)][ratio]"
if(welding)
. += "[initial(icon_state)]-on"
/obj/item/weldingtool/process()
switch(welding)
@@ -177,11 +177,6 @@
if(get_fuel() <= 0 && welding)
switched_on(user)
update_icon()
//mob icon update
if(ismob(loc))
var/mob/M = loc
M.update_inv_hands(0)
return 0
return 1

View File

@@ -40,13 +40,13 @@
add_atom_colour(wirecutter_colors[our_color], FIXED_COLOUR_PRIORITY)
update_icon()
/obj/item/wirecutters/update_icon()
/obj/item/wirecutters/update_overlays()
. = ..()
if(!random_color) //icon override
return
cut_overlays()
var/mutable_appearance/base_overlay = mutable_appearance(icon, "cutters_cutty_thingy")
base_overlay.appearance_flags = RESET_COLOR
add_overlay(base_overlay)
. += base_overlay
/obj/item/wirecutters/attack(mob/living/carbon/C, mob/user)
if(istype(C) && C.handcuffed && istype(C.handcuffed, /obj/item/restraints/handcuffs/cable))

View File

@@ -44,9 +44,13 @@
item_state = "balloon-empty"
/obj/item/toy/balloon/New()
/obj/item/toy/balloon/Initialize()
. = ..()
create_reagents(10)
..()
/obj/item/toy/balloon/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/toy/balloon/attack(mob/living/carbon/human/M, mob/user)
return
@@ -102,7 +106,7 @@
icon_state = "burst"
qdel(src)
/obj/item/toy/balloon/update_icon()
/obj/item/toy/balloon/update_icon_state()
if(src.reagents.total_volume >= 1)
icon_state = "waterballoon"
item_state = "balloon"
@@ -200,8 +204,8 @@
custom_materials = list(/datum/material/iron=10, /datum/material/glass=10)
var/amount_left = 7
/obj/item/toy/ammo/gun/update_icon()
src.icon_state = text("357OLD-[]", src.amount_left)
/obj/item/toy/ammo/gun/update_icon_state()
icon_state = "357OLD-[amount_left]"
/obj/item/toy/ammo/gun/examine(mob/user)
. = ..()
@@ -319,7 +323,8 @@
add_fingerprint(user)
/obj/item/toy/sword/cx/update_icon()
/obj/item/toy/sword/cx/update_overlays()
. = ..()
var/mutable_appearance/blade_overlay = mutable_appearance(icon, "cxsword_blade")
var/mutable_appearance/gem_overlay = mutable_appearance(icon, "cxsword_gem")
@@ -327,15 +332,10 @@
blade_overlay.color = light_color
gem_overlay.color = light_color
cut_overlays() //So that it doesn't keep stacking overlays non-stop on top of each other
add_overlay(gem_overlay)
. += gem_overlay
if(active)
add_overlay(blade_overlay)
if(ismob(loc))
var/mob/M = loc
M.update_inv_hands()
. += blade_overlay
/obj/item/toy/sword/cx/AltClick(mob/living/user)
. = ..()
@@ -843,15 +843,16 @@
user.visible_message("[user] draws a card from the deck.", "<span class='notice'>You draw a card from the deck.</span>")
update_icon()
/obj/item/toy/cards/deck/update_icon()
if(cards.len > 26)
icon_state = "deck_[deckstyle]_full"
else if(cards.len > 10)
icon_state = "deck_[deckstyle]_half"
else if(cards.len > 0)
icon_state = "deck_[deckstyle]_low"
else if(cards.len == 0)
icon_state = "deck_[deckstyle]_empty"
/obj/item/toy/cards/deck/update_icon_state()
switch(cards.len)
if(27 to INFINITY)
icon_state = "deck_[deckstyle]_full"
if(11 to 27)
icon_state = "deck_[deckstyle]_half"
if(1 to 11)
icon_state = "deck_[deckstyle]_low"
else
icon_state = "deck_[deckstyle]_empty"
/obj/item/toy/cards/deck/attack_self(mob/user)
if(cooldown < world.time - 50)

View File

@@ -97,9 +97,6 @@
return
unwield(user)
/obj/item/twohanded/update_icon()
return
/obj/item/twohanded/attack_self(mob/user)
. = ..()
if(wielded) //Trying to unwield it
@@ -241,7 +238,7 @@
. = ..()
AddComponent(/datum/component/butchering, 100, 80, 0 , hitsound) //axes are not known for being precision butchering tools
/obj/item/twohanded/fireaxe/update_icon() //Currently only here to fuck with the on-mob icons.
/obj/item/twohanded/fireaxe/update_icon_state() //Currently only here to fuck with the on-mob icons.
icon_state = "fireaxe[wielded]"
return
@@ -342,7 +339,7 @@
STOP_PROCESSING(SSobj, src)
. = ..()
/obj/item/twohanded/dualsaber/update_icon()
/obj/item/twohanded/dualsaber/update_icon_state()
if(wielded)
icon_state = "dualsaber[item_color][wielded]"
else
@@ -492,23 +489,9 @@
spinnable = FALSE
total_mass_on = 4
/obj/item/twohanded/dualsaber/hypereutactic/chaplain
name = "\improper divine lightblade"
desc = "A giant blade of bright and holy light, said to cut down the wicked with ease."
force = 5
force_unwielded = 5
force_wielded = 20
block_chance = 50
armour_penetration = 0
var/chaplain_spawnable = TRUE
obj_flags = UNIQUE_RENAME
/obj/item/twohanded/dualsaber/hypereutactic/chaplain/Initialize()
/obj/item/twohanded/dualsaber/hypereutactic/ComponentInitialize()
. = ..()
AddComponent(/datum/component/anti_magic, TRUE, TRUE, FALSE, null, null, FALSE)
/obj/item/twohanded/dualsaber/hypereutactic/chaplain/IsReflect()
return FALSE
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/twohanded/dualsaber/hypereutactic/alt_pre_attack(atom/A, mob/living/user, params) //checks if it can do right click memes
altafterattack(A, user, TRUE, params)
@@ -519,7 +502,11 @@
user.visible_message("<span class='notice'>[user] points the tip of [src] at [target].</span>", "<span class='notice'>You point the tip of [src] at [target].</span>")
return TRUE
/obj/item/twohanded/dualsaber/hypereutactic/update_icon()
/obj/item/twohanded/dualsaber/hypereutactic/update_icon_state()
return
/obj/item/twohanded/dualsaber/hypereutactic/update_overlays()
. = ..()
var/mutable_appearance/blade_overlay = mutable_appearance(icon, "hypereutactic_blade")
var/mutable_appearance/gem_overlay = mutable_appearance(icon, "hypereutactic_gem")
@@ -527,15 +514,10 @@
blade_overlay.color = light_color
gem_overlay.color = light_color
cut_overlays() //So that it doesn't keep stacking overlays non-stop on top of each other
add_overlay(gem_overlay)
. += gem_overlay
if(wielded)
add_overlay(blade_overlay)
if(ismob(loc))
var/mob/M = loc
M.update_inv_hands()
. += blade_overlay
clean_blood()
@@ -576,6 +558,24 @@
update_icon()
update_light()
/obj/item/twohanded/dualsaber/hypereutactic/chaplain
name = "divine lightblade"
desc = "A giant blade of bright and holy light, said to cut down the wicked with ease."
force = 5
force_unwielded = 5
force_wielded = 20
block_chance = 50
armour_penetration = 0
var/chaplain_spawnable = TRUE
obj_flags = UNIQUE_RENAME
/obj/item/twohanded/dualsaber/hypereutactic/chaplain/ComponentInitialize()
. = ..()
AddComponent(/datum/component/anti_magic, TRUE, TRUE, FALSE, null, null, FALSE)
/obj/item/twohanded/dualsaber/hypereutactic/chaplain/IsReflect()
return FALSE
//spears
/obj/item/twohanded/spear
icon_state = "spearglass0"
@@ -639,7 +639,7 @@
if(explosive)
. += "<span class='notice'>Use in your hands to activate the attached explosive.</span><br><span class='notice'>Alt-click to set your war cry.</span><br><span class='notice'>Right-click in combat mode to wield</span>"
/obj/item/twohanded/spear/update_icon()
/obj/item/twohanded/spear/update_icon_state()
if(explosive)
icon_state = "spearbomb[wielded]"
else
@@ -717,9 +717,10 @@
tool_behaviour = TOOL_SAW
toolspeed = 0.5
/obj/item/twohanded/required/chainsaw/Initialize()
/obj/item/twohanded/required/chainsaw/ComponentInitialize()
. = ..()
AddComponent(/datum/component/butchering, 30, 100, 0, 'sound/weapons/chainsawhit.ogg', TRUE)
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/twohanded/required/chainsaw/suicide_act(mob/living/carbon/user)
if(on)
@@ -738,7 +739,7 @@
to_chat(user, "As you pull the starting cord dangling from [src], [on ? "it begins to whirr." : "the chain stops moving."]")
force = on ? force_on : initial(force)
throwforce = on ? force_on : force
icon_state = "chainsaw_[on ? "on" : "off"]"
update_icon()
var/datum/component/butchering/butchering = src.GetComponent(/datum/component/butchering)
butchering.butchering_enabled = on
@@ -747,11 +748,8 @@
else
hitsound = "swing_hit"
if(src == user.get_active_held_item()) //update inhands
user.update_inv_hands()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/twohanded/required/chainsaw/update_icon_state()
icon_state = "chainsaw_[on ? "on" : "off"]"
/obj/item/twohanded/required/chainsaw/get_dismemberment_chance()
if(wielded)
@@ -844,7 +842,7 @@
force_unwielded = 100
force_wielded = 500000 // Kills you DEAD.
/obj/item/twohanded/pitchfork/update_icon()
/obj/item/twohanded/pitchfork/update_icon_state()
icon_state = "pitchfork[wielded]"
/obj/item/twohanded/pitchfork/suicide_act(mob/user)
@@ -918,7 +916,7 @@
return 1
return 0
/obj/item/twohanded/vibro_weapon/update_icon()
/obj/item/twohanded/vibro_weapon/update_icon_state()
icon_state = "hfrequency[wielded]"
/*
@@ -930,7 +928,7 @@
desc = "A large, vicious axe crafted out of several sharpened bone plates and crudely tied together. Made of monsters, by killing monsters, for killing monsters."
force_wielded = 23
/obj/item/twohanded/fireaxe/boneaxe/update_icon()
/obj/item/twohanded/fireaxe/boneaxe/update_icon_state()
icon_state = "bone_axe[wielded]"
/*
@@ -956,7 +954,7 @@
attack_verb = list("attacked", "poked", "jabbed", "torn", "gored")
sharpness = IS_SHARP
/obj/item/twohanded/bonespear/update_icon()
/obj/item/twohanded/bonespear/update_icon_state()
icon_state = "bone_spear[wielded]"
/obj/item/twohanded/binoculars
@@ -1120,7 +1118,7 @@
turn_off(user)
add_fingerprint(user)
/obj/item/twohanded/electrostaff/update_icon()
/obj/item/twohanded/electrostaff/update_icon_state()
. = ..()
if(!wielded)
icon_state = "electrostaff_3"