Skip to content

Commit 32c9d4d

Browse files
Slime People and IPC; Imitating Species Cosmetically. (ParadiseSS13#27359)
* Pain * More transparency / alpha * Vulp + Name override * more transparency alpha stuff * Reworks species subtype for slimepeople * Iteration 3... * Me when initial * 60 - 61 * Character.dm select query changes. * 61-62 * The real 61-62 * Update to IPC imitation * +63-64.sql > species_subtype after pda_ringtone IPC identity configuration surgery. Slime "Morph" action: 10 seconds. Allows a slime person to change how they look. > Same cost as regenerating a limb. Link processing subspecies implement. * Pain2 * SQL * Frankenstein monster fix * Slimify! ...no longer applies to robotic limbs. * 220 Alpha to 200 * Ordering issue fix. * Last ordering issue. * aa review, paradise_schema.sql * Apply suggestions from code review Co-authored-by: AffectedArc07 <[email protected]> Signed-off-by: Spaghetti-bit <[email protected]> --------- Signed-off-by: Spaghetti-bit <[email protected]> Co-authored-by: AffectedArc07 <[email protected]>
1 parent 59377ad commit 32c9d4d

File tree

28 files changed

+670
-429
lines changed

28 files changed

+670
-429
lines changed

SQL/paradise_schema.sql

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ CREATE TABLE `characters` (
8383
`runechat_color` VARCHAR(7) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '#FFFFFF',
8484
`cyborg_brain_type` ENUM('MMI', 'Robobrain', 'Positronic') NOT NULL DEFAULT 'MMI',
8585
`pda_ringtone` VARCHAR(16) NULL DEFAULT NULL COLLATE 'utf8mb3_general_ci',
86+
`species_subtype` VARCHAR(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'None',
8687
PRIMARY KEY (`id`),
8788
KEY `ckey` (`ckey`)
8889
) ENGINE=InnoDB AUTO_INCREMENT=125467 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

SQL/updates/63-64.sql

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Updates the DB from 63 to 64 ~SpaghettiBit
2+
# Adds a subtype race to be stored on character saves
3+
# Add species_subtype after pda_ringtone
4+
ALTER TABLE `characters`
5+
ADD COLUMN `species_subtype` VARCHAR(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'None' AFTER `pda_ringtone`;

code/__DEFINES/flags.dm

+4-3
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@
110110
#define HAS_ALT_HEADS (1<<11)
111111
#define HAS_WING (1<<12)
112112
#define HAS_BODYACC_COLOR (1<<13)
113-
#define BALD (1<<14)
114-
#define ALL_RPARTS (1<<15)
115-
#define SHAVED (1<<16)
113+
#define HAS_SPECIES_SUBTYPE (1<<14)
114+
#define BALD (1<<15)
115+
#define ALL_RPARTS (1<<16)
116+
#define SHAVED (1<<17)
116117

117118
//Pre-baked combinations of the above body flags
118119
#define HAS_BODY_ACCESSORY (HAS_TAIL | HAS_WING)

code/__DEFINES/misc_defines.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@
431431
#define INVESTIGATE_HOTMIC "hotmic"
432432

433433
// The SQL version required by this version of the code
434-
#define SQL_VERSION 63
434+
#define SQL_VERSION 64
435435

436436
// Vending machine stuff
437437
#define CAT_NORMAL (1<<0)

code/datums/diseases/advance/symptoms/hair.dm

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ BONUS
3737
switch(A.stage)
3838
if(1, 2, 3)
3939
to_chat(H, "<span class='warning'>Your scalp itches.</span>")
40-
head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.name)
40+
head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.sprite_sheet_name)
4141
else
4242
to_chat(H, "<span class='warning'>Hair bursts forth from your scalp!</span>")
4343
var/datum/sprite_accessory/tmp_hair_style = GLOB.hair_styles_full_list["Very Long Hair"]
4444

45-
if(head_organ.dna.species.name in tmp_hair_style.species_allowed) //If 'Very Long Hair' is a style the person's species can have, give it to them.
45+
if(head_organ.dna.species.sprite_sheet_name in tmp_hair_style.species_allowed) //If 'Very Long Hair' is a style the person's species can have, give it to them.
4646
head_organ.h_style = "Very Long Hair"
4747
else //Otherwise, give them a random hair style.
48-
head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.name)
48+
head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.sprite_sheet_name)
4949
H.update_hair()

