mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
update_appearance (#55468)
Creates update_name and update_desc Creates the wrapper proc update_appearance to batch update_name, update_desc, and update_icon together Less non-icon handling code in update_icon and friends Signal hooks for things that want to change names and descriptions 99%+ of the changes in this are just from switching everything over to update_appearance from update_icon
This commit is contained in:
@@ -92,7 +92,7 @@
|
||||
|
||||
/obj/item/clothing/head/helmet/space/hostile_environment/Initialize()
|
||||
. = ..()
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/item/clothing/head/helmet/space/hostile_environment/update_overlays()
|
||||
. = ..()
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
playsound(user, 'sound/weapons/plasma_cutter.ogg', 100, TRUE)
|
||||
D.fire()
|
||||
charged = FALSE
|
||||
update_icon()
|
||||
update_appearance()
|
||||
addtimer(CALLBACK(src, .proc/Recharge), charge_time)
|
||||
return
|
||||
if(proximity_flag && isliving(target))
|
||||
@@ -146,17 +146,18 @@
|
||||
/obj/item/kinetic_crusher/proc/Recharge()
|
||||
if(!charged)
|
||||
charged = TRUE
|
||||
update_icon()
|
||||
update_appearance()
|
||||
playsound(src.loc, 'sound/weapons/kenetic_reload.ogg', 60, TRUE)
|
||||
|
||||
/obj/item/kinetic_crusher/ui_action_click(mob/user, actiontype)
|
||||
set_light_on(!light_on)
|
||||
playsound(user, 'sound/weapons/empty.ogg', 100, TRUE)
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
|
||||
/obj/item/kinetic_crusher/update_icon_state()
|
||||
inhand_icon_state = "crusher[wielded]" // this is not icon_state and not supported by 2hcomponent
|
||||
return ..()
|
||||
|
||||
/obj/item/kinetic_crusher/update_overlays()
|
||||
. = ..()
|
||||
|
||||
@@ -35,7 +35,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list(
|
||||
|
||||
/obj/item/stack/marker_beacon/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1)
|
||||
. = ..()
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/item/stack/marker_beacon/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -44,6 +44,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list(
|
||||
|
||||
/obj/item/stack/marker_beacon/update_icon_state()
|
||||
icon_state = "[initial(icon_state)][lowertext(picked_color)]"
|
||||
return ..()
|
||||
|
||||
/obj/item/stack/marker_beacon/attack_self(mob/user)
|
||||
if(!isturf(user.loc))
|
||||
@@ -66,7 +67,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list(
|
||||
return
|
||||
if(input_color)
|
||||
picked_color = input_color
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/structure/marker_beacon
|
||||
name = "marker beacon"
|
||||
@@ -87,25 +88,30 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list(
|
||||
. = ..()
|
||||
if(set_color)
|
||||
picked_color = set_color
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/structure/marker_beacon/deconstruct(disassembled = TRUE)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
var/obj/item/stack/marker_beacon/M = new(loc)
|
||||
M.picked_color = picked_color
|
||||
M.update_icon()
|
||||
M.update_appearance()
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/marker_beacon/examine(mob/user)
|
||||
. = ..()
|
||||
. += "<span class='notice'>Alt-click to select a color. Current color is [picked_color].</span>"
|
||||
|
||||
/obj/structure/marker_beacon/update_icon()
|
||||
/obj/structure/marker_beacon/update_appearance(updates)
|
||||
while(!picked_color || !GLOB.marker_beacon_colors[picked_color])
|
||||
picked_color = pick(GLOB.marker_beacon_colors)
|
||||
icon_state = "[icon_prefix][lowertext(picked_color)]-on"
|
||||
|
||||
. = ..()
|
||||
set_light(light_range, light_power, GLOB.marker_beacon_colors[picked_color])
|
||||
|
||||
/obj/structure/marker_beacon/update_icon_state()
|
||||
icon_state = "[icon_prefix][lowertext(picked_color)]-on"
|
||||
return ..()
|
||||
|
||||
/obj/structure/marker_beacon/attack_hand(mob/living/user, list/modifiers)
|
||||
. = ..()
|
||||
if(.)
|
||||
@@ -114,7 +120,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list(
|
||||
if(do_after(user, remove_speed, target = src))
|
||||
var/obj/item/stack/marker_beacon/M = new(loc)
|
||||
M.picked_color = picked_color
|
||||
M.update_icon()
|
||||
M.update_appearance()
|
||||
transfer_fingerprints_to(M)
|
||||
if(user.put_in_hands(M, TRUE)) //delete the beacon if it fails
|
||||
playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE)
|
||||
@@ -147,7 +153,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sortList(list(
|
||||
return
|
||||
if(input_color)
|
||||
picked_color = input_color
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
|
||||
/* Preset marker beacon types, for mapping */
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
/obj/item/organ/regenerative_core/proc/preserved(implanted = 0)
|
||||
inert = FALSE
|
||||
preserved = TRUE
|
||||
update_icon()
|
||||
update_appearance()
|
||||
desc = "All that remains of a hivelord. It is preserved, allowing you to use it to heal completely without danger of decay."
|
||||
if(implanted)
|
||||
SSblackbox.record_feedback("nested tally", "hivelord_core", 1, list("[type]", "implanted"))
|
||||
@@ -55,7 +55,7 @@
|
||||
name = "decayed regenerative core"
|
||||
desc = "All that remains of a hivelord. It has decayed, and is completely useless."
|
||||
SSblackbox.record_feedback("nested tally", "hivelord_core", 1, list("[type]", "inert"))
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/item/organ/regenerative_core/ui_action_click()
|
||||
if(inert)
|
||||
@@ -118,10 +118,11 @@
|
||||
|
||||
/obj/item/organ/regenerative_core/legion/Initialize()
|
||||
. = ..()
|
||||
update_icon()
|
||||
update_appearance()
|
||||
|
||||
/obj/item/organ/regenerative_core/update_icon_state()
|
||||
icon_state = inert ? "legion_soul_inert" : "legion_soul"
|
||||
return ..()
|
||||
|
||||
/obj/item/organ/regenerative_core/update_overlays()
|
||||
. = ..()
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
/obj/machinery/sleeper/survival_pod
|
||||
icon = 'icons/obj/lavaland/survival_pod.dmi'
|
||||
icon_state = "sleeper"
|
||||
base_icon_state = "sleeper"
|
||||
|
||||
/obj/machinery/sleeper/survival_pod/update_overlays()
|
||||
. = ..()
|
||||
|
||||
@@ -335,11 +335,13 @@
|
||||
|
||||
/obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_overlays()
|
||||
. = ..()
|
||||
if(reagents?.total_volume)
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/lavaland/ash_flora.dmi', "fullbowl")
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
. += filling
|
||||
if(!reagents?.total_volume)
|
||||
return
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/lavaland/ash_flora.dmi', "fullbowl")
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
. += filling
|
||||
|
||||
/obj/item/reagent_containers/glass/bowl/mushroom_bowl/update_icon_state()
|
||||
if(!reagents || !reagents.total_volume)
|
||||
icon_state = "mushroom_bowl"
|
||||
return ..()
|
||||
|
||||
@@ -608,10 +608,8 @@
|
||||
list_reagents = list(/datum/reagent/flightpotion = 5)
|
||||
|
||||
/obj/item/reagent_containers/glass/bottle/potion/update_icon_state()
|
||||
if(reagents.total_volume)
|
||||
icon_state = "potionflask"
|
||||
else
|
||||
icon_state = "potionflask_empty"
|
||||
icon_state = "potionflask[reagents.total_volume ? null : "_empty"]"
|
||||
return ..()
|
||||
|
||||
/datum/reagent/flightpotion
|
||||
name = "Flight Potion"
|
||||
@@ -1127,13 +1125,13 @@
|
||||
var/obj/item/hierophant_club/club = src.target
|
||||
if(istype(club))
|
||||
club.blink_charged = FALSE
|
||||
club.update_icon()
|
||||
club.update_appearance()
|
||||
|
||||
/datum/action/innate/dash/hierophant/charge()
|
||||
var/obj/item/hierophant_club/club = target
|
||||
if(istype(club))
|
||||
club.blink_charged = TRUE
|
||||
club.update_icon()
|
||||
club.update_appearance()
|
||||
|
||||
current_charges = clamp(current_charges + 1, 0, max_charges)
|
||||
holder.update_action_buttons_icon()
|
||||
@@ -1212,6 +1210,7 @@
|
||||
|
||||
/obj/item/hierophant_club/update_icon_state()
|
||||
icon_state = inhand_icon_state = "hierophant_club[blink_charged ? "_ready":""][(!QDELETED(beacon)) ? "":"_beacon"]"
|
||||
return ..()
|
||||
|
||||
/obj/item/hierophant_club/ui_action_click(mob/user, action)
|
||||
if(!user.is_holding(src)) //you need to hold the staff to teleport
|
||||
|
||||
@@ -350,7 +350,5 @@
|
||||
..()
|
||||
|
||||
/obj/machinery/mineral/ore_redemption/update_icon_state()
|
||||
if(powered())
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = "[initial(icon_state)]-off"
|
||||
icon_state = "[initial(icon_state)][powered() ? null : "-off"]"
|
||||
return ..()
|
||||
|
||||
@@ -85,10 +85,8 @@
|
||||
GLOB.vending_products[M.equipment_path] = 1
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/update_icon_state()
|
||||
if(powered())
|
||||
icon_state = initial(icon_state)
|
||||
else
|
||||
icon_state = "[initial(icon_state)]-off"
|
||||
icon_state = "[initial(icon_state)][powered() ? null : "-off"]"
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/ui_assets(mob/user)
|
||||
return list(
|
||||
|
||||
@@ -25,20 +25,23 @@
|
||||
/obj/item/stack/ore/update_overlays()
|
||||
. = ..()
|
||||
var/difference = min(ORESTACK_OVERLAYS_MAX, amount) - (LAZYLEN(stack_overlays)+1)
|
||||
if(difference == 0)
|
||||
if(!difference)
|
||||
return
|
||||
else if(difference < 0 && LAZYLEN(stack_overlays)) //amount < stack_overlays, remove excess.
|
||||
if (LAZYLEN(stack_overlays)-difference <= 0)
|
||||
|
||||
if(difference < 0 && LAZYLEN(stack_overlays)) //amount < stack_overlays, remove excess.
|
||||
if(LAZYLEN(stack_overlays)-difference <= 0)
|
||||
stack_overlays = null
|
||||
else
|
||||
stack_overlays.len += difference
|
||||
else if(difference > 0) //amount > stack_overlays, add some.
|
||||
return
|
||||
stack_overlays.len += difference
|
||||
|
||||
else //amount > stack_overlays, add some.
|
||||
for(var/i in 1 to difference)
|
||||
var/mutable_appearance/newore = mutable_appearance(icon, icon_state)
|
||||
newore.pixel_x = rand(-8,8)
|
||||
newore.pixel_y = rand(-8,8)
|
||||
LAZYADD(stack_overlays, newore)
|
||||
if (stack_overlays)
|
||||
|
||||
if(stack_overlays)
|
||||
. += stack_overlays
|
||||
|
||||
/obj/item/stack/ore/welder_act(mob/living/user, obj/item/I)
|
||||
|
||||
Reference in New Issue
Block a user