Skip to content

Commit dd06816

Browse files
LikeLakers2JohnFulpWillardSmArtKarLemonInTheDarkBen10Omintrix
authored
[PORTS] HUD Screen stuff (#5830)
## About The Pull Request This PR ports the following PRs from tgstation: * tgstation/tgstation#76772 * tgstation/tgstation#88307 - Caused by 76772 * tgstation/tgstation#78066 - Caused by 76772 * tgstation/tgstation#83987 * tgstation/tgstation#76443 (Partial - just the code to support the other PRs) These changes are intended to fix various issues regarding HUDs. NOTE: While testing, I encountered certain HUD-related issues. The following is a list of issues I know NOT to be the result of this PR: * The Character setup screen would show your characters as super-tiny. (This is a bug caused by 516; reverting to 515 fixes the issue.) * The asterisk next to runechat emotes, as well as the mouse icons shown below the name of certain hovered objects, being much bigger. (This is a bug caused by 516; reverting to 515 fixes the issue.) * Taking possession of a `/mob/living/basic/possession_holder` will give you a black screen. (This is a bug caused by 516; reverting to 515 fixes the issue.) ## Why It's Good For The Game Bugfixes and better code. ## Changelog :cl:MichiRecRoom refactor: The code behind many HUD systems has been refactored slightly. Due to the massive amount of HUD types we have, I only tested monkestation-specific HUDs - so please let me know if you see any broken HUDs! refactor: (JohnFulpWillard) Huds now have their hud owner set in Initialize /:cl: --------- Co-authored-by: John Willard <[email protected]> Co-authored-by: SmArtKar <[email protected]> Co-authored-by: LemonInTheDark <[email protected]> Co-authored-by: Ben10Omintrix <[email protected]>
1 parent 5004743 commit dd06816

File tree

55 files changed

+335
-451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+335
-451
lines changed

code/_onclick/click.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@
558558
M.Scale(px/sx, py/sy)
559559
transform = M
560560

561-
/atom/movable/screen/click_catcher/Initialize(mapload)
561+
/atom/movable/screen/click_catcher/Initialize(mapload, datum/hud/hud_owner)
562562
. = ..()
563563
RegisterSignal(SSmapping, COMSIG_PLANE_OFFSET_INCREASE, PROC_REF(offset_increased))
564564
offset_increased(SSmapping, 0, SSmapping.max_plane_offset)

code/_onclick/hud/action_button.dm

+5-5
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@
276276

277277
/atom/movable/screen/button_palette/Destroy()
278278
if(our_hud)
279-
our_hud.mymob?.client?.screen -= src
279+
our_hud.mymob?.canon_client?.screen -= src
280280
our_hud.toggle_palette = null
281281
our_hud = null
282282
return ..()
283283

284-
/atom/movable/screen/button_palette/Initialize(mapload)
284+
/atom/movable/screen/button_palette/Initialize(mapload, datum/hud/hud_owner)
285285
. = ..()
286286
update_appearance()
287287

@@ -441,7 +441,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
441441

442442
/atom/movable/screen/palette_scroll/down/Destroy()
443443
if(our_hud)
444-
our_hud.mymob?.client?.screen -= src
444+
our_hud.mymob?.canon_client?.screen -= src
445445
our_hud.palette_down = null
446446
our_hud = null
447447
return ..()
@@ -454,7 +454,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
454454

455455
/atom/movable/screen/palette_scroll/up/Destroy()
456456
if(our_hud)
457-
our_hud.mymob?.client?.screen -= src
457+
our_hud.mymob?.canon_client?.screen -= src
458458
our_hud.palette_up = null
459459
our_hud = null
460460
return ..()
@@ -472,7 +472,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
472472
/atom/movable/screen/action_landing/Destroy()
473473
if(owner)
474474
owner.landing = null
475-
owner?.owner?.mymob?.client?.screen -= src
475+
owner?.owner?.mymob?.canon_client?.screen -= src
476476
owner.refresh_actions()
477477
owner = null
478478
return ..()

code/_onclick/hud/ai.dm

+17-34
Original file line numberDiff line numberDiff line change
@@ -183,106 +183,89 @@
183183
var/mob/living/silicon/ai/myai = mymob
184184

185185
// Language menu
186-
using = new /atom/movable/screen/language_menu
186+
using = new /atom/movable/screen/language_menu(null, src)
187187
using.screen_loc = ui_ai_language_menu
188-
using.hud = src
189188
static_inventory += using
190189

191190
//AI core
192-
using = new /atom/movable/screen/ai/aicore()
191+
using = new /atom/movable/screen/ai/aicore(null, src)
193192
using.screen_loc = ui_ai_core
194-
using.hud = src
195193
static_inventory += using
196194

197195
//Camera list
198-
using = new /atom/movable/screen/ai/camera_list()
196+
using = new /atom/movable/screen/ai/camera_list(null, src)
199197
using.screen_loc = ui_ai_camera_list
200-
using.hud = src
201198
static_inventory += using
202199

203200
//Track
204-
using = new /atom/movable/screen/ai/camera_track()
201+
using = new /atom/movable/screen/ai/camera_track(null, src)
205202
using.screen_loc = ui_ai_track_with_camera
206-
using.hud = src
207203
static_inventory += using
208204

209205
//Camera light
210-
using = new /atom/movable/screen/ai/camera_light()
206+
using = new /atom/movable/screen/ai/camera_light(null, src)
211207
using.screen_loc = ui_ai_camera_light
212-
using.hud = src
213208
static_inventory += using
214209

215210
//Crew Monitoring
216-
using = new /atom/movable/screen/ai/crew_monitor()
211+
using = new /atom/movable/screen/ai/crew_monitor(null, src)
217212
using.screen_loc = ui_ai_crew_monitor
218-
using.hud = src
219213
static_inventory += using
220214

221215
//Crew Manifest
222-
using = new /atom/movable/screen/ai/crew_manifest()
216+
using = new /atom/movable/screen/ai/crew_manifest(null, src)
223217
using.screen_loc = ui_ai_crew_manifest
224-
using.hud = src
225218
static_inventory += using
226219

227220
//Alerts
228-
using = new /atom/movable/screen/ai/alerts()
221+
using = new /atom/movable/screen/ai/alerts(null, src)
229222
using.screen_loc = ui_ai_alerts
230-
using.hud = src
231223
static_inventory += using
232224

233225
//Announcement
234-
using = new /atom/movable/screen/ai/announcement()
226+
using = new /atom/movable/screen/ai/announcement(null, src)
235227
using.screen_loc = ui_ai_announcement
236-
using.hud = src
237228
static_inventory += using
238229

239230
//Shuttle
240-
using = new /atom/movable/screen/ai/call_shuttle()
231+
using = new /atom/movable/screen/ai/call_shuttle(null, src)
241232
using.screen_loc = ui_ai_shuttle
242-
using.hud = src
243233
static_inventory += using
244234

245235
//Laws
246-
using = new /atom/movable/screen/ai/state_laws()
236+
using = new /atom/movable/screen/ai/state_laws(null, src)
247237
using.screen_loc = ui_ai_state_laws
248-
using.hud = src
249238
static_inventory += using
250239

251240
// Modular Interface
252-
using = new /atom/movable/screen/ai/modpc()
241+
using = new /atom/movable/screen/ai/modpc(null, src)
253242
using.screen_loc = ui_ai_mod_int
254-
using.hud = src
255243
static_inventory += using
256244
myai.interfaceButton = using
257245
var/atom/movable/screen/ai/modpc/tabletbutton = using
258246
tabletbutton.robot = myai
259247

260248
//Take image
261-
using = new /atom/movable/screen/ai/image_take()
249+
using = new /atom/movable/screen/ai/image_take(null, src)
262250
using.screen_loc = ui_ai_take_picture
263-
using.hud = src
264251
static_inventory += using
265252

266253
//View images
267-
using = new /atom/movable/screen/ai/image_view()
254+
using = new /atom/movable/screen/ai/image_view(null, src)
268255
using.screen_loc = ui_ai_view_images
269-
using.hud = src
270256
static_inventory += using
271257

272258
//Medical/Security sensors
273-
using = new /atom/movable/screen/ai/sensors()
259+
using = new /atom/movable/screen/ai/sensors(null, src)
274260
using.screen_loc = ui_ai_sensor
275-
using.hud = src
276261
static_inventory += using
277262

278263
//Multicamera mode
279-
using = new /atom/movable/screen/ai/multicam()
264+
using = new /atom/movable/screen/ai/multicam(null, src)
280265
using.screen_loc = ui_ai_multicam
281-
using.hud = src
282266
static_inventory += using
283267

284268
//Add multicamera camera
285-
using = new /atom/movable/screen/ai/add_multicam()
269+
using = new /atom/movable/screen/ai/add_multicam(null, src)
286270
using.screen_loc = ui_ai_add_multicam
287-
using.hud = src
288271
static_inventory += using

code/_onclick/hud/alert.dm

+3-3
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
639639
var/angle = 0
640640
var/mob/living/basic/construct/Cviewer
641641

642-
/atom/movable/screen/alert/bloodsense/Initialize(mapload)
642+
/atom/movable/screen/alert/bloodsense/Initialize(mapload, datum/hud/hud_owner)
643643
. = ..()
644644
narnar = new('icons/hud/screen_alert.dmi', "mini_nar")
645645
START_PROCESSING(SSprocessing, src)
@@ -766,7 +766,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
766766
desc = "Unit's power cell has no charge remaining. No modules available until power cell is recharged."
767767
icon_state = "empty_cell"
768768

769-
/atom/movable/screen/alert/emptycell/Initialize(mapload)
769+
/atom/movable/screen/alert/emptycell/Initialize(mapload, datum/hud/hud_owner)
770770
. = ..()
771771
update_appearance(updates=UPDATE_DESC)
772772

@@ -781,7 +781,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
781781
desc = "Unit's power cell is running low."
782782
icon_state = "low_cell"
783783

784-
/atom/movable/screen/alert/lowcell/Initialize(mapload)
784+
/atom/movable/screen/alert/lowcell/Initialize(mapload, datum/hud/hud_owner)
785785
. = ..()
786786
update_appearance(updates=UPDATE_DESC)
787787

code/_onclick/hud/alien.dm

+12-25
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,16 @@
3737

3838
//begin buttons
3939

40-
using = new /atom/movable/screen/swap_hand()
40+
using = new /atom/movable/screen/swap_hand(null, src)
4141
using.icon = ui_style
4242
using.icon_state = "swap_1"
4343
using.screen_loc = ui_swaphand_position(owner,1)
44-
using.hud = src
4544
static_inventory += using
4645

47-
using = new /atom/movable/screen/swap_hand()
46+
using = new /atom/movable/screen/swap_hand(null, src)
4847
using.icon = ui_style
4948
using.icon_state = "swap_2"
5049
using.screen_loc = ui_swaphand_position(owner,2)
51-
using.hud = src
5250
static_inventory += using
5351

5452
if(isalienhunter(mymob))
@@ -57,64 +55,53 @@
5755
H.leap_icon.screen_loc = ui_alien_storage_r
5856
static_inventory += H.leap_icon
5957

60-
using = new/atom/movable/screen/language_menu
58+
using = new/atom/movable/screen/language_menu(null, src)
6159
using.screen_loc = ui_alien_language_menu
62-
using.hud = src
6360
static_inventory += using
6461

65-
using = new /atom/movable/screen/navigate
62+
using = new /atom/movable/screen/navigate(null, src)
6663
using.screen_loc = ui_alien_navigate_menu
67-
using.hud = src
6864
static_inventory += using
6965

70-
using = new /atom/movable/screen/drop()
66+
using = new /atom/movable/screen/drop(null, src)
7167
using.icon = ui_style
7268
using.screen_loc = ui_drop_throw
73-
using.hud = src
7469
static_inventory += using
7570

76-
using = new /atom/movable/screen/resist()
71+
using = new /atom/movable/screen/resist(null, src)
7772
using.icon = ui_style
7873
using.screen_loc = ui_above_movement
79-
using.hud = src
8074
hotkeybuttons += using
8175

82-
throw_icon = new /atom/movable/screen/throw_catch()
76+
throw_icon = new /atom/movable/screen/throw_catch(null, src)
8377
throw_icon.icon = ui_style
8478
throw_icon.screen_loc = ui_drop_throw
85-
throw_icon.hud = src
8679
hotkeybuttons += throw_icon
8780

88-
pull_icon = new /atom/movable/screen/pull()
81+
pull_icon = new /atom/movable/screen/pull(null, src)
8982
pull_icon.icon = ui_style
9083
pull_icon.update_appearance()
9184
pull_icon.screen_loc = ui_above_movement
92-
pull_icon.hud = src
9385
static_inventory += pull_icon
9486

9587
//begin indicators
9688

97-
healths = new /atom/movable/screen/healths/alien()
98-
healths.hud = src
89+
healths = new /atom/movable/screen/healths/alien(null, src)
9990
infodisplay += healths
10091

101-
alien_plasma_display = new /atom/movable/screen/alien/plasma_display()
102-
alien_plasma_display.hud = src
92+
alien_plasma_display = new /atom/movable/screen/alien/plasma_display(null, src)
10393
infodisplay += alien_plasma_display
10494

10595
if(!isalienqueen(mymob))
106-
alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder
107-
alien_queen_finder.hud = src
96+
alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder(null, src)
10897
infodisplay += alien_queen_finder
10998

110-
zone_select = new /atom/movable/screen/zone_sel/alien()
111-
zone_select.hud = src
99+
zone_select = new /atom/movable/screen/zone_sel/alien(null, src)
112100
zone_select.update_appearance()
113101
static_inventory += zone_select
114102

115103
for(var/atom/movable/screen/inventory/inv in (static_inventory + toggleable_inventory))
116104
if(inv.slot_id)
117-
inv.hud = src
118105
inv_slots[TOBITSHIFT(inv.slot_id) + 1] = inv
119106
inv.update_appearance()
120107

code/_onclick/hud/alien_larva.dm

+6-12
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,26 @@
66
..()
77
var/atom/movable/screen/using
88

9-
healths = new /atom/movable/screen/healths/alien()
10-
healths.hud = src
9+
healths = new /atom/movable/screen/healths/alien(null, src)
1110
infodisplay += healths
1211

13-
alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder()
14-
alien_queen_finder.hud = src
12+
alien_queen_finder = new /atom/movable/screen/alien/alien_queen_finder(null, src)
1513
infodisplay += alien_queen_finder
1614

17-
pull_icon = new /atom/movable/screen/pull()
15+
pull_icon = new /atom/movable/screen/pull(null, src)
1816
pull_icon.icon = 'icons/hud/screen_alien.dmi'
1917
pull_icon.update_appearance()
2018
pull_icon.screen_loc = ui_above_movement
21-
pull_icon.hud = src
2219
hotkeybuttons += pull_icon
2320

24-
using = new/atom/movable/screen/language_menu
21+
using = new/atom/movable/screen/language_menu(null, src)
2522
using.screen_loc = ui_alien_language_menu
26-
using.hud = src
2723
static_inventory += using
2824

29-
using = new /atom/movable/screen/navigate
25+
using = new /atom/movable/screen/navigate(null, src)
3026
using.screen_loc = ui_alien_navigate_menu
31-
using.hud = src
3227
static_inventory += using
3328

34-
zone_select = new /atom/movable/screen/zone_sel/alien()
35-
zone_select.hud = src
29+
zone_select = new /atom/movable/screen/zone_sel/alien(null, src)
3630
zone_select.update_appearance()
3731
static_inventory += zone_select

0 commit comments

Comments
 (0)