Merge pull request #14992 from SandPoot/more-radial-wheels-for-your-pain

Changelings now use a radial menu to select DNAs (tg port)
This commit is contained in:
silicons
2021-08-13 14:04:35 -07:00
committed by GitHub
5 changed files with 42 additions and 18 deletions

View File

@@ -297,8 +297,14 @@
prof.socks = H.socks
prof.socks_color = H.socks_color
var/list/slots = list("head", "wear_mask", "back", "wear_suit", "w_uniform", "shoes", "belt", "gloves", "glasses", "ears", "wear_id", "s_store")
for(var/slot in slots)
var/datum/icon_snapshot/entry = new
entry.name = H.name
entry.icon = H.icon
entry.icon_state = H.icon_state
entry.overlays = H.get_overlays_copy(list(HANDS_LAYER, HANDCUFF_LAYER, LEGCUFF_LAYER))
prof.profile_snapshot = entry
for(var/slot in GLOB.slots)
if(slot in H.vars)
var/obj/item/I = H.vars[slot]
if(!I)
@@ -518,6 +524,9 @@
var/socks
var/socks_color
/// Icon snapshot of the profile
var/datum/icon_snapshot/profile_snapshot
/datum/changelingprofile/Destroy()
qdel(dna)
. = ..()
@@ -535,13 +544,14 @@
newprofile.underwear = underwear
newprofile.undershirt = undershirt
newprofile.socks = socks
newprofile.profile_snapshot = profile_snapshot
/datum/antagonist/changeling/xenobio
name = "Xenobio Changeling"
give_objectives = FALSE
show_in_roundend = FALSE //These are here for admin tracking purposes only
you_are_greet = FALSE
antag_moodlet = FALSE
/datum/antagonist/changeling/roundend_report()
var/list/parts = list()

View File

@@ -10,15 +10,8 @@
//Transform into a human.
/obj/effect/proc_holder/changeling/humanform/sting_action(mob/living/carbon/user)
var/datum/antagonist/changeling/changeling = user.mind.has_antag_datum(/datum/antagonist/changeling)
var/list/names = list()
for(var/datum/changelingprofile/prof in changeling.stored_profiles)
names += "[prof.name]"
var/chosen_name = input("Select the target DNA: ", "Target DNA", null) as null|anything in names
if(!chosen_name)
return
var/datum/changelingprofile/chosen_prof = changeling.get_dna(chosen_name)
var/datum/changelingprofile/chosen_prof = changeling.select_dna()
if(!chosen_prof)
return
if(!user || user.mob_transforming)

View File

@@ -78,7 +78,7 @@
if(changeling.chosen_sting)
unset_sting(user)
return
selected_dna = changeling.select_dna("Select the target DNA: ", "Target DNA")
selected_dna = changeling.select_dna()
if(!selected_dna)
return
if(NOTRANSSTING in selected_dna.dna.species.species_traits)

View File

@@ -134,7 +134,7 @@
//Change our DNA to that of somebody we've absorbed.
/obj/effect/proc_holder/changeling/transform/sting_action(mob/living/carbon/human/user)
var/datum/antagonist/changeling/changeling = user.mind.has_antag_datum(/datum/antagonist/changeling)
var/datum/changelingprofile/chosen_prof = changeling.select_dna("Select the target DNA: ", "Target DNA")
var/datum/changelingprofile/chosen_prof = changeling.select_dna()
if(!chosen_prof)
return
@@ -142,15 +142,21 @@
changeling_transform(user, chosen_prof)
return TRUE
/datum/antagonist/changeling/proc/select_dna(var/prompt, var/title)
/**
* Gives a changeling a list of all possible dnas in their profiles to choose from and returns profile containing their chosen dna
*/
/datum/antagonist/changeling/proc/select_dna()
var/mob/living/carbon/user = owner.current
if(!istype(user))
return
var/list/names = list("Drop Flesh Disguise")
for(var/datum/changelingprofile/prof in stored_profiles)
names += "[prof.name]"
var/list/disguises = list("Drop Flesh Disguise" = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_drop"))
for(var/datum/changelingprofile/current_profile in stored_profiles)
var/datum/icon_snapshot/snap = current_profile.profile_snapshot
var/image/disguise_image = image(icon = snap.icon, icon_state = snap.icon_state)
disguise_image.overlays = snap.overlays
disguises[current_profile.name] = disguise_image
var/chosen_name = input(prompt, title, null) as null|anything in names
var/chosen_name = show_radial_menu(user, user, disguises, custom_check = CALLBACK(src, .proc/check_menu, user), radius = 40, require_near = TRUE, tooltips = TRUE)
if(!chosen_name)
return
@@ -158,6 +164,21 @@
for(var/slot in GLOB.slots)
if(istype(user.vars[slot], GLOB.slot2type[slot]))
qdel(user.vars[slot])
return
var/datum/changelingprofile/prof = get_dna(chosen_name)
return prof
/**
* Checks if we are allowed to interact with a radial menu
*
* Arguments:
* * user The carbon mob interacting with the menu
*/
/datum/antagonist/changeling/proc/check_menu(mob/living/carbon/user)
if(!istype(user))
return FALSE
var/datum/antagonist/changeling/changeling_datum = user.mind.has_antag_datum(/datum/antagonist/changeling)
if(!changeling_datum)
return FALSE
return TRUE