forked from DaedalusDock/daedalusdock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspecies.dm
2042 lines (1687 loc) · 75.5 KB
/
species.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
GLOBAL_LIST_EMPTY(roundstart_races)
GLOBAL_LIST_EMPTY(roundstart_races_by_type)
/// An assoc list of species types to their features (from get_features())
GLOBAL_LIST_EMPTY(features_by_species)
/**
* # species datum
*
* Datum that handles different species in the game.
*
* This datum handles species in the game, such as lizardpeople, mothmen, zombies, skeletons, etc.
* It is used in [carbon humans][mob/living/carbon/human] to determine various things about them, like their food preferences, if they have biological genders, their damage resistances, and more.
*
*/
/datum/species
///If the game needs to manually check your race to do something not included in a proc here, it will use this.
var/id
///This is the fluff name. They are displayed on health analyzers and in the character setup menu. Must be `\improper`.
var/name
/// The formatting of the name of the species in plural context. Defaults to "[name]\s" if unset.
/// Ex "[Plasmamen] are weak", "[Mothmen] are strong", "[Lizardpeople] don't like", "[Golems] hate"
var/plural_form
// Default color. If mutant colors are disabled, this is the color that will be used by that race.
var/default_color = "#FFFFFF"
///Whether or not the race has sexual characteristics (biological genders). At the moment this is only FALSE for skeletons and shadows
var/sexes = TRUE
///A bitfield of "bodytypes", updated by /datum/obj/item/bodypart/proc/synchronize_bodytypes()
var/bodytype = BODYTYPE_HUMANOID | BODYTYPE_ORGANIC
///Clothing offsets. If a species has a different body than other species, you can offset clothing so they look less weird.
var/list/offset_features = list(OFFSET_UNIFORM = list(0,0), OFFSET_ID = list(0,0), OFFSET_GLOVES = list(0,0), OFFSET_GLASSES = list(0,0), OFFSET_EARS = list(0,0), OFFSET_SHOES = list(0,0), OFFSET_S_STORE = list(0,0), OFFSET_FACEMASK = list(0,0), OFFSET_HEAD = list(0,0), OFFSET_FACE = list(0,0), OFFSET_BELT = list(0,0), OFFSET_BACK = list(0,0), OFFSET_SUIT = list(0,0), OFFSET_NECK = list(0,0))
///If this species needs special 'fallback' sprites, what is the path to the file that contains them?
var/fallback_clothing_path
///The maximum number of bodyparts this species can have.
var/max_bodypart_count = 6
///This allows races to have specific hair colors. If null, it uses the H's hair/facial hair colors. If "mutcolor", it uses the H's mutant_color. If "fixedmutcolor", it uses fixedmutcolor
var/hair_color
///The alpha used by the hair. 255 is completely solid, 0 is invisible.
var/hair_alpha = 255
///This is used for children, it will determine their default limb ID for use of examine. See [/mob/living/carbon/human/proc/examine].
var/examine_limb_id
///Never, Optional, or Forced digi legs?
var/digitigrade_customization = DIGITIGRADE_NEVER
///Does the species use skintones or not? As of now only used by humans.
var/use_skintones = FALSE
///If your race bleeds something other than bog standard blood, change this to reagent id. For example, ethereals bleed liquid electricity.
var/datum/reagent/exotic_blood
///What the species drops when gibbed by a gibber machine.
var/meat = /obj/item/food/meat/slab/human
///What skin the species drops when gibbed by a gibber machine.
var/skinned_type
///Bitfield for food types that the species likes, giving them a mood boost. Lizards like meat, for example.
var/liked_food = NONE
///Bitfield for food types that the species dislikes, giving them disgust. Humans hate raw food, for example.
var/disliked_food = GROSS
///Bitfield for food types that the species absolutely hates, giving them even more disgust than disliked food. Meat is "toxic" to moths, for example.
var/toxic_food = TOXIC
///How are we treated regarding processing reagents, by default we process them as if we're organic
var/reagent_flags = PROCESS_ORGANIC
///Inventory slots the race can't equip stuff to. Golems cannot wear jumpsuits, for example.
var/list/no_equip = list()
/// Allows the species to equip items that normally require a jumpsuit without having one equipped. Used by golems.
var/nojumpsuit = FALSE
///Affects the speech message, for example: Motharula flutters, "My speech message is flutters!"
var/say_mod = "says"
///Affects the species' screams, for example: "Motharula buzzes!"
var/scream_verb = "screams"
///What languages this species can understand and say. Use a [language holder datum][/datum/language_holder] in this var.
var/species_language_holder = /datum/language_holder
/// DEPRECATED: Now only handles legs.
var/list/mutant_bodyparts = list()
///Internal organs that are unique to this race, like a tail.
var/list/mutant_organs = list()
///The bodyparts this species uses. assoc of bodypart string - bodypart type. Make sure all the fucking entries are in or I'll skin you alive.
var/list/bodypart_overrides = list(
BODY_ZONE_L_ARM = /obj/item/bodypart/arm/left,
BODY_ZONE_R_ARM = /obj/item/bodypart/arm/right,
BODY_ZONE_HEAD = /obj/item/bodypart/head,
BODY_ZONE_L_LEG = /obj/item/bodypart/leg/left,
BODY_ZONE_R_LEG = /obj/item/bodypart/leg/right,
BODY_ZONE_CHEST = /obj/item/bodypart/chest,
)
/// Robotic bodyparts for preference selection
var/list/robotic_bodyparts = list(
BODY_ZONE_L_ARM = /obj/item/bodypart/arm/left/robot/surplus,
BODY_ZONE_R_ARM = /obj/item/bodypart/arm/right/robot/surplus,
BODY_ZONE_L_LEG = /obj/item/bodypart/leg/left/robot/surplus,
BODY_ZONE_R_LEG= /obj/item/bodypart/leg/right/robot/surplus,
)
///List of cosmetic organs to generate like horns, frills, wings, etc. list(typepath of organ = "Round Beautiful BDSM Snout"). Still WIP
var/list/cosmetic_organs = list()
//* BODY TEMPERATURE THINGS *//
var/cold_level_3 = 120
var/cold_level_2 = 200
var/cold_level_1 = BODYTEMP_COLD_DAMAGE_LIMIT
var/cold_discomfort_level = 285
/// The natural body temperature to adjust towards
var/bodytemp_normal = BODYTEMP_NORMAL
var/heat_discomfort_level = 315
var/heat_level_1 = BODYTEMP_HEAT_DAMAGE_LIMIT
var/heat_level_2 = 400
var/heat_level_3 = 1000
/// Minimum amount of kelvin moved toward normal body temperature per tick.
var/bodytemp_autorecovery_min = BODYTEMP_AUTORECOVERY_MINIMUM
var/list/heat_discomfort_strings = list(
"You feel sweat drip down your neck.",
"You feel uncomfortably warm.",
"Your skin prickles in the heat."
)
var/list/cold_discomfort_strings = list(
"You feel chilly.",
"You shiver suddenly.",
"Your chilly flesh stands out in goosebumps."
)
//* MODIFIERS *//
///Multiplier for the race's speed. Positive numbers make it move slower, negative numbers make it move faster.
var/speedmod = 0
///Percentage modifier for overall defense of the race, or less defense, if it's negative.
var/armor = 0
///multiplier for brute damage
var/brutemod = 1
///multiplier for burn damage
var/burnmod = 1
///multiplier for damage from cold temperature
var/coldmod = 1
///multiplier for damage from hot temperature
var/heatmod = 1
///multiplier for stun durations
var/stunmod = 1
///Base electrocution coefficient. Basically a multiplier for damage from electrocutions.
var/siemens_coeff = 1
///To use MUTCOLOR with a fixed color that's independent of the mcolor feature in DNA.
var/fixed_mut_color = ""
///Special mutation that can be found in the genepool exclusively in this species. Dont leave empty or changing species will be a headache
var/inert_mutation = /datum/mutation/human/dwarfism
///Sounds to override barefeet walking
var/list/special_step_sounds
///Special sound for grabbing
var/grab_sound
/// A path to an outfit that is important for species life e.g. vox outfit
var/datum/outfit/outfit_important_for_life
///Used for picking outfits in _job.dm
var/job_outfit_type
///Icon file used for eyes, defaults to 'icons/mob/human_face.dmi' if not set
var/species_eye_path
///Is this species a flying species? Used as an easy check for some things
var/flying_species = FALSE
///The actual flying ability given to flying species
var/datum/action/innate/flight/fly
//Dictates which wing icons are allowed for a given species. If count is >1 a radial menu is used to choose between all icons in list
var/list/wings_icons = list("Angel")
///Used to determine what description to give when using a potion of flight, if false it will describe them as growing new wings
var/has_innate_wings = FALSE
/// The icon_state of the fire overlay added when sufficently ablaze and standing. see onfire.dmi
var/fire_overlay = "human_burning"
///Species-only traits. Can be found in [code/__DEFINES/DNA.dm]
var/list/species_traits = list()
///Generic traits tied to having the species.
var/list/inherent_traits = list(TRAIT_ADVANCEDTOOLUSER, TRAIT_CAN_STRIP)
/// List of biotypes the mob belongs to. Used by diseases.
var/inherent_biotypes = MOB_ORGANIC|MOB_HUMANOID
///List of factions the mob gain upon gaining this species.
var/list/inherent_factions
/// The [/mob/living/var/mob_size] of members of this species.
var/species_mob_size = MOB_SIZE_HUMAN
///What gas does this species breathe? Used by suffocation screen alerts, most of actual gas breathing is handled by mutantlungs. See [life.dm][code/modules/mob/living/carbon/human/life.dm]
var/breathid = GAS_OXYGEN
///What anim to use for dusting
var/dust_anim = "dust-h"
///What anim to use for gibbing
var/gib_anim = "gibbed-h"
///Forces an item into this species' hands. Only an honorary mutantthing because this is not an organ and not loaded in the same way, you've been warned to do your research.
var/obj/item/mutanthands
/// A template for what organs this species should have.
/// Assign null to simply exclude spawning with one.
var/list/organs = list(
ORGAN_SLOT_BRAIN = /obj/item/organ/brain,
ORGAN_SLOT_HEART = /obj/item/organ/heart,
ORGAN_SLOT_LUNGS = /obj/item/organ/lungs,
ORGAN_SLOT_EYES = /obj/item/organ/eyes,
ORGAN_SLOT_EARS = /obj/item/organ/ears,
ORGAN_SLOT_TONGUE = /obj/item/organ/tongue,
ORGAN_SLOT_STOMACH = /obj/item/organ/stomach,
ORGAN_SLOT_APPENDIX = /obj/item/organ/appendix,
ORGAN_SLOT_LIVER = /obj/item/organ/liver,
ORGAN_SLOT_KIDNEYS = /obj/item/organ/kidneys,
)
///Bitflag that controls what in game ways something can select this species as a spawnable source, such as magic mirrors. See [mob defines][code/__DEFINES/mobs.dm] for possible sources.
var/changesource_flags = null
///Unique cookie given by admins through prayers
var/species_cookie = /obj/item/food/cookie
///For custom overrides for species ass images
var/icon/ass_image
/// List of family heirlooms this species can get with the family heirloom quirk. List of types.
var/list/family_heirlooms
///List of results you get from knife-butchering. null means you cant butcher it. Associated by resulting type - value of amount
var/list/knife_butcher_results
/// Should we preload this species's organs?
var/preload = TRUE
/// Do we try to prevent reset_perspective() from working? Useful for Dullahans to stop perspective changes when they're looking through their head.
var/prevent_perspective_change = FALSE
///Was the species changed from its original type at the start of the round?
var/roundstart_changed = FALSE
var/properly_gained = FALSE
/// A list of weighted lists to pain emotes. The list with the LOWEST damage requirement needs to be first.
var/list/pain_emotes = list(
list(
"grunts in pain" = 1,
"moans in pain" = 1,
) = PAIN_AMT_LOW,
list(
"pain" = 1,
) = PAIN_AMT_MEDIUM,
list(
"agony" = 1,
) = PAIN_AMT_AGONIZING,
)
///////////
// PROCS //
///////////
/datum/species/New()
wings_icons = string_list(wings_icons)
//This isn't a simple \s use because it fucks up the codex.
plural_form ||= findtext_char(name, "s", -1) ? name : "[name]s"
return ..()
/// Gets a list of all species available to choose in roundstart.
/proc/get_selectable_species()
RETURN_TYPE(/list)
if (!GLOB.roundstart_races.len)
generate_selectable_species()
return GLOB.roundstart_races
/proc/get_selectable_species_by_type()
RETURN_TYPE(/list)
if (!GLOB.roundstart_races_by_type.len)
generate_selectable_species()
return GLOB.roundstart_races_by_type
/**
* Generates species available to choose in character setup at roundstart
*
* This proc generates which species are available to pick from in character setup.
* If there are no available roundstart species, defaults to human.
*/
/proc/generate_selectable_species()
var/list/selectable_species = list()
var/list/species_by_type = list()
for(var/species_type in subtypesof(/datum/species))
var/datum/species/species = new species_type
if(species.check_roundstart_eligible())
selectable_species += species.id
species_by_type += species_type
qdel(species)
if(!selectable_species.len)
selectable_species += SPECIES_HUMAN
species_by_type += /datum/species/human
GLOB.roundstart_races = selectable_species
GLOB.roundstart_races_by_type = species_by_type
return
/**
* Checks if a species is eligible to be picked at roundstart.
*
* Checks the config to see if this species is allowed to be picked in the character setup menu.
* Used by [/proc/generate_selectable_species].
*/
/datum/species/proc/check_roundstart_eligible()
if(id in (CONFIG_GET(keyed_list/roundstart_races)))
return TRUE
return FALSE
/**
* Generates a random name for a carbon.
*
* This generates a random unique name based on a human's species and gender.
* Arguments:
* * gender - The gender that the name should adhere to. Use MALE for male names, use anything else for female names.
* * unique - If true, ensures that this new name is not a duplicate of anyone else's name currently on the station.
* * lastname - Does this species' naming system adhere to the last name system? Set to false if it doesn't.
*/
/datum/species/proc/random_name(gender,unique,lastname)
if(unique)
return random_unique_name(gender)
var/randname
if(gender == MALE)
randname = pick(GLOB.first_names_male)
else
randname = pick(GLOB.first_names_female)
if(lastname)
randname += " [lastname]"
else
randname += " [pick(GLOB.last_names)]"
return randname
/**
* Copies some vars and properties over that should be kept when creating a copy of this species.
*
* Used by slimepeople to copy themselves, and by the DNA datum to hardset DNA to a species
* Arguments:
* * old_species - The species that the carbon used to be before copying
*/
/datum/species/proc/copy_properties_from(datum/species/old_species)
return
/datum/species/proc/should_organ_apply_to(mob/living/carbon/target, obj/item/organ/organpath)
if(isnull(organpath) || isnull(target))
CRASH("passed a null path or mob to 'should_external_organ_apply_to'")
var/feature_key = initial(organpath.feature_key)
if(isnull(feature_key))
return TRUE
if(target.dna.features[feature_key] != SPRITE_ACCESSORY_NONE)
return TRUE
return FALSE
/**
* Corrects organs in a carbon, removing ones it doesn't need and adding ones it does.
*
* Takes all organ slots, removes organs a species should not have, adds organs a species should have.
* can use replace_current to refresh all organs, creating an entirely new set.
*
* Arguments:
* * C - carbon, the owner of the species datum AKA whoever we're regenerating organs in
* * old_species - datum, used when regenerate organs is called in a switching species to remove old mutant organs.
* * replace_current - boolean, forces all old organs to get deleted whether or not they pass the species' ability to keep that organ
* * excluded_zones - list, add zone defines to block organs inside of the zones from getting handled. see headless mutation for an example
* * visual_only - boolean, only load organs that change how the species looks. Do not use for normal gameplay stuff
*/
/datum/species/proc/regenerate_organs(mob/living/carbon/C, datum/species/old_species, replace_current = TRUE, list/excluded_zones, visual_only = FALSE)
for(var/slot in organs)
var/obj/item/organ/oldorgan = C.getorganslot(slot) //used in removing
var/obj/item/organ/neworgan = organs[slot] //used in adding
if(visual_only && !initial(neworgan.visual))
continue
var/used_neworgan = FALSE
var/should_have = !!neworgan
if(should_have)
neworgan = SSwardrobe.provide_type(neworgan)
if(oldorgan && (!should_have || replace_current) && !(oldorgan.zone in excluded_zones) && !(oldorgan.organ_flags & ORGAN_UNREMOVABLE))
if(slot == ORGAN_SLOT_BRAIN)
var/obj/item/organ/brain/brain = oldorgan
if(!brain.decoy_override)//"Just keep it if it's fake" - confucius, probably
brain.before_organ_replacement(neworgan)
brain.Remove(C,TRUE) //brain argument used so it doesn't cause any... sudden death.
QDEL_NULL(brain)
oldorgan = null //now deleted
else
oldorgan.before_organ_replacement(neworgan)
oldorgan.Remove(C,TRUE)
QDEL_NULL(oldorgan) //we cannot just tab this out because we need to skip the deleting if it is a decoy brain.
oldorgan = null
if(oldorgan)
oldorgan.setOrganDamage(0)
oldorgan.germ_level = 0
else if(should_have && !(initial(neworgan.zone) in excluded_zones))
used_neworgan = TRUE
neworgan.Insert(C, TRUE, FALSE)
if(!used_neworgan)
qdel(neworgan)
if(old_species)
for(var/mutantorgan in old_species.mutant_organs)
// Snowflake check. If our species share this mutant organ, let's not remove it
// just yet as we'll be properly replacing it later.
if(mutantorgan in mutant_organs)
continue
var/obj/item/organ/I = C.getorgan(mutantorgan)
if(I)
I.Remove(C, TRUE)
qdel(I)
for(var/mutantorgan in old_species.cosmetic_organs)
if(mutantorgan in cosmetic_organs)
continue
var/obj/item/organ/I = C.getorgan(mutantorgan)
if(I)
I.Remove(C)
qdel(I)
if(replace_current)
for(var/slot in old_species.organs)
if(!(slot in organs))
var/obj/item/organ/O = C.getorganslot(slot)
if(!O)
continue
O.Remove(C, TRUE)
qdel(O)
for(var/organ_path in mutant_organs)
var/obj/item/organ/current_organ = C.getorgan(organ_path)
if(!current_organ || replace_current)
var/obj/item/organ/replacement = SSwardrobe.provide_type(organ_path)
// If there's an existing mutant organ, we're technically replacing it.
// Let's abuse the snowflake proc that skillchips added. Basically retains
// feature parity with every other organ too.
if(current_organ)
current_organ.before_organ_replacement(replacement)
// organ.Insert will qdel any current organs in that slot, so we don't need to.
replacement.Insert(C, TRUE, FALSE)
for(var/obj/item/organ/organ_path as anything in cosmetic_organs)
if(!should_organ_apply_to(C, organ_path))
continue
//Load a persons preferences from DNA
var/obj/item/organ/new_organ = SSwardrobe.provide_type(organ_path)
new_organ.Insert(C, FALSE, FALSE)
/**
* Proc called when a carbon becomes this species.
*
* This sets up and adds/changes/removes things, qualities, abilities, and traits so that the transformation is as smooth and bugfree as possible.
* Produces a [COMSIG_SPECIES_GAIN] signal.
* Arguments:
* * C - Carbon, this is whoever became the new species.
* * old_species - The species that the carbon used to be before becoming this race, used for regenerating organs.
* * pref_load - Preferences to be loaded from character setup, loads in preferred mutant things like bodyparts, digilegs, skin color, etc.
*/
/datum/species/proc/on_species_gain(mob/living/carbon/C, datum/species/old_species, pref_load)
SHOULD_CALL_PARENT(TRUE)
// Drop the items the new species can't wear
if((AGENDER in species_traits))
C.gender = PLURAL
for(var/slot_id in no_equip)
var/obj/item/thing = C.get_item_by_slot(slot_id)
if(thing && (!thing.species_exception || !is_type_in_list(src,thing.species_exception)))
C.dropItemToGround(thing)
if(C.hud_used)
C.hud_used.update_locked_slots()
C.mob_size = species_mob_size
C.mob_biotypes = inherent_biotypes
if(type != old_species?.type)
replace_body(C, src)
regenerate_organs(C, old_species, visual_only = C.visual_only_organs)
C.dna.blood_type = get_random_blood_type()
if(old_species.mutanthands)
for(var/obj/item/I in C.held_items)
if(istype(I, old_species.mutanthands))
qdel(I)
if(mutanthands)
// Drop items in hands
// If you're lucky enough to have a TRAIT_NODROP item, then it stays.
for(var/V in C.held_items)
var/obj/item/I = V
if(istype(I))
C.dropItemToGround(I)
else //Entries in the list should only ever be items or null, so if it's not an item, we can assume it's an empty hand
INVOKE_ASYNC(C, TYPE_PROC_REF(/mob, put_in_hands), new mutanthands)
for(var/X in inherent_traits)
ADD_TRAIT(C, X, SPECIES_TRAIT)
if(TRAIT_VIRUSIMMUNE in inherent_traits)
for(var/datum/pathogen/A in C.diseases)
A.force_cure(add_resistance = FALSE)
if(TRAIT_TOXIMMUNE in inherent_traits)
C.setToxLoss(0, TRUE, TRUE)
if(TRAIT_NOMETABOLISM in inherent_traits)
C.reagents.end_metabolization(C, keep_liverless = TRUE)
if(TRAIT_GENELESS in inherent_traits)
C.dna.remove_all_mutations() // Radiation immune mobs can't get mutations normally
if(inherent_factions)
for(var/i in inherent_factions)
C.faction += i //Using +=/-= for this in case you also gain the faction from a different source.
if(flying_species && isnull(fly))
fly = new
fly.Grant(C)
C.add_or_update_variable_movespeed_modifier(/datum/movespeed_modifier/species, slowdown=speedmod)
SEND_SIGNAL(C, COMSIG_SPECIES_GAIN, src, old_species)
properly_gained = TRUE
/**
* Proc called when a carbon is no longer this species.
*
* This sets up and adds/changes/removes things, qualities, abilities, and traits so that the transformation is as smooth and bugfree as possible.
* Produces a [COMSIG_SPECIES_LOSS] signal.
* Arguments:
* * C - Carbon, this is whoever lost this species.
* * new_species - The new species that the carbon became, used for genetics mutations.
* * pref_load - Preferences to be loaded from character setup, loads in preferred mutant things like bodyparts, digilegs, skin color, etc.
*/
/datum/species/proc/on_species_loss(mob/living/carbon/human/C, datum/species/new_species, pref_load)
SHOULD_CALL_PARENT(TRUE)
for(var/X in inherent_traits)
REMOVE_TRAIT(C, X, SPECIES_TRAIT)
for(var/path in cosmetic_organs)
var/obj/item/organ/organ = locate(path) in C.organs
if(!organ)
continue
organ.Remove(C, TRUE)
qdel(organ)
//If their inert mutation is not the same, swap it out
if((inert_mutation != new_species.inert_mutation) && LAZYLEN(C.dna.mutation_index) && (inert_mutation in C.dna.mutation_index))
C.dna.remove_mutation(inert_mutation)
//keep it at the right spot, so we can't have people taking shortcuts
var/location = C.dna.mutation_index.Find(inert_mutation)
C.dna.mutation_index[location] = new_species.inert_mutation
C.dna.default_mutation_genes[location] = C.dna.mutation_index[location]
C.dna.mutation_index[new_species.inert_mutation] = create_sequence(new_species.inert_mutation)
C.dna.default_mutation_genes[new_species.inert_mutation] = C.dna.mutation_index[new_species.inert_mutation]
if(inherent_factions)
for(var/i in inherent_factions)
C.faction -= i
C.remove_movespeed_modifier(/datum/movespeed_modifier/species)
SEND_SIGNAL(C, COMSIG_SPECIES_LOSS, src)
/**
* Handles the body of a human
*
* Handles lipstick, having no eyes, eye color, undergarnments like underwear, undershirts, and socks, and body layers.
* Calls [handle_mutant_bodyparts][/datum/species/proc/handle_mutant_bodyparts]
* Arguments:
* * species_human - Human, whoever we're handling the body for
*/
/datum/species/proc/handle_body(mob/living/carbon/human/species_human)
species_human.remove_overlay(BODY_LAYER)
if(HAS_TRAIT(species_human, TRAIT_INVISIBLE_MAN))
return
var/list/standing = list()
var/obj/item/bodypart/head/noggin = species_human.get_bodypart(BODY_ZONE_HEAD)
if(noggin && !(HAS_TRAIT(species_human, TRAIT_HUSK)))
// lipstick
if(species_human.lip_style && (LIPS in species_traits))
var/mutable_appearance/lip_overlay = mutable_appearance('icons/mob/human_face.dmi', "lips_[species_human.lip_style]", -BODY_LAYER)
lip_overlay.color = species_human.lip_color
if(OFFSET_FACE in species_human.dna.species.offset_features)
lip_overlay.pixel_x += species_human.dna.species.offset_features[OFFSET_FACE][1]
lip_overlay.pixel_y += species_human.dna.species.offset_features[OFFSET_FACE][2]
standing += lip_overlay
// blush
if (HAS_TRAIT(species_human, TRAIT_BLUSHING)) // Caused by either the *blush emote or the "drunk" mood event
var/mutable_appearance/blush_overlay = mutable_appearance('icons/mob/human_face.dmi', "blush", -BODY_ADJ_LAYER) //should appear behind the eyes
blush_overlay.color = COLOR_BLUSH_PINK
standing += blush_overlay
// organic body markings
if(HAS_MARKINGS in species_traits)
var/obj/item/bodypart/chest/chest = species_human.get_bodypart(BODY_ZONE_CHEST)
var/obj/item/bodypart/arm/right/right_arm = species_human.get_bodypart(BODY_ZONE_R_ARM)
var/obj/item/bodypart/arm/left/left_arm = species_human.get_bodypart(BODY_ZONE_L_ARM)
var/obj/item/bodypart/leg/right/right_leg = species_human.get_bodypart(BODY_ZONE_R_LEG)
var/obj/item/bodypart/leg/left/left_leg = species_human.get_bodypart(BODY_ZONE_L_LEG)
var/datum/sprite_accessory/markings = GLOB.moth_markings_list[species_human.dna.features["moth_markings"]]
if(!HAS_TRAIT(species_human, TRAIT_HUSK))
if(noggin && (IS_ORGANIC_LIMB(noggin)))
var/mutable_appearance/markings_head_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_head", -BODY_LAYER)
standing += markings_head_overlay
if(chest && (IS_ORGANIC_LIMB(chest)))
var/mutable_appearance/markings_chest_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_chest", -BODY_LAYER)
standing += markings_chest_overlay
if(right_arm && (IS_ORGANIC_LIMB(right_arm)))
var/mutable_appearance/markings_r_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_r_arm", -BODY_LAYER)
standing += markings_r_arm_overlay
if(left_arm && (IS_ORGANIC_LIMB(left_arm)))
var/mutable_appearance/markings_l_arm_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_l_arm", -BODY_LAYER)
standing += markings_l_arm_overlay
if(right_leg && (IS_ORGANIC_LIMB(right_leg)))
var/mutable_appearance/markings_r_leg_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_r_leg", -BODY_LAYER)
standing += markings_r_leg_overlay
if(left_leg && (IS_ORGANIC_LIMB(left_leg)))
var/mutable_appearance/markings_l_leg_overlay = mutable_appearance(markings.icon, "[markings.icon_state]_l_leg", -BODY_LAYER)
standing += markings_l_leg_overlay
//Underwear, Undershirts & Socks
if(!(NO_UNDERWEAR in species_traits))
if(species_human.underwear)
var/datum/sprite_accessory/underwear/underwear = GLOB.underwear_list[species_human.underwear]
var/mutable_appearance/underwear_overlay
if(underwear)
if(species_human.dna.species.sexes && species_human.physique == FEMALE && (underwear.gender == MALE))
underwear_overlay = wear_female_version(underwear.icon_state, underwear.icon, BODY_LAYER, FEMALE_UNIFORM_FULL)
else
underwear_overlay = mutable_appearance(underwear.icon, underwear.icon_state, -BODY_LAYER)
if(!underwear.use_static)
underwear_overlay.color = species_human.underwear_color
standing += underwear_overlay
if(species_human.undershirt)
var/datum/sprite_accessory/undershirt/undershirt = GLOB.undershirt_list[species_human.undershirt]
if(undershirt)
if(species_human.dna.species.sexes && species_human.physique == FEMALE)
standing += wear_female_version(undershirt.icon_state, undershirt.icon, BODY_LAYER)
else
standing += mutable_appearance(undershirt.icon, undershirt.icon_state, -BODY_LAYER)
if(species_human.socks && species_human.num_legs >= 2 && !(src.bodytype & BODYTYPE_DIGITIGRADE))
var/datum/sprite_accessory/socks/socks = GLOB.socks_list[species_human.socks]
if(socks)
standing += mutable_appearance(socks.icon, socks.icon_state, -BODY_LAYER)
if(standing.len)
species_human.overlays_standing[BODY_LAYER] = standing
species_human.apply_overlay(BODY_LAYER)
//This exists so sprite accessories can still be per-layer without having to include that layer's
//number in their sprite name, which causes issues when those numbers change.
/datum/species/proc/mutant_bodyparts_layertext(layer)
switch(layer)
if(BODY_BEHIND_LAYER)
return "BEHIND"
if(BODY_ADJ_LAYER)
return "ADJ"
if(BODY_FRONT_LAYER)
return "FRONT"
///Proc that will randomise the hair, or primary appearance element (i.e. for moths wings) of a species' associated mob
/datum/species/proc/randomize_main_appearance_element(mob/living/carbon/human/human_mob)
human_mob.hairstyle = random_hairstyle(human_mob.gender)
human_mob.update_body_parts()
///Proc that will randomise the underwear (i.e. top, pants and socks) of a species' associated mob
/datum/species/proc/randomize_active_underwear(mob/living/carbon/human/human_mob)
human_mob.undershirt = random_undershirt(human_mob.gender)
human_mob.underwear = random_underwear(human_mob.gender)
human_mob.socks = random_socks(human_mob.gender)
human_mob.update_body()
/datum/species/proc/spec_life(mob/living/carbon/human/H, delta_time, times_fired)
// If you're dirty, your gloves will become dirty, too.
if(H.gloves && (H.germ_level > H.gloves.germ_level) && prob(10))
H.gloves.germ_level += 1
/datum/species/proc/spec_death(gibbed, mob/living/carbon/human/H)
return
/datum/species/proc/can_equip(obj/item/I, slot, disable_warning, mob/living/carbon/human/H, bypass_equip_delay_self = FALSE)
if(slot in no_equip)
if(!I.species_exception || !is_type_in_list(src, I.species_exception))
return FALSE
// if there's an item in the slot we want, fail
if(H.get_item_by_slot(slot))
return FALSE
// For whatever reason, this item cannot be equipped by this species
if(slot != ITEM_SLOT_HANDS && (bodytype & I.restricted_bodytypes))
return FALSE
// this check prevents us from equipping something to a slot it doesn't support, WITH the exceptions of storage slots (pockets, suit storage, and backpacks)
// we don't require having those slots defined in the item's slot_flags, so we'll rely on their own checks further down
if(!(I.slot_flags & slot))
var/excused = FALSE
// Anything that's small or smaller can fit into a pocket by default
if((slot == ITEM_SLOT_RPOCKET || slot == ITEM_SLOT_LPOCKET) && I.w_class <= WEIGHT_CLASS_SMALL)
excused = TRUE
else if(slot == ITEM_SLOT_SUITSTORE || slot == ITEM_SLOT_BACKPACK || slot == ITEM_SLOT_HANDS || slot == ITEM_SLOT_HANDCUFFED || slot == ITEM_SLOT_LEGCUFFED)
excused = TRUE
if(!excused)
return FALSE
switch(slot)
if(ITEM_SLOT_HANDS)
var/empty_hands = length(H.get_empty_held_indexes())
if(HAS_TRAIT(I, TRAIT_NEEDS_TWO_HANDS) && ((empty_hands < 2) || H.usable_hands < 2))
if(!disable_warning)
to_chat(H, span_warning("You need two hands to hold [I]."))
return FALSE
if(empty_hands)
return TRUE
return FALSE
if(ITEM_SLOT_MASK)
if(!H.get_bodypart(BODY_ZONE_HEAD))
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_NECK)
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_BACK)
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_OCLOTHING)
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_GLOVES)
if(H.num_hands == 0)
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_FEET)
if(H.num_legs < 2)
return FALSE
if((bodytype & BODYTYPE_DIGITIGRADE) && !(I.item_flags & IGNORE_DIGITIGRADE))
if(!(I.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON)))
if(!disable_warning)
to_chat(H, span_warning("The footwear around here isn't compatible with your feet!"))
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_BELT)
var/obj/item/bodypart/O = H.get_bodypart(BODY_ZONE_CHEST)
if(!H.w_uniform && !nojumpsuit && (!O || IS_ORGANIC_LIMB(O)))
if(!disable_warning)
to_chat(H, span_warning("You need a jumpsuit before you can attach this [I.name]!"))
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_EYES)
if(!H.get_bodypart(BODY_ZONE_HEAD))
return FALSE
var/obj/item/organ/eyes/E = H.getorganslot(ORGAN_SLOT_EYES)
if(E?.no_glasses)
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_HEAD)
if(!H.get_bodypart(BODY_ZONE_HEAD))
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_EARS)
if(!H.get_bodypart(BODY_ZONE_HEAD))
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_ICLOTHING)
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_ID)
var/obj/item/bodypart/O = H.get_bodypart(BODY_ZONE_CHEST)
if(!H.w_uniform && !nojumpsuit && (!O || IS_ORGANIC_LIMB(O)))
if(!disable_warning)
to_chat(H, span_warning("You need a jumpsuit before you can attach this [I.name]!"))
return FALSE
return H.equip_delay_self_check(I, bypass_equip_delay_self)
if(ITEM_SLOT_LPOCKET)
if(HAS_TRAIT(I, TRAIT_NODROP)) //Pockets aren't visible, so you can't move TRAIT_NODROP items into them.
return FALSE
if(H.l_store) // no pocket swaps at all
return FALSE
var/obj/item/bodypart/O = H.get_bodypart(BODY_ZONE_L_LEG)
if(!H.w_uniform && !nojumpsuit && (!O || IS_ORGANIC_LIMB(O)))
if(!disable_warning)
to_chat(H, span_warning("You need a jumpsuit before you can attach this [I.name]!"))
return FALSE
return TRUE
if(ITEM_SLOT_RPOCKET)
if(HAS_TRAIT(I, TRAIT_NODROP))
return FALSE
if(H.r_store)
return FALSE
var/obj/item/bodypart/O = H.get_bodypart(BODY_ZONE_R_LEG)
if(!H.w_uniform && !nojumpsuit && (!O || IS_ORGANIC_LIMB(O)))
if(!disable_warning)
to_chat(H, span_warning("You need a jumpsuit before you can attach this [I.name]!"))
return FALSE
return TRUE
if(ITEM_SLOT_SUITSTORE)
if(HAS_TRAIT(I, TRAIT_NODROP))
return FALSE
if(!H.wear_suit)
if(!disable_warning)
to_chat(H, span_warning("You need a suit before you can attach this [I.name]!"))
return FALSE
if(!H.wear_suit.allowed)
if(!disable_warning)
to_chat(H, span_warning("You somehow have a suit with no defined allowed items for suit storage, stop that."))
return FALSE
if(I.w_class > WEIGHT_CLASS_BULKY)
if(!disable_warning)
to_chat(H, span_warning("The [I.name] is too big to attach!")) //should be src?
return FALSE
if( istype(I, /obj/item/modular_computer/tablet) || istype(I, /obj/item/pen) || is_type_in_list(I, H.wear_suit.allowed) )
return TRUE
return FALSE
if(ITEM_SLOT_HANDCUFFED)
if(H.handcuffed)
return FALSE
if(!istype(I, /obj/item/restraints/handcuffs))
return FALSE
if(H.num_hands < 2)
return FALSE
return TRUE
if(ITEM_SLOT_LEGCUFFED)
if(H.legcuffed)
return FALSE
if(!istype(I, /obj/item/restraints/legcuffs))
return FALSE
if(H.num_legs < 2)
return FALSE
return TRUE
if(ITEM_SLOT_BACKPACK)
if(H.back && H.back.atom_storage?.can_insert(I, H, messages = TRUE))
return TRUE
return FALSE
return FALSE //Unsupported slot
/datum/species/proc/equip_delay_self_check(obj/item/I, mob/living/carbon/human/H, bypass_equip_delay_self)
if(!I.equip_delay_self || bypass_equip_delay_self)
return TRUE
H.visible_message(
span_notice("[H] start putting on [I]..."),
span_notice("You start putting on [I]...")
)
return do_after(H, H, I.equip_delay_self, DO_PUBLIC, display = I)
/// Equips the necessary species-relevant gear before putting on the rest of the uniform.
/datum/species/proc/pre_equip_species_outfit(datum/outfit/O, mob/living/carbon/human/equipping, visuals_only = FALSE)
return
/**
* Equip the outfit required for life. Replaces items currently worn.
*/
/datum/species/proc/give_important_for_life(mob/living/carbon/human/human_to_equip)
if(!outfit_important_for_life)
return
human_to_equip.equipOutfit(outfit_important_for_life)
/**
* Species based handling for irradiation
*
* Arguments:
* - [source][/mob/living/carbon/human]: The mob requesting handling
* - time_since_irradiated: The amount of time since the mob was first irradiated
* - delta_time: The amount of time that has passed since the last tick
*/
/datum/species/proc/handle_radiation(mob/living/carbon/human/source, time_since_irradiated, delta_time)
if(time_since_irradiated > RAD_MOB_KNOCKDOWN && DT_PROB(RAD_MOB_KNOCKDOWN_PROB, delta_time))
if(!source.IsParalyzed())
source.emote("collapse")
source.Paralyze(RAD_MOB_KNOCKDOWN_AMOUNT)
to_chat(source, span_danger("You feel weak."))
if(time_since_irradiated > RAD_MOB_VOMIT && DT_PROB(RAD_MOB_VOMIT_PROB, delta_time))
source.vomit(10, TRUE)
if(time_since_irradiated > RAD_MOB_MUTATE && DT_PROB(RAD_MOB_MUTATE_PROB, delta_time))
to_chat(source, span_danger("You mutate!"))
source.easy_random_mutate(NEGATIVE + MINOR_NEGATIVE)
source.emote("gasp")
source.domutcheck()
if(time_since_irradiated > RAD_MOB_HAIRLOSS && DT_PROB(RAD_MOB_HAIRLOSS_PROB, delta_time))
if(source.has_hair(TRUE))
to_chat(source, span_danger("Your hair starts to fall out in clumps..."))
addtimer(CALLBACK(src, PROC_REF(go_bald), source), 5 SECONDS)
/**
* Makes the target human bald.
*
* Arguments:
* - [target][/mob/living/carbon/human]: The mob to make go bald.
*/
/datum/species/proc/go_bald(mob/living/carbon/human/target)
if(QDELETED(target)) //may be called from a timer
return
target.facial_hairstyle = "Shaved"
target.hairstyle = "Bald"
target.update_body_parts()
//////////////////
// ATTACK PROCS //
//////////////////
/datum/species/proc/spec_updatehealth(mob/living/carbon/human/H)
return
/datum/species/proc/spec_fully_heal(mob/living/carbon/human/H)
return
/datum/species/proc/help(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style)
target.add_fingerprint_on_clothing_or_self(user, BODY_ZONE_CHEST)
if(target.body_position == STANDING_UP || (target.health >= 0 && !(HAS_TRAIT(target, TRAIT_FAKEDEATH) || target.undergoing_cardiac_arrest())))
target.help_shake_act(user)
if(target != user)
log_combat(user, target, "shaken")
return TRUE
user.do_cpr(target)
/datum/species/proc/grab(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style, list/params)
if(attacker_style?.grab_act(user,target) == MARTIAL_ATTACK_SUCCESS)
return TRUE
else
user.try_make_grab(target, use_offhand = params?[RIGHT_CLICK])
return TRUE
///This proc handles punching damage.
/datum/species/proc/harm(mob/living/carbon/human/user, mob/living/carbon/human/target, datum/martial_art/attacker_style)
// Pacifists can't harm.
if(HAS_TRAIT(user, TRAIT_PACIFISM))
to_chat(user, span_warning("You don't want to harm [target]!"))
return FALSE