Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e7731fd

Browse filesBrowse files
authored
Refactors species gender code, allows IPCs to be referred to as objects (yogstation13#21910)
* install gender malware * Update data.ts * L * Update create_mob.dm
1 parent 1a2b875 commit e7731fd
Copy full SHA for e7731fd

28 files changed

+147-128Lines changed: 147 additions & 128 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎code/__DEFINES/DNA.dm‎

Copy file name to clipboardExpand all lines: code/__DEFINES/DNA.dm
+9-11Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,20 @@
169169
#define NOFLASH 17
170170
/// Use this if you want to change the race's color without the player being able to pick their own color. AKA special color shifting
171171
#define DYNCOLORS 18
172-
/// Forced genders
173-
#define AGENDER 19
174-
#define FGENDER 20
175-
#define MGENDER 21
176172
/// Do not draw eyes or eyeless overlay
177-
#define NOEYESPRITES 22
173+
#define NOEYESPRITES 19
178174
/// Used for determining which wounds are applicable to this species.
179175
/// if we have flesh (can suffer slash/piercing/burn wounds, requires they don't have NOBLOOD)
180-
#define HAS_FLESH 23
176+
#define HAS_FLESH 20
181177
/// if we have bones (can suffer bone wounds)
182-
#define HAS_BONE 24
178+
#define HAS_BONE 21
183179
/// Can't be husked.
184-
#define NOHUSK 25
180+
#define NOHUSK 22
185181
/// have no mouth to ingest/eat with
186-
#define NOMOUTH 26
182+
#define NOMOUTH 23
187183
/// has a tail
188-
#define HAS_TAIL 27
189-
#define NONANITES 28
184+
#define HAS_TAIL 24
185+
#define NONANITES 25
190186

191187
//organ slots
192188
#define ORGAN_SLOT_BRAIN "brain"
@@ -228,9 +224,11 @@
228224
#define CHROMOSOME_NONE 1
229225
#define CHROMOSOME_USED 2
230226

227+
#define GENDERS 4
231228
#define G_MALE 1
232229
#define G_FEMALE 2
233230
#define G_PLURAL 3
231+
#define G_NEUTER 4
234232

235233
// Defines for used in creating "perks" for the species preference pages.
236234
/// A key that designates UI icon displayed on the perk.
Collapse file

‎code/datums/dna.dm‎

Copy file name to clipboardExpand all lines: code/datums/dna.dm
+13-7Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
161161

162162
switch(holder.gender)
163163
if(MALE)
164-
L[DNA_GENDER_BLOCK] = construct_block(G_MALE, 3)
164+
L[DNA_GENDER_BLOCK] = construct_block(G_MALE, GENDERS)
165165
if(FEMALE)
166-
L[DNA_GENDER_BLOCK] = construct_block(G_FEMALE, 3)
166+
L[DNA_GENDER_BLOCK] = construct_block(G_FEMALE, GENDERS)
167+
if(NEUTER)
168+
L[DNA_GENDER_BLOCK] = construct_block(G_NEUTER, GENDERS)
167169
else
168-
L[DNA_GENDER_BLOCK] = construct_block(G_PLURAL, 3)
170+
L[DNA_GENDER_BLOCK] = construct_block(G_PLURAL, GENDERS)
169171
if(ishuman(holder))
170172
var/mob/living/carbon/human/H = holder
171173
if(!GLOB.hair_styles_list.len)
@@ -326,11 +328,13 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
326328
if(DNA_GENDER_BLOCK)
327329
switch(H.gender)
328330
if(MALE)
329-
set_uni_identity_block(blocknumber, construct_block(G_MALE, 3))
331+
set_uni_identity_block(blocknumber, construct_block(G_MALE, GENDERS))
330332
if(FEMALE)
331-
set_uni_identity_block(blocknumber, construct_block(G_FEMALE, 3))
333+
set_uni_identity_block(blocknumber, construct_block(G_FEMALE, GENDERS))
334+
if(NEUTER)
335+
set_uni_identity_block(blocknumber, construct_block(G_NEUTER, GENDERS))
332336
else
333-
set_uni_identity_block(blocknumber, construct_block(G_PLURAL, 3))
337+
set_uni_identity_block(blocknumber, construct_block(G_PLURAL, GENDERS))
334338
if(DNA_FACIAL_HAIR_STYLE_BLOCK)
335339
set_uni_identity_block(blocknumber, construct_block(GLOB.facial_hair_styles_list.Find(H.facial_hair_style), GLOB.facial_hair_styles_list.len))
336340
if(DNA_HAIR_STYLE_BLOCK)
@@ -573,11 +577,13 @@ GLOBAL_LIST_INIT(total_uf_len_by_block, populate_total_uf_len_by_block())
573577
if(!has_dna())
574578
return
575579

576-
switch(deconstruct_block(get_uni_identity_block(dna.unique_identity, DNA_GENDER_BLOCK), 3))
580+
switch(deconstruct_block(get_uni_identity_block(dna.unique_identity, DNA_GENDER_BLOCK), GENDERS))
577581
if(G_MALE)
578582
gender = MALE
579583
if(G_FEMALE)
580584
gender = FEMALE
585+
if(G_NEUTER)
586+
gender = NEUTER
581587
else
582588
gender = PLURAL
583589

Collapse file

‎code/game/machinery/cloning.dm‎

Copy file name to clipboardExpand all lines: code/game/machinery/cloning.dm
+8-7Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,14 @@ GLOBAL_VAR_INIT(clones, 0)
242242
var/mob/M = H.easy_random_mutate(NEGATIVE+MINOR_NEGATIVE)
243243
if(ismob(M))
244244
H = M
245-
if((AGENDER || MGENDER || FGENDER) in H.dna.species.species_traits)
246-
if((FGENDER in H.dna.species.species_traits) && (H.gender != FEMALE))
247-
H.gender = FEMALE
248-
if((MGENDER in H.dna.species.species_traits) && (H.gender != MALE))
249-
H.gender = MALE
250-
if((AGENDER in H.dna.species.species_traits) && (H.gender != PLURAL))
251-
H.gender = PLURAL
245+
246+
var/list/possible_genders = H.dna.species.possible_genders
247+
if(!possible_genders || possible_genders.len < 1)
248+
stack_trace("[H.dna.species.type] has no possible genders!")
249+
H.gender = PLURAL // uh oh
250+
else if(possible_genders.len == 1)
251+
H.gender = possible_genders[1] // some species only have one gender
252+
252253
if(!H.GetComponent(/datum/component/mood) && mood)
253254
H.AddComponent(/datum/component/mood)
254255

Collapse file

‎code/game/objects/structures/mirror.dm‎

Copy file name to clipboardExpand all lines: code/game/objects/structures/mirror.dm
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@
180180
. += list(RACE = list("select a new race", choosable_races))
181181
. += list(GENDER = list("Select a new gender", list()))
182182
var/datum/species/S = H.dna.species
183-
if(!(AGENDER in S.species_traits) || !(FGENDER in S.species_traits) || !(MGENDER in S.species_traits))
184-
.[GENDER][2] = list(MALE, FEMALE)
183+
if(S.possible_genders.len > 1)
184+
.[GENDER][2] = S.possible_genders
185185
if(!(NOEYESPRITES in S.species_traits))
186186
. += list(EYE_COLOR)
187187
if(S.use_skintones)
@@ -249,12 +249,8 @@
249249
if(RACE)
250250
var/newrace = GLOB.species_list[selection]
251251
H.set_species(newrace, icon_update=0)
252-
if(FGENDER in S.species_traits)
253-
H.gender = FEMALE
254-
if(MGENDER in S.species_traits)
255-
H.gender = MALE
256-
if(AGENDER in S.species_traits)
257-
H.gender = PLURAL
252+
if(S.possible_genders.len < 2)
253+
H.gender = S.possible_genders[1]
258254
return TRUE
259255
if(SKIN_COLOR)
260256
H.skin_tone = selection
Collapse file

‎code/modules/admin/create_mob.dm‎

Copy file name to clipboardExpand all lines: code/modules/admin/create_mob.dm
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
user << browse(create_panel_helper(create_mob_html), "window=create_mob;size=425x475")
1212

1313
/proc/randomize_human(mob/living/carbon/human/human)
14-
human.gender = pick(MALE, FEMALE)
14+
human.gender = human.dna ? pick(human.dna.species.possible_genders) : pick(MALE, FEMALE, PLURAL, NEUTER)
1515
human.real_name = human.dna?.species.random_name(human.gender) || random_unique_name(human.gender)
1616
human.name = human.real_name
1717
human.underwear = random_underwear(human.gender)
Collapse file

‎code/modules/client/preferences/gender.dm‎

Copy file name to clipboardExpand all lines: code/modules/client/preferences/gender.dm
+11-19Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,23 @@
55
priority = PREFERENCE_PRIORITY_GENDER
66

77
/datum/preference/choiced/gender/init_possible_values()
8-
return list(MALE, FEMALE, PLURAL)
8+
return list(MALE, FEMALE, PLURAL, NEUTER)
99

1010
/datum/preference/choiced/gender/create_informed_default_value(datum/preferences/preferences)
1111

1212
var/datum/species/species_type = preferences.read_preference(/datum/preference/choiced/species)
13-
14-
if(!initial(species_type.sexes) || (AGENDER in initial(species_type.species_traits)))
15-
return PLURAL
16-
else if(FGENDER in initial(species_type.species_traits))
17-
return FEMALE
18-
else if(MGENDER in initial(species_type.species_traits))
19-
return MALE
2013

21-
return pick(list(MALE, FEMALE, PLURAL))
14+
var/list/possible_genders = initial(species_type.possible_genders)
15+
if(possible_genders.len < 1)
16+
stack_trace("[species_type.type] has no possible genders!")
17+
return list(PLURAL)
18+
19+
return pick(possible_genders)
2220

2321
/datum/preference/choiced/gender/apply_to_human(mob/living/carbon/human/target, value)
2422
var/datum/species/S = target.dna.species
2523

26-
if(!S.sexes || (AGENDER in S.species_traits))
27-
value = PLURAL //disregard gender preferences on this species
28-
29-
if(S)
30-
if(FGENDER in S.species_traits)
31-
value = FEMALE
32-
else if(MGENDER in S.species_traits)
33-
value = MALE
34-
35-
target.gender = value
24+
if(!(value in S.possible_genders))
25+
target.gender = pick(S.possible_genders)
26+
else
27+
target.gender = value
Collapse file

‎code/modules/client/preferences/species.dm‎

Copy file name to clipboardExpand all lines: code/modules/client/preferences/species.dm
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
data[species_id]["lore"] = species.get_species_lore()
4343
data[species_id]["icon"] = sanitize_css_class_name(species.name)
4444
data[species_id]["use_skintones"] = species.use_skintones
45-
data[species_id]["sexes"] = species.sexes && !((FGENDER in species.species_traits) || (MGENDER in species.species_traits) || (AGENDER in species.species_traits))
45+
data[species_id]["possible_genders"] = species.possible_genders
4646
data[species_id]["enabled_features"] = species.get_features()
4747
data[species_id]["perks"] = species.get_species_perks()
4848
data[species_id]["diet"] = species.get_species_diet()
Collapse file

‎code/modules/mob/living/carbon/human/species.dm‎

Copy file name to clipboardExpand all lines: code/modules/mob/living/carbon/human/species.dm
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ GLOBAL_LIST_EMPTY(features_by_species)
1818
var/plural_form
1919
/// if alien colors are disabled, this is the color that will be used by that race
2020
var/default_color = "#FFF"
21-
/// whether or not the race has sexual characteristics. at the moment this is only FALSE for skeletons and shadows
22-
var/sexes = TRUE
2321

2422
///A list that contains pixel offsets for various clothing features, if your species is a different shape
2523
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))
@@ -38,6 +36,8 @@ GLOBAL_LIST_EMPTY(features_by_species)
3836

