Skip to content

Commit

Permalink
Merge pull request Civ13#2915 from HaultyAnonie/random_skin_tone
Browse files Browse the repository at this point in the history
Mobs.dm clean-up; (procs)
  • Loading branch information
savethetreez authored May 31, 2024
2 parents 7f38220 + d380dda commit 57f7ee5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 47 deletions.
2 changes: 1 addition & 1 deletion code/__defines/math_physics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define RADIATOR_EXPOSED_SURFACE_AREA_RATIO 0.04 // (3 cm + 100 cm * sin(3deg))/(2*(3+100 cm)). Unitless ratio.
#define HUMAN_EXPOSED_SURFACE_AREA 5.2 //m^2, surface area of 1.7m (H) x 0.46m (D) cylinder

#define Clamp(x, y, z) (x <= y ? y : (x >= z ? z : x))
#define Clamp(x, y, z) (x <= y ? y : (x >= z ? z : x)) // Ensures that a value (x) is within a specified range (y to z). If x is less than y, it returns y; if x is greater than z, it returns z; otherwise, it returns x. This effectively clamps the value of x within the range specified by y and z.
#define CLAMP01(x) max(0, min(1, x))
#define CLAMP0100(x) max(0, min(100, x))

Expand Down
90 changes: 44 additions & 46 deletions code/_helpers/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -417,65 +417,63 @@ proc/random_afrikaans_name(gender, species = "Human")
return current_species.get_random_afrikaans_name(gender)

proc/random_skin_tone()

var/skin_tone = "caucasian"
if (prob(60))
pass()
else if (prob(15))
skin_tone = "mulatto"
else if (prob(10))
skin_tone = "african"
else if (prob(10))
skin_tone = "latino"

switch(skin_tone)
if ("caucasian") . = -10
if ("mulatto") . = -115
if ("african") . = -165
if ("latino") . = -55
else . = rand(-185,34)
switch(pick(60;"caucasian", 15;"afroamerican", 10;"african", 10;"latino", 5;"albino"))
if("caucasian") . = -10
if("afroamerican") . = -115
if("african") . = -165
if("latino") . = -55
if("albino") . = 34
else . = rand(-185,34)
return min(max( .+rand(-25, 25), -185),34)

proc/skintone2racedescription(tone)
switch (tone)
if(!isnum(tone))
CRASH("skintone2racedescription; proc called without correct tone (integer) argument.")

switch(tone)
if (30 to INFINITY) return "albino"
if (20 to 30) return "pale"
if (5 to 15) return "light skinned"
if (-10 to 5) return "white"
if (-25 to -10) return "tan"
if (-45 to -25) return "darker skinned"
if (-65 to -45) return "brown"
if (-INFINITY to -65) return "black"
else return "unknown"
if (20 to 29) return "pale"
if (5 to 19) return "light skinned"
if (-10 to 4) return "white"
if (-25 to -9) return "tan"
if (-45 to -24) return "darker skinned"
if (-65 to -44) return "brown"
if (-INFINITY to -64) return "black"
else return "unknown"

proc/age2agedescription(age)
if(!isnum(age))
CRASH("age2agedescription; proc called without correct age (integer) argument.")

switch(age)
if (0 to 1) return "infant"
if (1 to 3) return "toddler"
if (3 to 13) return "child"
if (13 to 19) return "teenager"
if (19 to 30) return "young adult"
if (30 to 45) return "adult"
if (45 to 60) return "middle-aged"
if (60 to 70) return "aging"
if (70 to INFINITY) return "elderly"
if (2 to 3) return "toddler"
if (4 to 12) return "child"
if (13 to 17) return "teenager"
if (18 to 29) return "young adult"
if (30 to 44) return "adult"
if (45 to 59) return "middle-aged"
if (60 to 69) return "aging"
if (70 to INFINITY) return "elderly"
else return "unknown"

proc/ageAndGender2Desc(age, gender)//Used for the radio
if (gender == FEMALE)
proc/ageAndGender2Desc(age, gender) // Radio name getters.
if (!gender || !isnum(age))
CRASH("ageAndGender2Desc; proc called without age/gender argument.")

if (gender == MALE)
switch(age)
if (0 to 15) return "Girl"
if (15 to 25) return "Young Woman"
if (25 to 60) return "Woman"
if (60 to INFINITY) return "Old Woman"
else return "Unknown"
if (0 to 15) return "Boy"
if (16 to 25) return "Young Man"
if (26 to 60) return "Man"
if (61 to INFINITY) return "Old Man"
else
switch(age)
if (0 to 15) return "Boy"
if (15 to 25) return "Young Man"
if (25 to 60) return "Man"
if (60 to INFINITY) return "Old Man"
else return "Unknown"
if (0 to 15) return "Girl"
if (16 to 25) return "Young Woman"
if (26 to 60) return "Woman"
if (61 to INFINITY) return "Old Woman"
return "Unknown"

proc/get_body_build(gender, body_build = "Default")
if (gender == MALE)
Expand Down

0 comments on commit 57f7ee5

Please sign in to comment.