code/game/dna/dna2_helpers.dm

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
var/list/available = list()
242242
for(var/head_accessory in GLOB.head_accessory_styles_list)
243243
var/datum/sprite_accessory/S = GLOB.head_accessory_styles_list[head_accessory]
244-
if(!(head_organ.dna.species.name in S.species_allowed)) //If the user's head is not of a species the head accessory style allows, skip it. Otherwise, add it to the list.
244+
if(!(head_organ.dna.species.sprite_sheet_name in S.species_allowed)) //If the user's head is not of a species the head accessory style allows, skip it. Otherwise, add it to the list.
245245
continue
246246
available += head_accessory
247247
var/list/sorted = sortTim(available, GLOBAL_PROC_REF(cmp_text_asc))

code/game/gamemodes/miniantags/tourist/tourist_arrivals.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@
118118
head_organ.sec_hair_colour = hair_c
119119
M.change_eye_color(eye_c)
120120
M.s_tone = skin_tone
121-
head_organ.h_style = random_hair_style(M.gender, head_organ.dna.species.name)
122-
head_organ.f_style = random_facial_hair_style(M.gender, head_organ.dna.species.name)
121+
head_organ.h_style = random_hair_style(M.gender, head_organ.dna.species.sprite_sheet_name)
122+
head_organ.f_style = random_facial_hair_style(M.gender, head_organ.dna.species.sprite_sheet_name)
123123

124124
M.regenerate_icons()
125125
M.update_body()

code/game/objects/structures/dresser.dm

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
var/list/valid_underwear = list()
2222
for(var/underwear in GLOB.underwear_list)
2323
var/datum/sprite_accessory/S = GLOB.underwear_list[underwear]
24-
if(!(H.dna.species.name in S.species_allowed))
24+
if(!(H.dna.species.sprite_sheet_name in S.species_allowed))
2525
continue
2626
valid_underwear[underwear] = GLOB.underwear_list[underwear]
2727
var/new_underwear = tgui_input_list(user, "Choose your underwear:", "Changing", valid_underwear)
@@ -32,7 +32,7 @@
3232
var/list/valid_undershirts = list()
3333
for(var/undershirt in GLOB.undershirt_list)
3434
var/datum/sprite_accessory/S = GLOB.undershirt_list[undershirt]
35-
if(!(H.dna.species.name in S.species_allowed))
35+
if(!(H.dna.species.sprite_sheet_name in S.species_allowed))
3636
continue
3737
valid_undershirts[undershirt] = GLOB.undershirt_list[undershirt]
3838
var/new_undershirt = tgui_input_list(user, "Choose your undershirt:", "Changing", valid_undershirts)
@@ -43,7 +43,7 @@
4343
var/list/valid_sockstyles = list()
4444
for(var/sockstyle in GLOB.socks_list)
4545
var/datum/sprite_accessory/S = GLOB.socks_list[sockstyle]
46-
if(!(H.dna.species.name in S.species_allowed))
46+
if(!(H.dna.species.sprite_sheet_name in S.species_allowed))
4747
continue
4848
valid_sockstyles[sockstyle] = GLOB.socks_list[sockstyle]
4949
var/new_socks = tgui_input_list(user, "Choose your socks:", "Changing", valid_sockstyles)

