forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathhuman_defense.dm
809 lines (720 loc) · 33.6 KB
/
human_defense.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
/mob/living/carbon/human/getarmor(def_zone, type)
var/armorval = 0
var/organnum = 0
if(def_zone)
if(isbodypart(def_zone))
var/obj/item/bodypart/bp = def_zone
if(bp)
return check_armor(def_zone, type)
var/obj/item/bodypart/affecting = get_bodypart(check_zone(def_zone))
if(affecting)
return check_armor(affecting, type)
//If a specific bodypart is targeted, check how that bodypart is protected and return the value.
//If you don't specify a bodypart, it checks ALL your bodyparts for protection, and averages out the values
for(var/X in bodyparts)
var/obj/item/bodypart/BP = X
armorval += check_armor(BP, type)
organnum++
return (armorval/max(organnum, 1))
/mob/living/carbon/human/proc/check_armor(obj/item/bodypart/def_zone, damage_type)
if(!damage_type)
return 0
var/protection = 100
var/list/covering_clothing = list(head, wear_mask, wear_suit, w_uniform, back, gloves, shoes, belt, s_store, glasses, ears, wear_id, wear_neck) //Everything but pockets. Pockets are l_store and r_store. (if pockets were allowed, putting something armored, gloves or hats for example, would double up on the armor)
for(var/obj/item/clothing/clothing_item in covering_clothing)
if(clothing_item.body_parts_covered & def_zone.body_part)
protection *= (100 - min(clothing_item.get_armor_rating(damage_type), 100)) * 0.01
protection *= (100 - min(physiology.armor.get_rating(damage_type), 100)) * 0.01
return 100 - protection
///Get all the clothing on a specific body part
/mob/living/carbon/human/proc/get_clothing_on_part(obj/item/bodypart/def_zone)
var/list/covering_part = list()
var/list/body_parts = list(head, wear_mask, wear_suit, w_uniform, back, gloves, shoes, belt, s_store, glasses, ears, wear_id, wear_neck) //Everything but pockets. Pockets are l_store and r_store. (if pockets were allowed, putting something armored, gloves or hats for example, would double up on the armor)
for(var/bp in body_parts)
if(!bp)
continue
if(bp && istype(bp , /obj/item/clothing))
var/obj/item/clothing/C = bp
if(C.body_parts_covered & def_zone.body_part)
covering_part += C
return covering_part
/mob/living/carbon/human/bullet_act(obj/projectile/bullet, def_zone, piercing_hit = FALSE)
if(bullet.firer == src && bullet.original == src) //can't block or reflect when shooting yourself
return ..()
if(bullet.reflectable)
if(check_reflect(def_zone)) // Checks if you've passed a reflection% check
visible_message(
span_danger("[capitalize(bullet.declent_ru(NOMINATIVE))] отражается от [declent_ru(GENITIVE)]!"),
span_userdanger("[capitalize(bullet.declent_ru(NOMINATIVE))] отражается от [declent_ru(GENITIVE)]!"),
)
// Finds and plays the block_sound of item which reflected
for(var/obj/item/held_item in held_items)
if(held_item.IsReflect(def_zone))
playsound(src, held_item.block_sound, BLOCK_SOUND_VOLUME, TRUE)
// Find a turf near or on the original location to bounce to
if(!isturf(loc)) //Open canopy mech (ripley) check. if we're inside something and still got hit
return loc.projectile_hit(bullet, def_zone, piercing_hit)
bullet.reflect(src)
return BULLET_ACT_FORCE_PIERCE // complete projectile permutation
if(check_block(bullet, bullet.damage, "[bullet.declent_ru(ACCUSATIVE)]", PROJECTILE_ATTACK, bullet.armour_penetration, bullet.damage_type))
bullet.on_hit(src, 100, def_zone, piercing_hit)
return BULLET_ACT_HIT
return ..()
///Reflection checks for anything in your l_hand, r_hand, or wear_suit based on the reflection chance of the object
/mob/living/carbon/human/proc/check_reflect(def_zone)
if(wear_suit)
if(wear_suit.IsReflect(def_zone))
return TRUE
if(head)
if(head.IsReflect(def_zone))
return TRUE
for(var/obj/item/I in held_items)
if(I.IsReflect(def_zone))
return TRUE
return FALSE
/mob/living/carbon/human/check_block(atom/hit_by, damage, attack_text = "атаку", attack_type = MELEE_ATTACK, armour_penetration = 0, damage_type = BRUTE)
. = ..()
if(. == SUCCESSFUL_BLOCK)
return SUCCESSFUL_BLOCK
var/block_chance_modifier = round(damage / -3)
for(var/obj/item/worn_thing in get_equipped_items(INCLUDE_HELD))
// Things that are supposed to be worn, being held = cannot block
if(isclothing(worn_thing))
if(worn_thing in held_items)
continue
// Things that are supposed to be held, being worn = cannot block
else if(!(worn_thing in held_items))
continue
var/final_block_chance = worn_thing.block_chance - (clamp((armour_penetration - worn_thing.armour_penetration) / 2, 0, 100)) + block_chance_modifier
if(worn_thing.hit_reaction(src, hit_by, attack_text, final_block_chance, damage, attack_type, damage_type))
return SUCCESSFUL_BLOCK
return FAILED_BLOCK
/mob/living/carbon/human/grippedby(mob/living/carbon/user, instant = FALSE)
if(w_uniform)
w_uniform.add_fingerprint(user)
..()
/mob/living/carbon/human/attack_hulk(mob/living/carbon/human/user)
. = ..()
if(!.)
return
var/hulk_verb = pick("крушит","избивает")
if(check_block(user, 15, "крушащий удар", attack_type = UNARMED_ATTACK))
return
var/obj/item/bodypart/arm/active_arm = user.get_active_hand()
playsound(loc, active_arm.unarmed_attack_sound, 25, TRUE, -1)
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] [hulk_verb] [declent_ru(ACCUSATIVE)]!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] [hulk_verb] [declent_ru(ACCUSATIVE)]!"), span_hear("Вы слышите противный звук удара плоти о плоть!"), null, user)
to_chat(user, span_danger("Вы [hulk_verb]е [declent_ru(ACCUSATIVE)]!"))
apply_damage(15, BRUTE, wound_bonus=10)
/mob/living/carbon/human/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
return TRUE
if(ishuman(user))
var/mob/living/carbon/human/H = user
dna.species.spec_attack_hand(H, src, null, modifiers)
/mob/living/carbon/human/proc/disarm_precollide(datum/source, mob/living/shover, mob/living/target, obj/item/weapon)
SIGNAL_HANDLER
return COMSIG_LIVING_ACT_SOLID
/mob/living/carbon/human/proc/disarm_collision(datum/source, mob/living/shover, mob/living/target, shove_flags, obj/item/weapon)
SIGNAL_HANDLER
if(src == target || LAZYFIND(target.buckled_mobs, src) || !iscarbon(target))
return
if(!(shove_flags & SHOVE_KNOCKDOWN_BLOCKED))
target.Knockdown(SHOVE_KNOCKDOWN_HUMAN, daze_amount = 3 SECONDS)
if(!HAS_TRAIT(src, TRAIT_BRAWLING_KNOCKDOWN_BLOCKED))
Knockdown(SHOVE_KNOCKDOWN_COLLATERAL, daze_amount = 3 SECONDS)
target.visible_message(span_danger("[capitalize(shover.declent_ru(NOMINATIVE))] толкает [target.declent_ru(ACCUSATIVE)] в [declent_ru(ACCUSATIVE)]!"),
span_userdanger("Вы врезаетесь в [declent_ru(ACCUSATIVE)] из-за толчка [shover.declent_ru(GENITIVE)]!"), span_hear("Вы слышите агрессивное шарканье с последующим громким стуком!"), COMBAT_MESSAGE_RANGE, src)
to_chat(src, span_danger("Вы толкаете [target.declent_ru(ACCUSATIVE)] в [declent_ru(ACCUSATIVE)]!"))
log_combat(shover, target, "shoved", addition = "into [name][weapon ? " with [weapon]" : ""]")
return COMSIG_LIVING_SHOVE_HANDLED
/mob/living/carbon/human/attack_paw(mob/living/carbon/human/user, list/modifiers)
var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/obj/item/bodypart/affecting = get_bodypart(get_random_valid_zone(dam_zone))
if(LAZYACCESS(modifiers, RIGHT_CLICK)) //Always drop item in hand, if no item, get stunned instead.
var/obj/item/I = get_active_held_item()
if(I && !(I.item_flags & ABSTRACT) && dropItemToGround(I))
playsound(loc, 'sound/items/weapons/slash.ogg', 25, TRUE, -1)
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] обезоруживает [declent_ru(ACCUSATIVE)]!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] обезоруживает вас!"), span_hear("Вы слышите агрессивное шарканье!"), null, user)
to_chat(user, span_danger("Вы обезоруживаете [declent_ru(ACCUSATIVE)]!"))
else if(!user.client || prob(5)) // only natural monkeys get to stun reliably, (they only do it occasionaly)
playsound(loc, 'sound/items/weapons/pierce.ogg', 25, TRUE, -1)
if (src.IsKnockdown() && !src.IsParalyzed())
Paralyze(40)
log_combat(user, src, "pinned")
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] наваливается на [declent_ru(ACCUSATIVE)]!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] наваливается на вас!"), span_hear("Вы слышите шарканье и приглушенный стон!"), null, user)
to_chat(user, span_danger("Вы наваливаетесь на [declent_ru(ACCUSATIVE)]!"))
else
Knockdown(30)
log_combat(user, src, "tackled")
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] сбивает с ног [declent_ru(ACCUSATIVE)]"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] сбивает вас с ног!"), span_hear("Вы слышите агрессивное шарканье с последующим громким стуком!"), null, user)
to_chat(user, span_danger("Вы сбиваете с ног [declent_ru(ACCUSATIVE)]!"))
return TRUE
if(!user.combat_mode)
..() //shaking
return FALSE
if(user.limb_destroyer)
dismembering_strike(user, affecting.body_zone)
if(try_inject(user, affecting, injection_flags = INJECT_TRY_SHOW_ERROR_MESSAGE))//Thick suits can stop monkey bites.
if(..()) //successful monkey bite, this handles disease contraction.
var/obj/item/bodypart/head/monkey_mouth = user.get_bodypart(BODY_ZONE_HEAD)
var/damage = HAS_TRAIT(user, TRAIT_PERFECT_ATTACKER) ? monkey_mouth.unarmed_damage_high : rand(monkey_mouth.unarmed_damage_low, monkey_mouth.unarmed_damage_high)
if(!damage)
return FALSE
if(check_block(user, damage, "[user.declent_ru(ACCUSATIVE)]", attack_type = UNARMED_ATTACK))
return FALSE
apply_damage(damage, BRUTE, affecting, run_armor_check(affecting, MELEE))
return TRUE
//BANDASTATION EDIT REMOVAL BEGIN XENO_REWORK - Moved to: modular_bandastation\xeno_rework\code\larva.dm
/*
/mob/living/carbon/human/attack_alien(mob/living/carbon/alien/adult/user, list/modifiers)
. = ..()
if(!.)
return
if(LAZYACCESS(modifiers, RIGHT_CLICK)) //Always drop item in hand if there is one. If there's no item, shove the target. If the target is incapacitated, slam them into the ground to stun them.
var/obj/item/I = get_active_held_item()
if(I && dropItemToGround(I))
playsound(loc, 'sound/items/weapons/slash.ogg', 25, TRUE, -1)
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] обезоруживает [declent_ru(ACCUSATIVE)]!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] обезоруживает вас!"), span_hear("Вы слышите агрессивное шарканье!"), null, user)
to_chat(user, span_danger("Вы обезоруживаете [declent_ru(ACCUSATIVE)]!"))
else if(!HAS_TRAIT(src, TRAIT_INCAPACITATED))
playsound(loc, 'sound/items/weapons/pierce.ogg', 25, TRUE, -1)
var/shovetarget = get_edge_target_turf(user, get_dir(user, get_step_away(src, user)))
adjustStaminaLoss(35)
throw_at(shovetarget, 4, 2, user, force = MOVE_FORCE_OVERPOWERING)
log_combat(user, src, "shoved")
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] сбивает с ног [declent_ru(ACCUSATIVE)]!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] толкает вас с огромной силой"), span_hear("Вы слышите агрессивное шарканье с последующим громким стуком!"), null, user)
to_chat(user, span_danger("Вы толкаете [declent_ru(ACCUSATIVE)] с огромной силой!"))
else
Paralyze(5 SECONDS)
playsound(loc, 'sound/items/weapons/punch3.ogg', 25, TRUE, -1)
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] впечатывает [declent_ru(ACCUSATIVE)] в пол!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] впечатывает вас в пол!"), span_hear("Вы слышите, как что-то громко падает на пол!"), null, user)
to_chat(user, span_danger("Вы впечатываете [declent_ru(ACCUSATIVE)] в пол под вами!"))
log_combat(user, src, "slammed into the ground")
return TRUE
if(user.combat_mode)
if (w_uniform)
w_uniform.add_fingerprint(user)
var/damage = prob(90) ? rand(user.melee_damage_lower, user.melee_damage_upper) : 0
if(!damage)
playsound(loc, 'sound/items/weapons/slashmiss.ogg', 50, TRUE, -1)
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] бросается на [declent_ru(ACCUSATIVE)]!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] бросается на вас!"), span_hear("Вы слышите свист!"), null, user)
to_chat(user, span_danger("Вы бросаетесь на [declent_ru(ACCUSATIVE)]!"))
return FALSE
var/obj/item/bodypart/affecting = get_bodypart(get_random_valid_zone(user.zone_selected))
var/armor_block = run_armor_check(affecting, MELEE,"","",10)
playsound(loc, 'sound/items/weapons/slice.ogg', 25, TRUE, -1)
visible_message(span_danger("[capitalize(user.declent_ru(NOMINATIVE))] режет [declent_ru(ACCUSATIVE)]!"), \
span_userdanger("[capitalize(user.declent_ru(NOMINATIVE))] режет вас!"), span_hear("Вы слышите противный звук разрезания!"), null, user)
to_chat(user, span_danger("Вы режете [declent_ru(ACCUSATIVE)]!"))
log_combat(user, src, "attacked")
if(!dismembering_strike(user, user.zone_selected)) //Dismemberment successful
return TRUE
apply_damage(damage, BRUTE, affecting, armor_block)
*/
//BANDASTATION EDIT REMOVAL END
/mob/living/carbon/human/attack_larva(mob/living/carbon/alien/larva/worm, list/modifiers)
. = ..()
if(!.)
return //successful larva bite.
var/damage = rand(worm.melee_damage_lower, worm.melee_damage_upper)
if(!damage)
return
if(check_block(worm, damage, "[worm.declent_ru(ACCUSATIVE)]", attack_type = UNARMED_ATTACK))
return FALSE
if(stat != DEAD)
worm.amount_grown = min(worm.amount_grown + damage, worm.max_grown)
var/obj/item/bodypart/affecting = get_bodypart(get_random_valid_zone(worm.zone_selected))
var/armor_block = run_armor_check(affecting, MELEE)
apply_damage(damage, BRUTE, affecting, armor_block)
/mob/living/carbon/human/ex_act(severity, target, origin)
if(HAS_TRAIT(src, TRAIT_BOMBIMMUNE))
return FALSE
. = ..()
if (!. || !severity || QDELETED(src))
return FALSE
var/brute_loss = 0
var/burn_loss = 0
var/bomb_armor = getarmor(null, BOMB)
//200 max knockdown for EXPLODE_HEAVY
//160 max knockdown for EXPLODE_LIGHT
var/obj/item/organ/ears/ears = get_organ_slot(ORGAN_SLOT_EARS)
switch (severity)
if (EXPLODE_DEVASTATE)
if(bomb_armor < EXPLODE_GIB_THRESHOLD) //gibs the mob if their bomb armor is lower than EXPLODE_GIB_THRESHOLD
for(var/thing in contents)
switch(severity)
if(EXPLODE_DEVASTATE)
SSexplosions.high_mov_atom += thing
if(EXPLODE_HEAVY)
SSexplosions.med_mov_atom += thing
if(EXPLODE_LIGHT)
SSexplosions.low_mov_atom += thing
investigate_log("has been gibbed by an explosion.", INVESTIGATE_DEATHS)
gib(DROP_ALL_REMAINS)
return TRUE
else
brute_loss = 500
var/atom/throw_target = get_edge_target_turf(src, get_dir(src, get_step_away(src, src)))
throw_at(throw_target, 200, 4)
damage_clothes(400 - bomb_armor, BRUTE, BOMB)
if (EXPLODE_HEAVY)
brute_loss = 60
burn_loss = 60
if(bomb_armor)
brute_loss = 30*(2 - round(bomb_armor*0.01, 0.05))
burn_loss = brute_loss //damage gets reduced from 120 to up to 60 combined brute+burn
damage_clothes(200 - bomb_armor, BRUTE, BOMB)
if (ears && !HAS_TRAIT_FROM_ONLY(src, TRAIT_DEAF, EAR_DAMAGE))
ears.adjustEarDamage(30, 120)
Unconscious(20) //short amount of time for follow up attacks against elusive enemies like wizards
Knockdown(200 - (bomb_armor * 1.6)) //between ~4 and ~20 seconds of knockdown depending on bomb armor
if(EXPLODE_LIGHT)
brute_loss = 30
if(bomb_armor)
brute_loss = 15*(2 - round(bomb_armor*0.01, 0.05))
damage_clothes(max(50 - bomb_armor, 0), BRUTE, BOMB)
if (ears && !HAS_TRAIT_FROM_ONLY(src, TRAIT_DEAF, EAR_DAMAGE))
ears.adjustEarDamage(15,60)
Knockdown(160 - (bomb_armor * 1.6)) //100 bomb armor will prevent knockdown altogether
take_overall_damage(brute_loss,burn_loss)
//attempt to dismember bodyparts
if(severity >= EXPLODE_HEAVY || !bomb_armor)
var/max_limb_loss = 0
var/probability = 0
switch(severity)
if(EXPLODE_NONE)
max_limb_loss = 1
probability = 20
if(EXPLODE_LIGHT)
max_limb_loss = 2
probability = 30
if(EXPLODE_HEAVY)
max_limb_loss = 3
probability = 40
if(EXPLODE_DEVASTATE)
max_limb_loss = 4
probability = 50
for(var/X in bodyparts)
var/obj/item/bodypart/BP = X
if(prob(probability) && !prob(getarmor(BP, BOMB)) && BP.body_zone != BODY_ZONE_HEAD && BP.body_zone != BODY_ZONE_CHEST)
BP.receive_damage(INFINITY, wound_bonus = CANT_WOUND) //Capped by proc
BP.dismember()
max_limb_loss--
if(!max_limb_loss)
break
return TRUE
/mob/living/carbon/human/blob_act(obj/structure/blob/B)
if(stat == DEAD)
return
show_message(span_userdanger("Блоб атакует вас!"))
var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/obj/item/bodypart/affecting = get_bodypart(get_random_valid_zone(dam_zone))
apply_damage(5, BRUTE, affecting, run_armor_check(affecting, MELEE))
///Calculates the siemens coeff based on clothing and species, can also restart hearts.
/mob/living/carbon/human/electrocute_act(shock_damage, source, siemens_coeff = 1, flags = NONE, jitter_time = 20 SECONDS, stutter_time = 4 SECONDS, stun_duration = 4 SECONDS)
//Calculates the siemens coeff based on clothing. Completely ignores the arguments
if(flags & SHOCK_TESLA) //I hate this entire block. This gets the siemens_coeff for tesla shocks
if(gloves && gloves.siemens_coefficient <= 0)
siemens_coeff -= 0.5
if(wear_suit)
if(wear_suit.siemens_coefficient == -1)
siemens_coeff -= 1
else if(wear_suit.siemens_coefficient <= 0)
siemens_coeff -= 0.95
siemens_coeff = max(siemens_coeff, 0)
if(flags & SHOCK_NOGLOVES) //This gets the siemens_coeff for all non tesla shocks
if(wear_suit)
siemens_coeff *= wear_suit.siemens_coefficient
else if(gloves)
siemens_coeff *= gloves.siemens_coefficient
siemens_coeff *= physiology.siemens_coeff
siemens_coeff *= dna.species.siemens_coeff
. = ..()
//Don't go further if the shock was blocked/too weak.
if(!.)
return
if(!(flags & SHOCK_ILLUSION))
if(shock_damage * siemens_coeff >= 5)
force_say()
//Note we both check that the user is in cardiac arrest and can actually heartattack
//If they can't, they're missing their heart and this would runtime
if(undergoing_cardiac_arrest() && can_heartattack() && (shock_damage * siemens_coeff >= 1) && prob(25))
var/obj/item/organ/heart/heart = get_organ_slot(ORGAN_SLOT_HEART)
if(heart.Restart() && stat == CONSCIOUS)
to_chat(src, span_notice("Вы чувстуете, как ваше сердце снова бьется!"))
if (!(flags & SHOCK_NO_HUMAN_ANIM))
electrocution_animation(4 SECONDS)
/mob/living/carbon/human/acid_act(acidpwr, acid_volume, bodyzone_hit) //todo: update this to utilize check_obscured_slots() //and make sure it's check_obscured_slots(TRUE) to stop aciding through visors etc
var/list/damaged = list()
var/list/inventory_items_to_kill = list()
var/acidity = acidpwr * min(acid_volume*0.005, 0.1)
//HEAD//
if(!bodyzone_hit || bodyzone_hit == BODY_ZONE_HEAD) //only if we didn't specify a zone or if that zone is the head.
var/obj/item/clothing/head_clothes = null
if(glasses)
head_clothes = glasses
if(wear_mask)
head_clothes = wear_mask
if(wear_neck)
head_clothes = wear_neck
if(head)
head_clothes = head
if(head_clothes)
if(!(head_clothes.resistance_flags & UNACIDABLE))
head_clothes.acid_act(acidpwr, acid_volume)
update_worn_glasses()
update_worn_mask()
update_worn_neck()
update_worn_head()
else
to_chat(src, span_notice("[capitalize(head_clothes.declent_ru(NOMINATIVE))] защищает вашу голову и лицо от кислоты!"))
else
. = get_bodypart(BODY_ZONE_HEAD)
if(.)
damaged += .
if(ears)
inventory_items_to_kill += ears
//CHEST//
if(!bodyzone_hit || bodyzone_hit == BODY_ZONE_CHEST)
var/obj/item/clothing/chest_clothes = null
if(w_uniform)
chest_clothes = w_uniform
if(wear_suit)
chest_clothes = wear_suit
if(chest_clothes)
if(!(chest_clothes.resistance_flags & UNACIDABLE))
chest_clothes.acid_act(acidpwr, acid_volume)
update_worn_undersuit()
update_worn_oversuit()
else
to_chat(src, span_notice("[capitalize(chest_clothes.declent_ru(NOMINATIVE))] защищает ваше тело от кислоты!"))
else
. = get_bodypart(BODY_ZONE_CHEST)
if(.)
damaged += .
if(wear_id)
inventory_items_to_kill += wear_id
if(r_store)
inventory_items_to_kill += r_store
if(l_store)
inventory_items_to_kill += l_store
if(s_store)
inventory_items_to_kill += s_store
//ARMS & HANDS//
if(!bodyzone_hit || bodyzone_hit == BODY_ZONE_L_ARM || bodyzone_hit == BODY_ZONE_R_ARM)
var/obj/item/clothing/arm_clothes = null
if(gloves)
arm_clothes = gloves
if(w_uniform && ((w_uniform.body_parts_covered & HANDS) || (w_uniform.body_parts_covered & ARMS)))
arm_clothes = w_uniform
if(wear_suit && ((wear_suit.body_parts_covered & HANDS) || (wear_suit.body_parts_covered & ARMS)))
arm_clothes = wear_suit
if(arm_clothes)
if(!(arm_clothes.resistance_flags & UNACIDABLE))
arm_clothes.acid_act(acidpwr, acid_volume)
update_worn_gloves()
update_worn_undersuit()
update_worn_oversuit()
else
to_chat(src, span_notice("[capitalize(arm_clothes.declent_ru(NOMINATIVE))] защищает руки и кисти от кислоты!"))
else
. = get_bodypart(BODY_ZONE_R_ARM)
if(.)
damaged += .
. = get_bodypart(BODY_ZONE_L_ARM)
if(.)
damaged += .
//LEGS & FEET//
if(!bodyzone_hit || bodyzone_hit == BODY_ZONE_L_LEG || bodyzone_hit == BODY_ZONE_R_LEG || bodyzone_hit == "feet")
var/obj/item/clothing/leg_clothes = null
if(shoes)
leg_clothes = shoes
if(w_uniform && ((w_uniform.body_parts_covered & FEET) || (bodyzone_hit != "feet" && (w_uniform.body_parts_covered & LEGS))))
leg_clothes = w_uniform
if(wear_suit && ((wear_suit.body_parts_covered & FEET) || (bodyzone_hit != "feet" && (wear_suit.body_parts_covered & LEGS))))
leg_clothes = wear_suit
if(leg_clothes)
if(!(leg_clothes.resistance_flags & UNACIDABLE))
leg_clothes.acid_act(acidpwr, acid_volume)
update_worn_shoes()
update_worn_undersuit()
update_worn_oversuit()
else
to_chat(src, span_notice("[capitalize(leg_clothes.declent_ru(NOMINATIVE))] защищает ноги и ступы от кислоты!"))
else
. = get_bodypart(BODY_ZONE_R_LEG)
if(.)
damaged += .
. = get_bodypart(BODY_ZONE_L_LEG)
if(.)
damaged += .
//DAMAGE//
for(var/obj/item/bodypart/affecting in damaged)
var/damage_mod = 1
if(affecting.body_zone == BODY_ZONE_HEAD && prob(min(acidpwr * acid_volume * 0.1, 90))) //Applies disfigurement
damage_mod = 2
emote("scream")
set_facial_hairstyle("Shaved", update = FALSE)
set_hairstyle("Bald") //This calls update_body_parts()
ADD_TRAIT(src, TRAIT_DISFIGURED, TRAIT_GENERIC)
apply_damage(acidity * damage_mod, BRUTE, affecting)
apply_damage(acidity * damage_mod * 2, BURN, affecting)
//MELTING INVENTORY ITEMS//
//these items are all outside of armour visually, so melt regardless.
if(!bodyzone_hit)
if(back)
inventory_items_to_kill += back
if(belt)
inventory_items_to_kill += belt
inventory_items_to_kill += held_items
for(var/obj/item/inventory_item in inventory_items_to_kill)
inventory_item.acid_act(acidpwr, acid_volume)
return TRUE
///Overrides the point value that the mob is worth
/mob/living/carbon/human/singularity_act()
. = 20
switch(mind?.assigned_role.type)
if(/datum/job/chief_engineer, /datum/job/station_engineer)
. = 100
if(/datum/job/clown)
. = rand(-1000, 1000)
..() //Called afterwards because getting the mind after getting gibbed is sketchy
/mob/living/carbon/human/help_shake_act(mob/living/carbon/helper, force_friendly)
if(!istype(helper))
return
if(wear_suit)
wear_suit.add_fingerprint(helper)
else if(w_uniform)
w_uniform.add_fingerprint(helper)
return ..()
/mob/living/carbon/human/check_self_for_injuries()
if(stat >= UNCONSCIOUS)
return
var/list/combined_msg = list()
visible_message(span_notice("[capitalize(declent_ru(NOMINATIVE))] осматривает себя."))
combined_msg += span_notice("<b>Вы осматриваете себя на предмет ранений.</b>")
var/list/missing = list(BODY_ZONE_HEAD, BODY_ZONE_CHEST, BODY_ZONE_L_ARM, BODY_ZONE_R_ARM, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
for(var/obj/item/bodypart/body_part as anything in bodyparts)
missing -= body_part.body_zone
if(body_part.bodypart_flags & BODYPART_PSEUDOPART) //don't show injury text for fake bodyparts; ie chainsaw arms or synthetic armblades
continue
body_part.check_for_injuries(src, combined_msg)
for(var/t in missing)
combined_msg += span_bolddanger("У вас отсутствует [parse_zone(t)]!")
if(is_bleeding())
var/list/obj/item/bodypart/bleeding_limbs = list()
for(var/obj/item/bodypart/part as anything in bodyparts)
if(part.get_modified_bleed_rate())
bleeding_limbs += part
var/num_bleeds = LAZYLEN(bleeding_limbs)
var/bleed_text = "<span class='danger'>Вы истекаете кровью из:"
switch(num_bleeds)
if(1 to 2)
bleed_text += " [bleeding_limbs[1].declent_ru(GENITIVE)][num_bleeds == 2 ? " и [bleeding_limbs[2].declent_ru(GENITIVE)]" : ""]"
if(3 to INFINITY)
for(var/i in 1 to (num_bleeds - 1))
var/obj/item/bodypart/BP = bleeding_limbs[i]
bleed_text += " [BP.declent_ru(GENITIVE)],"
bleed_text += " и [bleeding_limbs[num_bleeds].declent_ru(GENITIVE)]"
bleed_text += "!</span>"
combined_msg += bleed_text
if(getStaminaLoss())
if(getStaminaLoss() > 30)
combined_msg += span_info("Вы абсолютно обессилены.")
else
combined_msg += span_info("Вы чувствуете усталость.")
if(HAS_TRAIT(src, TRAIT_SELF_AWARE))
if(toxloss)
if(toxloss > 10)
combined_msg += span_danger("Вы чувствуете недомогание.")
else if(toxloss > 20)
combined_msg += span_danger("Вас тошнит.")
else if(toxloss > 40)
combined_msg += span_danger("Вы чувствуете себя очень плохо!")
if(oxyloss)
if(oxyloss > 10)
combined_msg += span_danger("У вас кружится голова.")
else if(oxyloss > 20)
combined_msg += span_danger("Ваши мысли затуманены и находятся где-то далеко.")
else if(oxyloss > 30)
combined_msg += span_danger("Вы задыхаетесь!")
if(!HAS_TRAIT(src, TRAIT_NOHUNGER))
switch(nutrition)
if(NUTRITION_LEVEL_FULL to INFINITY)
combined_msg += span_info("Вы наелись до отказа!")
if(NUTRITION_LEVEL_WELL_FED to NUTRITION_LEVEL_FULL)
combined_msg += span_info("Вы наелись!")
if(NUTRITION_LEVEL_FED to NUTRITION_LEVEL_WELL_FED)
combined_msg += span_info("Вы не голодны.")
if(NUTRITION_LEVEL_HUNGRY to NUTRITION_LEVEL_FED)
combined_msg += span_info("Вам не помешает перекусить.")
if(NUTRITION_LEVEL_STARVING to NUTRITION_LEVEL_HUNGRY)
combined_msg += span_info("Вы чувствуете сильный голод.")
if(0 to NUTRITION_LEVEL_STARVING)
combined_msg += span_danger("Вы умираете с голоду!")
//Compiles then shows the list of damaged organs and broken organs
var/list/broken = list()
var/list/damaged = list()
var/broken_message
var/damaged_message
var/broken_plural
var/damaged_plural
//Sets organs into their proper list
for(var/obj/item/organ/organ as anything in organs)
if(organ.organ_flags & ORGAN_FAILING)
if(broken.len)
broken += ", "
broken += organ.name
else if(organ.damage > organ.low_threshold)
if(damaged.len)
damaged += ", "
damaged += organ.name
//Checks to enforce proper grammar, inserts words as necessary into the list
if(broken.len)
if(broken.len > 1)
broken.Insert(broken.len, "и ")
broken_plural = TRUE
else
var/holder = broken[1] //our one and only element
if(holder[length(holder)] == "s")
broken_plural = TRUE
//Put the items in that list into a string of text
for(var/B in broken)
broken_message += B
combined_msg += span_warning("У вас не функционируют: [broken_plural ? broken_message : broken_message]")
if(damaged.len)
if(damaged.len > 1)
damaged.Insert(damaged.len, "и ")
damaged_plural = TRUE
else
var/holder = damaged[1]
if(holder[length(holder)] == "s")
damaged_plural = TRUE
for(var/D in damaged)
damaged_message += D
combined_msg += span_info("У вас болят: [damaged_plural ? damaged_message : damaged_message].")
if(quirks.len)
combined_msg += span_notice("У вас имеются следующий черты: [get_quirk_string(FALSE, CAT_QUIRK_ALL)].")
to_chat(src, boxed_message(combined_msg.Join("\n")))
/mob/living/carbon/human/damage_clothes(damage_amount, damage_type = BRUTE, damage_flag = 0, def_zone)
if(damage_type != BRUTE && damage_type != BURN)
return
damage_amount *= 0.5 //0.5 multiplier for balance reason, we don't want clothes to be too easily destroyed
var/list/torn_items = list()
//HEAD//
if(!def_zone || def_zone == BODY_ZONE_HEAD)
var/obj/item/clothing/head_clothes = null
if(glasses)
head_clothes = glasses
if(wear_mask)
head_clothes = wear_mask
if(wear_neck)
head_clothes = wear_neck
if(head)
head_clothes = head
if(head_clothes)
torn_items += head_clothes
else if(ears)
torn_items += ears
//CHEST//
if(!def_zone || def_zone == BODY_ZONE_CHEST)
var/obj/item/clothing/chest_clothes = null
if(w_uniform)
chest_clothes = w_uniform
if(wear_suit)
chest_clothes = wear_suit
if(chest_clothes)
torn_items += chest_clothes
//ARMS & HANDS//
if(!def_zone || def_zone == BODY_ZONE_L_ARM || def_zone == BODY_ZONE_R_ARM)
var/obj/item/clothing/arm_clothes = null
if(gloves)
arm_clothes = gloves
if(w_uniform && ((w_uniform.body_parts_covered & HANDS) || (w_uniform.body_parts_covered & ARMS)))
arm_clothes = w_uniform
if(wear_suit && ((wear_suit.body_parts_covered & HANDS) || (wear_suit.body_parts_covered & ARMS)))
arm_clothes = wear_suit
if(arm_clothes)
torn_items |= arm_clothes
//LEGS & FEET//
if(!def_zone || def_zone == BODY_ZONE_L_LEG || def_zone == BODY_ZONE_R_LEG)
var/obj/item/clothing/leg_clothes = null
if(shoes)
leg_clothes = shoes
if(w_uniform && ((w_uniform.body_parts_covered & FEET) || (w_uniform.body_parts_covered & LEGS)))
leg_clothes = w_uniform
if(wear_suit && ((wear_suit.body_parts_covered & FEET) || (wear_suit.body_parts_covered & LEGS)))
leg_clothes = wear_suit
if(leg_clothes)
torn_items |= leg_clothes
for(var/obj/item/I in torn_items)
I.take_damage(damage_amount, damage_type, damage_flag, 0)
/**
* Used by fire code to damage worn items.
*
* Arguments:
* - seconds_per_tick
* - times_fired
* - stacks: Current amount of firestacks
*
*/
/mob/living/carbon/human/proc/burn_clothing(seconds_per_tick, stacks)
var/list/burning_items = list()
var/obscured = check_obscured_slots(TRUE)
//HEAD//
if(glasses && !(obscured & ITEM_SLOT_EYES))
burning_items += glasses
if(wear_mask && !(obscured & ITEM_SLOT_MASK))
burning_items += wear_mask
if(wear_neck && !(obscured & ITEM_SLOT_NECK))
burning_items += wear_neck
if(ears && !(obscured & ITEM_SLOT_EARS))
burning_items += ears
if(head)
burning_items += head
//CHEST//
if(w_uniform && !(obscured & ITEM_SLOT_ICLOTHING))
burning_items += w_uniform
if(wear_suit)
burning_items += wear_suit
//ARMS & HANDS//
var/obj/item/clothing/arm_clothes = null
if(gloves && !(obscured & ITEM_SLOT_GLOVES))
arm_clothes = gloves
else if(wear_suit && ((wear_suit.body_parts_covered & HANDS) || (wear_suit.body_parts_covered & ARMS)))
arm_clothes = wear_suit
else if(w_uniform && ((w_uniform.body_parts_covered & HANDS) || (w_uniform.body_parts_covered & ARMS)))
arm_clothes = w_uniform
if(arm_clothes)
burning_items |= arm_clothes
//LEGS & FEET//
var/obj/item/clothing/leg_clothes = null
if(shoes && !(obscured & ITEM_SLOT_FEET))
leg_clothes = shoes
else if(wear_suit && ((wear_suit.body_parts_covered & FEET) || (wear_suit.body_parts_covered & LEGS)))
leg_clothes = wear_suit
else if(w_uniform && ((w_uniform.body_parts_covered & FEET) || (w_uniform.body_parts_covered & LEGS)))
leg_clothes = w_uniform
if(leg_clothes)
burning_items |= leg_clothes
if (!gloves || (!(gloves.resistance_flags & FIRE_PROOF) && (gloves.resistance_flags & FLAMMABLE)))
for(var/obj/item/burnable_item in held_items)
burning_items |= burnable_item
for(var/obj/item/burning in burning_items)
burning.fire_act((stacks * 25 * seconds_per_tick)) //damage taken is reduced to 2% of this value by fire_act()
/mob/living/carbon/human/on_fire_stack(seconds_per_tick, datum/status_effect/fire_handler/fire_stacks/fire_handler)
SEND_SIGNAL(src, COMSIG_HUMAN_BURNING)
burn_clothing(seconds_per_tick, fire_handler.stacks)
var/no_protection = FALSE
if (HAS_TRAIT(src, TRAIT_IGNORE_FIRE_PROTECTION))
no_protection = TRUE
fire_handler.harm_human(seconds_per_tick, no_protection)