-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathmulebot.dm
755 lines (648 loc) · 21.9 KB
/
mulebot.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
// Mulebot - carries crates around for Quartermaster
// Navigates via floor navbeacons
// Remote Controlled from QM's PDA
#define SIGH 0
#define ANNOYED 1
#define DELIGHT 2
/mob/living/simple_animal/bot/mulebot
name = "\improper MULEbot"
desc = "A Multiple Utility Load Effector bot."
icon_state = "mulebot0"
density = TRUE
move_resist = MOVE_FORCE_STRONG
animate_movement = 1
health = 50
maxHealth = 50
damage_coeff = list(BRUTE = 0.5, BURN = 0.7, TOX = 0, CLONE = 0, STAMINA = 0, OXY = 0)
combat_mode = TRUE //No swapping
can_toggle_combat = FALSE // I SAID NO SWAPPING
buckle_lying = 0
mob_size = MOB_SIZE_LARGE
radio_key = /obj/item/encryptionkey/headset_cargo
radio_channel = RADIO_CHANNEL_SUPPLY
bot_type = MULE_BOT
model = "MULE"
bot_core_type = /obj/machinery/bot_core/mulebot
/// unique identifier in case there are multiple mulebots.
var/id
path_image_color = "#7F5200"
var/atom/movable/load = null
var/mob/living/passenger = null
var/turf/target // this is turf to navigate to (location of beacon)
var/loaddir = 0 // this the direction to unload onto/load from
var/home_destination = "" // tag of home beacon
var/reached_target = 1 //true if already reached the target
var/auto_return = 1 // true if auto return to home beacon after unload
var/auto_pickup = 1 // true if auto-pickup at beacon
var/report_delivery = 1 // true if bot will announce an arrival to a location.
var/obj/item/stock_parts/cell/cell
var/bloodiness = 0
///The amount of steps we should take until we rest for a time.
var/num_steps = 0
/mob/living/simple_animal/bot/mulebot/Initialize(mapload)
. = ..()
wires = new /datum/wires/mulebot(src)
var/datum/job/cargo_tech/J = new/datum/job/cargo_tech
access_card.access = J.get_access()
prev_access = access_card.access
cell = new /obj/item/stock_parts/cell/upgraded(src, 2000)
var/static/mulebot_count = 0
mulebot_count += 1
set_id(suffix || id || "#[mulebot_count]")
suffix = null
/mob/living/simple_animal/bot/mulebot/Destroy()
unload(0)
qdel(wires)
wires = null
return ..()
/mob/living/simple_animal/bot/mulebot/proc/set_id(new_id)
id = new_id
if(paicard)
bot_name = "\improper MULEbot ([new_id])"
else
name = "\improper MULEbot ([new_id])"
/mob/living/simple_animal/bot/mulebot/bot_reset()
..()
reached_target = 0
/mob/living/simple_animal/bot/mulebot/attackby(obj/item/I, mob/living/user, params)
if(I.tool_behaviour == TOOL_SCREWDRIVER)
..()
if(open)
on = FALSE
else if(istype(I, /obj/item/stock_parts/cell) && open && !cell)
if(!user.transferItemToLoc(I, src))
return
cell = I
visible_message("[user] inserts a cell into [src].",
span_notice("You insert the new cell into [src]."))
else if(I.tool_behaviour == TOOL_CROWBAR && open && cell)
cell.add_fingerprint(usr)
cell.forceMove(loc)
cell = null
visible_message("[user] crowbars out the power cell from [src].",
span_notice("You pry the powercell out of [src]."))
else if(is_wire_tool(I) && open)
return attack_hand(user)
else if(load && ismob(load)) // chance to knock off rider
if(prob(1 + I.force * 2))
unload(0)
user.visible_message(span_danger("[user] knocks [load] off [src] with \the [I]!"),
span_danger("You knock [load] off [src] with \the [I]!"))
else
to_chat(user, span_warning("You hit [src] with \the [I] but to no effect!"))
..()
else
..()
update_appearance(UPDATE_ICON)
return
/mob/living/simple_animal/bot/mulebot/emag_act(mob/user, obj/item/card/emag/emag_card)
if(emagged < 1)
emagged = TRUE
if(!open)
locked = !locked
to_chat(user, span_notice("You [locked ? "lock" : "unlock"] [src]'s controls!"))
flick("mulebot-emagged", src)
playsound(src, "sparks", 100, 0)
/mob/living/simple_animal/bot/mulebot/update_icon_state()
. = ..()
if(open)
icon_state="mulebot-hatch"
else
icon_state = "mulebot[wires.is_cut(WIRE_AVOIDANCE)]"
/mob/living/simple_animal/bot/mulebot/update_overlays()
. = ..()
if(load && !ismob(load))//buckling handles the mob offsets
load.pixel_y = initial(load.pixel_y) + 9
if(load.layer < layer)
load.layer = layer + 0.01
. += load
/mob/living/simple_animal/bot/mulebot/ex_act(severity)
unload(0)
switch(severity)
if(1)
qdel(src)
if(2)
for(var/i = 1; i < 3; i++)
wires.cut_random()
if(3)
wires.cut_random()
return
/mob/living/simple_animal/bot/mulebot/bullet_act(obj/projectile/Proj)
. = ..()
if(.)
if(prob(50) && !isnull(load))
unload(0)
if(prob(25))
visible_message(span_danger("Something shorts out inside [src]!"))
wires.cut_random()
/mob/living/simple_animal/bot/mulebot/interact(mob/user)
if(open && !isAI(user))
wires.interact(user)
else
if(wires.is_cut(WIRE_RX) && isAI(user))
return
ui_interact(user)
/mob/living/simple_animal/bot/mulebot/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Mule", name)
ui.open()
/mob/living/simple_animal/bot/mulebot/ui_data(mob/user)
var/list/data = list()
data["on"] = on
data["locked"] = locked
data["siliconUser"] = user.has_unlimited_silicon_privilege
data["mode"] = mode ? mode_name[mode] : "Ready"
data["modeStatus"] = ""
switch(mode)
if(BOT_IDLE, BOT_DELIVER, BOT_GO_HOME)
data["modeStatus"] = "good"
if(BOT_BLOCKED, BOT_NAV, BOT_WAIT_FOR_NAV)
data["modeStatus"] = "average"
if(BOT_NO_ROUTE)
data["modeStatus"] = "bad"
else
data["modeStatus"] = "unknown"
data["load"] = load ? load.name : null
data["destination"] = destination ? destination : null
data["home"] = home_destination
data["destinations"] = GLOB.deliverybeacontags
data["cell"] = cell ? TRUE : FALSE
data["cellPercent"] = cell ? cell.percent() : null
data["autoReturn"] = auto_return
data["autoPickup"] = auto_pickup
data["reportDelivery"] = report_delivery
data["haspai"] = paicard ? TRUE : FALSE
data["id"] = id
return data
/mob/living/simple_animal/bot/mulebot/ui_act(action, params)
if(..() || (locked && !usr.has_unlimited_silicon_privilege))
return
switch(action)
if("lock")
if(usr.has_unlimited_silicon_privilege)
locked = !locked
. = TRUE
if("power")
if(on)
turn_off()
else if(cell && !open)
if(!turn_on())
to_chat(usr, span_warning("You can't switch on [src]!"))
return
. = TRUE
else
bot_control(action, usr, params) // Kill this later.
. = TRUE
/mob/living/simple_animal/bot/mulebot/bot_control(command, mob/user, list/params = list(), pda = FALSE)
if(pda && wires.is_cut(WIRE_RX)) // MULE wireless is controlled by wires.
return
switch(command)
if("stop")
if(mode >= BOT_DELIVER)
bot_reset()
if("go")
if(mode == BOT_IDLE)
start()
if("home")
if(mode == BOT_IDLE || mode == BOT_DELIVER)
start_home()
if("destination")
var/new_dest
if(pda)
new_dest = input(user, "Enter Destination:", name, destination) as null|anything in GLOB.deliverybeacontags
else
new_dest = params["value"]
if(new_dest)
set_destination(new_dest)
if("setid")
var/new_id
if(pda)
new_id = stripped_input(user, "Enter ID:", name, id, MAX_NAME_LEN)
else
new_id = params["value"]
if(new_id)
set_id(new_id)
if("sethome")
var/new_home
if(pda)
new_home = input(user, "Enter Home:", name, home_destination) as null|anything in GLOB.deliverybeacontags
else
new_home = params["value"]
if(new_home)
home_destination = new_home
if("unload")
if(load && mode != BOT_HUNT)
if(loc == target)
unload(loaddir)
else
unload(0)
if("autoret")
auto_return = !auto_return
if("autopick")
auto_pickup = !auto_pickup
if("report")
report_delivery = !report_delivery
if("ejectpai")
ejectpairemote(user)
// TODO: remove this; PDAs currently depend on it
/mob/living/simple_animal/bot/mulebot/get_controls(mob/user)
var/ai = issilicon(user)
var/dat
dat += "<h3>Multiple Utility Load Effector Mk. V</h3>"
dat += "<b>ID:</b> [id]<BR>"
dat += "<b>Power:</b> [on ? "On" : "Off"]<BR>"
dat += "<h3>Status</h3>"
dat += "<div class='statusDisplay'>"
switch(mode)
if(BOT_IDLE)
dat += span_good("Ready")
if(BOT_DELIVER)
dat += span_good("[mode_name[BOT_DELIVER]]")
if(BOT_GO_HOME)
dat += span_good("[mode_name[BOT_GO_HOME]]")
if(BOT_BLOCKED)
dat += span_average("[mode_name[BOT_BLOCKED]]")
if(BOT_NAV,BOT_WAIT_FOR_NAV)
dat += span_average("[mode_name[BOT_NAV]]")
if(BOT_NO_ROUTE)
dat += span_bad("[mode_name[BOT_NO_ROUTE]]")
dat += "</div>"
dat += "<b>Current Load:</b> [load ? load.name : "<i>none</i>"]<BR>"
dat += "<b>Destination:</b> [!destination ? "<i>none</i>" : destination]<BR>"
dat += "<b>Power level:</b> [cell ? cell.percent() : 0]%"
if(locked && !ai && !IsAdminGhost(user))
dat += " <br /><div class='notice'>Controls are locked</div><A href='byond://?src=[REF(src)];op=unlock'>Unlock Controls</A>"
else
dat += " <br /><div class='notice'>Controls are unlocked</div><A href='byond://?src=[REF(src)];op=lock'>Lock Controls</A><BR><BR>"
dat += "<A href='byond://?src=[REF(src)];op=power'>Toggle Power</A><BR>"
dat += "<A href='byond://?src=[REF(src)];op=stop'>Stop</A><BR>"
dat += "<A href='byond://?src=[REF(src)];op=go'>Proceed</A><BR>"
dat += "<A href='byond://?src=[REF(src)];op=home'>Return to Home</A><BR>"
dat += "<A href='byond://?src=[REF(src)];op=destination'>Set Destination</A><BR>"
dat += "<A href='byond://?src=[REF(src)];op=setid'>Set Bot ID</A><BR>"
dat += "<A href='byond://?src=[REF(src)];op=sethome'>Set Home</A><BR>"
dat += "<A href='byond://?src=[REF(src)];op=autoret'>Toggle Auto Return Home</A> ([auto_return ? "On":"Off"])<BR>"
dat += "<A href='byond://?src=[REF(src)];op=autopick'>Toggle Auto Pickup Crate</A> ([auto_pickup ? "On":"Off"])<BR>"
dat += "<A href='byond://?src=[REF(src)];op=report'>Toggle Delivery Reporting</A> ([report_delivery ? "On" : "Off"])<BR>"
if(load)
dat += "<A href='byond://?src=[REF(src)];op=unload'>Unload Now</A><BR>"
dat += "<div class='notice'>The maintenance hatch is closed.</div>"
return dat
// returns true if the bot has power
/mob/living/simple_animal/bot/mulebot/proc/has_power()
return !open && cell && cell.charge > 0 && (!wires.is_cut(WIRE_POWER1) && !wires.is_cut(WIRE_POWER2))
/mob/living/simple_animal/bot/mulebot/proc/buzz(type)
switch(type)
if(SIGH)
audible_message("[src] makes a sighing buzz.", span_italics("You hear an electronic buzzing sound."))
playsound(loc, 'sound/machines/buzz-sigh.ogg', 50, 0)
if(ANNOYED)
audible_message("[src] makes an annoyed buzzing sound.", span_italics("You hear an electronic buzzing sound."))
playsound(loc, 'sound/machines/buzz-two.ogg', 50, 0)
if(DELIGHT)
audible_message("[src] makes a delighted ping!", span_italics("You hear a ping."))
playsound(loc, 'sound/machines/ping.ogg', 50, 0)
// mousedrop a crate to load the bot
// can load anything if hacked
/mob/living/simple_animal/bot/mulebot/MouseDrop_T(atom/movable/AM, mob/user)
var/mob/living/L = user
if(user.incapacitated() || (istype(L) && !(L.mobility_flags & MOBILITY_STAND)))
return
if(!istype(AM))
return
load(AM)
// called to load a crate
/mob/living/simple_animal/bot/mulebot/proc/load(atom/movable/AM)
if(load || AM.anchored)
return
if(!isturf(AM.loc)) //To prevent the loading from stuff from someone's inventory or screen icons.
return
var/obj/structure/closet/crate/CRATE
if(istype(AM, /obj/structure/closet/crate))
CRATE = AM
else
if(!wires.is_cut(WIRE_LOADCHECK))
buzz(SIGH)
return // if not hacked, only allow crates to be loaded
if(CRATE) // if it's a crate, close before loading
CRATE.close()
if(isobj(AM))
var/obj/O = AM
if(O.has_buckled_mobs() || (locate(/mob) in AM)) //can't load non crates objects with mobs buckled to it or inside it.
buzz(SIGH)
return
if(isliving(AM))
if(!load_mob(AM))
return
else
AM.forceMove(src)
load = AM
mode = BOT_IDLE
update_appearance(UPDATE_ICON)
/mob/living/simple_animal/bot/mulebot/proc/load_mob(mob/living/M)
can_buckle = TRUE
if(buckle_mob(M))
passenger = M
load = M
can_buckle = FALSE
return TRUE
return FALSE
/mob/living/simple_animal/bot/mulebot/post_buckle_mob(mob/living/M)
M.pixel_y = initial(M.pixel_y) + 9
if(M.layer < layer)
M.layer = layer + 0.01
/mob/living/simple_animal/bot/mulebot/post_unbuckle_mob(mob/living/M)
load = null
M.layer = initial(M.layer)
M.pixel_y = initial(M.pixel_y)
// called to unload the bot
// argument is optional direction to unload
// if zero, unload at bot's location
/mob/living/simple_animal/bot/mulebot/proc/unload(dirn)
if(!load)
return
mode = BOT_IDLE
cut_overlays()
unbuckle_all_mobs()
if(load)
load.forceMove(loc)
load.pixel_y = initial(load.pixel_y)
load.layer = initial(load.layer)
SET_PLANE_IMPLICIT(load, initial(load.plane))
if(dirn)
var/turf/T = loc
var/turf/newT = get_step(T,dirn)
if(load.CanPass(load,newT)) //Can't get off onto anything that wouldn't let you pass normally
step(load, dirn)
load = null
/mob/living/simple_animal/bot/mulebot/call_bot()
..()
if(path && path.len)
target = ai_waypoint //Target is the end point of the path, the waypoint set by the AI.
destination = get_area_name(target, TRUE)
pathset = 1 //Indicates the AI's custom path is initialized.
start()
/mob/living/simple_animal/bot/mulebot/handle_automated_action()
if(!has_power())
on = FALSE
return
if(on)
var/speed = (wires.is_cut(WIRE_MOTOR1) ? 0 : 1) + (wires.is_cut(WIRE_MOTOR2) ? 0 : 2)
if(!speed)//Devide by zero man bad
return
num_steps = round(10/speed) //10, 5, or 3 steps, depending on how many wires we have cut
if(mode != BOT_IDLE)
START_PROCESSING(SSfastprocess, src)
/mob/living/simple_animal/bot/mulebot/process()
if(num_steps <= 0)
return PROCESS_KILL
num_steps--
if(!on || client)
return
update_appearance(UPDATE_ICON)
switch(mode)
if(BOT_IDLE) // idle
return
if(BOT_DELIVER, BOT_GO_HOME, BOT_BLOCKED) // navigating to deliver,home, or blocked
if(loc == target) // reached target
at_target()
return
else if(path.len > 0 && target) // valid path
var/turf/next = path[1]
reached_target = 0
if(next == loc)
path -= next
return
if(isturf(next))
if(bloodiness)
var/obj/effect/decal/cleanable/blood/tracks/B = new(loc)
B.add_blood_DNA(return_blood_DNA())
var/newdir = get_dir(next, loc)
if(newdir == dir)
B.setDir(newdir)
else
newdir = newdir | dir
if(newdir == 3)
newdir = 1
else if(newdir == 12)
newdir = 4
B.setDir(newdir)
bloodiness--
var/oldloc = loc
var/moved = step_towards(src, next) // attempt to move
if(cell)
cell.use(1)
if(moved && oldloc!=loc) // successful move
blockcount = 0
path -= loc
if(destination == home_destination)
mode = BOT_GO_HOME
else
mode = BOT_DELIVER
else // failed to move
blockcount++
mode = BOT_BLOCKED
if(blockcount == 3)
buzz(ANNOYED)
if(blockcount > 10) // attempt 10 times before recomputing
// find new path excluding blocked turf
buzz(SIGH)
mode = BOT_WAIT_FOR_NAV
blockcount = 0
spawn(20)
calc_path(avoid=next)
if(path.len > 0)
buzz(DELIGHT)
mode = BOT_BLOCKED
return
return
else
buzz(ANNOYED)
mode = BOT_NAV
return
else
mode = BOT_NAV
return
if(BOT_NAV) // calculate new path
mode = BOT_WAIT_FOR_NAV
spawn(0)
calc_path()
if(path.len > 0)
blockcount = 0
mode = BOT_BLOCKED
buzz(DELIGHT)
else
buzz(SIGH)
mode = BOT_NO_ROUTE
// calculates a path to the current destination
// given an optional turf to avoid
/mob/living/simple_animal/bot/mulebot/calc_path(turf/avoid = null)
path = get_path_to(src, target, /turf/proc/Distance_cardinal, 0, 250, id=access_card, exclude=avoid)
// sets the current destination
// signals all beacons matching the delivery code
// beacons will return a signal giving their locations
/mob/living/simple_animal/bot/mulebot/proc/set_destination(new_dest)
new_destination = new_dest
get_nav()
// starts bot moving to current destination
/mob/living/simple_animal/bot/mulebot/proc/start()
if(!on)
return
if(destination == home_destination)
mode = BOT_GO_HOME
else
mode = BOT_DELIVER
update_appearance(UPDATE_ICON)
get_nav()
// starts bot moving to home
// sends a beacon query to find
/mob/living/simple_animal/bot/mulebot/proc/start_home()
if(!on)
return
spawn(0)
set_destination(home_destination)
mode = BOT_BLOCKED
update_appearance(UPDATE_ICON)
// called when bot reaches current target
/mob/living/simple_animal/bot/mulebot/proc/at_target()
if(!reached_target)
radio_channel = RADIO_CHANNEL_SUPPLY //Supply channel
audible_message("[src] makes a chiming sound!", span_italics("You hear a chime."))
playsound(loc, 'sound/machines/chime.ogg', 50, 0)
reached_target = 1
if(pathset) //The AI called us here, so notify it of our arrival.
loaddir = dir //The MULE will attempt to load a crate in whatever direction the MULE is "facing".
if(calling_ai)
to_chat(calling_ai, span_notice("[icon2html(src, calling_ai)] [src] wirelessly plays a chiming sound!"))
playsound(calling_ai, 'sound/machines/chime.ogg',40, 0)
calling_ai = null
radio_channel = RADIO_CHANNEL_AI_PRIVATE //Report on AI Private instead if the AI is controlling us.
if(load) // if loaded, unload at target
if(report_delivery)
speak("Destination <b>[destination]</b> reached. Unloading [load].",radio_channel)
unload(loaddir)
else
// not loaded
if(auto_pickup) // find a crate
var/atom/movable/AM
if(wires.is_cut(WIRE_LOADCHECK)) // if hacked, load first unanchored thing we find
for(var/atom/movable/A in get_step(loc, loaddir))
if(!A.anchored)
AM = A
break
else // otherwise, look for crates only
AM = locate(/obj/structure/closet/crate) in get_step(loc,loaddir)
if(AM && AM.Adjacent(src))
load(AM)
if(report_delivery)
speak("Now loading [load] at <b>[get_area_name(src)]</b>.", radio_channel)
// whatever happened, check to see if we return home
if(auto_return && home_destination && destination != home_destination)
// auto return set and not at home already
start_home()
mode = BOT_BLOCKED
else
bot_reset() // otherwise go idle
return
// called when bot bumps into anything
/mob/living/simple_animal/bot/mulebot/Bump(atom/obs)
if(wires.is_cut(WIRE_AVOIDANCE)) // usually just bumps, but if avoidance disabled knock over mobs
if(isliving(obs))
var/mob/living/L = obs
if(iscyborg(L))
visible_message(span_danger("[src] bumps into [L]!"))
else
if(!paicard)
log_combat(src, L, "knocked down")
visible_message(span_danger("[src] knocks over [L]!"))
L.Knockdown(8 SECONDS)
return ..()
// called from mob/living/carbon/human/proc/on_entered()
// when mulebot is in the same loc
/mob/living/simple_animal/bot/mulebot/proc/RunOver(mob/living/carbon/human/H)
log_combat(src, H, "run over", null, "(DAMTYPE: [uppertext(BRUTE)])")
H.visible_message(span_danger("[src] drives over [H]!"), \
span_userdanger("[src] drives over you!"))
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
var/damage = rand(5,15)
H.apply_damage(2*damage, BRUTE, BODY_ZONE_HEAD, run_armor_check(BODY_ZONE_HEAD, MELEE))
H.apply_damage(2*damage, BRUTE, BODY_ZONE_CHEST, run_armor_check(BODY_ZONE_CHEST, MELEE))
H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_L_LEG, run_armor_check(BODY_ZONE_L_LEG, MELEE))
H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_R_LEG, run_armor_check(BODY_ZONE_R_LEG, MELEE))
H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_L_ARM, run_armor_check(BODY_ZONE_L_ARM, MELEE))
H.apply_damage(0.5*damage, BRUTE, BODY_ZONE_R_ARM, run_armor_check(BODY_ZONE_R_ARM, MELEE))
var/turf/T = get_turf(src)
T.add_mob_blood(H)
var/list/blood_dna = H.get_blood_dna_list()
add_blood_DNA(blood_dna)
bloodiness += 4
// player on mulebot attempted to move
/mob/living/simple_animal/bot/mulebot/relaymove(mob/user)
if(user.incapacitated())
return
if(load == user)
unload(0)
//Update navigation data. Called when commanded to deliver, return home, or a route update is needed...
/mob/living/simple_animal/bot/mulebot/proc/get_nav()
if(!on || wires.is_cut(WIRE_BEACON))
return
for(var/obj/machinery/navbeacon/NB in GLOB.deliverybeacons)
if(NB.location == new_destination) // if the beacon location matches the set destination
// the we will navigate there
destination = new_destination
target = NB.loc
var/direction = NB.dir // this will be the load/unload dir
if(direction)
loaddir = text2num(direction)
else
loaddir = 0
update_appearance(UPDATE_ICON)
if(destination) // No need to calculate a path if you do not have a destination set!
calc_path()
/mob/living/simple_animal/bot/mulebot/emp_act(severity)
. = ..()
if(cell && !(. & EMP_PROTECT_CONTENTS))
cell.emp_act(severity)
if(load)
load.emp_act(severity)
/mob/living/simple_animal/bot/mulebot/explode()
visible_message(span_boldannounce("[src] blows apart!"))
var/atom/Tsec = drop_location()
new /obj/item/assembly/prox_sensor(Tsec)
new /obj/item/stack/rods(Tsec)
new /obj/item/stack/rods(Tsec)
new /obj/item/stack/cable_coil/cut(Tsec)
if(cell)
cell.forceMove(Tsec)
cell.update_appearance(UPDATE_ICON)
cell = null
do_sparks(3, TRUE, src)
new /obj/effect/decal/cleanable/oil(loc)
..()
/mob/living/simple_animal/bot/mulebot/remove_air(amount) //To prevent riders suffocating
if(loc)
return loc.remove_air(amount)
else
return null
/mob/living/simple_animal/bot/mulebot/remove_air_ratio(ratio)
if(loc)
return loc.remove_air_ratio(ratio)
return null
/mob/living/simple_animal/bot/mulebot/resist()
..()
if(load)
unload()
/mob/living/simple_animal/bot/mulebot/UnarmedAttack(atom/A)
if(isturf(A) && isturf(loc) && loc.Adjacent(A) && load)
unload(get_dir(loc, A))
else
..()
/mob/living/simple_animal/bot/mulebot/insertpai(mob/user, obj/item/computer_hardware/paicard/card)
if(..())
visible_message("[src] safeties are locked on.")
#undef SIGH
#undef ANNOYED
#undef DELIGHT
/obj/machinery/bot_core/mulebot
req_access = list(ACCESS_CARGO)