Makes prosthetics editable in appearance editor (#18879)

The appearance editor can now change organs and limbs into
prosthetic/nymph/amputated versions.
As ghostroles can now edit their own limbs, the Tarwa Conglomerate
ghostroles no longer have random nymph limbs.
Height and speech bubbles no longer need the user to be able to change
their species to modify them

---------

Signed-off-by: RustingWithYou <63625389+RustingWithYou@users.noreply.github.com>
Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>
This commit is contained in:
RustingWithYou
2024-04-18 22:50:20 +00:00
committed by GitHub
co-authored by Matt Atlas
parent eb63f6998b
commit 8c4b86349d
18 changed files with 215 additions and 57 deletions
@@ -143,6 +143,62 @@
check_dna()
dna.ready_dna(src)
/mob/living/carbon/human/proc/change_limb(var/limb, var/company)
var/obj/item/organ/external/target = organs_by_name[limb]
if(limb == BP_HEAD || limb == BP_CHEST || limb == BP_GROIN) //don't want to robotize or delete head/torso if this somehow happens
return
if(company == "Normal" || !target || target.species == GLOB.all_species["Nymph Limb"]) //If they're missing the limb, create a new one so it can be transformed properly. We also need to redo this here if they're editing a nymph limb to properly remove it.
species.create_organs(src)
remove_verb(src, /mob/living/carbon/human/proc/detach_nymph_limb) //this resets organs, so we can remove this here. if we don't we get funny stuff like being able to detach non-nymph arms or the verb just sticks around
if(company == "Amputated")
organs_by_name[limb] = null
organs -= target
if(target.children) // This might need to become recursive.
for(var/obj/item/organ/external/child in target.children)
organs_by_name[child.limb_name] = null
organs -= child
if(company == "Diona Nymph") //special snowflake code for diona limbs go brrr
target.AddComponent(/datum/component/nymph_limb)
var/datum/component/nymph_limb/D = target.GetComponent(/datum/component/nymph_limb)
if(D)
D.nymphize(src, target.limb_name, TRUE)
else
target.robotize(company)
force_update_limbs()
updatehealth()
update_body()
return TRUE
/mob/living/carbon/human/proc/change_organ(var/organ_tag, var/modification)
var/obj/item/organ/internal/target = internal_organs_by_name[organ_tag]
if(istype(target))
switch(modification)
if("Assisted")
target.mechassist()
if("Mechanical")
target.robotize()
if("Removed")
qdel(target)
update_body()
return TRUE
/mob/living/carbon/human/proc/generate_valid_prosthetics()
var/list/valid_prosthetics = PROSTHETICS_UNRESTRICTED
if(species.valid_prosthetics)
valid_prosthetics.Add(species.valid_prosthetics)
return valid_prosthetics
/mob/living/carbon/human/proc/generate_valid_limbs()
var/list/valid_limbs = list()
for(var/L in BP_ALL_LIMBS)
if(L != BP_CHEST && L != BP_HEAD && L != BP_GROIN)
valid_limbs += parse_zone(L) //turn it into actual text for the selection
return valid_limbs
/mob/living/carbon/human/proc/generate_valid_species(var/check_whitelist = 1, var/list/whitelist = list(), var/list/blacklist = list())
var/list/valid_species = new()
for(var/current_species_name in GLOB.all_species)
@@ -307,6 +307,8 @@
var/character_creation_psi_points = 0
/// Is this species psionically deaf?
var/psi_deaf = FALSE
///Which species-unique robolimb types can this species take?
var/list/valid_prosthetics
/datum/species/proc/get_eyes(var/mob/living/carbon/human/H)
return
@@ -60,6 +60,7 @@
character_color_presets = list("Dark" = "#000000", "Warm" = "#250302", "Cold" = "#1e1e29")
onfire_overlay = 'icons/mob/burning/burning_human.dmi'
valid_prosthetics = list(PROSTHETIC_SYNTHSKIN)
/datum/species/human/handle_npc(var/mob/living/carbon/human/H)
if(H.stat != CONSCIOUS)
@@ -129,6 +129,7 @@
metabolism_mod = 0.8
meat_type = /obj/item/reagent_containers/food/snacks/meat/adhomai
valid_prosthetics = list(PROSTHETIC_TESLA)
/datum/species/tajaran/after_equip(var/mob/living/carbon/human/H)
. = ..()
@@ -188,6 +188,8 @@
bump_flag = HEAVY
swap_flags = ~HEAVY
push_flags = (~HEAVY) ^ ROBOT
possible_external_organs_modifications = list("Normal", "Amputated") //We don't have any alternate limbs for Tesla suits
valid_prosthetics = null
/datum/species/tajaran/tesla_body/New()
..()
@@ -133,6 +133,7 @@
zombie_type = SPECIES_ZOMBIE_UNATHI
possible_external_organs_modifications = list("Normal","Amputated","Prosthesis", "Diona Nymph")
valid_prosthetics = list(PROSTHETIC_AUTAKH)
/datum/species/unathi/after_equip(var/mob/living/carbon/human/H)
. = ..()
@@ -148,6 +148,7 @@
alterable_internal_organs = list(BP_HEART, BP_EYES, BP_LUNGS, BP_STOMACH, BP_APPENDIX)
psi_deaf = TRUE
possible_speech_bubble_types = list("robot", "default")
valid_prosthetics = list(PROSTHETIC_VAURCA)
/datum/species/bug/before_equip(var/mob/living/carbon/human/H)
. = ..()
@@ -139,6 +139,8 @@
BP_APPENDIX = /obj/item/organ/internal/appendix/vaurca,
BP_HIVENET_SHIELD = /obj/item/organ/internal/augment/hiveshield
)
possible_external_organs_modifications = list("Normal", "Amputated") //We don't have any limb modfications for this species
valid_prosthetics = null
/datum/species/bug/type_c/New()
..()
@@ -228,6 +230,8 @@
)
default_h_style = "Bald"
possible_external_organs_modifications = list("Normal", "Amputated") //We don't have any limb modfications for this species
valid_prosthetics = null
/datum/species/bug/type_big/handle_post_spawn(var/mob/living/carbon/human/H)
H.mutations |= HULK
@@ -296,6 +300,8 @@ Bulwarks are much larger and have significantly thicker carapaces than most Vaur
sprint_speed_factor = 1.0
stamina = 50
possible_external_organs_modifications = list("Normal", "Amputated") //We don't have any limb modfications for this species, yet
valid_prosthetics = null
/datum/species/bug/type_e/New()
..()
@@ -18,6 +18,9 @@
var/list/valid_citizenships = list()
var/list/valid_accents = list()
var/list/valid_languages = list()
var/list/valid_prosthetics = list()
var/list/valid_limbs = list()
var/list/valid_organs = list()
var/check_whitelist
var/list/whitelist
@@ -184,6 +187,22 @@
. = TRUE
if("set_height")
owner.height = clamp(params["height"], owner.species.height_min, owner.species.height_max)
if("prosthetics")
if(can_change(APPEARANCE_PROSTHETICS))
var/limb = tgui_input_list(owner, "Select a Limb", "Limb Modifications", valid_limbs)
limb = reverse_parse_zone(limb) //turn it back into a proper organ tag
if(limb)
var/company = tgui_input_list(owner, "Select a Limb Type", "Limb Modifications", owner.species.possible_external_organs_modifications) //For amputated or nymph we just pass it straight into change_limb
if(company == "Prosthesis")
company = tgui_input_list(owner, "Select a Manufacturer", "Limb Modifications", valid_prosthetics)
owner.change_limb(limb, company)
. = TRUE
if("organs")
if(can_change(APPEARANCE_PROSTHETICS))
var/organ = tgui_input_list(owner, "Select an Organ", "Organ Modification", valid_organs)
var/obj/item/organ/internal/O = owner.internal_organs_by_name[organ]
var/modification = tgui_input_list(owner, "Select a Modification", "Organ Modification", O.possible_modifications)
owner.change_organ(organ, modification)
/datum/tgui_module/appearance_changer/ui_interact(var/mob/user, var/datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
@@ -208,6 +227,7 @@
data["height_max"] = owner.species.height_max
data["height_min"] = owner.species.height_min
data["owner_height"] = owner.height
data["change_prosthetics"] = can_change(APPEARANCE_PROSTHETICS)
data["owner_gender"] = owner.gender
data["owner_pronouns"] = owner.pronouns
@@ -301,6 +321,9 @@
valid_citizenships = list()
valid_accents = list()
valid_languages = list()
valid_prosthetics = list()
valid_limbs = list()
valid_organs = list()
generate_data()
/datum/tgui_module/appearance_changer/proc/generate_data()
@@ -344,3 +367,9 @@
valid_accents = owner.origin.possible_accents
if(!length(valid_languages))
valid_languages = owner.generate_valid_languages()
if(!length(valid_prosthetics))
valid_prosthetics = owner.generate_valid_prosthetics()
if(!length(valid_limbs))
valid_limbs = owner.generate_valid_limbs()
if(!length(valid_organs))
valid_organs = owner.species.alterable_internal_organs
+1 -1
View File
@@ -76,7 +76,7 @@
/obj/item/organ/internal/proc/special_condition() // For unique conditions
return
/obj/item/organ/internal/robotize(var/company = "Unbranded")
/obj/item/organ/internal/robotize(var/company = PROSTHETIC_UNBRANDED)
..()
min_bruised_damage += 5
min_broken_damage += 10
+7
View File
@@ -374,6 +374,13 @@ INITIALIZE_IMMEDIATE(/obj/item/organ)
if(robotic_name)
name = robotic_name
/obj/item/organ/proc/derobotize() //Turn a robot organ back into a flesh one. Used for appearance changers, etc.
robotic = initial(robotic)
status = initial(status)
drop_sound = initial(drop_sound)
pickup_sound = initial(pickup_sound)
name = initial(name)
/obj/item/organ/proc/mechassist() //Used to add things like pacemakers, etc
status = ORGAN_ASSISTED
robotic = ROBOTIC_ASSISTED
+1 -1
View File
@@ -18,7 +18,7 @@ GLOBAL_DATUM(basic_robolimb, /datum/robolimb)
/datum/robolimb
/// Shown when selecting the limb.
var/company = "Unbranded"
var/company = PROSTHETIC_UNBRANDED
/// Seen when examining a limb.
var/desc = "A generic unbranded robotic prosthesis."
/// Icon base to draw from.
+11 -11
View File
@@ -628,17 +628,17 @@
dislocated = -1
can_intake_reagents = 0
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/chest/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/groin/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/groin/ipc/unbranded/cap // extreme nugget action
force_prosthetic_name = "prosthetic groin cap"
@@ -659,39 +659,39 @@
/obj/item/organ/external/arm/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/arm/right/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/leg/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/leg/right/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/foot/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/foot/right/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/hand/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
/obj/item/organ/external/hand/right/ipc/unbranded
dislocated = -1
encased = "support frame"
robotize_type = "Unbranded"
robotize_type = PROSTHETIC_UNBRANDED
+2 -2
View File
@@ -81,7 +81,7 @@
target.dna.real_name = getName
if(target.mind)
target.mind.name = target.name
target.change_appearance(APPEARANCE_PLASTICSURGERY, user, TRUE, ui_state = GLOB.default_state, state_object = target)
target.change_appearance(APPEARANCE_PLASTICSURGERY &~ APPEARANCE_PROSTHETICS, user, TRUE, ui_state = GLOB.default_state, state_object = target)
target.op_stage.face = FACE_ALTERED
@@ -229,7 +229,7 @@
target.dna.real_name = getName
if(target.mind)
target.mind.name = target.name
target.change_appearance(APPEARANCE_PLASTICSURGERY, user, TRUE, ui_state = GLOB.default_state, state_object = target)
target.change_appearance(APPEARANCE_PLASTICSURGERY &~ APPEARANCE_PROSTHETICS, user, TRUE, ui_state = GLOB.default_state, state_object = target)
target.op_stage.face = FACE_ALTERED