update_appearance

This commit is contained in:
Artur
2021-07-06 21:50:53 +03:00
parent d185c5a3e9
commit cdbd585f4d
16 changed files with 134 additions and 40 deletions
+49 -11
View File
@@ -531,37 +531,75 @@
if(!LAZYLEN(.)) // lol ..length
return list("<span class='notice'><i>You examine [src] closer, but find nothing of interest...</i></span>")
/**
* Updates the appearence of the icon
*
* Mostly delegates to update_name, update_desc, and update_icon
*
* Arguments:
* - updates: A set of bitflags dictating what should be updated. Defaults to [ALL]
*/
/atom/proc/update_appearance(updates=ALL)
//SHOULD_NOT_SLEEP(TRUE)
//SHOULD_CALL_PARENT(TRUE)
. = NONE
updates &= ~SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_APPEARANCE, updates)
if(updates & UPDATE_NAME)
. |= update_name(updates)
if(updates & UPDATE_DESC)
. |= update_desc(updates)
if(updates & UPDATE_ICON)
. |= update_icon(updates)
/// Updates the name of the atom
/atom/proc/update_name(updates=ALL)
//SHOULD_CALL_PARENT(TRUE)
return SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_NAME, updates)
/// Updates the description of the atom
/atom/proc/update_desc(updates=ALL)
//SHOULD_CALL_PARENT(TRUE)
return SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_DESC, updates)
/// Updates the icon of the atom
/atom/proc/update_icon()
// I expect we're going to need more return flags and options in this proc
var/signalOut = SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON)
. = FALSE
/atom/proc/update_icon(updates=ALL)
SIGNAL_HANDLER
//SHOULD_CALL_PARENT(TRUE)
if(!(signalOut & COMSIG_ATOM_NO_UPDATE_ICON_STATE))
. = NONE
updates &= ~SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON, updates)
if(updates & UPDATE_ICON_STATE)
update_icon_state()
. = TRUE
. |= UPDATE_ICON_STATE
if(!(signalOut & COMSIG_ATOM_NO_UPDATE_OVERLAYS))
var/list/new_overlays = update_overlays()
if(updates & UPDATE_OVERLAYS)
if(LAZYLEN(managed_vis_overlays))
SSvis_overlays.remove_vis_overlay(src, managed_vis_overlays)
var/list/new_overlays = update_overlays(updates)
if(managed_overlays)
cut_overlay(managed_overlays)
managed_overlays = null
if(length(new_overlays))
managed_overlays = new_overlays
add_overlay(new_overlays)
. = TRUE
. |= UPDATE_OVERLAYS
SEND_SIGNAL(src, COMSIG_ATOM_UPDATED_ICON, signalOut, .)
. |= SEND_SIGNAL(src, COMSIG_ATOM_UPDATED_ICON, updates, .)
/// Updates the icon state of the atom
/atom/proc/update_icon_state()
//SHOULD_CALL_PARENT(TRUE)
return SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON_STATE)
/// Updates the overlays of the atom
/atom/proc/update_overlays()
SHOULD_CALL_PARENT(TRUE)
//SHOULD_CALL_PARENT(TRUE)
. = list()
SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_OVERLAYS, .)
/atom/proc/relaymove(mob/living/user)
if(!istype(user))
return //why are you buckling nonliving mobs to atoms?
+11
View File
@@ -176,6 +176,17 @@ Class Procs:
/obj/machinery/proc/process_atmos()//If you dont use process why are you here
return PROCESS_KILL
///Called when we want to change the value of the stat variable. Holds bitflags.
/obj/machinery/proc/set_machine_stat(new_value)
if(new_value == stat)
return
. = stat
stat = new_value
on_machine_stat_update(stat)
/obj/machinery/proc/on_machine_stat_update(stat)
return
/obj/machinery/emp_act(severity)
. = ..()
if(use_power && !stat && !(. & EMP_PROTECT_SELF))
@@ -12,7 +12,7 @@
var/load_audio = "sound/weapons/gun_magazine_insert_empty_1.ogg"
var/ammo_type
/obj/item/mecha_ammo/proc/update_name()
/obj/item/mecha_ammo/update_name()
if(!rounds)
name = "empty ammo box"
desc = "An exosuit ammuniton box that has since been emptied. Please recycle."
+1 -1
View File
@@ -446,7 +446,7 @@
mood_message = null
cheer_up()
/obj/item/toy/plush/proc/update_desc()
/obj/item/toy/plush/update_desc()
desc = normal_desc
if(mood_message)
desc += mood_message
+1 -1
View File
@@ -18,7 +18,7 @@
. = ..()
update_desc()
/obj/item/stack/spacecash/proc/update_desc()
/obj/item/stack/spacecash/update_desc()
var/total_worth = get_item_credit_value()
desc = "It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""]"
@@ -269,7 +269,7 @@
. += get_airlock_overlay("glass_construction", overlays_file)
. += get_airlock_overlay("panel_c[state+1]", overlays_file)
/obj/structure/door_assembly/proc/update_name()
/obj/structure/door_assembly/update_name()
name = ""
switch(state)
if(AIRLOCK_ASSEMBLY_NEEDS_WIRES)