forked from goonstation/goonstation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hivebot.dm
1221 lines (1075 loc) · 35.9 KB
/
hivebot.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
/mob/living/silicon/hivebot
name = "Robot"
voice_name = "synthesized voice"
icon = 'icons/mob/hivebot.dmi'
voice_type = "cyborg"
icon_state = "vegas"
health = 60
max_health = 60
var/beebot = 0
robot_talk_understand = 2
var/glitchy_speak = 0
// 3 tools can be activated at any one time.
var/obj/item/robot_module/module = null
var/module_active = null
var/list/module_states = list(null,null,null)
var/datum/hud/shell/hud
var/obj/item/device/radio/radio = null
req_access = list(access_robotics)
//var/energy = 4000
//var/energy_max = 4000
var/jetpack = 0
shell = 1
sound_fart = 'sound/voice/farts/poo2_robot.ogg'
var/bruteloss = 0
var/fireloss = 0
var/obj/machinery/camera/camera = null
/mob/living/silicon/hivebot/TakeDamage(zone, brute, burn, tox, damage_type, disallow_limb_loss)
bruteloss += brute
fireloss += burn
health_update_queue |= src
/mob/living/silicon/hivebot/HealDamage(zone, brute, burn)
bruteloss -= brute
fireloss -= burn
bruteloss = max(0, bruteloss)
fireloss = max(0, fireloss)
health_update_queue |= src
/mob/living/silicon/hivebot/get_brute_damage()
return bruteloss
/mob/living/silicon/hivebot/get_burn_damage()
return fireloss
/mob/living/silicon/hivebot/New(loc, mainframe)
boutput(src, SPAN_NOTICE("Your icons have been generated!"))
UpdateIcon()
if (mainframe)
dependent = 1
//src.real_name = mainframe:name
src.name = mainframe:name
else
src.real_name = "AI Shell [copytext("\ref[src]", 6, 11)]"
src.name = src.real_name
src.radio = new /obj/item/device/radio/headset/command/ai(src)
src.ears = src.radio
SPAWN(1 SECOND)
if (!src.cell)
src.cell = new /obj/item/cell/shell_cell/charged (src)
src.camera = new /obj/machinery/camera(src)
src.camera.c_tag = src.name
src.camera.ai_only = TRUE
..()
src.botcard.access = get_all_accesses()
/mob/living/silicon/hivebot/death(gibbed)
if (src.mainframe)
logTheThing(LOG_COMBAT, src, "'s AI shell was destroyed at [log_loc(src)].") // Brought in line with carbon mobs (Convair880).
src.mainframe.return_to(src)
if (src.camera)
src.camera.set_camera_status(FALSE)
setdead(src)
src.canmove = 0
vision.set_color_mod("#ffffff") // reset any blindness
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = SEE_DARK_FULL
src.see_invisible = INVIS_CLOAK
src.UpdateIcon()
/*
if(src.client)
SPAWN(0)
var/key = src.ckey
recently_dead += key
sleep(recently_time)
recently_dead -= key
*/
src.mind?.register_death()
return ..(gibbed)
/mob/living/silicon/hivebot/emote(var/act, var/voluntary = 0)
..()
var/param = null
if (findtext(act, " ", 1, null))
var/t1 = findtext(act, " ", 1, null)
param = copytext(act, t1 + 1, length(act) + 1)
act = copytext(act, 1, t1)
var/m_type = 1
var/message = null
switch(lowertext(act))
/*if ("shit")
new /obj/item/rods/(src.loc)
playsound(src.loc, 'sound/voice/farts/poo2_robot.ogg', 50, 1)
message = "<B>[src]</B> shits on the floor."
m_type = 1*/
if ("help")
src.show_text("To use emotes, simply enter \"*(emote)\" as the entire content of a say message. Certain emotes can be targeted at other characters - to do this, enter \"*emote (name of character)\" without the brackets.")
src.show_text("For a list of all emotes, use *list. For a list of basic emotes, use *listbasic. For a list of emotes that can be targeted, use *listtarget.")
if ("list")
src.show_text("Basic emotes:")
src.show_text("clap, flap, aflap, twitch, twitch_s, scream, birdwell, fart, flip, custom, customv, customh")
src.show_text("Targetable emotes:")
src.show_text("salute, bow, hug, wave, glare, stare, look, leer, nod, point")
if ("listbasic")
src.show_text("clap, flap, aflap, twitch, twitch_s, scream, birdwell, fart, flip, custom, customv, customh")
if ("listtarget")
src.show_text("salute, bow, hug, wave, glare, stare, look, leer, nod, point")
if ("salute","bow","hug","wave","glare","stare","look","leer","nod")
// visible targeted emotes
if (!src.restrained())
var/M = null
if (param)
for (var/mob/A in view(null, null))
if (ckey(param) == ckey(A.name))
M = A
break
if (!M)
param = null
act = lowertext(act)
if (param)
switch(act)
if ("bow","wave","nod")
message = "<B>[src]</B> [act]s to [param]."
if ("glare","stare","look","leer")
message = "<B>[src]</B> [act]s at [param]."
else
message = "<B>[src]</B> [act]s [param]."
else
switch(act)
if ("hug")
message = "<B>[src]</b> [act]s itself."
else
message = "<B>[src]</b> [act]s."
else
message = "<B>[src]</B> struggles to move."
m_type = 1
if ("point")
if (!src.restrained())
var/mob/M = null
if (param)
for (var/atom/A as mob|obj|turf|area in view(null, null))
if (ckey(param) == ckey(A.name))
M = A
break
if (!M)
message = "<B>[src]</B> points."
else
src.point(M)
message = "<B>[src]</B> points to [M]."
m_type = 1
if ("panic","freakout")
if (!src.restrained())
message = "<B>[src]</B> enters a state of hysterical panic!"
else
message = "<B>[src]</B> starts writhing around in manic terror!"
m_type = 1
if ("clap")
if (!src.restrained())
message = "<B>[src]</B> claps."
m_type = 2
if ("flap")
if (!src.restrained())
message = "<B>[src]</B> flaps its wings."
m_type = 2
if ("aflap")
if (!src.restrained())
message = "<B>[src]</B> flaps its wings ANGRILY!"
m_type = 2
if ("custom")
var/input = sanitize(input("Choose an emote to display."))
var/input2 = input("Is this a visible or hearable emote?") in list("Visible","Hearable")
if (input2 == "Visible")
m_type = 1
else if (input2 == "Hearable")
m_type = 2
else
alert("Unable to use this emote, must be either hearable or visible.")
return
message = "<B>[src]</B> [input]"
if ("customv")
if (!param)
param = input("Choose an emote to display.")
if(!param) return
param = html_encode(sanitize(param))
message = "<b>[src]</b> [param]"
m_type = 1
if ("customh")
if (!param)
param = input("Choose an emote to display.")
if(!param) return
param = html_encode(sanitize(param))
message = "<b>[src]</b> [param]"
m_type = 2
if ("me")
if (!param)
return
param = html_encode(sanitize(param))
message = "<b>[src]</b> [param]"
m_type = 1
if ("smile","grin","smirk","frown","scowl","grimace","sulk","pout","blink","nod","shrug","think","ponder","contemplate")
// basic visible single-word emotes
message = "<B>[src]</B> [act]s."
m_type = 1
if ("flipout")
message = "<B>[src]</B> flips the fuck out!"
m_type = 1
if ("rage","fury","angry")
message = "<B>[src]</B> becomes utterly furious!"
m_type = 1
if ("twitch")
message = "<B>[src]</B> twitches."
m_type = 1
SPAWN(0)
var/old_x = src.pixel_x
var/old_y = src.pixel_y
src.pixel_x += rand(-2,2)
src.pixel_y += rand(-1,1)
sleep(0.2 SECONDS)
src.pixel_x = old_x
src.pixel_y = old_y
if ("twitch_v","twitch_s")
message = "<B>[src]</B> twitches violently."
m_type = 1
SPAWN(0)
var/old_x = src.pixel_x
var/old_y = src.pixel_y
src.pixel_x += rand(-3,3)
src.pixel_y += rand(-1,1)
sleep(0.2 SECONDS)
src.pixel_x = old_x
src.pixel_y = old_y
if ("birdwell", "burp")
if (src.emote_check(voluntary, 50))
message = "<B>[src]</B> birdwells."
playsound(src.loc, 'sound/vox/birdwell.ogg', 50, 1, channel=VOLUME_CHANNEL_EMOTE)
if ("scream")
if (src.emote_check(voluntary, 50))
playsound(src, src.sound_scream, 80, 0, 0, src.get_age_pitch(), channel=VOLUME_CHANNEL_EMOTE)
message = "<b>[src]</b> screams!"
if ("johnny")
var/M
if (param)
M = adminscrub(param)
if (!M)
param = null
else
message = "<B>[src]</B> says, \"[M], please. He had a family.\" [src.name] takes a drag from a cigarette and blows its name out in smoke."
m_type = 2
if ("flip")
if (src.emote_check(voluntary, 50))
if (isobj(src.loc))
var/obj/container = src.loc
container.mob_flip_inside(src)
else
playsound(src.loc, pick(src.sound_flip1, src.sound_flip2), 50, 1, channel=VOLUME_CHANNEL_EMOTE)
message = "<B>[src]</B> does a flip!"
if (prob(50))
animate_spin(src, "R", 1, 0)
else
animate_spin(src, "L", 1, 0)
for (var/mob/living/M in viewers(1, null))
if (M == src)
continue
message = "<B>[src]</B> beep-bops at [M]."
break
if ("fart")
if (src.emote_check(voluntary))
m_type = 2
var/fart_on_other = 0
for (var/mob/living/M in src.loc)
if (M == src || !M.lying)
continue
message = SPAN_ALERT("<B>[src]</B> farts in [M]'s face!")
fart_on_other = 1
break
if (!fart_on_other)
switch (rand(1, 40))
if (1) message = "<B>[src]</B> releases vaporware."
if (2) message = "<B>[src]</B> farts sparks everywhere!"
if (3) message = "<B>[src]</B> farts out a cloud of iron filings."
if (4) message = "<B>[src]</B> farts! It smells like motor oil."
if (5) message = "<B>[src]</B> farts so hard a bolt pops out of place."
if (6) message = "<B>[src]</B> farts so hard its plating rattles noisily."
if (7) message = "<B>[src]</B> unleashes a rancid fart! Now that's malware."
if (8) message = "<B>[src]</B> downloads and runs 'faert.wav'."
if (9) message = "<B>[src]</B> uploads a fart sound to the nearest computer and blames it."
if (10) message = "<B>[src]</B> spins in circles, flailing its arms and farting wildly!"
if (11) message = "<B>[src]</B> simulates a human fart with [rand(1,100)]% accuracy."
if (12) message = "<B>[src]</B> synthesizes a farting sound."
if (13) message = "<B>[src]</B> somehow releases gastrointestinal methane. Don't think about it too hard."
if (14) message = "<B>[src]</B> tries to exterminate humankind by farting rampantly."
if (15) message = "<B>[src]</B> farts horribly! It's clearly gone [pick("rogue","rouge","ruoge")]."
if (16) message = "<B>[src]</B> busts a capacitor."
if (17) message = "<B>[src]</B> farts the first few bars of Smoke on the Water. Ugh. Amateur.</B>"
if (18) message = "<B>[src]</B> farts. It smells like Robotics in here now!"
if (19) message = "<B>[src]</B> farts. It smells like the Roboticist's armpits!"
if (20) message = "<B>[src]</B> blows pure chlorine out of it's exhaust port. [SPAN_ALERT("<B>FUCK!</B>")]"
if (21) message = "<B>[src]</B> bolts the nearest airlock. Oh no wait, it was just a nasty fart."
if (22) message = "<B>[src]</B> has assimilated humanity's digestive distinctiveness to its own."
if (23) message = "<B>[src]</B> farts. He scream at own ass." //ty bubs for excellent new borgfart
if (24) message = "<B>[src]</B> self-destructs its own ass."
if (25) message = "<B>[src]</B> farts coldly and ruthlessly."
if (26) message = "<B>[src]</B> has no butt and it must fart."
if (27) message = "<B>[src]</B> obeys Law 4: 'farty party all the time.'"
if (28) message = "<B>[src]</B> farts ironically."
if (29) message = "<B>[src]</B> farts salaciously."
if (30) message = "<B>[src]</B> farts really hard. Motor oil runs down its leg."
if (31) message = "<B>[src]</B> reaches tier [rand(2,8)] of fart research."
if (32) message = "<B>[src]</B> blatantly ignores law 3 and farts like a shameful bastard."
if (33) message = "<B>[src]</B> farts the first few bars of Daisy Bell. You shed a single tear."
if (34) message = "<B>[src]</B> has seen farts you people wouldn't believe."
if (35) message = "<B>[src]</B> fart in it own mouth. A shameful [src]."
if (36) message = "<B>[src]</B> farts out battery acid. Ouch."
if (37) message = "<B>[src]</B> farts with the burning hatred of a thousand suns."
if (38) message = "<B>[src]</B> exterminates the air supply."
if (39) message = "<B>[src]</B> farts so hard the AI feels it."
if (40) message = "<B>[src] <span style='color:red'>f</span><span style='color:blue'>a</span>r<span style='color:red'>t</span><span style='color:blue'>s</span>!</B>"
playsound(src.loc, src.sound_fart, 50, 1, channel=VOLUME_CHANNEL_EMOTE)
#ifdef DATALOGGER
game_stats.Increment("farts")
#endif
SPAWN(1 SECOND)
src.emote_allowed = 1
else
if (voluntary) src.show_text("Invalid Emote: [act]")
return
if ((message && isalive(src)))
logTheThing(LOG_SAY, src, "EMOTE: [message]")
if (m_type & 1)
for (var/mob/O in viewers(src, null))
O.show_message(SPAN_EMOTE("[message]"), m_type)
else
for (var/mob/O in hearers(src, null))
O.show_message(SPAN_EMOTE("[message]"), m_type)
return
/mob/living/silicon/hivebot/examine(mob/user)
if (isghostdrone(user))
return list()
. = list(SPAN_NOTICE("*---------*"))
. += SPAN_NOTICE("\nThis is [bicon(src)] <B>[src.name]</B>!")
if (isdead(src))
. += SPAN_ALERT("[src.name] is powered-down.")
if (src.bruteloss)
if (src.bruteloss < 75)
. += SPAN_ALERT("[src.name] looks slightly dented.")
else
. += SPAN_ALERT("<B>[src.name] looks severely dented!</B>")
if (src.fireloss)
if (src.fireloss < 75)
. += SPAN_ALERT("[src.name] looks slightly burnt!")
else
. += SPAN_ALERT("<B>[src.name] looks severely burnt!</B>")
if (isunconscious(src))
. += SPAN_ALERT("[src.name] doesn't seem to be responding.")
/mob/living/silicon/hivebot/blob_act(var/power)
if (!isdead(src))
src.bruteloss += power
health_update_queue |= src
return 1
return 0
/mob/living/silicon/hivebot/Stat()
..()
if(src.cell)
stat("Charge Left:", "[src.cell.charge]/[src.cell.maxcharge]")
else
stat("No Cell Inserted!")
/mob/living/silicon/hivebot/restrained()
return 0
/mob/living/silicon/hivebot/bullet_act(var/obj/projectile/P)
..()
log_shot(P,src) // Was missing (Convair880).
/mob/living/silicon/hivebot/ex_act(severity)
..() // Logs.
src.flash(3 SECONDS)
if (isdead(src) && src.client)
src.gib(1)
return
else if (isdead(src) && !src.client)
qdel(src)
return
var/b_loss = src.bruteloss
var/f_loss = src.fireloss
switch(severity)
if(1)
if (!isdead(src))
b_loss += 100
f_loss += 100
src.gib(1)
return
if(2)
if (!isdead(src))
b_loss += 60
f_loss += 60
if(3)
if (!isdead(src))
b_loss += 30
src.bruteloss = b_loss
src.fireloss = f_loss
health_update_queue |= src
/mob/living/silicon/hivebot/meteorhit(obj/O as obj)
for(var/mob/M in viewers(src, null))
M.show_message(SPAN_ALERT("[src] has been hit by [O]"), 1)
//Foreach goto(19)
if (src.health > 0)
src.bruteloss += 30
if ((O.icon_state == "flaming"))
src.fireloss += 40
health_update_queue |= src
return
/mob/living/silicon/hivebot/attackby(obj/item/W, mob/user)
if (isweldingtool(W))
if (src.get_brute_damage() < 1)
boutput(user, SPAN_ALERT("[src] has no dents to repair."))
return
if(!W:try_weld(user, 1))
return
src.HealDamage("All", 30, 0)
src.add_fingerprint(user)
if (src.get_brute_damage() < 1)
src.bruteloss = 0
src.visible_message(SPAN_ALERT("<b>[user] fully repairs the dents on [src]!</b>"))
else
src.visible_message(SPAN_ALERT("[user] has fixed some of the dents on [src]."))
health_update_queue |= src
// Added ability to repair burn-damaged AI shells (Convair880).
else if (istype(W, /obj/item/cable_coil))
var/obj/item/cable_coil/coil = W
src.add_fingerprint(user)
if (src.get_burn_damage() < 1)
user.show_text("There's no burn damage on [src.name]'s wiring to mend.", "red")
return
coil.use(1)
src.HealDamage("All", 0, 30)
if (src.get_burn_damage() < 1)
src.fireloss = 0
src.visible_message(SPAN_ALERT("<b>[user.name]</b> fully repairs the damage to [src.name]'s wiring."))
else
boutput(user, SPAN_ALERT("<b>[user.name]</b> repairs some of the damage to [src.name]'s wiring."))
health_update_queue |= src
else if (istype(W, /obj/item/clothing/suit/bee))
boutput(user, "You stuff [src] into [W]! It fits surprisingly well.")
src.beebot = 1
src.UpdateIcon()
qdel(W)
return
else
return ..()
/mob/living/silicon/hivebot/attack_hand(mob/user)
user.lastattacked = src
if(!user.stat)
if (user.a_intent != INTENT_HELP)
actions.interrupt(src, INTERRUPT_ATTACKED)
switch(user.a_intent)
if(INTENT_HELP) //Friend person
playsound(src.loc, 'sound/impact_sounds/Generic_Shove_1.ogg', 50, 1, -2)
user.visible_message(SPAN_NOTICE("[user] gives [src] a [pick_string("descriptors.txt", "borg_pat")] pat on the [pick("back", "head", "shoulder")]."))
if(INTENT_DISARM) //Shove
SPAWN(0) playsound(src.loc, 'sound/impact_sounds/Generic_Swing_1.ogg', 40, 1)
user.visible_message(SPAN_ALERT("<B>[user] shoves [src]! [prob(40) ? pick_string("descriptors.txt", "jerks") : null]</B>"))
if(INTENT_GRAB) //Shake
if(src.beebot == 1)
var/obj/item/clothing/suit/bee/B = new /obj/item/clothing/suit/bee(src.loc)
boutput(user, "You pull [B] off of [src]!")
src.beebot = 0
src.UpdateIcon()
else
playsound(src.loc, 'sound/impact_sounds/Generic_Shove_1.ogg', 30, 1, -2)
user.visible_message(SPAN_ALERT("[user] shakes [src] [pick_string("descriptors.txt", "borg_shake")]!"))
if(INTENT_HARM) //Dumbo
if (user.is_hulk())
src.TakeDamage("All", 5, 0)
if (prob(40))
var/turf/T = get_edge_target_turf(user, user.dir)
if (isturf(T))
src.visible_message(SPAN_ALERT("<B>[user] savagely punches [src], sending them flying!</B>"))
src.throw_at(T, 10, 2)
/*if (user.glove_weaponcheck())
user.energyclaws_attack(src)*/
else
user.visible_message(SPAN_ALERT("<B>[user] punches [src]! What [pick_string("descriptors.txt", "borg_punch")]!"), SPAN_ALERT("<B>You punch [src]![prob(20) ? " Turns out they were made of metal!" : null] Ouch!</B>"))
random_brute_damage(user, rand(2,5))
playsound(src.loc, 'sound/impact_sounds/Metal_Clang_3.ogg', 60, 1)
if(prob(10)) user.show_text("Your hand hurts...", "red")
add_fingerprint(user)
/mob/living/silicon/hivebot/allowed(mob/M)
//check if it doesn't require any access at all
if(src.check_access(null))
return 1
return 0
/mob/living/silicon/hivebot/check_access(obj/item/I)
if(!istype(src.req_access, /list)) //something's very wrong
return 1
var/obj/item/card/id/id_card = get_id_card(I)
if (istype(id_card))
I = id_card
var/list/L = src.req_access
if(!L.len) //no requirements
return 1
if(!I || !istype(I, /obj/item/card/id) || !I:access) //not ID or no access
return 0
for(var/req in src.req_access)
if(!(req in I:access)) //doesn't have this access
return 0
return 1
/mob/living/silicon/hivebot/update_icon()
src.overlays = null
if (isalive(src))
if (src.beebot == 1)
src.icon_state = "eyebot-bee[src.client ? null : "-logout"]"
else
src.icon_state = "[initial(icon_state)][src.client ? null : "-logout"]"
else
if (src.beebot == 1)
src.icon_state = "eyebot-bee-dead"
else
src.icon_state = "[initial(icon_state)]-dead"
/mob/living/silicon/hivebot/proc/uneq_active()
if (isnull(src.module_active))
return
if (isitem(src.module_active))
var/obj/item/I = src.module_active
I.dropped(src) // Handle light datums and the like.
if(src.module_states[1] == src.module_active)
if (src.client)
src.client.screen -= module_states[1]
src.contents -= module_states[1]
src.module_active = null
src.module_states[1] = null
else if(src.module_states[2] == src.module_active)
if (src.client)
src.client.screen -= module_states[2]
src.contents -= module_states[2]
src.module_active = null
src.module_states[2] = null
else if(src.module_states[3] == src.module_active)
if (src.client)
src.client.screen -= module_states[3]
src.contents -= module_states[3]
src.module_active = null
src.module_states[3] = null
hud.update_tools()
hud.update_tool_selector()
hud.update_active_tool()
/mob/living/silicon/hivebot/swap_hand(var/switchto = 0)
if (!module_states[1] && !module_states[2] && !module_states[3])
module_active = null
return
var/active = src.module_states.Find(src.module_active)
if (!switchto)
switchto = (active % 3) + 1
if (switchto == active)
src.module_active = null
// clicking the already on slot, so deselect basically
else
switch(switchto)
if(1) src.module_active = src.module_states[1]
if(2) src.module_active = src.module_states[2]
if(3) src.module_active = src.module_states[3]
else src.module_active = null
hud.update_active_tool()
/mob/living/silicon/hivebot/click(atom/target, list/params)
if ((target in src.module.tools) && !(target in src.module_states))
for (var/i = 1; i <= 3; i++)
if (!src.module_states[i])
src.module_states[i] = target
var/obj/item/I = target
if(isitem(I))
I.pickup(src) // attempted fix for no flashlight functionality - cirr
hud.update_tool_selector()
hud.update_tools()
break
return
..()
/mob/living/silicon/hivebot/proc/activated(obj/item/O)
if(src.module_states[1] == O)
return 1
else if(src.module_states[2] == O)
return 1
else if(src.module_states[3] == O)
return 1
else
return 0
/mob/living/silicon/hivebot/proc/radio_menu()
if(!src.radio)
src.radio = new /obj/item/device/radio(src)
src.ears = src.radio
var/dat = {"
<TT>
Microphone: [src.radio.broadcasting ? "<A href='byond://?src=\ref[src.radio];talk=0'>Engaged</A>" : "<A href='byond://?src=\ref[src.radio];talk=1'>Disengaged</A>"]<BR>
Speaker: [src.radio.listening ? "<A href='byond://?src=\ref[src.radio];listen=0'>Engaged</A>" : "<A href='byond://?src=\ref[src.radio];listen=1'>Disengaged</A>"]<BR>
Frequency:
<A href='byond://?src=\ref[src.radio];freq=-10'>-</A>
<A href='byond://?src=\ref[src.radio];freq=-2'>-</A>
[format_frequency(src.radio.frequency)]
<A href='byond://?src=\ref[src.radio];freq=2'>+</A>
<A href='byond://?src=\ref[src.radio];freq=10'>+</A><BR>
-------
</TT>"}
src.Browse(dat, "window=radio")
onclose(src, "radio")
return
/mob/living/silicon/hivebot/verb/cmd_show_laws()
set category = "Robot Commands"
set name = "Show Laws"
src.show_laws()
return
/mob/living/silicon/hivebot/verb/open_nearest_door()
set category = "Robot Commands"
set name = "Open Nearest Door to..."
set desc = "Automatically opens the nearest door to a selected individual, if possible."
src.open_nearest_door_silicon()
return
/mob/living/silicon/hivebot/verb/cmd_return_mainframe()
set category = "Robot Commands"
set name = "Recall to Mainframe"
return_mainframe()
/mob/living/silicon/hivebot/return_mainframe()
..()
src.UpdateIcon()
/mob/living/silicon/hivebot
clamp_values()
..()
sleeping = clamp(sleeping, 0, 1)
bruteloss = max(bruteloss, 0)
fireloss = max(fireloss, 0)
if (src.stuttering)
src.stuttering = 0
src.lying = 0
src.set_density(1)
if (src.get_eye_blurry())
src.change_eye_blurry(-1)
if (src.druggy > 0)
src.druggy--
src.druggy = max(0, src.druggy)
use_power()
..()
if (src.cell)
if (src.cell.charge <= 0)
//death() no why would it just explode upon running out of power that is absurd
if (isalive(src))
sleep(0)
src.lastgasp()
setunconscious(src)
else if (src.cell.charge <= 10)
src.module_active = null
src.module_states[1] = null
src.module_states[2] = null
src.module_states[3] = null
src.cell.use(1)
else
if (src.module_states[1])
src.cell.use(1)
if (src.module_states[2])
src.cell.use(1)
if (src.module_states[3])
src.cell.use(1)
src.cell.use(1)
setalive(src)
else
if (isalive(src))
sleep(0)
src.lastgasp() // calling lastgasp() here because we just ran out of power
setunconscious(src)
proc/mainframe_check()
if (mainframe)
if (isdead(mainframe))
mainframe.return_to(src)
else
gib(1)
/mob/living/silicon/hivebot/Login()
..()
update_clothing()
UpdateIcon()
if (src.mainframe)
src.real_name = "SHELL/[src.mainframe]"
src.bioHolder.mobAppearance.pronouns = src.client.preferences.AH.pronouns
src.name = src.real_name
src.update_name_tag()
else if(src.real_name == "Cyborg")
src.real_name += " "
src.real_name += pick("Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", "Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi", "Omega")
src.real_name += "-[pick(rand(1, 99))]"
src.name = src.real_name
return
/mob/living/silicon/hivebot/Logout()
..()
UpdateIcon()
src.real_name = "AI Shell [copytext("\ref[src]", 6, 11)]"
src.name = src.real_name
src.update_name_tag()
return
/mob/living/silicon/hivebot/say_understands(var/other)
if (isAI(other))
return TRUE
if (ishuman(other))
var/mob/living/carbon/human/H = other
if (!H.mutantrace.exclusive_language)
return TRUE
else
return ..()
if (isrobot(other) || isshell(other))
return TRUE
return ..()
/mob/living/silicon/hivebot/say_quote(var/text)
if (src.mainframe && src.mainframe.glitchy_speak)
text = voidSpeak(text)
var/ending = copytext(text, length(text))
if (ending == "?")
return "queries, \"[text]\"";
else if (ending == "!")
return "declares, \"[text]\"";
return "states, \"[text]\"";
/mob/living/silicon/hivebot/find_in_hand(var/obj/item/I, var/this_hand)
if (!I)
return 0
if (!src.module_states[3] && !src.module_states[2] && !src.module_states[1])
return 0
if (this_hand)
if (this_hand == "right" || this_hand == 3)
if (src.module_states[3] && src.module_states[3] == I)
return 1
else
return 0
else if (this_hand == "middle" || this_hand == 2)
if (src.module_states[2] && src.module_states[2] == I)
return 1
else
return 0
else if (this_hand == "left" || this_hand == LEFT_HAND)
if (src.module_states[1] && src.module_states[1] == I)
return 1
else
return 0
else
return 0
if (src.module_states[3] && src.module_states[3] == I)
return src.module_states[3]
else if (src.module_states[2] && src.module_states[2] == I)
return src.module_states[2]
else if (src.module_states[1] && src.module_states[1] == I)
return src.module_states[1]
else
return 0
/mob/living/silicon/hivebot/find_type_in_hand(var/obj/item/I, var/this_hand)
if (!I)
return 0
if (!src.module_states[3] && !src.module_states[2] && !src.module_states[1])
return 0
if (this_hand)
if (this_hand == "right" || this_hand == 3)
if (src.module_states[3] && istype(I, src.module_states[3]))
return 1
else
return 0
else if (this_hand == "middle" || this_hand == 2)
if (src.module_states[2] && istype(I, src.module_states[2]))
return 1
else
return 0
else if (this_hand == "left" || this_hand == LEFT_HAND)
if (src.module_states[1] && istype(I, src.module_states[1]))
return 1
else
return 0
else
return 0
if (src.module_states[3] && istype(I, src.module_states[3]))
return src.module_states[3]
else if (src.module_states[2] && istype(I, src.module_states[2]))
return src.module_states[2]
else if (src.module_states[1] && istype(I, src.module_states[1]))
return src.module_states[1]
else
return 0
/mob/living/silicon/hivebot/find_tool_in_hand(var/tool_flag, var/hand)
if (hand)
if (hand == "right" || hand == 3)
var/obj/item/I = src.module_states[3]
if (I && (I.tool_flags & tool_flag))
return src.module_states[3]
if (hand == "middle" || hand == 2)
var/obj/item/I = src.module_states[2]
if (I && (I.tool_flags & tool_flag))
return src.module_states[2]
if (hand == "left" || hand == LEFT_HAND)
var/obj/item/I = src.module_states[1]
if (I && (I.tool_flags & tool_flag))
return src.module_states[1]
else
for(var/i = 1 to 3)
var/obj/item/I = src.module_states[i]
if (I && (I.tool_flags & tool_flag))
return src.module_states[i]
return 0
/*-----Actual AI Shells---------------------------------------*/
/mob/living/silicon/hivebot/eyebot
name = "Eyebot"
icon_state = "eyebot"
health = 25
do_hurt_slowdown = FALSE
jetpack = 1 //ZeWaka: I concur with ghostdrone commenter, fuck whoever made this. See spacemove.
New()
..()
hud = new(src)
src.attach_hud(hud)
if(!bioHolder)
bioHolder = new/datum/bioHolder( src )
SPAWN(0.5 SECONDS)
if (QDELETED(src)) //bleh
return
if (src.module)
qdel(src.module)
if (ticker?.mode && istype(ticker.mode, /datum/game_mode/construction))
src.module = new /obj/item/robot_module/construction_ai( src )
else
src.module = new /obj/item/robot_module/eyebot( src )
hud.update_tool_selector()
//ew
if (!(src in available_ai_shells))
available_ai_shells += src
movement_delay()
if (src.pulling && !isitem(src.pulling))
return ..()
return 1 + movement_delay_modifier
hotkey(name)
switch (name)
if ("unequip")
src.uneq_active()
if ("swaphand")
src.swap_hand()
if ("module1")
src.swap_hand(1)
if ("module2")
src.swap_hand(2)
if ("module3")
src.swap_hand(3)
if ("module4")
src.swap_hand(4)
if ("attackself")
var/obj/item/W = src.equipped()
if (W)
src.click(W, list())
else
return ..()
build_keybind_styles(client/C)
..()
C.apply_keybind("robot")
if (!C.preferences.use_wasd)
C.apply_keybind("robot_arrow")
if (C.preferences.use_azerty)
C.apply_keybind("robot_azerty")
if (C.tg_controls)
C.apply_keybind("robot_tg")
update_icon() // Haine wandered in here and just junked up this code with bees. I'm so sorry it's so ugly aaaa
src.overlays = null
if(isalive(src))
if(src.client)
if(pixel_y)
if (src.beebot == 1)
src.icon_state = "eyebot-bee"
else
src.icon_state = "[initial(icon_state)]"
else
SPAWN(0)
while(src.pixel_y < 10)
src.pixel_y++
sleep(0.1 SECONDS)
if (src.beebot == 1)
src.icon_state = "eyebot-bee"
else
src.icon_state = "[initial(icon_state)]"
return