forked from Monkestation/Vanderlin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreen_objects.dm
More file actions
2005 lines (1740 loc) · 52 KB
/
screen_objects.dm
File metadata and controls
2005 lines (1740 loc) · 52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Screen objects
Todo: improve/re-implement
Screen objects are only used for the hud and should not appear anywhere "in-game".
They are used with the client/screen list and the screen_loc var.
For more information, see the byond documentation on the screen_loc and screen vars.
*/
/atom/movable/screen
name = ""
icon = 'icons/mob/screen_gen.dmi'
plane = HUD_PLANE
appearance_flags = APPEARANCE_UI
/// A reference to the object in the slot. Grabs or items, generally, but any datum will do.
var/datum/weakref/master_ref = null
/// A reference to the owner HUD, if any.
VAR_PRIVATE/datum/hud/hud = null
var/lastclick
var/category
/atom/movable/screen/Initialize(mapload, datum/hud/hud_owner)
. = ..()
if(isnull(hud_owner)) //some screens set their hud owners on /new, this prevents overriding them with null post atoms init
return
set_new_hud(hud_owner)
/atom/movable/screen/Destroy(force)
master_ref = null
hud = null
return ..()
/atom/movable/screen/Click(location, control, params)
if(!usr || !usr.client)
return FALSE
var/mob/user = usr
var/list/modifiers = params2list(params)
if(LAZYACCESS(modifiers, LEFT_CLICK) && LAZYACCESS(modifiers, SHIFT_CLICKED)) // screen objects don't do the normal Click() stuff so we'll cheat
examine_ui(user)
return FALSE
/atom/movable/screen/proc/examine_ui(mob/user)
var/list/inspec = list("----------------------")
inspec += "<br><span class='notice'><b>[name]</b></span>"
if(desc)
inspec += "<br>[desc]"
inspec += "[extra_info(user)]"
inspec += "<br>----------------------"
to_chat(user, "[inspec.Join()]")
/atom/movable/screen/proc/extra_info(mob/user)
return
/atom/movable/screen/orbit()
return
/atom/movable/screen/proc/component_click(atom/movable/screen/component_button/component, params)
return
/atom/movable/screen/text
icon = null
icon_state = null
layer = FLOAT_LAYER
plane = HUD_PLANE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
screen_loc = "CENTER-7,CENTER-7"
maptext_height = 480
maptext_width = 480
/atom/movable/screen/swap_hand
plane = HUD_PLANE
name = "swap hand"
/atom/movable/screen/swap_hand/Click()
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
if(world.time <= usr.next_move)
return 1
if(ismob(usr))
var/mob/M = usr
M.swap_hand()
return 1
/atom/movable/screen/skills
name = "skills"
icon_state = "skills"
screen_loc = ui_skill_menu
/atom/movable/screen/skills/Click(location, control, params)
var/list/modifiers = params2list(params)
if(LAZYACCESS(modifiers, SHIFT_CLICKED))
if(ishuman(usr))
var/mob/living/L = usr
var/datum/language_holder/H = L.get_language_holder()
H.open_language_menu(usr)
return
if(LAZYACCESS(modifiers, RIGHT_CLICK))
var/ht
var/mob/living/L = usr
to_chat(L, "*----*")
if(ishuman(usr))
var/mob/living/carbon/human/M = usr
for(var/datum/quirk/vice/vices in M.quirks)
to_chat(M, "<span class='info'>[vices.get_desc()]</span>")
to_chat(M, "*----*")
if(M.mind)
if(M.mind.language_holder)
if(!length(M.mind.language_holder.languages))
to_chat(M, "<span class='warning'>I don't know any languages.</span>")
else
for(var/X in M.mind.language_holder.languages)
var/datum/language/LA = GLOB.language_datum_instances[X]
to_chat(M, "<span class='info'>[LA.name] - ,[LA.key]</span>")
to_chat(M, "*----*")
for(var/X in GLOB.roguetraits)
if(HAS_TRAIT(L, X))
to_chat(L, "[X] - <span class='info'>[GLOB.roguetraits[X]]</span>")
ht = TRUE
if(!ht)
to_chat(L, "<span class='warning'>I have no special traits.</span>")
to_chat(L, "*----*")
return
if(!LAZYACCESS(modifiers, CTRL_CLICKED))
usr.attributes?.ui_interact(usr)
return
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
H.print_skill_levels(H)
/atom/movable/screen/craft
name = "crafting menu"
icon_state = "craft"
screen_loc = rogueui_craft
var/last_craft
var/obj/item/recipe_book/always_known/book
/atom/movable/screen/craft/Click(location, control, params)
var/list/modifiers = params2list(params)
if(modifiers["middle"])
if(QDELETED(book))
book = new(null)
var/mob/M = usr
for(var/datum/recipe as anything in M.mind?.learned_recipes)
book.types |= recipe.type
book.generate_categories()
usr << browse(book.generate_html(usr),"window=recipe;size=800x810")
return
if(world.time < lastclick + 3 SECONDS)
return
lastclick = world.time
if(!HAS_TRAIT(usr, TRAIT_BLUEPRINT_VISION))
var/mob/vision = usr
vision.enter_blueprint()
else
var/mob/vision = usr
REMOVE_TRAIT(usr, TRAIT_BLUEPRINT_VISION, TRAIT_GENERIC)
vision.blueprints.quit()
vision.blueprints = null
/atom/movable/screen/craft/Destroy()
QDEL_NULL(book)
. = ..()
/atom/movable/screen/area_creator
name = "create new area"
icon_state = "area_edit"
screen_loc = ui_building
/atom/movable/screen/area_creator/Click()
if(usr.incapacitated(IGNORE_GRAB) || (isobserver(usr) && !IsAdminGhost(usr)))
return TRUE
var/area/A = get_area(usr)
if(!A.outdoors)
to_chat(usr, "<span class='warning'>There is already a defined structure here.</span>")
return TRUE
create_area(usr)
/atom/movable/screen/language_menu
name = "language menu"
icon_state = "talk_wheel"
screen_loc = ui_language_menu
/atom/movable/screen/language_menu/Click()
var/mob/M = usr
var/datum/language_holder/H = M.get_language_holder()
H.open_language_menu(usr)
/atom/movable/screen/inventory
/// The identifier for the slot. It has nothing to do with ID cards.
var/slot_id
/// Icon when empty. For now used only by humans.
var/icon_empty
/// Icon when contains an item. For now used only by humans.
var/icon_full = "genslot"
/// The overlay when hovering over with an item in your hand
plane = HUD_PLANE
no_over_text = FALSE
/atom/movable/screen/inventory/Click(location, control, params)
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
if(world.time <= usr.next_move)
return TRUE
if(usr.incapacitated(IGNORE_GRAB))
return TRUE
if(hud?.mymob && slot_id)
var/obj/item/inv_item = hud.mymob.get_item_by_slot(slot_id)
if(inv_item)
return inv_item.Click(location, control, params)
if(usr.attack_ui(slot_id, params))
usr.update_inv_hands()
return TRUE
/atom/movable/screen/inventory/MouseEntered(location, control, params)
. = ..()
add_overlays()
/atom/movable/screen/inventory/MouseExited()
..()
if(hud)
cut_overlay(hud.object_overlay)
QDEL_NULL(hud.object_overlay)
/atom/movable/screen/inventory/update_icon_state()
if(!icon_empty)
icon_empty = icon_state
if(hud?.mymob && slot_id && icon_full)
var/obj/item/I = hud.mymob.get_item_by_slot(slot_id)
if(I)
icon_state = icon_full
if(I.uses_integrity)
if(I.obj_broken)
icon_state = "slotbroke"
else if(I.get_integrity() < I.max_integrity)
icon_state = "slotdmg"
else
icon_state = icon_empty
return ..()
/atom/movable/screen/inventory/proc/add_overlays()
var/mob/user = hud?.mymob
cut_overlays()
if(!user || !slot_id)
return
var/obj/item/holding = user.get_active_held_item()
if(!holding || user.get_item_by_slot(slot_id))
return
var/image/item_overlay = image(holding)
item_overlay.alpha = 92
if(!user.can_equip(holding, slot_id, disable_warning = TRUE, bypass_equip_delay_self = TRUE))
item_overlay.color = "#fd0279"
else
item_overlay.color = "#c5c5c5"
if(hud)
if(hud.object_overlay)
if(hud.overlay_curloc != src)
hud.overlay_curloc.cut_overlay(hud.object_overlay)
hud.overlay_curloc = src
cut_overlay(hud.object_overlay)
hud.object_overlay = item_overlay
add_overlay(hud.object_overlay)
/atom/movable/screen/inventory/hand
no_over_text = TRUE
var/mutable_appearance/handcuff_overlay
var/static/mutable_appearance/blocked_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "blocked")
var/static/mutable_appearance/fingerless_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "fingerless")
var/static/mutable_appearance/grabbed_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "grabbed")
var/held_index = 0
/atom/movable/screen/inventory/hand/update_overlays()
. = ..()
if(!handcuff_overlay)
var/state = (!(held_index % 2)) ? "markus" : "gabrielle"
handcuff_overlay = mutable_appearance('icons/mob/screen_gen.dmi', state)
if(!hud?.mymob)
return
if(iscarbon(hud.mymob))
var/mob/living/carbon/C = hud.mymob
if(C.handcuffed)
. += handcuff_overlay
if(held_index)
if(!C.has_hand_for_held_index(held_index))
. += blocked_overlay
else if(C.check_arm_grabbed(held_index))
. += grabbed_overlay
else if(!C.has_hand_for_held_index(held_index, TRUE))
. += fingerless_overlay
if(held_index == hud.mymob.active_hand_index)
. += "hand_active"
/atom/movable/screen/inventory/hand/add_overlays()
return
/atom/movable/screen/inventory/hand/Click(location, control, params)
// At this point in client Click() code we have passed the 1/10 sec check and little else
// We don't even know if it's a middle click
var/mob/user = hud?.mymob
if(usr != user)
return TRUE
if(world.time <= user.next_move)
return TRUE
if(user.active_hand_index == held_index)
var/obj/item/I = user.get_active_held_item()
if(I)
I.Click(location, control, params)
else
user.swap_hand(held_index)
return TRUE
/atom/movable/screen/drop
name = "drop"
icon_state = "act_drop"
plane = HUD_PLANE
/atom/movable/screen/drop/Click()
if(ismob(usr))
var/mob/M = usr
M.playsound_local(M, 'sound/misc/click.ogg', 100)
if(usr.stat == CONSCIOUS)
usr.dropItemToGround(usr.get_active_held_item(), silent = FALSE)
/atom/movable/screen/act_intent
name = "intent"
icon_state = "help"
screen_loc = ui_acti
/atom/movable/screen/act_intent/Click(location, control, params)
usr.a_intent_change(INTENT_HOTKEY_RIGHT)
/atom/movable/screen/act_intent/proc/switch_intent(index as num)
return
/atom/movable/screen/act_intent/rogintent
name = ""
desc = ""
icon = 'icons/mob/rogueintentbase.dmi'
icon_state = "intentbase"
screen_loc = rogueui_intents
var/intent1
var/intent2
var/intent3
var/intent4
var/border1
var/border2
/atom/movable/screen/act_intent/rogintent/update_overlays()
. = ..()
. += intent1
. += intent2
. += intent3
. += intent4
. += border1
. += border2
/atom/movable/screen/act_intent/rogintent/proc/update(list/left_intents, list/right_intents, active = FALSE)
if(!left_intents || !right_intents)
return
if(!hud?.mymob)
return
var/lol = 0
intent1 = null
intent2 = null
intent3 = null
intent4 = null
var/list/used = right_intents
if(hud.mymob.active_hand_index == 1)
used = left_intents
for(var/datum/intent/intenty as anything in used)
lol++
switch(lol)
if(1)
intent1 = image(icon='icons/mob/roguehud.dmi',icon_state=intenty.icon_state, pixel_x = 64, pixel_y = 16, layer = layer+0.02)
if(2)
intent2 = image(icon='icons/mob/roguehud.dmi',icon_state=intenty.icon_state, pixel_x = 96, pixel_y = 16, layer = layer+0.02)
if(3)
intent3 = image(icon='icons/mob/roguehud.dmi',icon_state=intenty.icon_state, pixel_x = 64, layer = layer+0.02)
if(4)
intent4 = image(icon='icons/mob/roguehud.dmi',icon_state=intenty.icon_state, pixel_x = 96, layer = layer+0.02)
if(ismob(usr))
var/mob/M = usr
switch_intent(M.r_index, M.l_index, active)
update_appearance(UPDATE_OVERLAYS)
/atom/movable/screen/act_intent/rogintent/switch_intent(r_index, l_index)
var/used = "offintent"
if(!r_index || !l_index)
return
var/used_index = r_index
var/other = l_index
if(hud.mymob.active_hand_index == 1)
used_index = l_index
other = r_index
switch(used_index)
if(1)
border1 = image(icon='icons/mob/roguehud.dmi', icon_state="intentselected", pixel_x = 64, pixel_y = 16, layer = layer+0.01)
if(2)
border1 = image(icon='icons/mob/roguehud.dmi', icon_state="intentselected", pixel_x = 96, pixel_y = 16, layer = layer+0.01)
if(3)
border1 = image(icon='icons/mob/roguehud.dmi', icon_state="intentselected", pixel_x = 64, layer = layer+0.01)
if(4)
border1 = image(icon='icons/mob/roguehud.dmi', icon_state="intentselected", pixel_x = 96, layer = layer+0.01)
switch(other)
if(1)
border2 = image(icon='icons/mob/roguehud.dmi', icon_state=used, pixel_x = 64, pixel_y = 16, layer = layer+0.01)
if(2)
border2 = image(icon='icons/mob/roguehud.dmi', icon_state=used, pixel_x = 96, pixel_y = 16, layer = layer+0.01)
if(3)
border2 = image(icon='icons/mob/roguehud.dmi', icon_state=used, pixel_x = 64, layer = layer+0.01)
if(4)
border2 = image(icon='icons/mob/roguehud.dmi', icon_state=used, pixel_x = 96, layer = layer+0.01)
update_appearance(UPDATE_OVERLAYS)
/atom/movable/screen/act_intent/rogintent/Click(location, control, params)
var/list/modifiers = params2list(params)
var/mob/user = hud?.mymob
if(usr != user)
return TRUE
user.playsound_local(user, 'sound/misc/click.ogg', 100)
var/_x = text2num(LAZYACCESS(modifiers, ICON_X))
var/_y = text2num(LAZYACCESS(modifiers, ICON_Y))
var/clicked = get_index_at_loc(_x, _y)
if(!clicked)
return
if(LAZYACCESS(modifiers, LEFT_CLICK))
if(LAZYACCESS(modifiers, SHIFT_CLICKED))
user.examine_intent(clicked, FALSE)
return
user.rog_intent_change(clicked)
/atom/movable/screen/act_intent/rogintent/proc/get_index_at_loc(xl, yl)
/* if(xl<=64)
if(xl<32)
if(yl>16)
return 1
else
return 3
else
if(yl>16)
return 2
else
return 4
else*/
if(xl > 64)
if(xl<96)
if(yl>16)
return 1
else
return 3
else
if(yl>16)
return 2
else
return 4
//
/atom/movable/screen/quad_intents
name = "mmb intents"
icon_state = "mmbintents0"
icon = 'icons/mob/roguehud.dmi'
screen_loc = rogueui_quad
/atom/movable/screen/quad_intents/proc/switch_intent(input)
icon_state = "mmbintents0"
if(input in 1 to 4)
icon_state = "mmbintents[input]"
/atom/movable/screen/quad_intents/Click(location, control, params)
if(ismob(usr))
var/mob/M = usr
M.playsound_local(M, 'sound/misc/click.ogg', 100)
var/list/modifiers = params2list(params)
var/_y = text2num(LAZYACCESS(modifiers, ICON_Y))
if(_y<=9)
usr.mmb_intent_change(QINTENT_STEAL)
else if(_y>=9 && _y<=16)
usr.mmb_intent_change(QINTENT_KICK)
else if(_y>=17 && _y<=24)
usr.mmb_intent_change(QINTENT_JUMP)
else if(_y>=24 && _y<=32)
usr.mmb_intent_change(QINTENT_BITE)
/atom/movable/screen/give_intent
name = "give/take"
icon_state = "take0"
icon = 'icons/mob/roguehud.dmi'
screen_loc = rogueui_give
var/giving = FALSE
/atom/movable/screen/give_intent/proc/switch_intent(ass)
if(ass == QINTENT_GIVE)
giving = TRUE
else
giving = FALSE
update_appearance(UPDATE_ICON_STATE)
/atom/movable/screen/give_intent/Click(location, control, params)
if(ismob(usr))
var/mob/M = usr
M.playsound_local(M, 'sound/misc/click.ogg', 100)
usr.mmb_intent_change(QINTENT_GIVE)
/atom/movable/screen/give_intent/update_icon_state()
..()
if(ismob(usr))
var/mob/M = usr
if(M.get_active_held_item())
icon_state = "give[giving]"
else
icon_state = "take[giving]"
/atom/movable/screen/def_intent
name = "defense intent"
icon_state = "def1n"
icon = 'icons/mob/roguehud.dmi'
screen_loc = rogueui_def
/atom/movable/screen/def_intent/update_icon_state()
. = ..()
icon_state = "def[hud.mymob.d_intent]n"
/atom/movable/screen/def_intent/Click(location, control, params)
var/list/modifiers = params2list(params)
var/_y = text2num(LAZYACCESS(modifiers, ICON_Y))
if(_y>=0 && _y<17)
usr.def_intent_change(INTENT_DODGE)
else if(_y>16 && _y<=32)
usr.def_intent_change(INTENT_PARRY)
/atom/movable/screen/cmode
name = "combat mode"
icon_state = "combat0"
icon = 'icons/mob/roguehud.dmi'
screen_loc = rogueui_cmode
/atom/movable/screen/cmode/Click(location, control, params)
var/list/modifiers = params2list(params)
if(isliving(usr))
var/mob/living/L = usr
L.playsound_local(L, 'sound/misc/click.ogg', 100)
if(LAZYACCESS(modifiers, RIGHT_CLICK))
L.submit()
else
L.toggle_cmode()
update_appearance(UPDATE_ICON_STATE)
/atom/movable/screen/cmode/update_icon_state()
. = ..()
icon_state = "combat[hud?.mymob?.cmode]"
/atom/movable/screen/mov_intent
name = "run/walk toggle"
icon_state = "running"
/atom/movable/screen/mov_intent/Click(location, control, params)
toggle(usr)
/atom/movable/screen/mov_intent/update_icon_state()
. = ..()
switch(hud?.mymob?.m_intent)
if(MOVE_INTENT_WALK)
icon_state = "walking"
if(MOVE_INTENT_RUN)
icon_state = "running"
/atom/movable/screen/mov_intent/proc/toggle(mob/user)
if(isobserver(user))
return
user.toggle_move_intent(user)
update_appearance(UPDATE_ICON_STATE)
/atom/movable/screen/rogmove
name = "sneak mode"
icon = 'icons/mob/roguehud.dmi'
icon_state = "sneak0"
screen_loc = rogueui_moves
/atom/movable/screen/rogmove/Click(location, control, params)
var/mob/M = usr
toggle(M)
/atom/movable/screen/rogmove/proc/toggle(mob/user)
if(isobserver(user))
return
if(user.m_intent == MOVE_INTENT_SNEAK)
user.toggle_rogmove_intent(MOVE_INTENT_WALK)
else
user.toggle_rogmove_intent(MOVE_INTENT_SNEAK)
update_appearance(UPDATE_ICON_STATE)
user.update_sneak_invis()
/atom/movable/screen/rogmove/update_icon_state()
. = ..()
if(hud?.mymob?.m_intent == MOVE_INTENT_SNEAK)
icon_state = "sneak1"
else
icon_state = "sneak0"
/atom/movable/screen/rogmove/sprint
name = "sprint mode"
icon = 'icons/mob/roguehud.dmi'
icon_state = "sprint0"
screen_loc = rogueui_moves
/atom/movable/screen/rogmove/sprint/toggle(mob/user)
if(isobserver(user))
return
if(user.m_intent == MOVE_INTENT_RUN)
user.toggle_rogmove_intent(MOVE_INTENT_WALK)
else
user.toggle_rogmove_intent(MOVE_INTENT_RUN)
update_appearance(UPDATE_ICON_STATE)
/atom/movable/screen/rogmove/sprint/update_icon_state()
. = ..()
if(hud?.mymob?.m_intent == MOVE_INTENT_RUN)
icon_state = "sprint1"
else
icon_state = "sprint0"
/atom/movable/screen/advsetup
name = ""
icon = null
icon_state = ""
/atom/movable/screen/advsetup/Initialize(mapload, datum/hud/hud_owner)
. = ..()
addtimer(CALLBACK(src, PROC_REF(check_mob)), 3 SECONDS)
/atom/movable/screen/advsetup/Destroy()
hud?.static_inventory -= src
return ..()
/atom/movable/screen/advsetup/proc/check_mob()
if(QDELETED(src))
return
if(!hud)
qdel(src)
return
if(!ishuman(hud.mymob))
qdel(src)
return
var/mob/living/carbon/human/H = hud.mymob
if(H.mind && H.mind.antag_datums)
for(var/datum/antagonist/D in H.mind.antag_datums)
if(istype(D, /datum/antagonist/vampire))
qdel(src)
return
if(H.advsetup)
alpha = 0
icon = 'icons/mob/advsetup.dmi'
animate(src, alpha = 255, time = 30)
/atom/movable/screen/advsetup/Click(location,control,params)
if(!hud)
qdel(src)
return
if(!ishuman(hud.mymob))
qdel(src)
return
var/mob/living/carbon/human/H = hud.mymob
if(!H.advsetup)
qdel(src)
return
else
SSrole_class_handler.setup_class_handler(H)
/atom/movable/screen/eye_intent
name = "eye intent"
icon = 'icons/mob/roguehud.dmi'
icon_state = "eye"
/atom/movable/screen/eye_intent/Click(location,control,params)
var/list/modifiers = params2list(params)
var/_y = text2num(LAZYACCESS(modifiers, ICON_Y))
hud.mymob.playsound_local(hud.mymob, 'sound/misc/click.ogg', 100)
if(isliving(hud?.mymob))
var/mob/living/L = hud.mymob
if(L.eyesclosed)
L.set_eyes_closed(FALSE)
return
if(LAZYACCESS(modifiers, LEFT_CLICK))
if(_y>=29 || _y<=4)
if(isliving(hud.mymob))
var/mob/living/L = hud.mymob
L.set_eyes_closed(TRUE)
else
toggle(usr)
if(LAZYACCESS(modifiers, MIDDLE_CLICK))
if(isliving(hud.mymob))
var/mob/living/L = hud.mymob
L.look_up()
update_appearance(UPDATE_ICON)
if(LAZYACCESS(modifiers, RIGHT_CLICK))
if(isliving(hud.mymob))
var/mob/living/L = hud.mymob
L.look_around()
/atom/movable/screen/eye_intent/update_icon_state()
. = ..()
var/mob/living/L = hud.mymob
if(!istype(L))
icon_state = "eye"
return
if(L.eyesclosed)
icon_state = "eye_closed"
else if(L.tempfixeye)
icon_state = "eye_target"
else if(L.fixedeye)
icon_state = "eye_fixed"
else
icon_state = "eye"
/atom/movable/screen/eye_intent/update_overlays()
. = ..()
var/mob/living/carbon/human/human = hud.mymob
if(!istype(human))
return
var/mutable_appearance/iris = mutable_appearance(src.icon, "oeye")
switch(icon_state)
if("eye_closed")
iris.icon_state = "oeye_closed"
if("eye_target")
iris.icon_state = "oeye_target"
if("eye_fixed")
iris.icon_state = "oeye_fixed"
else
iris.icon_state = "oeye"
iris.color = human.get_eye_color()
. += iris
/atom/movable/screen/eye_intent/proc/toggle(mob/user)
if(isobserver(user))
return
user.toggle_eye_intent(user)
/atom/movable/screen/pull
name = "stop pulling"
icon_state = "pull"
/atom/movable/screen/pull/Click()
if(isobserver(usr))
return
usr.stop_pulling()
/atom/movable/screen/pull/update_icon_state()
if(hud?.mymob?.pulling)
icon_state = "pull"
else
icon_state = "pull0"
return ..()
/atom/movable/screen/rest
name = "rest"
icon_state = "act_rest"
plane = HUD_PLANE
/atom/movable/screen/rest/Click()
if(isliving(usr))
var/mob/living/L = usr
L.lay_down()
/atom/movable/screen/rest/update_icon_state()
var/mob/living/user = hud?.mymob
if(!istype(user))
return
if(!user.resting)
icon_state = "act_rest"
else
icon_state = "act_rest0"
return ..()
/atom/movable/screen/restup
name = "stand up"
icon_state = "act_rest_up"
plane = HUD_PLANE
/atom/movable/screen/restup/Click(location, control, params)
var/list/modifiers = params2list(params)
if(isliving(usr))
var/mob/living/L = usr
if(LAZYACCESS(modifiers, RIGHT_CLICK))
L.look_up()
else
L.stand_up()
/atom/movable/screen/restdown
name = "lay down"
icon_state = "act_rest_down"
plane = HUD_PLANE
/atom/movable/screen/restdown/Click(location, control, params)
var/list/modifiers = params2list(params)
if(isliving(usr))
var/mob/living/L = usr
if(LAZYACCESS(modifiers, RIGHT_CLICK))
var/turf/O
for(var/turf/T in range(1, L))
if(istransparentturf(T))
O = T
break
L.look_down(O)
else
L.lay_down()
/atom/movable/screen/storage
name = "storage"
icon_state = "block"
screen_loc = "7,7 to 10,8"
plane = HUD_PLANE
/atom/movable/screen/storage/Initialize(mapload, datum/hud/hud_owner, obj/item/new_master)
. = ..()
master_ref = WEAKREF(new_master)
/atom/movable/screen/storage/Click(location, control, params)
var/list/modifiers = params2list(params)
var/obj/item/master = master_ref?.resolve()
if(LAZYACCESS(modifiers, RIGHT_CLICK))
if(master)
var/obj/item/flipper = usr.get_active_held_item()
if(!flipper || (!usr.Adjacent(flipper) && !usr.DirectAccess(flipper)) || !isliving(usr) || usr.incapacitated(IGNORE_GRAB))
return
var/old_width = flipper.grid_width
var/old_height = flipper.grid_height
flipper.grid_height = old_width
flipper.grid_width = old_height
update_hovering(location, control, modifiers)
return
if(world.time <= usr.next_move)
return TRUE
if(usr.incapacitated(IGNORE_GRAB))
return TRUE
if(master)
var/obj/item/I = usr.get_active_held_item()
if(I)
master.attackby(src, I, usr, modifiers, TRUE)
return TRUE
/atom/movable/screen/throw_catch
name = "throw/catch"
icon_state = "catch0"
var/throwy = 0
/atom/movable/screen/throw_catch/Click()
if(iscarbon(usr))
var/mob/living/carbon/C = usr
C.toggle_throw_mode()
/atom/movable/screen/throw_catch/update_icon_state()
. = ..()
if(!ismob(usr))
return
var/mob/M = usr
if(M.get_active_held_item())
icon_state = "throw[throwy]"
else
icon_state = "catch[throwy]"
/atom/movable/screen/zone_sel
name = "damage zone"
icon_state = "m-zone_sel"
screen_loc = rogueui_targetdoll
var/overlay_icon = 'icons/mob/roguehud64.dmi'
var/static/list/hover_overlays_cache = list()
var/hovering
var/arrowheight = 0
/atom/movable/screen/zone_sel/Click(location, control,params)
if(isobserver(usr))
return
var/list/modifiers = params2list(params)
var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
var/choice = get_zone_at(icon_x, icon_y)
if(ismob(hud.mymob))
var/mob/M = hud.mymob
if(M.gender == FEMALE)
choice = get_zone_at(icon_x, icon_y, FEMALE)
if (!choice)
return 1
if(LAZYACCESS(modifiers, RIGHT_CLICK) && ishuman(hud.mymob))
var/mob/living/carbon/human/H = hud.mymob
return H.check_limb_for_injuries(H, choice = check_zone(choice))
else
return set_selected_zone(choice, usr)
/atom/movable/screen/zone_sel/MouseEntered(location, control, params)
MouseMove(location, control, params)
/atom/movable/screen/zone_sel/MouseMove(location, control, params)
if(isobserver(usr))
return
var/list/modifiers = params2list(params)
var/icon_x = text2num(LAZYACCESS(modifiers, ICON_X))
var/icon_y = text2num(LAZYACCESS(modifiers, ICON_Y))
var/choice = get_zone_at(icon_x, icon_y)
choice = "m_[choice]"
if(ismob(hud.mymob))
var/mob/M = hud.mymob
if(M.gender == FEMALE)
choice = get_zone_at(icon_x, icon_y, FEMALE)
choice = "f_[choice]"
if(hovering == choice)
return
vis_contents -= hover_overlays_cache[hovering]
hovering = choice
var/obj/effect/overlay/zone_sel/overlay_object = hover_overlays_cache[choice]
if(!overlay_object)
overlay_object = new
// overlay_object.icon_state = "[basedholder]-[choice]"
overlay_object.icon_state = "[choice]"
hover_overlays_cache[choice] = overlay_object
vis_contents += overlay_object
/obj/effect/overlay/zone_sel
icon = 'icons/mob/roguehud64.dmi'
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
alpha = 128
anchored = TRUE
plane = ABOVE_HUD_PLANE
/atom/movable/screen/zone_sel/MouseExited(location, control, params)
if(!isobserver(usr) && hovering)
vis_contents -= hover_overlays_cache[hovering]
hovering = null
/atom/movable/screen/zone_sel/proc/get_zone_at(icon_x, icon_y, gender = MALE)
if(gender == MALE)
switch(icon_y)
if(1 to 3)
switch(icon_x)
if(5 to 7)
return BODY_ZONE_PRECISE_R_INHAND
if(17 to 28)
return BODY_ZONE_PRECISE_R_FOOT
if(38 to 49)
return BODY_ZONE_PRECISE_L_FOOT
if(59 to 61)
return BODY_ZONE_PRECISE_L_INHAND
if(4 to 5)
switch(icon_x)
if(5 to 7)
return BODY_ZONE_PRECISE_R_INHAND
if(17 to 28)
return BODY_ZONE_PRECISE_R_FOOT
if(38 to 49)
return BODY_ZONE_PRECISE_L_FOOT