code/modules/awaymissions/mob_spawn.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@
247247
if(hair_style)
248248
D.h_style = hair_style
249249
else
250-
D.h_style = random_hair_style(gender, D.dna.species.name)
250+
D.h_style = random_hair_style(gender, D.dna.species.sprite_sheet_name)
251251
D.hair_colour = rand_hex_color()
252252
if(facial_hair_style)
253253
D.f_style = facial_hair_style
254254
else
255-
D.f_style = random_facial_hair_style(gender, D.dna.species.name)
255+
D.f_style = random_facial_hair_style(gender, D.dna.species.sprite_sheet_name)
256256
D.facial_colour = rand_hex_color()
257257
if(skin_tone)
258258
H.s_tone = skin_tone

code/modules/client/login_processing/20-load_characters.dm

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
height,
6565
cyborg_brain_type,
6666
body_type,
67-
pda_ringtone
67+
pda_ringtone,
68+
species_subtype
6869
FROM characters WHERE ckey=:ckey"}, list(
6970
"ckey" = C.ckey
7071
))

code/modules/client/preference/character.dm

+60-36
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
var/e_colour = "#000000" //Eye color
3838
var/alt_head = "None" //Alt head style.
3939
var/species = "Human"
40+
/// Used for DNA species to allow select species to imitate / morph into different species.
41+
var/species_subtype = "None"
4042
var/language = "None" //Secondary language
4143
var/autohiss_mode = AUTOHISS_OFF //Species autohiss level. OFF, BASIC, FULL.
4244
/// If a spawned cyborg should have an MMI, a positronic, or a robobrain. MMI by default
@@ -202,7 +204,8 @@
202204
runechat_color=:runechat_color,
203205
cyborg_brain_type=:cyborg_brain_type,
204206
body_type=:body_type,
205-
pda_ringtone=:pda_ringtone
207+
pda_ringtone=:pda_ringtone,
208+
species_subtype=:species_subtype
206209
WHERE ckey=:ckey
207210
AND slot=:slot"}, list(
208211
// OH GOD SO MANY PARAMETERS
@@ -266,6 +269,7 @@
266269
"runechat_color" = runechat_color,
267270
"cyborg_brain_type" = cyborg_brain_type,
268271
"pda_ringtone" = pda_ringtone,
272+
"species_subtype" = species_subtype,
269273
"ckey" = C.ckey,
270274
"slot" = slot_number
271275
))
@@ -306,7 +310,7 @@
306310
player_alt_titles,
307311
disabilities, organ_data, rlimb_data, nanotrasen_relation, physique, height, speciesprefs,
308312
socks, body_accessory, gear, autohiss,
309-
hair_gradient, hair_gradient_offset, hair_gradient_colour, hair_gradient_alpha, custom_emotes, runechat_color, cyborg_brain_type, body_type, pda_ringtone)
313+
hair_gradient, hair_gradient_offset, hair_gradient_colour, hair_gradient_alpha, custom_emotes, runechat_color, cyborg_brain_type, body_type, pda_ringtone, species_subtype)
310314
VALUES
311315
(:ckey, :slot, :metadata, :name, :be_random_name, :gender,
312316
:age, :species, :language,
@@ -333,7 +337,7 @@
333337
:playertitlelist,
334338
:disabilities, :organ_list, :rlimb_list, :nanotrasen_relation, :physique, :height, :speciesprefs,
335339
:socks, :body_accessory, :gearlist, :autohiss_mode,
336-
:h_grad_style, :h_grad_offset, :h_grad_colour, :h_grad_alpha, :custom_emotes, :runechat_color, :cyborg_brain_type, :body_type, :pda_ringtone)
340+
:h_grad_style, :h_grad_offset, :h_grad_colour, :h_grad_alpha, :custom_emotes, :runechat_color, :cyborg_brain_type, :body_type, :pda_ringtone, :species_subtype)
337341
"}, list(
338342
// This has too many params for anyone to look at this without going insae
339343
"ckey" = C.ckey,
@@ -397,7 +401,8 @@
397401
"custom_emotes" = json_encode(custom_emotes),
398402
"runechat_color" = runechat_color,
399403
"cyborg_brain_type" = cyborg_brain_type,
400-
"pda_ringtone" = pda_ringtone
404+
"pda_ringtone" = pda_ringtone,
405+
"species_subtype" = species_subtype
401406
))
402407