3937
var/forced_skintone
4038

39+
/// What genders can this race be?
40+
var/list/possible_genders = list(MALE, PLURAL, FEMALE)
4141
/// If your race wants to bleed something other than bog standard blood, change this to reagent id.
4242
var/datum/reagent/exotic_blood
4343
///If your race uses a non standard bloodtype (A+, O-, AB-, etc)
@@ -432,13 +432,15 @@ GLOBAL_LIST_EMPTY(features_by_species)
432432
replacement.Insert(C, TRUE, FALSE)
433433

434434
/datum/species/proc/on_species_gain(mob/living/carbon/C, datum/species/old_species, pref_load)
435+
// Change the gender to fit with the new species
436+
if(!possible_genders || possible_genders.len < 1)
437+
stack_trace("[type] has no possible genders!")
438+
C.gender = PLURAL // uh oh
439+
else if(possible_genders.len == 1)
440+
C.gender = possible_genders[1] // some species only have one gender
441+
else if(!(C.gender in possible_genders))
442+
C.gender = pick(possible_genders) // randomized gender
435443
// Drop the items the new species can't wear
436-
if((AGENDER in species_traits))
437-
C.gender = PLURAL
438-
if((FGENDER in species_traits))
439-
C.gender = FEMALE
440-
if((MGENDER in species_traits))
441-
C.gender = MALE
442444
extra_no_equip = old_species.extra_no_equip.Copy()
443445
for(var/slot_id in no_equip)
444446
var/obj/item/thing = C.get_item_by_slot(slot_id)
@@ -801,7 +803,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
801803
if(undershirt)
802804
if(HAS_TRAIT(H, TRAIT_SKINNY)) //Check for skinny first
803805
standing += wear_skinny_version(undershirt.icon_state, undershirt.icon, BODY_LAYER)
804-
else if(H.dna.species.sexes && H.gender == FEMALE)
806+
else if(H.gender == FEMALE && (FEMALE in possible_genders))
805807
standing += wear_female_version(undershirt.icon_state, undershirt.icon, BODY_LAYER)
806808
else
807809
standing += mutable_appearance(undershirt.icon, undershirt.icon_state, -BODY_LAYER)
Collapse file

