Datumizes changelings and refactors related code (#17774)

* it's finally here

unfucks tgui

* oops, I don't want to change the mode

* charlie and moxian review

* charlie review II + some GC fixes

* rebase to fix conflicts + tgui bundle deconflict

* charlie review III + affected review

* final? tweaks
This commit is contained in:
SteelSlayer
2022-06-18 20:55:49 +01:00
committed by GitHub
parent 0dc7d74cdc
commit c3fcf3e256
62 changed files with 1100 additions and 1129 deletions
+17 -35
View File
@@ -51,7 +51,6 @@
var/miming = 0 // Mime's vow of silence
var/list/antag_datums
var/datum/changeling/changeling //changeling holder
var/linglink
var/antag_hud_icon_state = null //this mind's ANTAG_HUD should have this icon_state
@@ -278,12 +277,15 @@
/datum/mind/proc/memory_edit_changeling(mob/living/carbon/human/H)
. = _memory_edit_header("changeling", list("traitorchan"))
if(src in SSticker.mode.changelings)
var/datum/antagonist/changeling/cling = has_antag_datum(/datum/antagonist/changeling)
if(cling)
. += "<b><font color='red'>CHANGELING</font></b>|<a href='?src=[UID()];changeling=clear'>no</a>"
if(objectives.len==0)
if(!length(cling.objectives))
. += "<br>Objectives are empty! <a href='?src=[UID()];changeling=autoobjectives'>Randomize!</a>"
if(changeling && changeling.absorbed_dna.len && (current.real_name != changeling.absorbed_dna[1]))
. += "<br><a href='?src=[UID()];changeling=initialdna'>Transform to initial appearance.</a>"
if(length(cling.absorbed_dna))
var/datum/dna/DNA = cling.absorbed_dna[1]
if(current.real_name != DNA.real_name)
. += "<br><a href='?src=[UID()];changeling=initialdna'>Transform to initial appearance.</a>"
else
. += "<a href='?src=[UID()];changeling=changeling'>changeling</a>|<b>NO</b>"
@@ -952,41 +954,30 @@
else if(href_list["changeling"])
switch(href_list["changeling"])
if("clear")
if(src in SSticker.mode.changelings)
SSticker.mode.changelings -= src
special_role = null
if(changeling)
current.remove_changeling_powers()
qdel(current.middleClickOverride) // In case the old changeling has a targeted sting prepared (`datum/middleClickOverride`), delete it.
current.middleClickOverride = null
qdel(changeling)
changeling = null
SSticker.mode.update_change_icons_removed(src)
to_chat(current, "<FONT color='red' size = 3><B>You grow weak and lose your powers! You are no longer a changeling and are stuck in your current form!</B></FONT>")
if(ischangeling(current))
remove_antag_datum(/datum/antagonist/changeling)
log_admin("[key_name(usr)] has de-changelinged [key_name(current)]")
message_admins("[key_name_admin(usr)] has de-changelinged [key_name_admin(current)]")
if("changeling")
if(!(src in SSticker.mode.changelings))
SSticker.mode.changelings += src
SSticker.mode.grant_changeling_powers(current)
SSticker.mode.update_change_icons_added(src)
special_role = SPECIAL_ROLE_CHANGELING
SEND_SOUND(current, sound('sound/ambience/antag/ling_aler.ogg'))
to_chat(current, "<B><font color='red'>Your powers have awoken. A flash of memory returns to us... we are a changeling!</font></B>")
if(!ischangeling(current))
add_antag_datum(/datum/antagonist/changeling)
to_chat(current, "<span class='biggerdanger'>Your powers have awoken. A flash of memory returns to us... we are a changeling!</span>")
log_admin("[key_name(usr)] has changelinged [key_name(current)]")
message_admins("[key_name_admin(usr)] has changelinged [key_name_admin(current)]")
if("autoobjectives")
SSticker.mode.forge_changeling_objectives(src)
var/datum/antagonist/changeling/cling = has_antag_datum(/datum/antagonist/changeling)
cling.give_objectives()
to_chat(usr, "<span class='notice'>The objectives for changeling [key] have been generated. You can edit them and announce manually.</span>")
log_admin("[key_name(usr)] has automatically forged objectives for [key_name(current)]")
message_admins("[key_name_admin(usr)] has automatically forged objectives for [key_name_admin(current)]")
if("initialdna")
if(!changeling || !changeling.absorbed_dna.len)
var/datum/antagonist/changeling/cling = has_antag_datum(/datum/antagonist/changeling)
if(!cling || !length(cling.absorbed_dna))
to_chat(usr, "<span class='warning'>Resetting DNA failed!</span>")
else
current.dna = changeling.absorbed_dna[1]
current.dna = cling.absorbed_dna[1]
current.real_name = current.dna.real_name
current.UpdateAppearance()
domutcheck(current)
@@ -1608,15 +1599,6 @@
if(!has_antag_datum(/datum/antagonist/vampire))
add_antag_datum(/datum/antagonist/vampire)
/datum/mind/proc/make_Changeling()
if(!(src in SSticker.mode.changelings))
SSticker.mode.changelings += src
SSticker.mode.grant_changeling_powers(current)
special_role = SPECIAL_ROLE_CHANGELING
SSticker.mode.forge_changeling_objectives(src)
SSticker.mode.greet_changeling(src)
SSticker.mode.update_change_icons_added(src)
/datum/mind/proc/make_Overmind()
if(!(src in SSticker.mode.blob_overminds))
SSticker.mode.blob_overminds += src
+11 -7
View File
@@ -358,34 +358,38 @@
tick_interval = 4 SECONDS
alert_type = null
var/stacks = 0
/// A reference to the changeling's changeling antag datum.
var/datum/antagonist/changeling/cling
/datum/status_effect/speedlegs/on_apply()
ADD_TRAIT(owner, TRAIT_GOTTAGOFAST, "changeling")
cling = owner.mind.has_antag_datum(/datum/antagonist/changeling)
ADD_TRAIT(owner, TRAIT_GOTTAGOFAST, CHANGELING_TRAIT)
return TRUE
/datum/status_effect/speedlegs/tick()
if(owner.stat || owner.staminaloss >= 90 || owner.mind.changeling.chem_charges <= (stacks + 1) * 3)
if(owner.stat || owner.staminaloss >= 90 || cling.chem_charges <= (stacks + 1) * 3)
to_chat(owner, "<span class='danger'>Our muscles relax without the energy to strengthen them.</span>")
owner.Weaken(6 SECONDS)
owner.remove_status_effect(STATUS_EFFECT_SPEEDLEGS)
qdel(src)
else
stacks++
owner.mind.changeling.chem_charges -= stacks * 3 //At first the changeling may regenerate chemicals fast enough to nullify fatigue, but it will stack
cling.chem_charges -= stacks * 3 //At first the changeling may regenerate chemicals fast enough to nullify fatigue, but it will stack
if(stacks == 7) //Warning message that the stacks are getting too high
to_chat(owner, "<span class='warning'>Our legs are really starting to hurt...</span>")
/datum/status_effect/speedlegs/before_remove()
if(stacks < 3 && !(owner.stat || owner.staminaloss >= 90 || owner.mind.changeling.chem_charges <= (stacks + 1) * 3)) //We don't want people to turn it on and off fast, however, we need it forced off if the 3 later conditions are met.
if(stacks < 3 && !(owner.stat || owner.staminaloss >= 90 || cling.chem_charges <= (stacks + 1) * 3)) //We don't want people to turn it on and off fast, however, we need it forced off if the 3 later conditions are met.
to_chat(owner, "<span class='notice'>Our muscles just tensed up, they will not relax so fast.</span>")
return FALSE
return TRUE
/datum/status_effect/speedlegs/on_remove()
REMOVE_TRAIT(owner, TRAIT_GOTTAGOFAST, "changeling")
REMOVE_TRAIT(owner, TRAIT_GOTTAGOFAST, CHANGELING_TRAIT)
if(!owner.IsWeakened())
to_chat(owner, "<span class='notice'>Our muscles relax.</span>")
if(stacks >= 7)
to_chat(owner, "<span class='danger'>We collapse in exhaustion.</span>")
owner.Weaken(6 SECONDS)
owner.emote("gasp")
owner.mind.changeling.geneticdamage += stacks
cling.genetic_damage += stacks
cling = null
+1 -1
View File
@@ -1755,7 +1755,7 @@ GLOBAL_LIST_INIT(uplink_items, subtypesof(/datum/uplink_item))
else if(!AT)
to_chat(usr, "<span class='warning'>Error: Embedded Syndicate credentials not found.</span>")
return
else if(mind.changeling || mind.has_antag_datum(/datum/antagonist/vampire))
else if(ischangeling(usr) || mind.has_antag_datum(/datum/antagonist/vampire))
to_chat(usr, "<span class='warning'>Error: Embedded Syndicate credentials contain an abnormal signature. Aborting.</span>")
return