-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathalert.dm
891 lines (743 loc) · 31.5 KB
/
alert.dm
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
//A system to manage and display alerts on screen without needing you to do it yourself
//PUBLIC - call these wherever you want
/**
*Proc to create or update an alert. Returns the alert if the alert is new or updated, 0 if it was thrown already
*category is a text string. Each mob may only have one alert per category; the previous one will be replaced
*path is a type path of the actual alert type to throw
*severity is an optional number that will be placed at the end of the icon_state for this alert
*for example, high pressure's icon_state is "highpressure" and can be serverity 1 or 2 to get "highpressure1" or "highpressure2"
*new_master is optional and sets the alert's icon state to "template" in the ui_style icons with the master as an overlay.
*flicks are forwarded to master
*override makes it so the alert is not replaced until cleared by a clear_alert with clear_override, and it's used for hallucinations.
*/
/mob/proc/throw_alert(category, type, severity, obj/new_master, override = FALSE)
// MOJAVE EDIT BEGIN
// If we have an offscreen hud, and this alert has an offscreen alternative, display it instead.
// and wipe out severity
// @kosh I know this looks gross, it is midnight and I want to go to bed xoxox
if( ispath(type,/atom/movable/screen/alert) )
var/atom/movable/screen/alert/alert_type = type
if(initial(alert_type.hudbar_alternative) && hud_used?.contains_off_screen_hud) // MS Health doll
type = initial(alert_type.hudbar_alternative)
severity = null
// MOJAVE EDIT END
if(!category || QDELETED(src))
return
var/atom/movable/screen/alert/thealert
if(alerts[category])
thealert = alerts[category]
if(thealert.override_alerts)
return thealert
if(new_master && new_master != thealert.master)
WARNING("[src] threw alert [category] with new_master [new_master] while already having that alert with master [thealert.master]")
clear_alert(category)
return .()
else if(thealert.type != type)
clear_alert(category)
return .()
else if(!severity || severity == thealert.severity)
if(thealert.timeout)
clear_alert(category)
return .()
else //no need to update
return thealert
else
thealert = new type()
thealert.override_alerts = override
if(override)
thealert.timeout = null
thealert.owner = src
if(new_master)
var/old_layer = new_master.layer
var/old_plane = new_master.plane
new_master.layer = FLOAT_LAYER
new_master.plane = FLOAT_PLANE
thealert.add_overlay(new_master)
new_master.layer = old_layer
new_master.plane = old_plane
thealert.icon_state = "template" // We'll set the icon to the client's ui pref in reorganize_alerts()
thealert.master = new_master
else
thealert.icon_state = "[initial(thealert.icon_state)][severity]"
thealert.severity = severity
alerts[category] = thealert
if(client && hud_used)
hud_used.reorganize_alerts()
// thealert.transform = matrix(32, 6, MATRIX_TRANSLATE) // MS disable screen obj easing in
// animate(thealert, transform = matrix(), time = 2.5, easing = CUBIC_EASING) // MS disable screen obj easing in
if(thealert.timeout)
addtimer(CALLBACK(src, PROC_REF(alert_timeout), thealert, category), thealert.timeout)
thealert.timeout = world.time + thealert.timeout - world.tick_lag
return thealert
/mob/proc/alert_timeout(atom/movable/screen/alert/alert, category)
if(alert.timeout && alerts[category] == alert && world.time >= alert.timeout)
clear_alert(category)
// Proc to clear an existing alert.
/mob/proc/clear_alert(category, clear_override = FALSE)
var/atom/movable/screen/alert/alert = alerts[category]
if(!alert)
return 0
if(alert.override_alerts && !clear_override)
return 0
alerts -= category
if(client && hud_used)
hud_used.reorganize_alerts()
client.screen -= alert
qdel(alert)
// Proc to check for an alert
/mob/proc/has_alert(category)
return !isnull(alerts[category])
/atom/movable/screen/alert
icon = 'icons/hud/screen_alert.dmi'
icon_state = "default"
name = "Alert"
desc = "Something seems to have gone wrong with this alert, so report this bug please"
mouse_opacity = MOUSE_OPACITY_ICON
var/timeout = 0 //If set to a number, this alert will clear itself after that many deciseconds
var/severity = 0
var/alerttooltipstyle = ""
var/override_alerts = FALSE //If it is overriding other alerts of the same type
var/mob/owner //Alert owner
/// Boolean. If TRUE, the Click() proc will attempt to Click() on the master first if there is a master.
var/click_master = TRUE
// If we have an offscreen alternative. This is an on/off alert and doesn't support severity
var/atom/movable/screen/alert/hudbar_alternative // MS Health doll
/atom/movable/screen/alert/MouseEntered(location,control,params)
. = ..()
if(!QDELETED(src))
openToolTip(usr,src,params,title = name,content = desc,theme = alerttooltipstyle)
/atom/movable/screen/alert/MouseExited()
closeToolTip(usr)
//Gas alerts
/atom/movable/screen/alert/not_enough_oxy
name = "Choking (No O2)"
desc = "You're not getting enough oxygen. Find some good air before you pass out! The box in your backpack has an oxygen tank and breath mask in it."
icon_state = ALERT_NOT_ENOUGH_OXYGEN
hudbar_alternative = /atom/movable/screen/alert/hudbar/oxy // MS Health doll
/atom/movable/screen/alert/too_much_oxy
name = "Choking (O2)"
desc = "There's too much oxygen in the air, and you're breathing it in! Find some good air before you pass out!"
icon_state = ALERT_TOO_MUCH_OXYGEN
hudbar_alternative = /atom/movable/screen/alert/hudbar/toxin // MS Health doll
/atom/movable/screen/alert/not_enough_nitro
name = "Choking (No N2)"
desc = "You're not getting enough nitrogen. Find some good air before you pass out!"
icon_state = ALERT_NOT_ENOUGH_NITRO
hudbar_alternative = /atom/movable/screen/alert/hudbar/oxy // MS Health doll
/atom/movable/screen/alert/too_much_nitro
name = "Choking (N2)"
desc = "There's too much nitrogen in the air, and you're breathing it in! Find some good air before you pass out!"
icon_state = ALERT_TOO_MUCH_NITRO
hudbar_alternative = /atom/movable/screen/alert/hudbar/toxin // MS Health doll
/atom/movable/screen/alert/not_enough_co2
name = "Choking (No CO2)"
desc = "You're not getting enough carbon dioxide. Find some good air before you pass out!"
icon_state = ALERT_NOT_ENOUGH_CO2
hudbar_alternative = /atom/movable/screen/alert/hudbar/oxy // MS Health doll
/atom/movable/screen/alert/too_much_co2
name = "Choking (CO2)"
desc = "There's too much carbon dioxide in the air, and you're breathing it in! Find some good air before you pass out!"
icon_state = ALERT_TOO_MUCH_CO2
hudbar_alternative = /atom/movable/screen/alert/hudbar/toxin // MS Health doll
/atom/movable/screen/alert/not_enough_plas
name = "Choking (No Plasma)"
desc = "You're not getting enough plasma. Find some good air before you pass out!"
icon_state = ALERT_NOT_ENOUGH_PLASMA
hudbar_alternative = /atom/movable/screen/alert/hudbar/oxy // MS Health doll
/atom/movable/screen/alert/too_much_plas
name = "Choking (Plasma)"
desc = "There's highly flammable, toxic plasma in the air and you're breathing it in. Find some fresh air. The box in your backpack has an oxygen tank and gas mask in it."
icon_state = ALERT_TOO_MUCH_PLASMA
hudbar_alternative = /atom/movable/screen/alert/hudbar/toxin // MS Health doll
/atom/movable/screen/alert/not_enough_n2o
name = "Choking (No N2O)"
desc = "You're not getting enough N2O. Find some good air before you pass out!"
icon_state = ALERT_NOT_ENOUGH_N2O
hudbar_alternative = /atom/movable/screen/alert/hudbar/oxy // MS Health doll
/atom/movable/screen/alert/too_much_n2o
name = "Choking (N2O)"
desc = "There's sleeping gas in the air and you're breathing it in. Find some fresh air. The box in your backpack has an oxygen tank and gas mask in it."
icon_state = ALERT_TOO_MUCH_N2O
hudbar_alternative = /atom/movable/screen/alert/hudbar/toxin // MS Health doll
//End gas alerts
/atom/movable/screen/alert/fat
name = "Fat"
desc = "You ate too much food, lardass. Run around the station and lose some weight."
icon_state = "fat"
hudbar_alternative = /atom/movable/screen/alert/hudbar/hunger/fat // MS Health doll
/atom/movable/screen/alert/hungry
name = "Hungry"
desc = "Some food would be good right about now."
icon_state = "hungry"
hudbar_alternative = /atom/movable/screen/alert/hudbar/hunger // MS Health doll
/atom/movable/screen/alert/starving
name = "Starving"
desc = "You're severely malnourished. The hunger pains make moving around a chore."
icon_state = "starving"
hudbar_alternative = /atom/movable/screen/alert/hudbar/hunger/starving // MS Health doll
/atom/movable/screen/alert/gross
name = "Grossed out."
desc = "That was kind of gross..."
icon_state = "gross"
/atom/movable/screen/alert/verygross
name = "Very grossed out."
desc = "You're not feeling very well..."
icon_state = "gross2"
/atom/movable/screen/alert/disgusted
name = "DISGUSTED"
desc = "ABSOLUTELY DISGUSTIN'"
icon_state = "gross3"
/atom/movable/screen/alert/hot
name = "Too Hot"
desc = "You're flaming hot! Get somewhere cooler and take off any insulating clothing like a fire suit."
icon_state = "hot"
hudbar_alternative = /atom/movable/screen/alert/hudbar/hot
/atom/movable/screen/alert/cold
name = "Too Cold"
desc = "You're freezing cold! Get somewhere warmer and take off any insulating clothing like a space suit."
icon_state = "cold"
hudbar_alternative = /atom/movable/screen/alert/hudbar/cold
/atom/movable/screen/alert/lowpressure
name = "Low Pressure"
desc = "The air around you is hazardously thin. A space suit would protect you."
icon_state = "lowpressure"
hudbar_alternative = /atom/movable/screen/alert/hudbar/low_pressure
/atom/movable/screen/alert/highpressure
name = "High Pressure"
desc = "The air around you is hazardously thick. A fire suit would protect you."
icon_state = "highpressure"
hudbar_alternative = /atom/movable/screen/alert/hudbar/high_pressure
/atom/movable/screen/alert/blind
name = "Blind"
desc = "You can't see! This may be caused by a genetic defect, eye trauma, being unconscious, \
or something covering your eyes."
icon_state = ALERT_BLIND
/atom/movable/screen/alert/high
name = "High"
desc = "Whoa man, you're tripping balls! Careful you don't get addicted... if you aren't already."
icon_state = "high"
/atom/movable/screen/alert/hypnosis
name = "Hypnosis"
desc = "Something's hypnotizing you, but you're not really sure about what."
icon_state = ALERT_HYPNOSIS
var/phrase
/atom/movable/screen/alert/mind_control
name = "Mind Control"
desc = "Your mind has been hijacked! Click to view the mind control command."
icon_state = ALERT_MIND_CONTROL
var/command
/atom/movable/screen/alert/mind_control/Click()
. = ..()
if(!.)
return
to_chat(owner, span_mind_control("[command]"))
/atom/movable/screen/alert/drunk
name = "Drunk"
desc = "All that alcohol you've been drinking is impairing your speech, motor skills, and mental cognition. Make sure to act like it."
icon_state = ALERT_DRUNK
/atom/movable/screen/alert/embeddedobject
name = "Embedded Object"
desc = "Something got lodged into your flesh and is causing major bleeding. It might fall out with time, but surgery is the safest way. \
If you're feeling frisky, examine yourself and click the underlined item to pull the object out."
icon_state = ALERT_EMBEDDED_OBJECT
/atom/movable/screen/alert/embeddedobject/Click()
. = ..()
if(!.)
return
var/mob/living/carbon/carbon_owner = owner
return carbon_owner.help_shake_act(carbon_owner)
/atom/movable/screen/alert/negative
name = "Negative Gravity"
desc = "You're getting pulled upwards. While you won't have to worry about falling down anymore, you may accidentally fall upwards!"
icon_state = "negative"
/atom/movable/screen/alert/weightless
name = "Weightless"
desc = "Gravity has ceased affecting you, and you're floating around aimlessly. You'll need something large and heavy, like a \
wall or lattice, to push yourself off if you want to move. A jetpack would enable free range of motion. A pair of \
magboots would let you walk around normally on the floor. Barring those, you can throw things, use a fire extinguisher, \
or shoot a gun to move around via Newton's 3rd Law of Motion."
icon_state = "weightless"
/atom/movable/screen/alert/highgravity
name = "High Gravity"
desc = "You're getting crushed by high gravity, picking up items and movement will be slowed."
icon_state = "paralysis"
/atom/movable/screen/alert/veryhighgravity
name = "Crushing Gravity"
desc = "You're getting crushed by high gravity, picking up items and movement will be slowed. You'll also accumulate brute damage!"
icon_state = "paralysis"
/atom/movable/screen/alert/fire
name = "On Fire"
desc = "You're on fire. Stop, drop and roll to put the fire out or move to a vacuum area."
icon_state = "fire"
hudbar_alternative = /atom/movable/screen/alert/hudbar/fire
/atom/movable/screen/alert/fire/Click()
. = ..()
if(!.)
return
var/mob/living/living_owner = owner
living_owner.changeNext_move(CLICK_CD_RESIST)
if(living_owner.mobility_flags & MOBILITY_MOVE)
return living_owner.resist_fire()
/atom/movable/screen/alert/give // information set when the give alert is made
icon_state = "default"
var/mob/living/carbon/offerer
var/obj/item/receiving
/**
* Handles assigning most of the variables for the alert that pops up when an item is offered
*
* Handles setting the name, description and icon of the alert and tracking the person giving
* and the item being offered, also registers a signal that removes the alert from anyone who moves away from the offerer
* Arguments:
* * taker - The person receiving the alert
* * offerer - The person giving the alert and item
* * receiving - The item being given by the offerer
*/
/atom/movable/screen/alert/give/proc/setup(mob/living/carbon/taker, mob/living/carbon/offerer, obj/item/receiving)
name = "[offerer] is offering [receiving]"
desc = "[offerer] is offering [receiving]. Click this alert to take it."
icon_state = "template"
cut_overlays()
add_overlay(receiving)
src.receiving = receiving
src.offerer = offerer
RegisterSignal(taker, COMSIG_MOVABLE_MOVED, PROC_REF(check_in_range), override = TRUE) //Override to prevent runtimes when people offer a item multiple times
/atom/movable/screen/alert/give/Click(location, control, params)
. = ..()
if(!.)
return
if(!iscarbon(usr))
CRASH("User for [src] is of type \[[usr.type]\]. This should never happen.")
handle_transfer()
/// An overrideable proc used simply to hand over the item when claimed, this is a proc so that high-fives can override them since nothing is actually transferred
/atom/movable/screen/alert/give/proc/handle_transfer()
var/mob/living/carbon/taker = owner
taker.take(offerer, receiving)
/// Simply checks if the other person is still in range
/atom/movable/screen/alert/give/proc/check_in_range(atom/taker)
SIGNAL_HANDLER
if(!offerer.CanReach(taker))
to_chat(owner, span_warning("You moved out of range of [offerer]!"))
owner.clear_alert("[offerer]")
/atom/movable/screen/alert/give/highfive/setup(mob/living/carbon/taker, mob/living/carbon/offerer, obj/item/receiving)
. = ..()
name = "[offerer] is offering a high-five!"
desc = "[offerer] is offering a high-five! Click this alert to slap it."
RegisterSignal(offerer, COMSIG_PARENT_EXAMINE_MORE, PROC_REF(check_fake_out))
/atom/movable/screen/alert/give/highfive/handle_transfer()
var/mob/living/carbon/taker = owner
if(receiving && (receiving in offerer.held_items))
receiving.on_offer_taken(offerer, taker)
return
too_slow_p1()
/// If the person who offered the high five no longer has it when we try to accept it, we get pranked hard
/atom/movable/screen/alert/give/highfive/proc/too_slow_p1()
var/mob/living/carbon/rube = owner
if(!rube || !offerer)
qdel(src)
return
offerer.visible_message(span_notice("[rube] rushes in to high-five [offerer], but-"), span_nicegreen("[rube] falls for your trick just as planned, lunging for a high-five that no longer exists! Classic!"), ignored_mobs=rube)
to_chat(rube, span_nicegreen("You go in for [offerer]'s high-five, but-"))
addtimer(CALLBACK(src, PROC_REF(too_slow_p2), offerer, rube), 0.5 SECONDS)
/// Part two of the ultimate prank
/atom/movable/screen/alert/give/highfive/proc/too_slow_p2()
var/mob/living/carbon/rube = owner
if(!rube || !offerer)
qdel(src)
return
offerer.visible_message(span_danger("[offerer] pulls away from [rube]'s slap at the last second, dodging the high-five entirely!"), span_nicegreen("[rube] fails to make contact with your hand, making an utter fool of [rube.p_them()]self!"), span_hear("You hear a disappointing sound of flesh not hitting flesh!"), ignored_mobs=rube)
var/all_caps_for_emphasis = uppertext("NO! [offerer] PULLS [offerer.p_their()] HAND AWAY FROM YOURS! YOU'RE TOO SLOW!")
to_chat(rube, span_userdanger("[all_caps_for_emphasis]"))
playsound(offerer, 'sound/weapons/thudswoosh.ogg', 100, TRUE, 1)
rube.Knockdown(1 SECONDS)
SEND_SIGNAL(offerer, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/down_low)
SEND_SIGNAL(rube, COMSIG_ADD_MOOD_EVENT, "high_five", /datum/mood_event/too_slow)
qdel(src)
/// If someone examine_more's the offerer while they're trying to pull a too-slow, it'll tip them off to the offerer's trickster ways
/atom/movable/screen/alert/give/highfive/proc/check_fake_out(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER
if(!receiving)
examine_list += "[span_warning("[offerer]'s arm appears tensed up, as if [offerer.p_they()] plan on pulling it back suddenly...")]\n"
/atom/movable/screen/alert/give/secret_handshake
icon_state = "default"
/atom/movable/screen/alert/give/secret_handshake/setup(mob/living/carbon/taker, mob/living/carbon/offerer, obj/item/receiving)
name = "[offerer] is offering a Handshake"
desc = "[offerer] wants to teach you the Secret Handshake for their Family and induct you! Click on this alert to accept."
icon_state = "template"
cut_overlays()
add_overlay(receiving)
src.receiving = receiving
src.offerer = offerer
RegisterSignal(taker, COMSIG_MOVABLE_MOVED, PROC_REF(check_in_range), override = TRUE) //Override to prevent runtimes when people offer a item multiple times
/// Gives the player the option to succumb while in critical condition
/atom/movable/screen/alert/succumb
name = "Succumb"
desc = "Shuffle off this mortal coil."
icon_state = ALERT_SUCCUMB
/atom/movable/screen/alert/succumb/Click()
. = ..()
if(!.)
return
var/mob/living/living_owner = owner
var/last_whisper = tgui_input_text(usr, "Do you have any last words?", "Final Words")
if (isnull(last_whisper) || !CAN_SUCCUMB(living_owner))
return
if (length(last_whisper))
living_owner.say("#[last_whisper]")
living_owner.succumb(whispered = length(last_whisper) > 0)
//ALIENS
/atom/movable/screen/alert/alien_plas
name = "Plasma"
desc = "There's flammable plasma in the air. If it lights up, you'll be toast."
icon_state = ALERT_XENO_PLASMA
alerttooltipstyle = "alien"
/atom/movable/screen/alert/alien_fire
// This alert is temporarily gonna be thrown for all hot air but one day it will be used for literally being on fire
name = "Too Hot"
desc = "It's too hot! Flee to space or at least away from the flames. Standing on weeds will heal you."
icon_state = ALERT_XENO_FIRE
alerttooltipstyle = "alien"
/atom/movable/screen/alert/alien_vulnerable
name = "Severed Matriarchy"
desc = "Your queen has been killed, you will suffer movement penalties and loss of hivemind. A new queen cannot be made until you recover."
icon_state = ALERT_XENO_NOQUEEN
alerttooltipstyle = "alien"
//BLOBS
/atom/movable/screen/alert/nofactory
name = "No Factory"
desc = "You have no factory, and are slowly dying!"
icon_state = "blobbernaut_nofactory"
alerttooltipstyle = "blob"
// BLOODCULT
/atom/movable/screen/alert/bloodsense
name = "Blood Sense"
desc = "Allows you to sense blood that is manipulated by dark magicks."
icon_state = "cult_sense"
alerttooltipstyle = "cult"
var/static/image/narnar
var/angle = 0
var/mob/living/simple_animal/hostile/construct/Cviewer = null
/atom/movable/screen/alert/bloodsense/Initialize(mapload)
. = ..()
narnar = new('icons/hud/screen_alert.dmi', "mini_nar")
START_PROCESSING(SSprocessing, src)
/atom/movable/screen/alert/bloodsense/Destroy()
Cviewer = null
STOP_PROCESSING(SSprocessing, src)
return ..()
/atom/movable/screen/alert/bloodsense/process()
var/atom/blood_target
if(!owner.mind)
return
var/datum/antagonist/cult/antag = owner.mind.has_antag_datum(/datum/antagonist/cult,TRUE)
if(!antag)
return
var/datum/objective/sacrifice/sac_objective = locate() in antag.cult_team.objectives
if(antag.cult_team.blood_target)
if(!get_turf(antag.cult_team.blood_target))
antag.cult_team.blood_target = null
else
blood_target = antag.cult_team.blood_target
if(Cviewer?.seeking && Cviewer.master)
blood_target = Cviewer.master
desc = "Your blood sense is leading you to [Cviewer.master]"
if(!blood_target)
if(sac_objective && !sac_objective.check_completion())
if(icon_state == "runed_sense0")
return
animate(src, transform = null, time = 1, loop = 0)
angle = 0
cut_overlays()
icon_state = "runed_sense0"
desc = "Nar'Sie demands that [sac_objective.target] be sacrificed before the summoning ritual can begin."
add_overlay(sac_objective.sac_image)
else
var/datum/objective/eldergod/summon_objective = locate() in antag.cult_team.objectives
if(!summon_objective)
return
desc = "The sacrifice is complete, summon Nar'Sie! The summoning can only take place in [english_list(summon_objective.summon_spots)]!"
if(icon_state == "runed_sense1")
return
animate(src, transform = null, time = 1, loop = 0)
angle = 0
cut_overlays()
icon_state = "runed_sense1"
add_overlay(narnar)
return
var/turf/P = get_turf(blood_target)
var/turf/Q = get_turf(owner)
if(!P || !Q || (P.z != Q.z)) //The target is on a different Z level, we cannot sense that far.
icon_state = "runed_sense2"
desc = "You can no longer sense your target's presence."
return
if(isliving(blood_target))
var/mob/living/real_target = blood_target
desc = "You are currently tracking [real_target.real_name] in [get_area_name(blood_target)]."
else
desc = "You are currently tracking [blood_target] in [get_area_name(blood_target)]."
var/target_angle = get_angle(Q, P)
var/target_dist = get_dist(P, Q)
cut_overlays()
switch(target_dist)
if(0 to 1)
icon_state = "runed_sense2"
if(2 to 8)
icon_state = "arrow8"
if(9 to 15)
icon_state = "arrow7"
if(16 to 22)
icon_state = "arrow6"
if(23 to 29)
icon_state = "arrow5"
if(30 to 36)
icon_state = "arrow4"
if(37 to 43)
icon_state = "arrow3"
if(44 to 50)
icon_state = "arrow2"
if(51 to 57)
icon_state = "arrow1"
if(58 to 64)
icon_state = "arrow0"
if(65 to 400)
icon_state = "arrow"
var/difference = target_angle - angle
angle = target_angle
if(!difference)
return
var/matrix/final = matrix(transform)
final.Turn(difference)
animate(src, transform = final, time = 5, loop = 0)
//GUARDIANS
/atom/movable/screen/alert/cancharge
name = "Charge Ready"
desc = "You are ready to charge at a location!"
icon_state = "guardian_charge"
alerttooltipstyle = "parasite"
/atom/movable/screen/alert/canstealth
name = "Stealth Ready"
desc = "You are ready to enter stealth!"
icon_state = "guardian_canstealth"
alerttooltipstyle = "parasite"
/atom/movable/screen/alert/instealth
name = "In Stealth"
desc = "You are in stealth and your next attack will do bonus damage!"
icon_state = "guardian_instealth"
alerttooltipstyle = "parasite"
//SILICONS
/atom/movable/screen/alert/nocell
name = "Missing Power Cell"
desc = "Unit has no power cell. No modules available until a power cell is reinstalled. Robotics may provide assistance."
icon_state = "no_cell"
/atom/movable/screen/alert/emptycell
name = "Out of Power"
desc = "Unit's power cell has no charge remaining. No modules available until power cell is recharged. \
Recharging stations are available in robotics, the dormitory bathrooms, and the AI satellite."
icon_state = "empty_cell"
/atom/movable/screen/alert/lowcell
name = "Low Charge"
desc = "Unit's power cell is running low. Recharging stations are available in robotics, the dormitory bathrooms, and the AI satellite."
icon_state = "low_cell"
//Ethereal
/atom/movable/screen/alert/lowcell/ethereal
name = "Low Blood Charge"
desc = "Your charge is running low, find a source of energy! Use a recharging station, eat some Ethereal-friendly food, or syphon some power from lights, a power cell, or an APC (done by right clicking on combat mode)."
/atom/movable/screen/alert/emptycell/ethereal
name = "No Blood Charge"
desc = "You are out of juice, find a source of energy! Use a recharging station, eat some Ethereal-friendly food, or syphon some power from lights, a power cell, or an APC (done by right clicking on combat mode)."
/atom/movable/screen/alert/ethereal_overcharge
name = "Blood Overcharge"
desc = "Your charge is running dangerously high, find an outlet for your energy! Right click an APC while not in combat mode."
icon_state = "cell_overcharge"
//MODsuit unique
/atom/movable/screen/alert/nocore
name = "Missing Core"
desc = "Unit has no core. No modules available until a core is reinstalled. Robotics may provide assistance."
icon_state = "no_cell"
/atom/movable/screen/alert/emptycell/plasma
name = "Out of Power"
desc = "Unit's plasma core has no charge remaining. No modules available until plasma core is recharged. \
Unit can be refilled through plasma ore."
/atom/movable/screen/alert/lowcell/plasma
name = "Low Charge"
desc = "Unit's plasma core is running low. Unit can be refilled through plasma ore."
//Need to cover all use cases - emag, illegal upgrade module, malf AI hack, traitor cyborg
/atom/movable/screen/alert/hacked
name = "Hacked"
desc = "Hazardous non-standard equipment detected. Please ensure any usage of this equipment is in line with unit's laws, if any."
icon_state = ALERT_HACKED
/atom/movable/screen/alert/locked
name = "Locked Down"
desc = "Unit has been remotely locked down. Usage of a Robotics Control Console like the one in the Research Director's \
office by your AI master or any qualified human may resolve this matter. Robotics may provide further assistance if necessary."
icon_state = ALERT_LOCKED
/atom/movable/screen/alert/newlaw
name = "Law Update"
desc = "Laws have potentially been uploaded to or removed from this unit. Please be aware of any changes \
so as to remain in compliance with the most up-to-date laws."
icon_state = ALERT_NEW_LAW
timeout = 300
/atom/movable/screen/alert/hackingapc
name = "Hacking APC"
desc = "An Area Power Controller is being hacked. When the process is \
complete, you will have exclusive control of it, and you will gain \
additional processing time to unlock more malfunction abilities."
icon_state = ALERT_HACKING_APC
timeout = 600
var/atom/target = null
/atom/movable/screen/alert/hackingapc/Click()
. = ..()
if(!.)
return
var/mob/living/silicon/ai/ai_owner = owner
var/turf/target_turf = get_turf(target)
if(target_turf)
ai_owner.eyeobj.setLoc(target_turf)
//MECHS
/atom/movable/screen/alert/low_mech_integrity
name = "Mech Damaged"
desc = "Mech integrity is low."
icon_state = "low_mech_integrity"
//GHOSTS
//TODO: expand this system to replace the pollCandidates/CheckAntagonist/"choose quickly"/etc Yes/No messages
/atom/movable/screen/alert/notify_cloning
name = "Revival"
desc = "Someone is trying to revive you. Re-enter your corpse if you want to be revived!"
icon_state = "template"
timeout = 300
/atom/movable/screen/alert/notify_cloning/Click()
. = ..()
if(!.)
return
var/mob/dead/observer/dead_owner = owner
dead_owner.reenter_corpse()
/atom/movable/screen/alert/notify_action
name = "Body created"
desc = "A body was created. You can enter it."
icon_state = "template"
timeout = 300
var/atom/target = null
var/action = NOTIFY_JUMP
/atom/movable/screen/alert/notify_action/Click()
. = ..()
if(!.)
return
if(!target)
return
var/mob/dead/observer/ghost_owner = owner
if(!istype(ghost_owner))
return
switch(action)
if(NOTIFY_ATTACK)
target.attack_ghost(ghost_owner)
if(NOTIFY_JUMP)
var/turf/target_turf = get_turf(target)
if(target_turf && isturf(target_turf))
ghost_owner.abstract_move(target_turf)
if(NOTIFY_ORBIT)
ghost_owner.ManualFollow(target)
//OBJECT-BASED
/atom/movable/screen/alert/buckled
name = "Buckled"
desc = "You've been buckled to something. Click the alert to unbuckle unless you're handcuffed."
icon_state = ALERT_BUCKLED
/atom/movable/screen/alert/restrained/handcuffed
name = "Handcuffed"
desc = "You're handcuffed and can't act. If anyone drags you, you won't be able to move. Click the alert to free yourself."
click_master = FALSE
/atom/movable/screen/alert/restrained/legcuffed
name = "Legcuffed"
desc = "You're legcuffed, which slows you down considerably. Click the alert to free yourself."
click_master = FALSE
/atom/movable/screen/alert/restrained/Click()
. = ..()
if(!.)
return
var/mob/living/living_owner = owner
if(!living_owner.can_resist())
return
living_owner.changeNext_move(CLICK_CD_RESIST)
if((living_owner.mobility_flags & MOBILITY_MOVE) && (living_owner.last_special <= world.time))
return living_owner.resist_restraints()
/atom/movable/screen/alert/buckled/Click()
. = ..()
if(!.)
return
var/mob/living/living_owner = owner
if(!living_owner.can_resist())
return
living_owner.changeNext_move(CLICK_CD_RESIST)
if(living_owner.last_special <= world.time)
return living_owner.resist_buckle()
/atom/movable/screen/alert/shoes/untied
name = "Untied Shoes"
desc = "Your shoes are untied! Click the alert or your shoes to tie them."
icon_state = ALERT_SHOES_KNOT
/atom/movable/screen/alert/shoes/knotted
name = "Knotted Shoes"
desc = "Someone tied your shoelaces together! Click the alert or your shoes to undo the knot."
icon_state = ALERT_SHOES_KNOT
/atom/movable/screen/alert/shoes/Click()
. = ..()
if(!.)
return
var/mob/living/carbon/carbon_owner = owner
if(!carbon_owner.can_resist() || !carbon_owner.shoes)
return
carbon_owner.changeNext_move(CLICK_CD_RESIST)
carbon_owner.shoes.handle_tying(carbon_owner)
// PRIVATE = only edit, use, or override these if you're editing the system as a whole
// Re-render all alerts - also called in /datum/hud/show_hud() because it's needed there
/datum/hud/proc/reorganize_alerts(mob/viewmob)
var/mob/screenmob = viewmob || mymob
if(!screenmob.client)
return
var/list/alerts = mymob.alerts
if(!hud_shown)
for(var/i in 1 to alerts.len)
screenmob.client.screen -= alerts[alerts[i]]
return 1
var/iCounter = 0 // MS health doll - counter because we skip our hudbar ones
for(var/i in 1 to alerts.len)
var/atom/movable/screen/alert/alert = alerts[alerts[i]]
if( !istype(alert, /atom/movable/screen/alert/hudbar) )// MOJAVE EDIT BEGIN MS health doll - offscreen hud status' have their own spot
iCounter++
if(alert.icon_state == "template")
alert.icon = ui_style
switch(iCounter)
if(1)
. = ui_alert1
if(2)
. = ui_alert2
if(3)
. = ui_alert3
if(4)
. = ui_alert4
if(5)
. = ui_alert5 // Right now there's 5 slots
else
. = ""
alert.screen_loc = .
// MOJAVE EDIT END
screenmob.client.screen |= alert
if(!viewmob)
for(var/M in mymob.observers)
reorganize_alerts(M)
return 1
/atom/movable/screen/alert/Click(location, control, params)
if(!usr || !usr.client)
return FALSE
if(usr != owner)
return FALSE
var/list/modifiers = params2list(params)
if(LAZYACCESS(modifiers, SHIFT_CLICK)) // screen objects don't do the normal Click() stuff so we'll cheat
to_chat(usr, span_boldnotice("[name]</span> - <span class='info'>[desc]"))
return FALSE
if(master && click_master)
return usr.client.Click(master, location, control, params)
return TRUE
/atom/movable/screen/alert/Destroy()
. = ..()
severity = 0
master = null
owner = null
screen_loc = ""