‎code/modules/mob/living/carbon/human/species_types/IPC.dm‎

Copy file name to clipboardExpand all lines: code/modules/mob/living/carbon/human/species_types/IPC.dm
+11-4Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
id = "ipc"
66
say_mod = "states" //inherited from a user's real species
77
bubble_icon = BUBBLE_ROBOT // beep boop
8-
sexes = FALSE
9-
species_traits = list(NOTRANSSTING,NOEYESPRITES,NO_DNA_COPY,NOZOMBIE,MUTCOLORS,NOHUSK,AGENDER,NOBLOOD,NO_UNDERWEAR)
8+
possible_genders = list(PLURAL, NEUTER) // A MERE OBJECT
9+
species_traits = list(NOTRANSSTING,NOEYESPRITES,NO_DNA_COPY,NOZOMBIE,MUTCOLORS,NOHUSK,NOBLOOD,NO_UNDERWEAR)
1010
inherent_traits = list(TRAIT_RESISTCOLD,TRAIT_RADIMMUNE,TRAIT_NOBREATH,TRAIT_LIMBATTACHMENT,TRAIT_EASYDISMEMBER,TRAIT_NOCRITDAMAGE,TRAIT_GENELESS,TRAIT_MEDICALIGNORE,TRAIT_NOCLONE,TRAIT_TOXIMMUNE,TRAIT_EASILY_WOUNDED,TRAIT_NODEFIB,TRAIT_POWERHUNGRY)
1111
inherent_biotypes = MOB_ROBOTIC|MOB_HUMANOID
1212
mutantbrain = /obj/item/organ/brain/positron
@@ -390,8 +390,10 @@ ipc martial arts stuff
390390
var/list/initial_mutant_bodyparts
391391
var/list/initial_step_sounds
392392
var/list/initial_walk_sounds
393+
var/list/initial_genders
393394
var/list/blacklisted_species = list(/datum/species/ethereal, /datum/species/moth)//species that really don't work with this system (lizards aren't quite right either, but whatever)
394395
var/list/old_features
396+
var/old_gender
395397
var/ipc_color
396398
var/disguised = FALSE
397399