403408
if(!query.warn_execute())
@@ -422,7 +427,6 @@
422427
age = text2num(query.item[5])
423428
species = query.item[6]
424429
language = query.item[7]
425-
426430
h_colour = query.item[8]
427431
h_sec_colour = query.item[9]
428432
f_colour = query.item[10]
@@ -493,7 +497,7 @@
493497
cyborg_brain_type = query.item[59]
494498
body_type = query.item[60]
495499
pda_ringtone = query.item[61]
496-
500+
species_subtype = query.item[62]
497501
//Sanitize
498502
var/datum/species/SP = GLOB.all_species[species]
499503
if(!SP)
@@ -507,6 +511,9 @@
507511
species = "Human"
508512
stack_trace("Character doesn't have a species, character name is [real_name]. Defaulting to human.")
509513

514+
if(isnull(species_subtype))
515+
species_subtype = "None"
516+
510517
if(isnull(language))
511518
language = "None"
512519

@@ -830,53 +837,65 @@
830837
//Icon-based species colour.
831838
var/coloured_tail
832839
if(current_species)
833-
if(current_species.bodyflags & HAS_ICON_SKIN_TONE) //Handling species-specific icon-based skin tones by flagged race.
834-
var/mob/living/carbon/human/fake/H = new
835-
H.dna.species = current_species
840+
var/mob/living/carbon/human/fake/H = new
841+
H.dna.species = current_species
842+
if(species_subtype != "None" && current_species.bodyflags & HAS_SPECIES_SUBTYPE)
843+
var/datum/species/subtype_species = GLOB.all_species[species_subtype]
844+
if(subtype_species) // Take certain attributes from our subtype to apply to our current species.
845+
H.dna.species.updatespeciessubtype(H, subtype_species)
846+
current_species = H.dna.species
847+
else if(current_species.bodyflags & HAS_ICON_SKIN_TONE) //Handling species-specific icon-based skin tones by flagged race.
836848
H.s_tone = s_tone
837849
H.dna.species.updatespeciescolor(H, 0) //The mob's species wasn't set, so it's almost certainly different than the character's species at the moment. Thus, we need to be owner-insensitive.
838-
var/obj/item/organ/external/chest/C = H.get_organ("chest")
839-
icobase = C.icobase ? C.icobase : C.dna.species.icobase
840850
if(H.dna.species.bodyflags & HAS_TAIL)
841851
coloured_tail = H.tail ? H.tail : H.dna.species.tail
842-
843-
qdel(H)
844-
else
845-
icobase = current_species.icobase
852+
icobase = current_species.icobase
853+
qdel(H)
846854
else
847855
icobase = 'icons/mob/human_races/r_human.dmi'
848856

