-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathrobot_upgrades.dm
1410 lines (1189 loc) · 48.6 KB
/
robot_upgrades.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
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
// robot_upgrades.dm
// Contains various borg upgrades.
/// The amount of times that the expander upgrade can be used.
#define EXPANDER_MAXIMUM_STACK 2
/obj/item/borg/upgrade
name = "borg upgrade module."
desc = "Protected by FRM." // FRM stands for Firmware Rights Management.
icon = 'icons/obj/module.dmi'
icon_state = "cyborg_upgrade"
/// Prevents the upgrade from being used.
var/locked = FALSE
/// Does this upgrade require the cyborg to select a module first?
var/require_module = FALSE
/// Is this upgrade only for (a) specific module(s)? If so, they need to be using one of these modules to gain the upgrade.
var/list/module_types = null
/// Bitflags listing module compatibility. Used in the exosuit fabricator for creating sub-categories.
var/list/module_flags = NONE
/// Does this upgrade require access to the cyborg's internals?
var/requires_internals = TRUE
/// Should this upgrade be consumed/deleted on use? This also means this upgrade will not be in the cyborg's `upgrades` list (most of the time).
var/one_use = FALSE
/// Can multiple of this upgrade type be used on the same cyborg?
var/repeatable = FALSE
/// If the cyborg doesn't have all of these upgrades, they are prevented from receiving this upgrade.
var/list/prerequisite_upgrades = null
/// If the cyborg has any of these upgrades, they are prevented from receiving this upgrade.
var/list/blacklisted_upgrades = null
/// Called when upgrade is used on the cyborg.
/obj/item/borg/upgrade/proc/action(mob/living/silicon/robot/R, user = usr)
if(R.stat == DEAD)
to_chat(user, span_notice("[src] will not function on a deceased cyborg."))
return FALSE
if(module_types && module_types.len > 0 && !is_type_in_list(R.module, module_types))
to_chat(R, "Upgrade mounting error! No suitable hardpoint detected!")
to_chat(user, "There's no mounting point for the module!")
return FALSE
if(!repeatable)
for(var/obj/item/borg/upgrade/installed_upgrade in R.upgrades)
if(type == installed_upgrade.type)
to_chat(R, "Upgrade error! Similar upgrade already applied!")
to_chat(user, "This upgrade was already applied to this cyborg!")
return FALSE
if(prerequisite_upgrades && prerequisite_upgrades.len > 0)
var/list/unsatisfied_prereq_types = prerequisite_upgrades.Copy()
for(var/upgrade_type in unsatisfied_prereq_types)
for(var/obj/item/borg/upgrade/installed_upgrade in R.upgrades)
if(upgrade_type == installed_upgrade.type)
unsatisfied_prereq_types -= upgrade_type
if(unsatisfied_prereq_types.len > 0) // Didn't meet all of the prerequisites.
var/first_upgrade_type = unsatisfied_prereq_types[1]
var/obj/item/borg/upgrade/temp_upgrade = new first_upgrade_type()
to_chat(R, "Upgrade error! Upgrade requires [initial(temp_upgrade.name)] first!") // Hint of what upgrade to add next.
to_chat(user, "This upgrade requires the prerequisite upgrade, [initial(temp_upgrade.name)]!")
return FALSE
if(blacklisted_upgrades && blacklisted_upgrades.len > 0)
for(var/upgrade_type in blacklisted_upgrades)
for(var/obj/item/borg/upgrade/installed_upgrade in R.upgrades)
if(upgrade_type == installed_upgrade.type)
var/obj/item/borg/upgrade/temp_upgrade = new upgrade_type()
to_chat(R, "Upgrade error! Upgrade conflicts with [initial(temp_upgrade.name)]!")
to_chat(user, "This upgrade is incompatible with [initial(temp_upgrade.name)]!")
return FALSE
return TRUE
/// Called when upgrade is removed from the cyborg.
/obj/item/borg/upgrade/proc/deactivate(mob/living/silicon/robot/R, user = usr)
if(!(src in R.upgrades)) // This upgrade should still be in the list when this proc is called.
return FALSE
for(var/obj/item/borg/upgrade/I in R.upgrades)
if(!I.prerequisite_upgrades)
continue
if(is_type_in_list(src, I.prerequisite_upgrades))
I.forceMove(get_turf(R)) // Will deactivate all upgrades that use this as a prerequisite.
return TRUE
/obj/item/borg/upgrade/rename
name = "cyborg reclassification board"
desc = "Used to rename a cyborg."
icon_state = "cyborg_upgrade1"
one_use = TRUE
var/heldname = ""
/// Prompts the user to enter what new name they want to give.
/obj/item/borg/upgrade/rename/attack_self(mob/user)
heldname = stripped_input(user, "Enter new robot name", "Cyborg Reclassification", heldname, MAX_NAME_LEN)
log_game("[key_name(user)] set \"[heldname]\" as a name in a cyborg reclassification board at [loc_name(user)]")
/// Changes the cyborg's name to something else.
/obj/item/borg/upgrade/rename/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
if(!length(heldname)) // Hugbox against people that forgot to set the name.
to_chat(user, span_notice("This board doesn't have a name set!"))
return FALSE
var/oldname = R.real_name
var/oldkeyname = key_name(R)
R.custom_name = heldname
R.updatename()
if(oldname != R.real_name) // Name is different now.
R.notify_ai(RENAME, oldname, R.real_name)
log_game("[key_name(user)] used a cyborg reclassification board to rename [oldkeyname] to [key_name(R)] at [loc_name(user)]") // Should be logged even if no change.
/obj/item/borg/upgrade/restart
name = "cyborg emergency reboot module"
desc = "Used to force a reboot of a disabled-but-repaired cyborg, bringing it back online."
icon_state = "cyborg_upgrade1"
one_use = TRUE
/// Revives the cyborg if they're dead and are sufficiently repaired.
/obj/item/borg/upgrade/restart/action(mob/living/silicon/robot/R, user = usr)
if(R.health < 0)
to_chat(user, span_warning("You have to repair the cyborg before using this module!"))
return FALSE
if(R.stat != DEAD)
to_chat(user, span_warning("This only works on dead cyborgs!"))
return FALSE
if(R.mind)
R.mind.grab_ghost()
playsound(loc, 'sound/voice/liveagain.ogg', 75, TRUE)
else
playsound(loc, 'sound/machines/ping.ogg', 75, TRUE)
R.revive()
R.logevent("WARN -- System recovered from unexpected shutdown.")
R.logevent("System brought online.")
return TRUE
/obj/item/borg/upgrade/panel_access_remover
name = "cyborg firmware hack"
desc = "Used to override the default firmware of a cyborg and disable panel access restrictions."
icon_state = "cyborg_upgrade2"
requires_internals = FALSE
one_use = TRUE
/// Removes all access requirements to a cyborg's cover.
/obj/item/borg/upgrade/panel_access_remover/action(mob/living/silicon/robot/R, user = usr)
R.req_access = list()
return TRUE
/obj/item/borg/upgrade/panel_access_remover/freeminer
name = "free miner cyborg firmware hack"
desc = "Used to override the default firmware of a cyborg with the freeminer version."
icon_state = "cyborg_upgrade2"
/// Changes the access requirements to a cyborg's cover to need freeminer engineer access.
/obj/item/borg/upgrade/panel_access_remover/freeminer/action(mob/living/silicon/robot/R, user = usr)
R.req_access = list(ACCESS_RUINS_ENGINEERING)
new /obj/item/borg/upgrade/panel_access_remover/freeminer(R.drop_location()) // Makes this upgrade "re-usable" by creating a new one while using all the functionality of `one_use`.
return TRUE
/obj/item/borg/upgrade/vtec
name = "cyborg VTEC module"
desc = "Used to kick in a cyborg's VTEC systems, increasing their speed."
icon_state = "cyborg_upgrade2"
require_module = TRUE
/// Doubles the cyborg's movespeed as long they are not flying/floating.
/obj/item/borg/upgrade/vtec/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
if(R.has_movespeed_modifier("VTEC"))
to_chat(user, span_notice("This cyborg already has VTEC built in them!"))
return FALSE
R.add_movespeed_modifier("VTEC", update=TRUE, priority=100, multiplicative_slowdown=-1, blacklisted_movetypes=(FLYING|FLOATING))
/obj/item/borg/upgrade/vtec/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
R.remove_movespeed_modifier("VTEC")
/obj/item/borg/upgrade/disablercooler
name = "cyborg rapid disabler cooling module"
desc = "Used to cool a mounted disabler, greatly increasing the potential current in it and thus its recharge rate."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/security)
module_flags = BORG_MODULE_SECURITY
/// Lowers the charge_delay of the cyborg disabler. Consequently, it recharges faster.
/obj/item/borg/upgrade/disablercooler/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/obj/item/gun/energy/disabler/cyborg/T = locate() in R.module.modules
if(!T)
to_chat(user, span_notice("This cyborg does not have a disabler to upgrade!"))
return FALSE
// A single upgrade is enough to allow for disabler spam.
T.charge_delay = max(2, T.charge_delay - 4)
/obj/item/borg/upgrade/disablercooler/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/obj/item/gun/energy/disabler/cyborg/T = locate() in R.module.modules
if(!T)
return FALSE
T.charge_delay = initial(T.charge_delay)
/obj/item/borg/upgrade/thrusters
name = "ion thruster upgrade"
desc = "An energy-operated thruster system for cyborgs."
icon_state = "cyborg_upgrade3"
/// Gives the cyborg the ability to fly in no gravity.
/obj/item/borg/upgrade/thrusters/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
if(R.ionpulse)
to_chat(user, span_notice("This cyborg already has ion thrusters built into them!"))
return FALSE
R.ionpulse = TRUE
/obj/item/borg/upgrade/thrusters/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
R.ionpulse = initial(R.ionpulse)
/// The base upgrade for the language upgrades. Use the children upgrades instead.
/obj/item/borg/upgrade/language
name = "cyborg language translator upgrade" // Shouldn't ever see this anyways.
desc = "Gives the cyborg the ability to hear and speak a set of languages."
blacklisted_upgrades = list(/obj/item/borg/upgrade/language/normal, /obj/item/borg/upgrade/language/expanded, /obj/item/borg/upgrade/language/omni)
icon_state = "cyborg_upgrade2"
/// What languages should be given? They will be able to speak and hear these.
var/list/languages = list()
/// Gives the cyborg the ability to speak and understand the listed languages.
/obj/item/borg/upgrade/language/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/borg/upgrade/language/other_lang_upgrade in R.upgrades) // Drop all other language upgrades.
other_lang_upgrade.forceMove(get_turf(R))
for(var/datum/language/lang as anything in languages)
R.grant_language(lang, TRUE, TRUE, LANGUAGE_SOFTWARE)
/obj/item/borg/upgrade/language/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
R.remove_all_languages(LANGUAGE_SOFTWARE)
/// Contains common languages.
/obj/item/borg/upgrade/language/normal
name = "translation matrix upgrade"
desc = "Increases the translation matrix to include all xeno languages."
blacklisted_upgrades = list(/obj/item/borg/upgrade/language/expanded, /obj/item/borg/upgrade/language/omni)
languages = list(
/datum/language/bonespeak,
/datum/language/draconic,
/datum/language/vox,
/datum/language/english,
/datum/language/etherean,
/datum/language/felinid,
/datum/language/mothian,
/datum/language/polysmorph,
/datum/language/sylvan
)
/// Contains both common and rarer languages.
/obj/item/borg/upgrade/language/expanded
name = "advanced translation matrix upgrade"
desc = "Increases the translation matrix to include an even wider variety in languages."
blacklisted_upgrades = list(/obj/item/borg/upgrade/language/omni)
languages = list(
/datum/language/bonespeak,
/datum/language/draconic,
/datum/language/vox,
/datum/language/english,
/datum/language/etherean,
/datum/language/felinid,
/datum/language/mothian,
/datum/language/polysmorph,
/datum/language/sylvan,
/datum/language/aphasia,
/datum/language/beachbum,
/datum/language/egg,
/datum/language/monkey,
/datum/language/mouse,
/datum/language/mushroom,
/datum/language/slime
)
/// Contains every language.
/obj/item/borg/upgrade/language/omni
name = "universal translation matrix upgrade"
desc = "Allow the translation matrix to handle any language."
blacklisted_upgrades = list()
languages = list()
/obj/item/borg/upgrade/language/omni/Initialize(mapload)
. = ..()
languages = subtypesof(/datum/language)
/obj/item/borg/upgrade/ddrill
name = "mining cyborg diamond drill"
desc = "A diamond drill replacement for the mining module's standard drill."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/miner)
module_flags = BORG_MODULE_MINER
/// Remove the cyborg mining drill and shovel. Give the cyborg diamond mining drill.
/obj/item/borg/upgrade/ddrill/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/pickaxe/drill/cyborg/D in R.module.modules)
R.module.remove_module(D, TRUE)
for(var/obj/item/shovel/S in R.module.modules)
R.module.remove_module(S, TRUE)
var/obj/item/pickaxe/drill/cyborg/diamond/DD = locate() in R.module.modules
if(DD)
to_chat(user, span_notice("This cyborg already has a diamond drill built into them!"))
return FALSE
DD = new(R.module)
R.module.basic_modules += DD
R.module.add_module(DD, FALSE, TRUE)
/obj/item/borg/upgrade/ddrill/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/pickaxe/drill/cyborg/diamond/DD in R.module.modules)
R.module.remove_module(DD, TRUE)
var/obj/item/pickaxe/drill/cyborg/D = locate() in R.module.modules
if(!D)
D = new(R.module)
R.module.basic_modules += D
R.module.add_module(D, FALSE, TRUE)
var/obj/item/shovel/S = locate() in R.module.modules
if(!S)
S = new(R.module)
R.module.basic_modules += S
R.module.add_module(S, FALSE, TRUE)
/obj/item/borg/upgrade/soh
name = "mining cyborg satchel of holding"
desc = "A satchel of holding replacement for mining cyborg's ore satchel module."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/miner)
module_flags = BORG_MODULE_MINER
/// Remove the cyborg ore satchel. Gives bluespace ore satchel if possible.
/obj/item/borg/upgrade/soh/action(mob/living/silicon/robot/R , user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/storage/bag/ore/cyborg/S in R.module.modules)
S.emptyStorage()
R.module.remove_module(S, TRUE)
var/obj/item/storage/bag/ore/holding/H = locate() in R.module.modules
if(H)
to_chat(user, span_notice("This cyborg already has a satchel of holding built in them!"))
return FALSE
H = new(R.module)
R.module.basic_modules += H
R.module.add_module(H, FALSE, TRUE)
/obj/item/borg/upgrade/soh/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/storage/bag/ore/holding/H in R.module.modules)
H.emptyStorage()
R.module.remove_module(H, TRUE)
var/obj/item/storage/bag/ore/cyborg/S = locate() in R.module.modules
if(!S)
S = new(R.module)
R.module.basic_modules += S
R.module.add_module(S, FALSE, TRUE)
/obj/item/borg/upgrade/tboh
name = "janitor cyborg trash bag of holding"
desc = "A trash bag of holding replacement for the janiborg's standard trash bag."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/janitor)
module_flags = BORG_MODULE_JANITOR
/// Remove the cyborg trash bag. Give cyborg bluespace trash bag if possible.
/obj/item/borg/upgrade/tboh/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/storage/bag/trash/cyborg/TB in R.module.modules)
TB.emptyStorage()
R.module.remove_module(TB, TRUE)
var/obj/item/storage/bag/trash/bluespace/cyborg/BTB = locate() in R.module.modules
if(BTB)
to_chat(user, span_notice("This cyborg already has a trash bag of holding built in them!"))
return FALSE
BTB = new /obj/item/storage/bag/trash/bluespace/cyborg(R.module)
R.module.basic_modules += BTB
R.module.add_module(BTB, FALSE, TRUE)
/obj/item/borg/upgrade/tboh/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/storage/bag/trash/bluespace/cyborg/BTB in R.module.modules)
BTB.emptyStorage()
R.module.remove_module(BTB, TRUE)
var/obj/item/storage/bag/trash/cyborg/TB = locate() in R.module.modules
if(!TB)
TB = new (R.module)
R.module.basic_modules += TB
R.module.add_module(TB, FALSE, TRUE)
/obj/item/borg/upgrade/amop
name = "janitor cyborg advanced mop"
desc = "An advanced mop replacement for the janiborg's standard mop."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/janitor)
module_flags = BORG_MODULE_JANITOR
/// Removes the cyborg mop. Give the cyborg advanced mop if possible.
/obj/item/borg/upgrade/amop/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/mop/cyborg/M in R.module.modules)
R.module.remove_module(M, TRUE)
var/obj/item/mop/advanced/cyborg/AM = locate() in R.module.modules
if(AM)
to_chat(user, span_notice("This cyborg already has an advanced mop built in them!"))
return FALSE
AM = new(R.module)
R.module.basic_modules += AM
R.module.add_module(AM, FALSE, TRUE)
/obj/item/borg/upgrade/amop/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/mop/advanced/cyborg/AM in R.module.modules)
R.module.remove_module(AM, TRUE)
var/obj/item/mop/cyborg/M = locate() in R.module.modules
if(!M)
M = new(R.module)
R.module.basic_modules += M
R.module.add_module(M, FALSE, TRUE)
/obj/item/borg/upgrade/syndicate
name = "illegal equipment module"
desc = "Unlocks the hidden, deadlier functions of a cyborg."
icon_state = "cyborg_upgrade3"
require_module = TRUE
/// Gives all the benefits and drawbacks that being emagged would get without the subversive lawset that an emag would give.
/obj/item/borg/upgrade/syndicate/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!. || R.emagged)
return FALSE
R.SetEmagged(TRUE)
R.logevent("WARN: hardware installed with missing security certificate!") // A bit of fluff to hint it was an illegal tech item.
R.logevent("WARN: root privileges granted to PID [num2hex(rand(1,65535), -1)][num2hex(rand(1,65535), -1)].") // Random eight digit hex value. Two are used because rand(1,4294967295) throws an error.
/obj/item/borg/upgrade/syndicate/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
R.SetEmagged(FALSE)
/obj/item/borg/upgrade/lavaproof
name = "mining cyborg lavaproof tracks"
desc = "An upgrade kit to apply specialized coolant systems and insulation layers to mining cyborg tracks, enabling them to withstand exposure to molten rock."
icon_state = "ash_plating"
resistance_flags = LAVA_PROOF | FIRE_PROOF
require_module = TRUE
module_types = list(/obj/item/robot_module/miner)
module_flags = BORG_MODULE_MINER
/// Gives the cyborg the ability to move across lava unharmed.
/obj/item/borg/upgrade/lavaproof/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
R.weather_immunities |= WEATHER_LAVA
/obj/item/borg/upgrade/lavaproof/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
R.weather_immunities &= ~WEATHER_LAVA
/obj/item/borg/upgrade/selfrepair
name = "self-repair module"
desc = "This module will repair the cyborg over time."
icon_state = "cyborg_upgrade5"
require_module = TRUE
COOLDOWN_DECLARE(next_repair)
/// How many deciseconds until they are repaired again?
var/repair_cooldown = 4 SECONDS
COOLDOWN_DECLARE(next_message)
/// How many deciseconds until they are reminded of the upgrade's active repair mode?
var/message_cooldown = 200 SECONDS
/// Is this on or off?
var/on = FALSE
/// How much power does it cost to repair? 0.5x if idle (no repair) and 3x if boosted (critical repair).
var/powercost = 10
/// How much damage (for brute and burn each) does heal on repair? 2.5x if boosted (critical repair).
var/repair_amount = -1
var/datum/action/toggle_action
// Gives the cyborg the ability to repair themselves over time.
/obj/item/borg/upgrade/selfrepair/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!. || toggle_action)
return FALSE
icon_state = "selfrepair_off"
toggle_action = new /datum/action/item_action/toggle(src)
toggle_action.Grant(R)
/obj/item/borg/upgrade/selfrepair/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
toggle_action.Remove(R)
QDEL_NULL(toggle_action)
deactivate_sr()
/obj/item/borg/upgrade/selfrepair/ui_action_click()
if(!on)
to_chat(toggle_action.owner, span_notice("You activate the self-repair module."))
activate_sr()
else
to_chat(toggle_action.owner, span_notice("You deactivate the self-repair module."))
deactivate_sr()
/obj/item/borg/upgrade/selfrepair/update_icon_state()
if(toggle_action)
icon_state = "selfrepair_[on ? "on" : "off"]"
else
icon_state = "cyborg_upgrade5"
return ..()
/obj/item/borg/upgrade/selfrepair/proc/activate_sr()
START_PROCESSING(SSobj, src)
on = TRUE
update_appearance(UPDATE_ICON)
/obj/item/borg/upgrade/selfrepair/proc/deactivate_sr()
STOP_PROCESSING(SSobj, src)
on = FALSE
update_appearance(UPDATE_ICON)
/obj/item/borg/upgrade/selfrepair/process()
if(!COOLDOWN_FINISHED(src, next_repair))
return
var/mob/living/silicon/robot/cyborg = toggle_action.owner
if(!istype(cyborg) || cyborg.stat == DEAD || !on)
deactivate_sr()
return
if(!cyborg.cell)
to_chat(cyborg, span_warning("Self-repair module deactivated. Please insert the power cell."))
deactivate_sr()
return
if(cyborg.cell.charge < powercost * 5)
to_chat(cyborg, span_warning("Self-repair module deactivated. Please recharge."))
deactivate_sr()
return
COOLDOWN_START(src, next_repair, repair_cooldown)
var/cost = powercost
if(cyborg.health < cyborg.maxHealth)
var/to_repair = repair_amount
if(cyborg.health < 0) // Critical damage.
to_repair *= 2.5
cost *= 3
cyborg.adjustBruteLoss(to_repair)
cyborg.adjustFireLoss(to_repair)
cyborg.updatehealth()
cyborg.cell.use(powercost)
else
cost *= 0.5
cyborg.cell.use(cost) // Idling.
if(!COOLDOWN_FINISHED(src, next_message))
return
COOLDOWN_START(src, next_message, message_cooldown)
var/msgmode = "standby"
if(cyborg.health < 0)
msgmode = "critical"
else if(cyborg.health < cyborg.maxHealth)
msgmode = "normal"
to_chat(cyborg, span_notice("Self-repair is active in [span_boldnotice("[msgmode]")] mode."))
/obj/item/borg/upgrade/hypospray
name = "medical cyborg hypospray advanced synthesiser"
desc = "An upgrade to the Medical module cyborg's hypospray, allowing it \
to produce more advanced and complex medical reagents."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/medical)
module_flags = BORG_MODULE_MEDICAL
/// Upgrades all of the cyborg's medical hyposprays to give additional chemicals if they can.
/obj/item/borg/upgrade/hypospray/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/has_hypo = FALSE
var/changed_hypo = FALSE
for(var/obj/item/reagent_containers/borghypo/medical/H in R.module.modules)
has_hypo = TRUE
if(!H.upgraded)
changed_hypo = TRUE
H.upgrade_hypo()
if(!has_hypo)
to_chat(user, span_notice("This cyborg does not have a medical hypospray!"))
return FALSE
if(!changed_hypo)
to_chat(user, span_notice("All of the cyborg's medical hyposprays are already upgraded!"))
return FALSE
// For the hacked medical hypospray if they haven't got it yet:
for(var/obj/item/reagent_containers/borghypo/medical/H in R.module.emag_modules)
if(!H.upgraded)
H.upgrade_hypo()
/obj/item/borg/upgrade/hypospray/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/reagent_containers/borghypo/medical/H in R.module.modules)
if(H.upgraded)
H.remove_hypo_upgrade()
// For the hacked medical hypospray if they haven't got it yet:
for(var/obj/item/reagent_containers/borghypo/medical/hackedH in R.module.emag_modules)
if(hackedH.upgraded)
hackedH.remove_hypo_upgrade()
/obj/item/borg/upgrade/hypospray/expanded
name = "medical cyborg expanded hypospray"
desc = "An upgrade to the Medical module's hypospray, allowing it \
to treat a wider range of conditions and problems."
/obj/item/borg/upgrade/condiment_synthesizer
name = "service cyborg condiment synthesiser"
desc = "An upgrade to the service model cyborg, allowing it to produce solid condiments."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/service)
module_flags = BORG_MODULE_SERVICE
/obj/item/borg/upgrade/condiment_synthesizer/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(.)
var/obj/item/reagent_containers/borghypo/condiment_synthesizer/cynthesizer = locate() in R.module.modules
if(cynthesizer)
R.balloon_alert_to_viewers("already installed!")
return FALSE
cynthesizer = new(R.module)
R.module.basic_modules += cynthesizer
R.module.add_module(cynthesizer, FALSE, TRUE)
/obj/item/borg/upgrade/condiment_synthesizer/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if (!.)
return FALSE
var/obj/item/reagent_containers/borghypo/condiment_synthesizer/cynthesizer = locate() in R.module.modules
if (cynthesizer)
R.module.remove_module(cynthesizer, TRUE)
/obj/item/borg/upgrade/piercing_hypospray
name = "cyborg piercing hypospray"
desc = "An upgrade to a cyborg's hypospray, allowing it to \
pierce armor and thick material."
icon_state = "cyborg_upgrade3"
module_types = list(/obj/item/robot_module/medical, /obj/item/robot_module/peacekeeper)
/// Gives all of the cyborg's hyposprays the ability to pierce armor and thick materials.
/obj/item/borg/upgrade/piercing_hypospray/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/has_hypo = FALSE
var/changed_hypo = FALSE
for(var/obj/item/reagent_containers/borghypo/H in R.module.modules)
has_hypo = TRUE
if(!H.bypass_protection)
changed_hypo = TRUE
H.bypass_protection = TRUE
if(!has_hypo)
to_chat(user, span_notice("This cyborg does not have a hypospray!"))
return FALSE
if(!changed_hypo)
to_chat(user, span_warning("All of the cyborg's hyposprays are already upgraded to pierce!"))
return FALSE
for(var/obj/item/reagent_containers/borghypo/H in R.module.emag_modules)
if(!H.bypass_protection)
H.bypass_protection = TRUE
/obj/item/borg/upgrade/piercing_hypospray/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/reagent_containers/borghypo/H in R.module.modules)
H.bypass_protection = initial(H.bypass_protection)
for(var/obj/item/reagent_containers/borghypo/H in R.module.emag_modules)
H.bypass_protection = initial(H.bypass_protection)
/// Gives medical cyborgs a gripper to use. Enables medical cyborgs to do all remaining aspects of medical (chemistry & blood giving) without the help of a human.
/obj/item/borg/upgrade/medigripper
name = "medical cyborg gripper"
desc = "An upgrade for medical cyborgs which grants them a gripper to hold and interact with medical related items."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/medical)
module_flags = BORG_MODULE_MEDICAL
/obj/item/borg/upgrade/medigripper/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/obj/item/borg/gripper/medical/gripper = locate() in R.module.modules
if(gripper)
to_chat(user, span_warning("This cyborg is already equipped with a medical gripper!"))
return FALSE
gripper = new(R.module)
R.module.basic_modules += gripper
R.module.add_module(gripper, FALSE, TRUE)
/obj/item/borg/upgrade/medigripper/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/borg/gripper/medical/gripper in R.module.modules)
R.module.remove_module(gripper, TRUE)
/obj/item/borg/upgrade/defib
name = "medical cyborg defibrillator"
desc = "An upgrade to the Medical module, installing a built-in \
defibrillator, for on the scene revival."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/medical)
module_flags = BORG_MODULE_MEDICAL
/// Gives the cyborg a defibrillator to use.
/obj/item/borg/upgrade/defib/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/obj/item/shockpaddles/cyborg/S = locate() in R.module.modules
if(S)
to_chat(user, span_warning("This cyborg is already equipped with a defibrillator!"))
return FALSE
S = new(R.module)
R.module.basic_modules += S
R.module.add_module(S, FALSE, TRUE)
/obj/item/borg/upgrade/defib/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/shockpaddles/cyborg/S in R.module.modules)
R.module.remove_module(S, TRUE)
/obj/item/borg/upgrade/adv_analyzer
name = "medical cyborg advanced health analyzer"
desc = "An upgrade to medical cyborg which replaces their normal health analyzer with its advanced version."
icon_state = "cyborg_upgrade5"
require_module = TRUE
module_types = list(/obj/item/robot_module/medical, /obj/item/robot_module/syndicate_medical)
module_flags = BORG_MODULE_MEDICAL
/// Replaces the cyborg's health analyzer with an advanced health analyzer.
/obj/item/borg/upgrade/adv_analyzer/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/healthanalyzer/healthanalyzer in R.module.modules)
R.module.remove_module(healthanalyzer, TRUE)
var/obj/item/healthanalyzer/advanced/advanalyzer = locate() in R.module.modules
if(advanalyzer)
to_chat(user, span_warning("This cyborg is already equipped with an advanced health analyzer."))
return FALSE
advanalyzer = new(R.module)
R.module.basic_modules += advanalyzer
R.module.add_module(advanalyzer, FALSE, TRUE)
/obj/item/borg/upgrade/adv_analyzer/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/healthanalyzer/advanced/advanalyzer in R.module.modules)
R.module.remove_module(advanalyzer, TRUE)
var/obj/item/healthanalyzer/healthanalyzer = locate() in R.module.modules
if(!healthanalyzer)
healthanalyzer = new(R.module)
R.module.basic_modules += healthanalyzer
R.module.add_module(healthanalyzer, FALSE, TRUE)
/obj/item/borg/upgrade/surgery_omnitool
name = "medical cyborg surgical omni-tool upgrade"
desc = "An upgrade for medical cyborgs which upgrading their built-in \
surgical omnitool to be on par with advanced surgical tools."
icon_state = "cyborg_upgrade3"
require_module = TRUE
module_types = list(/obj/item/robot_module/medical, /obj/item/robot_module/syndicate_medical)
module_flags = BORG_MODULE_MEDICAL
/obj/item/borg/upgrade/surgery_omnitool/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/borg/cyborg_omnitool/medical/omnitool_upgrade in R.module.modules)
if(omnitool_upgrade.upgraded)
to_chat(user, span_warning("This unit is already equipped with an omnitool upgrade!"))
return FALSE
for(var/obj/item/borg/cyborg_omnitool/medical/omnitool in R.module.modules)
omnitool.upgrade_omnitool()
/obj/item/borg/upgrade/surgery_omnitool/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
for(var/obj/item/borg/cyborg_omnitool/omnitool in R.module.modules)
omnitool.downgrade_omnitool()
/obj/item/borg/upgrade/ai
name = "B.O.R.I.S. module"
desc = "Bluespace Optimized Remote Intelligence Synchronization. An uplink device which takes the place of an MMI in cyborg endoskeletons, creating a robotic shell controlled by an AI."
icon_state = "boris"
// Creates a shell for an AI to connect to.
/obj/item/borg/upgrade/ai/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
if(R.shell)
to_chat(user, span_warning("This cyborg is already an AI shell!"))
return FALSE
if(R.key) // You cannot replace a player unless the key is completely removed.
to_chat(user, span_warning("Intelligence patterns detected in this [R.braintype]. Aborting."))
return FALSE
R.make_shell(src)
/obj/item/borg/upgrade/ai/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!. || !R.shell)
return FALSE
R.undeploy()
R.notify_ai(AI_SHELL)
/obj/item/borg/upgrade/expand
name = "borg expander"
desc = "A resizer upgrade that doubles the size of a cyborg."
icon_state = "cyborg_upgrade3"
repeatable = TRUE
/// Enlarges the cyborg by 2x of their current size.
/obj/item/borg/upgrade/expand/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
if(R.expansion_count >= EXPANDER_MAXIMUM_STACK)
to_chat(usr, span_notice("This cyborg has already expanded as much as it can!"))
return FALSE
R.notransform = TRUE
var/prev_lockcharge = R.lockcharge
R.SetLockdown(1)
R.anchored = TRUE
R.expansion_count++
var/datum/effect_system/fluid_spread/smoke/smoke = new
smoke.set_up(1, location = R.loc)
smoke.start()
sleep(0.2 SECONDS)
for(var/i in 1 to 4)
playsound(R, pick('sound/items/drill_use.ogg', 'sound/items/jaws_cut.ogg', 'sound/items/jaws_pry.ogg', 'sound/items/welder.ogg', 'sound/items/ratchet.ogg'), 80, 1, -1)
sleep(1.2 SECONDS)
if(!prev_lockcharge)
R.SetLockdown(0)
R.anchored = FALSE
R.notransform = FALSE
R.resize = 2
R.update_transform()
/obj/item/borg/upgrade/expand/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
if(R.expansion_count > 0)
R.resize = 0.5
R.expansion_count--
R.update_transform()
/obj/item/borg/upgrade/rped
name = "engineering cyborg RPED"
desc = "A rapid part exchange device for the engineering cyborg."
icon = 'icons/obj/storage.dmi'
icon_state = "borgrped"
require_module = TRUE
module_types = list(/obj/item/robot_module/engineering, /obj/item/robot_module/saboteur)
module_flags = BORG_MODULE_ENGINEERING
/// Gives the cyborg a rapid part exchange device (RPED).
/obj/item/borg/upgrade/rped/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/obj/item/storage/part_replacer/cyborg/RPED = locate() in R.module.modules
if(RPED)
to_chat(user, span_warning("This cyborg is already equipped with a RPED module."))
return FALSE
RPED = new(R.module)
R.module.basic_modules += RPED
R.module.add_module(RPED, FALSE, TRUE)
/obj/item/borg/upgrade/rped/deactivate(mob/living/silicon/robot/R, user = usr)
. = ..() // If BRPED upgrade is in, this will deactivate it too.
if(!.)
return FALSE
for(var/obj/item/storage/part_replacer/cyborg/RPED in R.module.modules)
RPED.emptyStorage()
R.module.remove_module(RPED, TRUE)
/obj/item/borg/upgrade/brped
name = "engineering cyborg BRPED"
desc = "A bluespace rapid part exchange device for the engineering cyborg."
icon = 'icons/obj/storage.dmi'
icon_state = "BS_RPED"
require_module = TRUE
module_types = list(/obj/item/robot_module/engineering, /obj/item/robot_module/saboteur)
module_flags = BORG_MODULE_ENGINEERING
prerequisite_upgrades = list(/obj/item/borg/upgrade/rped)
/// Gives the cyborg a bluespace rapid part exchange device (BRPED) if they had the previous RPED upgrade.
/obj/item/borg/upgrade/brped/action(mob/living/silicon/robot/R, user = usr)
. = ..()
if(!.)
return FALSE
var/obj/item/storage/part_replacer/bluespace/cyborg/BRPED = locate() in R.module.modules
if(BRPED)
to_chat(user, span_warning("This cyborg is already equipped with a BRPED module."))
return FALSE
for(var/obj/item/storage/part_replacer/cyborg/RPED in R.module.modules)