@@ -401,6 +403,7 @@ ipc martial arts stuff
401403
initial_mutant_bodyparts = LAZYCOPY(mutant_bodyparts)
402404
initial_step_sounds = LAZYCOPY(special_step_sounds)
403405
initial_walk_sounds = LAZYCOPY(special_walk_sounds)
406+
initial_genders = LAZYCOPY(possible_genders)
404407
ipc_color = sanitize_hexcolor("[pick("7F", "FF")][pick("7F", "FF")][pick("7F", "FF")]")
405408

406409
fake_species = new /datum/species/human() //default is human
@@ -430,7 +433,10 @@ ipc martial arts stuff
430433
disguised = TRUE
431434
name = fake_species.name
432435
say_mod = fake_species.say_mod
433-
sexes = fake_species.sexes
436+
old_gender = H.gender
437+
possible_genders = fake_species.possible_genders
438+
if(!(H.gender in fake_species.possible_genders))
439+
H.gender = pick(fake_species.possible_genders)
434440
species_traits = LAZYCOPY(initial_species_traits)
435441
inherent_traits = LAZYCOPY(initial_inherent_traits)
436442
mutant_bodyparts = LAZYCOPY(fake_species.mutant_bodyparts)
@@ -461,7 +467,8 @@ ipc martial arts stuff
461467
disguised = FALSE
462468
name = initial(name)
463469
say_mod = initial(say_mod)
464-
sexes = initial(sexes)
470+
H.gender = old_gender
471+
possible_genders = LAZYCOPY(initial_genders)
465472
species_traits = LAZYCOPY(initial_species_traits)
466473
inherent_traits = LAZYCOPY(initial_inherent_traits)
467474
mutant_bodyparts = LAZYCOPY(initial_mutant_bodyparts)
Collapse file

‎code/modules/mob/living/carbon/human/species_types/abductors.dm‎

Copy file name to clipboardExpand all lines: code/modules/mob/living/carbon/human/species_types/abductors.dm
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "Abductor"
33
id = "abductor"
44
say_mod = "gibbers"
5-
sexes = FALSE
5+
possible_genders = list(PLURAL)
66
species_traits = list(NOBLOOD,NOEYESPRITES)
77
inherent_traits = list(TRAIT_VIRUSIMMUNE,TRAIT_NOGUNS,TRAIT_NOHUNGER,TRAIT_NOBREATH,TRAIT_RADIMMUNE,TRAIT_GENELESS)
88
mutanttongue = /obj/item/organ/tongue/abductor

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.