849857
preview_icon = new /icon(icobase, "torso_[g]")
850858
preview_icon.Blend(new /icon(icobase, "groin_[g]"), ICON_OVERLAY)
851-
var/head = "head"
852-
if(alt_head && current_species.bodyflags & HAS_ALT_HEADS)
853-
var/datum/sprite_accessory/alt_heads/H = GLOB.alt_heads_list[alt_head]
854-
if(H.icon_state)
855-
head = H.icon_state
856-
preview_icon.Blend(new /icon(icobase, "[head]_[g]"), ICON_OVERLAY)
857-
858859
for(var/name in list("chest", "groin", "head", "r_arm", "r_hand", "r_leg", "r_foot", "l_leg", "l_foot", "l_arm", "l_hand"))
859-
if(organ_data[name] == "amputated") continue
860-
if(organ_data[name] == "cyborg")
860+
if(organ_data[name] == "amputated")
861+
continue
862+
var/icon/bodypart = new /icon(icobase, "[name]")
863+
if(name == "head") // Head nonsense.
864+
var/head = "head"
865+
if(alt_head && current_species.bodyflags & HAS_ALT_HEADS)
866+
var/datum/sprite_accessory/alt_heads/H = GLOB.alt_heads_list[alt_head]
867+
if(H.icon_state)
868+
head = H.icon_state
869+
bodypart = new /icon(icobase, "[head]_[g]") // head_state _ gender
870+
if(name in list("chest", "groin")) // Groin and Chest nonsense
871+
if(name == "chest")
872+
name = "torso"
873+
bodypart = new /icon(icobase, "[name]_[g]") // groin/torso _ gender
874+
if(organ_data[name] == "cyborg") // Robotic limbs.
861875
var/datum/robolimb/R
862876
if(rlimb_data[name]) R = GLOB.all_robolimbs[rlimb_data[name]]
863877
if(!R) R = GLOB.basic_robolimb
864878
if(name == "chest")
865879
name = "torso"
866-
preview_icon.Blend(icon(R.icon, "[name]"), ICON_OVERLAY) // This doesn't check gendered_icon. Not an issue while only limbs can be robotic.
880+
if(length(R.sprite_sheets) && R.sprite_sheets[current_species.sprite_sheet_name]) // Species specific augmented limbs
881+
R.icon = R.sprite_sheets[current_species.sprite_sheet_name]
882+
bodypart.Blend(new /icon(R.icon, "[name]"), ICON_OVERLAY)
883+
preview_icon.Blend(bodypart, ICON_OVERLAY)
867884
continue
868-
preview_icon.Blend(new /icon(icobase, "[name]"), ICON_OVERLAY)
869-
870-
// Skin color
871-
if(current_species && (current_species.bodyflags & HAS_SKIN_COLOR))
872-
preview_icon.Blend(s_colour, ICON_ADD)
873-
874-
// Skin tone
875-
if(current_species && (current_species.bodyflags & HAS_SKIN_TONE))
876-
if(s_tone >= 0)
877-
preview_icon.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD)
885+
if(istype(current_species, /datum/species/slime) && current_species.species_subtype != "None") // Applies to limbs that are not robotic.
886+
bodypart.GrayScale()
887+
bodypart.Blend("[s_colour]DC", ICON_AND) //DC = 220 alpha.
878888
else
879-
preview_icon.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT)
889+
// Skin color
890+
if(current_species && (current_species.bodyflags & HAS_SKIN_COLOR))
891+
bodypart.Blend(s_colour, ICON_ADD)
892+
// Skin tone
893+
if(current_species && (current_species.bodyflags & HAS_SKIN_TONE))
894+
if(s_tone >= 0)
895+
bodypart.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD)
896+
else
897+
bodypart.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT)
898+
preview_icon.Blend(bodypart, ICON_OVERLAY)
880899

881900
// Body accessory
882901
if(current_species && (current_species.bodyflags & HAS_BODY_ACCESSORY))
@@ -1831,6 +1850,11 @@
18311850
/datum/character_save/proc/copy_to(mob/living/carbon/human/character)
18321851
var/datum/species/S = GLOB.all_species[species]
18331852
character.set_species(S.type, delay_icon_update = TRUE) // Yell at me if this causes everything to melt
1853+
var/datum/species/subtype = GLOB.all_species[species_subtype]
1854+
if(!isnull(subtype))
1855+
character.dna.species.updatespeciessubtype(character, new subtype.type(), TRUE, FALSE)
1856+
else
1857+
character.species_subtype = "None"
18341858
if(be_random_name)
18351859
real_name = random_name(gender, species)
18361860

0 commit comments

Comments
 (0)