Skip to content

Commit

Permalink
Update_Appearance Port (#2170)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
[(original pr)](tgstation/tgstation#55468)
After nine years in development we hope it was worth the wait

I ported this specifically for the signals I'll need for world icons.
However, it had a lot of other useful stuff, so I ended up just grabbing
(almost) the entire pr.
I tried to grab as few of the superfluous code rewrites as possible to
make reviewing a bit easier, but I couldn't help grab stuff like the APC
icon code rewrite(the original code was a war crime).

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game

- ports the wrapper proc `update_appearance` for icons, descs, and
names, adds `update_desc` and `update_name` subprocs to handle those.
Things. without just stuffing them into update_icons like some kind of
psychopath

- ports a bunch of signal hooks useful for changing names, descriptions,
and icons. I needed these for world_icons which is where this wild ride
all started

- ports some `base_icon_state` implementation. Stuff like spear code
makes slightly less duplicates(and more sense) now which is nice.
We could definitely implement it more I think but that's a future me
problem

- 500 files of immersive vsc-mass-editing action to implement
`update_appearance()`(sorry in advance, but not as sorry as I was when
manually copy-pasting the custom ones for like 3 straight days)

-"consig" and "comisg" have been taken out behind the codebase and shot.
Not 'technically' a bug it just made my head hurt

-My first pr with 0 player facing changes (confetti)
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl: TemporalOroboros, Memed Hams
code: ports update_appearance, update_name, and update_desc from tg, as
well as associated signals
code: a bit of base_icon_state implementation. Can you believe it's been
sitting in our code almost unused for like 3 years
code: cleans up some code formatting, mainly around custom icons and
overlays
code: fixes the typos in COMSIG_STORAGE_EXITED and
COMSIG_STORAGE_ENTERED
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Sun-Soaked authored Aug 12, 2023
1 parent f521d24 commit b033e1e
Show file tree
Hide file tree
Showing 580 changed files with 4,158 additions and 3,683 deletions.
2 changes: 1 addition & 1 deletion check_regex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ standards:

- exactly:
[
290,
297,
"non-bitwise << uses",
'(?<!\d)(?<!\d\s)(?<!<)<<(?!=|\s\d|\d|<|\/)',
]
Expand Down
16 changes: 10 additions & 6 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,15 @@
#define COMSIG_ATOM_UPDATE_DESC "atom_update_desc"
///from base of atom/update_icon(): ()
#define COMSIG_ATOM_UPDATE_ICON "atom_update_icon"
#define COMSIG_ATOM_NO_UPDATE_ICON_STATE (1<<0)
#define COMSIG_ATOM_NO_UPDATE_OVERLAYS (1<<1)
///from base of atom/update_overlays(): (list/new_overlays)
/// If returned from [COMSIG_ATOM_UPDATE_ICON] it prevents the atom from updating its icon state.
#define COMSIG_ATOM_NO_UPDATE_ICON_STATE UPDATE_ICON_STATE
/// If returned from [COMSIG_ATOM_UPDATE_ICON] it prevents the atom from updating its overlays.
#define COMSIG_ATOM_NO_UPDATE_OVERLAYS UPDATE_OVERLAYS
///from base of [atom/update_icon_state]: ()
#define COMSIG_ATOM_UPDATE_ICON_STATE "atom_update_icon_state"
///from base of [/atom/update_overlays]: (list/new_overlays)
#define COMSIG_ATOM_UPDATE_OVERLAYS "atom_update_overlays"
///from base of atom/update_icon(): (signalOut, did_anything)
///from base of [/atom/update_icon]: (signalOut, did_anything)
#define COMSIG_ATOM_UPDATED_ICON "atom_updated_icon"
///from base of atom/Entered(): (atom/movable/entering, /atom)
#define COMSIG_ATOM_ENTERED "atom_entered"
Expand Down Expand Up @@ -188,9 +192,9 @@
#define COMSIG_ATOM_VIRTUAL_Z_CHANGE "atom_virtual_z_change"

//from base of atom/movable/on_enter_storage(): (datum/component/storage/concrete/master_storage)
#define COMISG_STORAGE_ENTERED "storage_entered"
#define COMSIG_STORAGE_ENTERED "storage_entered"
//from base of atom/movable/on_exit_storage(): (datum/component/storage/concrete/master_storage)
#define CONSIG_STORAGE_EXITED "storage_exited"
#define COMSIG_STORAGE_EXITED "storage_exited"

///from base of atom/expose_reagents():
#define COMSIG_ATOM_EXPOSE_REAGENTS "atom_expose_reagents"
Expand Down
10 changes: 4 additions & 6 deletions code/_onclick/hud/action_button.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
name = "Show Buttons"
else
name = "Hide Buttons"
update_icon()
update_appearance()
usr.update_action_buttons()

/atom/movable/screen/movable/action_button/hide_toggle/AltClick(mob/user)
Expand All @@ -151,14 +151,12 @@
hide_icon = settings["toggle_icon"]
hide_state = settings["toggle_hide"]
show_state = settings["toggle_show"]
update_icon()
update_appearance()

/atom/movable/screen/movable/action_button/hide_toggle/update_overlays()
. = ..()
if(hidden)
. += show_appearance
else
. += hide_appearance
. += hidden ? show_appearance : hide_appearance


/atom/movable/screen/movable/action_button/MouseEntered(location,control,params)
. = ..()
Expand Down
6 changes: 3 additions & 3 deletions code/_onclick/hud/alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_above_movement
pull_icon.hud = src
static_inventory += pull_icon
Expand All @@ -109,14 +109,14 @@

zone_select = new /atom/movable/screen/zone_sel/alien()
zone_select.hud = src
zone_select.update_icon()
zone_select.update_appearance()
static_inventory += zone_select

for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
if(inv.slot_id)
inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_icon()
inv.update_appearance()

/datum/hud/alien/persistent_inventory_update()
if(!mymob)
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/alien_larva.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = 'icons/hud/screen_alien.dmi'
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_above_movement
pull_icon.hud = src
hotkeybuttons += pull_icon
Expand All @@ -33,5 +33,5 @@

zone_select = new /atom/movable/screen/zone_sel/alien()
zone_select.hud = src
zone_select.update_icon()
zone_select.update_appearance()
static_inventory += zone_select
2 changes: 1 addition & 1 deletion code/_onclick/hud/constructs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
..()
pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_construct_pull
pull_icon.hud = src
static_inventory += pull_icon
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/devil.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_drone_pull
pull_icon.hud = src
static_inventory += pull_icon
Expand Down Expand Up @@ -44,7 +44,7 @@
zone_select = new /atom/movable/screen/zone_sel()
zone_select.icon = ui_style
zone_select.hud = src
zone_select.update_icon()
zone_select.update_appearance()

lingchemdisplay = new /atom/movable/screen/ling/chems()
lingchemdisplay.hud = src
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/drones.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
if(inv.slot_id)
inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_icon()
inv.update_appearance()


/datum/hud/dextrous/drone/persistent_inventory_update()
Expand Down
7 changes: 4 additions & 3 deletions code/_onclick/hud/families.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
desc = "Shows the current level of hostility the space police is planning to rain down on you. Better be careful."
icon = 'icons/obj/gang/wanted_160x32.dmi'
icon_state = "wanted_0"
base_icon_state = "wanted"
screen_loc = ui_wanted_lvl
///Wanted level, affects the hud icon.
var/level
Expand All @@ -14,7 +15,7 @@
var/datum/game_mode/gang/F = SSticker.mode
level = F.wanted_level
cops_arrived = F.cops_arrived
update_icon()
update_appearance()

/atom/movable/screen/wanted/MouseEntered(location,control,params)
. = ..()
Expand All @@ -24,5 +25,5 @@
closeToolTip(usr)

/atom/movable/screen/wanted/update_icon_state()
. = ..()
icon_state = "wanted_[level][cops_arrived ? "_active" : ""]"
icon_state = "[base_icon_state]_[level][cops_arrived ? "_active" : null]"
return ..()
6 changes: 3 additions & 3 deletions code/_onclick/hud/generic_dextrous.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_drone_pull
pull_icon.hud = src
static_inventory += pull_icon
Expand Down Expand Up @@ -47,7 +47,7 @@
zone_select = new /atom/movable/screen/zone_sel()
zone_select.icon = ui_style
zone_select.hud = src
zone_select.update_icon()
zone_select.update_appearance()
static_inventory += zone_select

using = new /atom/movable/screen/area_creator
Expand All @@ -61,7 +61,7 @@
if(inv.slot_id)
inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_icon()
inv.update_appearance()

/datum/hud/dextrous/persistent_inventory_update()
if(!mymob)
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/guardian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
pull_icon.hud = src
static_inventory += pull_icon
Expand Down Expand Up @@ -70,7 +70,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = 'icons/mob/guardian.dmi'
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
pull_icon.hud = src
static_inventory += pull_icon
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/holograms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_above_intent
pull_icon.hud = src
static_inventory += pull_icon
Expand All @@ -40,7 +40,7 @@
if(inv.slot_id)
inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_icon()
inv.update_appearance()


/datum/hud/dextrous/hologram/persistent_inventory_update()
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
hand_slots["[i]"] = hand_box
hand_box.hud = src
static_inventory += hand_box
hand_box.update_icon()
hand_box.update_appearance()

var/i = 1
for(var/atom/movable/screen/swap_hand/SH in static_inventory)
Expand Down
6 changes: 3 additions & 3 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_above_intent
pull_icon.hud = src
static_inventory += pull_icon
Expand All @@ -345,7 +345,7 @@
zone_select = new /atom/movable/screen/zone_sel()
zone_select.icon = ui_style
zone_select.hud = src
zone_select.update_icon()
zone_select.update_appearance()
static_inventory += zone_select

combo_display = new /atom/movable/screen/combo()
Expand All @@ -355,7 +355,7 @@
if(inv.slot_id)
inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_icon()
inv.update_appearance()

update_locked_slots()

Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
pull_icon.hud = src
static_inventory += pull_icon
Expand Down
6 changes: 3 additions & 3 deletions code/_onclick/hud/monkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_above_movement
pull_icon.hud = src
static_inventory += pull_icon
Expand All @@ -116,7 +116,7 @@
zone_select = new /atom/movable/screen/zone_sel()
zone_select.icon = ui_style
zone_select.hud = src
zone_select.update_icon()
zone_select.update_appearance()
static_inventory += zone_select

mymob.client.screen = list()
Expand All @@ -131,7 +131,7 @@
if(inv.slot_id)
inv.hud = src
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
inv.update_icon()
inv.update_appearance()

/datum/hud/monkey/persistent_inventory_update()
if(!mymob)
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/revenanthud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_icon()
pull_icon.update_appearance()
pull_icon.screen_loc = ui_living_pull
pull_icon.hud = src
static_inventory += pull_icon
Expand Down
15 changes: 7 additions & 8 deletions code/_onclick/hud/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@
pull_icon.icon = 'icons/hud/screen_cyborg.dmi'
pull_icon.screen_loc = ui_borg_pull
pull_icon.hud = src
pull_icon.update_icon()
pull_icon.update_appearance()
hotkeybuttons += pull_icon


zone_select = new /atom/movable/screen/zone_sel/robot()
zone_select.hud = src
zone_select.update_icon()
zone_select.update_appearance()
static_inventory += zone_select


Expand Down Expand Up @@ -269,20 +269,19 @@
/atom/movable/screen/robot/lamp
name = "headlamp"
icon_state = "lamp_off"
base_icon_state = "lamp"
var/mob/living/silicon/robot/robot

/atom/movable/screen/robot/lamp/Click()
. = ..()
if(.)
return
robot?.toggle_headlamp()
update_icon()
update_appearance()

/atom/movable/screen/robot/lamp/update_icon()
if(robot?.lamp_enabled)
icon_state = "lamp_on"
else
icon_state = "lamp_off"
/atom/movable/screen/robot/lamp/update_icon_state()
icon_state = "[base_icon_state]_[robot?.lamp_enabled ? "on" : "off"]"
return ..()

/atom/movable/screen/robot/modPC
name = "Modular Interface"
Expand Down
Loading

0 comments on commit b033e1e

Please sign in to comment.