forked from BigSlice/-tg-station
/
dwarf.dm
782 lines (679 loc) · 32.6 KB
/
dwarf.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
//Please note that the human sprite is a placeholder until the spritefag gets around
//to making dorf sprites for me - DerFlammenwerfer
/mob/living/carbon/dwarf
name = "Unknown"
real_name = "Unknown"
voice_name = "Unknown"
icon = 'icons/mob/human.dmi'
icon_state = "caucasian1_m_s"
var/revivalnotification = 0
/mob/living/carbon/dwarf/New()
create_reagents(1000)
verbs += /mob/living/proc/mob_sleep
verbs += /mob/living/proc/lay_down
//initialise organs
/*organs = newlist(/obj/item/organ/limb/chest, /obj/item/organ/limb/head, /obj/item/organ/limb/arm/l_arm,
/obj/item/organ/limb/arm/r_arm, /obj/item/organ/limb/leg/r_leg, /obj/item/organ/limb/leg/l_leg)*/
organsystem = new/datum/organsystem/humanoid/dwarf(src)
// for spawned dorfs; overwritten by other code
ready_dna(src)
make_blood(800)
set_skin_tone(skin_tone) //So DNA gets it set properly
..()
var/mob/M = src
faction |= "\ref[M]"
regenerate_icons()
update_body_parts()
/mob/living/carbon/dwarf/prepare_data_huds()
//Update med hud images...
..()
//...sec hud images...
//...and display them.
add_to_all_data_huds()
//I'm thinking we can modify the changeling/blob/alium chemical meter to track how many units of alcohol are
//in a dwarf's bloodstream. I am not sure how to go about that right now, but I'll look at the changeling file
//and see if I can hack something together for it -DerFlammenwerfer
/mob/living/carbon/dwarf/Stat()
..()
if(statpanel("Status"))
stat(null, "Intent: [a_intent]")
stat(null, "Move Mode: [m_intent]")
if(ticker && ticker.mode && ticker.mode.name == "AI malfunction")
var/datum/game_mode/malfunction/malf = ticker.mode
if(malf.malf_mode_declared && (malf.apcs > 0))
stat(null, "Time left: [max(malf.AI_win_timeleft/malf.apcs, 0)]")
if (internal)
if (!internal.air_contents)
qdel(internal)
else
stat("Internal Atmosphere Info", internal.name)
stat("Tank Pressure", internal.air_contents.return_pressure())
stat("Distribution Pressure", internal.distribute_pressure)
if(mind)
if(mind.changeling)
stat("Chemical Storage", "[mind.changeling.chem_charges]/[mind.changeling.chem_storage]")
stat("Absorbed DNA", mind.changeling.absorbedcount)
/mob/living/carbon/dwarf/ex_act(severity, ex_target)
var/b_loss = null
var/f_loss = null
switch (severity)
if (1.0)
b_loss += 500
if (!prob(getarmor(null, "bomb")))
gib()
return
else
var/atom/target = get_edge_target_turf(src, get_dir(src, get_step_away(src, src)))
throw_at(target, 200, 4)
//return
// var/atom/target = get_edge_target_turf(user, get_dir(src, get_step_away(user, src)))
//user.throw_at(target, 200, 4)
if (2.0)
b_loss += 60
f_loss += 60
if (prob(getarmor(null, "bomb")))
b_loss = b_loss/1.5
f_loss = f_loss/1.5
if (!istype(ears, /obj/item/clothing/ears/earmuffs))
adjustEarDamage(30, 120)
if (prob(70))
Paralyse(10)
if(3.0)
b_loss += 30
if (prob(getarmor(null, "bomb")))
b_loss = b_loss/2
if (!istype(ears, /obj/item/clothing/ears/earmuffs))
adjustEarDamage(15,60)
if (prob(50))
Paralyse(10)
var/update = 0
for(var/datum/organ/limb/limbdata in get_limbs())
var/probability = 0
if(limbdata.name == "head")
probability = b_loss/40 //This is half the chance for dismemberment from bombs that humans have -DerFlammenwerfer
else
probability = b_loss/6 //Dwarf bones are far more sturdy. If it needs to be tweaked later for balance, that's fine. -DerFlammenwerfer
if(probability && prob(probability))
var/obj/item/organ/limb/O = limbdata.dismember(ORGAN_DESTROYED)
if(O)
O.streak()
visible_message("<span class='danger'>[src]'s [O.name] is struck and the severed part sails off in an arc!</span>", "<span class='userdanger'>Your [O.name] is struck and the severed part sails off in an arc!</span>")
var/turf/location = src.loc
if(istype(location, /turf/simulated))
location.add_blood_floor(src)
if(limbdata.exists())
var/obj/item/organ/limb/temp = limbdata.organitem
switch(temp.name)
if("head")
update |= temp.take_damage(b_loss * 0.2, f_loss * 0.2)
if("chest")
update |= temp.take_damage(b_loss * 0.4, f_loss * 0.4)
if("l_arm")
update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05)
if("r_arm")
update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05)
if("l_leg")
update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05)
if("r_leg")
update |= temp.take_damage(b_loss * 0.05, f_loss * 0.05)
if(update) update_damage_overlays(0)
..()
/mob/living/carbon/dwarf/blob_act() //Not expecting dwarves to ever encounter blobs, be it during embark or in fortress mode, but I'm adding this anyway. -DerFlammenwerfer
if(stat == DEAD) return
show_message("<span class='userdanger'> The blob attacks you!</span>")
var/dam_zone = pick("chest", "l_hand", "r_hand", "l_leg", "r_leg")
dam_zone = ran_zone(dam_zone)
apply_damage(5, BRUTE, dam_zone, run_armor_check(dam_zone, "melee"))
return
/mob/living/carbon/dwarf/show_inv(mob/user)
user.set_machine(src)
var/has_breathable_mask = istype(wear_mask, /obj/item/clothing/mask)
var/list/obscured = check_obscured_slots()
var/dat = {"<table>
<tr><td><B>Left Hand:</B></td><td><A href='?src=\ref[src];item=[slot_l_hand]'>[(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "<font color=grey>Empty</font>"]</A></td></tr>
<tr><td><B>Right Hand:</B></td><td><A href='?src=\ref[src];item=[slot_r_hand]'>[(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "<font color=grey>Empty</font>"]</A></td></tr>
<tr><td> </td></tr>"}
dat += "<tr><td><B>Back:</B></td><td><A href='?src=\ref[src];item=[slot_back]'>[(back && !(back.flags&ABSTRACT)) ? back : "<font color=grey>Empty</font>"]</A>"
if(has_breathable_mask && istype(back, /obj/item/weapon/tank))
dat += " <A href='?src=\ref[src];internal=[slot_back]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "</td></tr><tr><td> </td></tr>"
dat += "<tr><td><B>Head:</B></td><td><A href='?src=\ref[src];item=[slot_head]'>[(head && !(head.flags&ABSTRACT)) ? head : "<font color=grey>Empty</font>"]</A></td></tr>"
if(slot_wear_mask in obscured)
dat += "<tr><td><font color=grey><B>Mask:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
else
dat += "<tr><td><B>Mask:</B></td><td><A href='?src=\ref[src];item=[slot_wear_mask]'>[(wear_mask && !(wear_mask.flags&ABSTRACT)) ? wear_mask : "<font color=grey>Empty</font>"]</A></td></tr>"
if(slot_glasses in obscured)
dat += "<tr><td><font color=grey><B>Eyes:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
else
dat += "<tr><td><B>Eyes:</B></td><td><A href='?src=\ref[src];item=[slot_glasses]'>[(glasses && !(glasses.flags&ABSTRACT)) ? glasses : "<font color=grey>Empty</font>"]</A></td></tr>"
if(slot_ears in obscured)
dat += "<tr><td><font color=grey><B>Ears:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
else
dat += "<tr><td><B>Ears:</B></td><td><A href='?src=\ref[src];item=[slot_ears]'>[(ears && !(ears.flags&ABSTRACT)) ? ears : "<font color=grey>Empty</font>"]</A></td></tr>"
dat += "<tr><td> </td></tr>"
dat += "<tr><td><B>Exosuit:</B></td><td><A href='?src=\ref[src];item=[slot_wear_suit]'>[(wear_suit && !(wear_suit.flags&ABSTRACT)) ? wear_suit : "<font color=grey>Empty</font>"]</A></td></tr>"
if(wear_suit)
dat += "<tr><td> ↳<B>Suit Storage:</B></td><td><A href='?src=\ref[src];item=[slot_s_store]'>[(s_store && !(s_store.flags&ABSTRACT)) ? s_store : "<font color=grey>Empty</font>"]</A>"
if(has_breathable_mask && istype(s_store, /obj/item/weapon/tank))
dat += " <A href='?src=\ref[src];internal=[slot_s_store]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "</td></tr>"
else
dat += "<tr><td><font color=grey> ↳<B>Suit Storage:</B></font></td></tr>"
if(slot_shoes in obscured)
dat += "<tr><td><font color=grey><B>Shoes:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
else
dat += "<tr><td><B>Shoes:</B></td><td><A href='?src=\ref[src];item=[slot_shoes]'>[(shoes && !(shoes.flags&ABSTRACT)) ? shoes : "<font color=grey>Empty</font>"]</A></td></tr>"
if(slot_gloves in obscured)
dat += "<tr><td><font color=grey><B>Gloves:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
else
dat += "<tr><td><B>Gloves:</B></td><td><A href='?src=\ref[src];item=[slot_gloves]'>[(gloves && !(gloves.flags&ABSTRACT)) ? gloves : "<font color=grey>Empty</font>"]</A></td></tr>"
if(slot_w_uniform in obscured)
dat += "<tr><td><font color=grey><B>Uniform:</B></font></td><td><font color=grey>Obscured</font></td></tr>"
else
dat += "<tr><td><B>Uniform:</B></td><td><A href='?src=\ref[src];item=[slot_w_uniform]'>[(w_uniform && !(w_uniform.flags&ABSTRACT)) ? w_uniform : "<font color=grey>Empty</font>"]</A></td></tr>"
if(w_uniform == null || (slot_w_uniform in obscured) || (dna && dna.species.nojumpsuit))
dat += "<tr><td><font color=grey> ↳<B>Pockets:</B></font></td></tr>"
dat += "<tr><td><font color=grey> ↳<B>ID:</B></font></td></tr>"
dat += "<tr><td><font color=grey> ↳<B>Belt:</B></font></td></tr>"
else
dat += "<tr><td> ↳<B>Belt:</B></td><td><A href='?src=\ref[src];item=[slot_belt]'>[(belt && !(belt.flags&ABSTRACT)) ? belt : "<font color=grey>Empty</font>"]</A>"
if(has_breathable_mask && istype(belt, /obj/item/weapon/tank))
dat += " <A href='?src=\ref[src];internal=[slot_belt]'>[internal ? "Disable Internals" : "Set Internals"]</A>"
dat += "</td></tr>"
dat += "<tr><td> ↳<B>Pockets:</B></td><td><A href='?src=\ref[src];pockets=left'>[(l_store && !(l_store.flags&ABSTRACT)) ? "Left (Full)" : "<font color=grey>Left (Empty)</font>"]</A>"
dat += " <A href='?src=\ref[src];pockets=right'>[(r_store && !(r_store.flags&ABSTRACT)) ? "Right (Full)" : "<font color=grey>Right (Empty)</font>"]</A></td></tr>"
dat += "<tr><td> ↳<B>ID:</B></td><td><A href='?src=\ref[src];item=[slot_wear_id]'>[(wear_id && !(wear_id.flags&ABSTRACT)) ? wear_id : "<font color=grey>Empty</font>"]</A></td></tr>"
if(handcuffed)
dat += "<tr><td><B>Handcuffed:</B> <A href='?src=\ref[src];item=[slot_handcuffed]'>Remove</A></td></tr>"
if(legcuffed)
dat += "<tr><td><A href='?src=\ref[src];item=[slot_legcuffed]'>Legcuffed</A></td></tr>"
dat += {"</table>
<A href='?src=\ref[user];mach_close=mob\ref[src]'>Close</A>
"}
var/datum/browser/popup = new(user, "mob\ref[src]", "[src]", 440, 510)
popup.set_content(dat)
popup.open()
// called when something steps onto a human
// this could be made more general, but for now just handle mulebot
/mob/living/carbon/dwarf/Crossed(var/atom/movable/AM)
var/obj/machinery/bot/mulebot/MB = AM
if(istype(MB))
MB.RunOver(src)
//Siemens Coefficient is what determines if you get electrocuted and whether or not you take partial, full, or additional damage. You find its var on clothing. -DerFlammenwerfer
/mob/living/carbon/dwarf/electrocute_act(var/shock_damage, var/obj/source, var/siemens_coeff = 1.0, var/safety = 0)
if(!safety)
if(gloves)
var/obj/item/clothing/gloves/G = gloves
siemens_coeff = G.siemens_coefficient
return ..(shock_damage,source,siemens_coeff)
//Some code regarding embedded objects and pickpocketing (and by extension the Shady Hands Shuffle) -DerFlammenwerfer
/mob/living/carbon/dwarf/Topic(href, href_list)
if(usr.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
if(href_list["embedded_object"])
var/obj/item/I = locate(href_list["embedded_object"])
var/obj/item/organ/limb/L = locate(href_list["embedded_limb"])
if(!I || !L || I.loc != src) //no item, no limb, or item is not in limb (the person atleast) anymore
return
var/time_taken = I.embedded_unsafe_removal_time*I.w_class
usr.visible_message("<span class='notice'>[usr] attempts to remove [I] from their [L]!</span>","<span class='notice'>You attempt to remove [I] from your [L], it will take [time_taken/10] seconds.</span>")
if(do_after(usr, time_taken, needhand = 1, target = usr))
L.embedded_objects -= I
L.take_damage(I.embedded_unsafe_removal_pain_multiplier*I.w_class)//It hurts to rip it out, get surgery you dingus.
I.loc = get_turf(src)
usr.put_in_hands(I)
usr.emote("scream")
usr.visible_message("<span class='danger'>[usr] successfully rips [I] out of their [L]!</span>","<span class='userdanger'>You successfully remove [I] from your [L]!</span>")
return
if(href_list["item"])
var/slot = text2num(href_list["item"])
if(slot in check_obscured_slots())
usr << "<span class='warning'>You can't reach that. Something is covering it.</span>"
return
if(href_list["pockets"])
var/pocket_side = href_list["pockets"]
var/pocket_id = (pocket_side == "right" ? slot_r_store : slot_l_store)
var/obj/item/pocket_item = (pocket_id == slot_r_store ? src.r_store : src.l_store)
var/obj/item/place_item = usr.get_active_hand() // Item to place in the pocket, if it's empty
//visible_message("<span class='danger'>[usr] tries to empty [src]'s pockets.</span>", \
"<span class='userdanger'>[usr] tries to empty [src]'s pockets.</span>") // Pickpocketing!
var/delay_denominator = 1
if(pocket_item && !(pocket_item.flags&ABSTRACT))
if(pocket_item.flags & NODROP)
usr << "<span class='notice'>You try to empty [src]'s [pocket_side] pocket, it seems to be stuck!</span>"
usr << "<span class='notice'>You try to empty [src]'s [pocket_side] pocket.</span>"
else if(place_item && place_item.mob_can_equip(src, pocket_id, 1) && !(place_item.flags&ABSTRACT))
usr << "<span class='notice'>You try to place [place_item] into [src]'s [pocket_side] pocket.</span>"
delay_denominator = 4
else
return
if(do_mob(usr, src, POCKET_STRIP_DELAY/delay_denominator)) //placing an item into the pocket is 4 times faster
if(pocket_item)
unEquip(pocket_item)
else
if(place_item)
usr.unEquip(place_item)
equip_to_slot_if_possible(place_item, pocket_id, 0, 1)
// Update strip window
if(usr.machine == src && in_range(src, usr))
show_inv(usr)
else
// Display a warning if the user mocks up
src << "<span class='warning'>You feel your [pocket_side] pocket being fumbled with!</span>"
..()
///////HUDs///////
if(href_list["hud"])
if(istype(usr, /mob/living/carbon/dwarf))
var/mob/living/carbon/dwarf/H = usr
var/perpname = get_face_name(get_id_name(""))
if(istype(H.glasses, /obj/item/clothing/glasses/hud))
var/datum/data/record/R = find_record("name", perpname, data_core.general)
if(href_list["photo_front"] || href_list["photo_side"])
if(R)
if(!canUseHUD()) return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud)) return
var/obj/item/weapon/photo/P = null
if(href_list["photo_front"])
P = R.fields["photo_front"]
else if(href_list["photo_side"])
P = R.fields["photo_side"]
if(P)
P.show(H)
if(href_list["hud"] == "m")
if(istype(H.glasses, /obj/item/clothing/glasses/hud/health))
if(href_list["p_stat"])
var/health = input(usr, "Specify a new physical status for this person.", "Medical HUD", R.fields["p_stat"]) in list("Active", "Physically Unfit", "*Unconscious*", "*Deceased*", "Cancel")
if(R)
if(!canUseHUD()) return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/health)) return
if(health && health != "Cancel")
R.fields["p_stat"] = health
return
if(href_list["m_stat"])
var/health = input(usr, "Specify a new mental status for this person.", "Medical HUD", R.fields["m_stat"]) in list("Stable", "*Watch*", "*Unstable*", "*Insane*", "Cancel")
if(R)
if(!canUseHUD()) return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/health)) return
if(health && health != "Cancel")
R.fields["m_stat"] = health
return
if(href_list["evaluation"])
if(!getBruteLoss() && !getFireLoss() && !getOxyLoss() && getToxLoss() < 20)
usr << "<span class='notice'>No external injuries detected.</span><br>"
return
var/span = "notice"
var/status = ""
if(getBruteLoss())
usr << "<b>Physical trauma analysis:</b>"
for(var/datum/organ/limb/LI in get_limbs())
if(LI.exists())
var/obj/item/organ/limb/org = LI.organitem
var/brutedamage = org.brute_dam
if(brutedamage > 0)
status = "received minor physical injuries."
span = "notice"
if(brutedamage > 20)
status = "been seriously damaged."
span = "danger"
if(brutedamage > 40)
status = "sustained major trauma!"
span = "userdanger"
if(brutedamage)
usr << "<span class='[span]'>The [org] appears to have [status]</span>"
if(getFireLoss())
usr << "<b>Analysis of skin burns:</b>"
for(var/datum/organ/limb/LI in get_limbs())
if(LI.exists())
var/obj/item/organ/limb/org = LI.organitem
var/burndamage = org.burn_dam
if(burndamage > 0)
status = "signs of minor burns."
span = "notice"
if(burndamage > 20)
status = "serious burns."
span = "danger"
if(burndamage > 40)
status = "major burns!"
span = "userdanger"
if(burndamage)
usr << "<span class='[span]'>The [org] appears to have [status]</span>"
if(getOxyLoss())
usr << "<span class='danger'>Patient has signs of suffocation, emergency treatment may be required!</span>"
if(getToxLoss() > 20)
usr << "<span class='danger'>Gathered data is inconsistent with the analysis, possible cause: poisoning.</span>"
if(href_list["hud"] == "s")
if(stat || usr == src)
return
if(!H.test_sechud_allowed(src)) //Don't cache it as we need to check again after the inputs
H << "<span class='warning'>ERROR: Invalid Access</span>"
return
if(perpname)
R = find_record("name", perpname, data_core.security)
if(R)
if(href_list["status"])
var/setcriminal = input(usr, "Specify a new criminal status for this person.", "Security HUD", R.fields["criminal"]) in list("None", "*Arrest*", "Incarcerated", "Parolled", "Discharged", "Cancel")
if(setcriminal != "Cancel")
if(R)
var/allowed = H.test_sechud_allowed(src)
if(allowed && canUseHUD())
if(istype(H.glasses, /obj/item/clothing/glasses/hud/security))
investigate_log("[src.key] has been set from [R.fields["criminal"]] to [setcriminal] by [usr.name] ([usr.key]).", "records")
R.fields["criminal"] = setcriminal
return
if(href_list["view"])
if(R)
if(!canUseHUD()) return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/security)) return
usr << "<b>Name:</b> [R.fields["name"]] <b>Criminal Status:</b> [R.fields["criminal"]]"
usr << "<b>Minor Crimes:</b>"
for(var/datum/data/crime/c in R.fields["mi_crim"])
usr << "<b>Crime:</b> [c.crimeName]"
usr << "<b>Details:</b> [c.crimeDetails]"
usr << "Added by [c.author] at [c.time]"
usr << "----------"
usr << "<b>Major Crimes:</b>"
for(var/datum/data/crime/c in R.fields["ma_crim"])
usr << "<b>Crime:</b> [c.crimeName]"
usr << "<b>Details:</b> [c.crimeDetails]"
usr << "Added by [c.author] at [c.time]"
usr << "----------"
usr << "<b>Notes:</b> [R.fields["notes"]]"
return
if(href_list["add_crime"])
switch(alert("What crime would you like to add?","Security HUD","Minor Crime","Major Crime","Cancel"))
if("Minor Crime")
if(R)
var/t1 = stripped_input("Please input minor crime names:", "Security HUD", "", null)
var/t2 = stripped_multiline_input("Please input minor crime details:", "Security HUD", "", null)
if(R)
var/allowed = H.test_sechud_allowed(src) //stop time of check / time of use issues 2016
if (!t1 || !t2 || !allowed) return
else if(!canUseHUD()) return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/security)) return
var/crime = data_core.createCrimeEntry(t1, t2, allowed, worldtime2text())
data_core.addMinorCrime(R.fields["id"], crime)
usr << "<span class='notice'>Successfully added a minor crime.</span>"
return
if("Major Crime")
if(R)
var/t1 = stripped_input("Please input major crime names:", "Security HUD", "", null)
var/t2 = stripped_multiline_input("Please input major crime details:", "Security HUD", "", null)
if(R)
var/allowed = H.test_sechud_allowed(src)
if (!t1 || !t2 || !allowed) return
else if (!canUseHUD()) return
else if (!istype(H.glasses, /obj/item/clothing/glasses/hud/security)) return
var/crime = data_core.createCrimeEntry(t1, t2, allowed, worldtime2text())
data_core.addMajorCrime(R.fields["id"], crime)
usr << "<span class='notice'>Successfully added a major crime.</span>"
return
if(href_list["view_comment"])
if(R)
if(!canUseHUD()) return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/security)) return
usr << "<b>Comments/Log:</b>"
var/counter = 1
while(R.fields[text("com_[]", counter)])
usr << R.fields[text("com_[]", counter)]
usr << "----------"
counter++
return
if(href_list["add_comment"])
if(R)
var/t1 = stripped_multiline_input("Add Comment:", "Secure. records", null, null)
if(R)
var/allowed = H.test_sechud_allowed(src)
if (!t1 || !allowed) return
else if(!canUseHUD()) return
else if(!istype(H.glasses, /obj/item/clothing/glasses/hud/security)) return
var/counter = 1
while(R.fields[text("com_[]", counter)])
counter++
R.fields[text("com_[]", counter)] = text("Made by [] on [] [], []<BR>[]", allowed, worldtime2text(), time2text(world.realtime, "MMM DD"), year_integer+540, t1,)
usr << "<span class='notice'>Successfully added comment.</span>"
return
usr << "<span class='warning'>Unable to locate a data core entry for this person.</span>"
/mob/living/carbon/dwarf/proc/canUseHUD()
return !(src.stat || src.weakened || src.stunned || src.restrained())
/mob/living/carbon/dwarf/proc/test_sechud_allowed(var/target)
// Checks the user has security clearence before allowing them to change arrest status via hud, edit it to return id name to enable all access
var/allowed_access = null
var/obj/item/clothing/glasses/G = glasses
if (!G.emagged)
if(wear_id)
var/list/access = wear_id.GetAccess()
if(access_sec_doors in access)
allowed_access = get_authentification_name()
else
allowed_access = "@%&ERROR_%$*"
return allowed_access
/mob/living/carbon/dwarf/proc/play_xylophone()
if(!src.xylophone)
visible_message("<span class='notice'>[src] begins playing \his ribcage like a xylophone. It's quite spooky.</span>","<span class='notice'>You begin to play a spooky refrain on your ribcage.</span>","You hear a spooky xylophone melody.")
var/song = pick('sound/effects/xylophone1.ogg','sound/effects/xylophone2.ogg','sound/effects/xylophone3.ogg')
playsound(loc, song, 50, 1, -1)
xylophone = 1
spawn(50)
xylophone = 0
/mob/living/carbon/dwarf/can_inject(var/mob/user, var/error_msg, var/target_zone)
. = 1 // Default to returning true.
if(user && !target_zone)
target_zone = user.zone_sel.selecting
// If targeting the head, see if the head item is thin enough.
// If targeting anything else, see if the wear suit is thin enough.
if(above_neck(target_zone))
if(head && head.flags & THICKMATERIAL)
. = 0
else
if(wear_suit && wear_suit.flags & THICKMATERIAL)
. = 0
if(!. && error_msg && user)
// Might need re-wording.
user << "<span class='alert'>There is no exposed flesh or thin material [above_neck(target_zone) ? "on their head" : "on their body"].</span>"
/mob/living/carbon/dwarf/proc/check_obscured_slots()
var/list/obscured = list()
if(wear_suit)
if(wear_suit.flags_inv & HIDEGLOVES)
obscured |= slot_gloves
if(wear_suit.flags_inv & HIDEJUMPSUIT)
obscured |= slot_w_uniform
if(wear_suit.flags_inv & HIDESHOES)
obscured |= slot_shoes
if(head)
if(head.flags_inv & HIDEMASK)
obscured |= slot_wear_mask
if(head.flags_inv & HIDEEYES)
obscured |= slot_glasses
if(head.flags_inv & HIDEEARS)
obscured |= slot_ears
if(obscured.len > 0)
return obscured
else
return null
/mob/living/carbon/dwarf/assess_threat(var/obj/machinery/bot/secbot/judgebot, var/lasercolor)
if(judgebot.emagged == 2)
return 10 //Everyone is a criminal!
var/threatcount = 0
//Lasertag bullshit
if(lasercolor)
if(lasercolor == "b")//Lasertag turrets target the opposing team, how great is that? -Sieve
if(istype(wear_suit, /obj/item/clothing/suit/redtag))
threatcount += 4
if((istype(r_hand,/obj/item/weapon/gun/energy/laser/redtag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/redtag)))
threatcount += 4
if(istype(belt, /obj/item/weapon/gun/energy/laser/redtag))
threatcount += 2
if(lasercolor == "r")
if(istype(wear_suit, /obj/item/clothing/suit/bluetag))
threatcount += 4
if((istype(r_hand,/obj/item/weapon/gun/energy/laser/bluetag)) || (istype(l_hand,/obj/item/weapon/gun/energy/laser/bluetag)))
threatcount += 4
if(istype(belt, /obj/item/weapon/gun/energy/laser/bluetag))
threatcount += 2
return threatcount
//Check for ID
var/obj/item/weapon/card/id/idcard = get_idcard()
if(judgebot.idcheck && !idcard && name=="Unknown")
threatcount += 4
//Check for weapons
if(judgebot.weaponscheck)
if(!idcard || !(access_weapons in idcard.access))
if(judgebot.check_for_weapons(l_hand))
threatcount += 4
if(judgebot.check_for_weapons(r_hand))
threatcount += 4
if(judgebot.check_for_weapons(belt))
threatcount += 2
//Check for arrest warrant
if(judgebot.check_records)
var/perpname = get_face_name(get_id_name())
var/datum/data/record/R = find_record("name", perpname, data_core.security)
if(R && R.fields["criminal"])
switch(R.fields["criminal"])
if("*Arrest*")
threatcount += 5
if("Incarcerated")
threatcount += 2
if("Parolled")
threatcount += 2
//Check for dresscode violations
if(istype(head, /obj/item/clothing/head/wizard) || istype(head, /obj/item/clothing/head/helmet/space/hardsuit/wizard))
threatcount += 2
//Check for nonhuman scum
if(dna && dna.species.id && dna.species.id != "human")
threatcount += 1
//Loyalty implants imply trustworthyness
if(isloyal(src))
threatcount -= 1
//Agent cards lower threatlevel.
if(istype(idcard, /obj/item/weapon/card/id/syndicate))
threatcount -= 5
return threatcount
//Removed the gender check; All dwarves will have beards when cloned regardless of gender
/mob/living/carbon/dwarf/proc/set_cloned_appearance()
facial_hair_style = "Full Beard"
hair_style = pick("Bedhead", "Bedhead 2", "Bedhead 3")
underwear = "Nude"
regenerate_icons()
/mob/living/carbon/dwarf/singularity_act()
var/gain = -100 //Lord Singuloth gets a hangover if he eats a dwarf. Too much ethanol in em.
investigate_log("([key_name(src)]) has been consumed by the singularity.","singulo") //Oh that's where the clown ended up!
gib()
return(gain)
/mob/living/carbon/dwarf/singularity_pull(S, current_size)
if(current_size >= STAGE_THREE)
var/list/handlist = list(l_hand, r_hand)
for(var/obj/item/hand in handlist)
if(prob(current_size * 5) && hand.w_class >= ((11-current_size)/2) && unEquip(hand))
step_towards(hand, src)
src << "<span class='warning'>\The [S] pulls \the [hand] from your grip!</span>"
apply_effect(current_size * 3, IRRADIATE)
if(mob_negates_gravity())
return
..()
/mob/living/carbon/dwarf/help_shake_act(mob/living/carbon/human/M)
if(!istype(M))
return
var/mob/living/carbon/dwarf/H = src
if(health >= 0)
if(src == M)
visible_message( \
"<span class='notice'>[src] examines \himself.", \
"<span class='notice'>You check yourself for injuries.</span>")
for(var/datum/organ/limb/limbdata in get_limbs())
if(limbdata.exists())
var/obj/item/organ/limb/org = limbdata.organitem
var/status = ""
var/brutedamage = org.brute_dam
var/burndamage = org.burn_dam
if(hallucination)
if(prob(30))
brutedamage += rand(30,40)
if(prob(30))
burndamage += rand(30,40)
if(brutedamage > 0)
status = "bruised"
if(brutedamage > 20)
status = "battered"
if(brutedamage > 40)
status = "mangled"
if(brutedamage > 0 && burndamage > 0)
status += " and "
if(burndamage > 40)
status += "peeling away"
else if(burndamage > 10)
status += "blistered"
else if(burndamage > 0)
status += "numb"
if(status == "")
status = "OK"
src << "\t [status == "OK" ? "\blue" : "\red"] Your [org.name] is [status]."
for(var/obj/item/I in org.embedded_objects)
src << "\t <a href='byond://?src=\ref[src];embedded_object=\ref[I];embedded_limb=\ref[org]'>\red There is \a [I] embedded in your [org]!</a>"
else
if(limbdata.status & ORGAN_DESTROYED)
src << "\t \red Your [limbdata.getDisplayName()] is missing and the wound bleeds terribly!"
else if(limbdata.status & ORGAN_NOBLEED)
src << "\t \red Your [limbdata.getDisplayName()] is missing and the wound hurts!"
else if(limbdata.status & ORGAN_REMOVED)
src << "\t You don't have \a [limbdata.getDisplayName()]."
if(H.blood_max)
src << "<span class='danger'>You are bleeding!</span>"
if(staminaloss)
if(staminaloss > 30)
src << "<span class='info'>You're completely exhausted.</span>"
else
src << "<span class='info'>You feel fatigued.</span>"
if(dna && dna.species.id && dna.species.id == "skeleton" && !H.w_uniform && !H.wear_suit)
H.play_xylophone()
else
if(H.wear_suit)
H.wear_suit.add_fingerprint(M)
else if(H.w_uniform)
H.w_uniform.add_fingerprint(M)
..()
/mob/living/carbon/dwarf/proc/do_cpr(mob/living/carbon/C)
if(C.stat == DEAD)
src << "<span class='warning'>[C.name] is dead!</span>"
return
if(is_mouth_covered())
src << "<span class='warning'>Remove your mask first!</span>"
return 0
if(C.is_mouth_covered())
src << "<span class='warning'>Remove their mask first!</span>"
return 0
if(C.cpr_time < world.time + 30)
add_logs(src, C, "CPRed")
visible_message("<span class='notice'>[src] is trying to perform CPR on [C.name]!</span>", \
"<span class='notice'>You try to perform CPR on [C.name]... Hold still!</span>")
if(!do_mob(src, C))
src << "<span class='warning'>You fail to perform CPR on [C]!</span>"
return 0
if(C.health <= config.health_threshold_crit)
C.cpr_time = world.time
var/suff = min(C.getOxyLoss(), 7)
C.adjustOxyLoss(-suff)
C.updatehealth()
src.visible_message("[src] performs CPR on [C.name]!", "<span class='notice'>You perform CPR on [C.name].</span>")
C << "<span class='unconscious'>You feel a breath of fresh air enter your lungs... It feels good...</span>"
/mob/living/carbon/dwarf/generateStaticOverlay()
var/image/staticOverlay = image(icon('icons/effects/effects.dmi', "static"), loc = src)
staticOverlay.override = 1
staticOverlays["static"] = staticOverlay
staticOverlay = image(icon('icons/effects/effects.dmi', "blank"), loc = src)
staticOverlay.override = 1
staticOverlays["blank"] = staticOverlay
staticOverlay = getLetterImage(src, "H", 1)
staticOverlay.override = 1
staticOverlays["letter"] = staticOverlay
/mob/living/carbon/dwarf/cuff_resist(obj/item/I)
if(dna && dna.check_mutation(HULK))
say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
..(I, cuff_break = 1)
else
..()
/mob/living/carbon/dwarf/proc/set_skin_tone(var/newskintone)
src.skin_tone = newskintone
if(dna.species.use_skintones) //Could make kobolds basically the dwarf version of liggers
hardset_dna(src, null, null, null, null, null, skintone2hex(newskintone))
return 1
return 0