Skip to content

Commit

Permalink
Adds some changeling fixes (#1606)
Browse files Browse the repository at this point in the history
* Ports 82412 from TGstation

tgstation/tgstation#82412

* Ports TGstation 81661

tgstation/tgstation#81661

* Ports 80012 from tgstation

tgstation/tgstation#80012

* Fixes #1445 via giving IPC's a trait they should have had already

* Removes a fix as Borbop wanted it in his :(

darn you, maintainer man...,,,
  • Loading branch information
Bastian0930 authored May 20, 2024
1 parent 3cfe041 commit cad62dc
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 25 deletions.
35 changes: 24 additions & 11 deletions code/game/gamemodes/objective.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ GLOBAL_LIST(admin_objective_list) //Prefilled admin assignable objective list
/datum/objective/proc/get_target()
return target

/datum/objective/proc/is_valid_target(datum/mind/possible_target)
if(!ishuman(possible_target.current))
return FALSE

if(possible_target.current.stat == DEAD)
return FALSE

var/target_area = get_area(possible_target.current)
if(!HAS_TRAIT(SSstation, STATION_TRAIT_LATE_ARRIVALS) && istype(target_area, /area/shuttle/arrival))
return FALSE

return TRUE

//dupe_search_range is a list of antag datums / minds / teams
/datum/objective/proc/find_target(dupe_search_range, list/blacklist)
var/list/datum/mind/owners = get_owners()
Expand All @@ -136,19 +149,14 @@ GLOBAL_LIST(admin_objective_list) //Prefilled admin assignable objective list
if(O.late_joiner)
try_target_late_joiners = TRUE
for(var/datum/mind/possible_target in get_crewmember_minds())
var/target_area = get_area(possible_target.current)
if(possible_target in owners)
continue
if(!ishuman(possible_target.current))
continue
if(possible_target.current.stat == DEAD)
continue
if(!is_unique_objective(possible_target,dupe_search_range))
continue
if(!HAS_TRAIT(SSstation, STATION_TRAIT_LATE_ARRIVALS) && istype(target_area, /area/shuttle/arrival))
continue
if(possible_target in blacklist)
continue
if(!is_valid_target(possible_target))
continue
possible_targets += possible_target
if(try_target_late_joiners)
var/list/all_possible_targets = possible_targets.Copy()
Expand Down Expand Up @@ -209,7 +217,7 @@ GLOBAL_LIST(admin_objective_list) //Prefilled admin assignable objective list
return TRUE

/datum/objective/assassinate
name = "assasinate"
name = "assassinate"
martyr_compatible = TRUE
admin_grantable = TRUE
var/target_role_type = FALSE
Expand Down Expand Up @@ -480,6 +488,11 @@ GLOBAL_LIST(admin_objective_list) //Prefilled admin assignable objective list
target = ..()
update_explanation_text()

/datum/objective/escape/escape_with_identity/is_valid_target(datum/mind/possible_target)
if(HAS_TRAIT(possible_target.current, TRAIT_NO_DNA_COPY))
return FALSE
return ..()

/datum/objective/escape/escape_with_identity/update_explanation_text()
if(target?.current)
target_real_name = target.current.real_name
Expand All @@ -494,12 +507,12 @@ GLOBAL_LIST(admin_objective_list) //Prefilled admin assignable objective list
explanation_text += "." //Proper punctuation is important!

else
explanation_text = "Free objective."
explanation_text = "Escape on the shuttle or an escape pod alive and without being in custody."

/datum/objective/escape/escape_with_identity/check_completion()
if(!target || !target_real_name)
return TRUE
var/list/datum/mind/owners = get_owners()
if(!target || !target_real_name)
return ..()
for(var/datum/mind/M in owners)
if(!ishuman(M.current) || !considered_escaped(M))
continue
Expand Down
13 changes: 9 additions & 4 deletions code/modules/antagonists/changeling/changeling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -689,16 +689,21 @@
else
var/datum/objective/maroon/maroon_objective = new
maroon_objective.owner = owner
maroon_objective.find_target()
objectives += maroon_objective


if (!(locate(/datum/objective/escape) in objectives) && escape_objective_possible)
var/datum/objective/escape/escape_with_identity/identity_theft = new
identity_theft.owner = owner
identity_theft.target = maroon_objective.target
identity_theft.find_target()
identity_theft.update_explanation_text()
objectives += identity_theft
escape_objective_possible = FALSE
maroon_objective.target = identity_theft.target || maroon_objective.find_target()
maroon_objective.update_explanation_text()
objectives += maroon_objective
objectives += identity_theft
else
maroon_objective.find_target()
objectives += maroon_objective

if (!(locate(/datum/objective/escape) in objectives) && escape_objective_possible)
if(prob(50))
Expand Down
36 changes: 26 additions & 10 deletions code/modules/antagonists/changeling/powers/fakedeath.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
..()
if(revive_ready)
INVOKE_ASYNC(src, PROC_REF(revive), user)
disable_revive(user) // this should be already called via signal, but just incase something wacky happens


else if(enable_fakedeath(user))
to_chat(user, span_changeling("We begin our stasis, preparing energy to arise once more."))
Expand All @@ -41,17 +41,24 @@
RegisterSignal(changeling, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change))
return TRUE

/// Sets [revive_ready] to FALSE and updates the button icons.
/// Can be called mid-revival if the process is being cancelled
/datum/action/changeling/fakedeath/proc/disable_revive(mob/living/changeling)
if(revive_ready)
chemical_cost = 15
revive_ready = FALSE
build_all_button_icons(UPDATE_BUTTON_NAME|UPDATE_BUTTON_ICON)

/// Removes the signals for fakedeath and listening for hapless doctors
/// healing a changeling who went into stasis after actually dying, and
/// also removes changeling stasis
/datum/action/changeling/fakedeath/proc/disable_stasis_and_fakedeath(mob/living/changeling)
REMOVE_TRAIT(changeling, TRAIT_DEATHCOMA, CHANGELING_TRAIT)
UnregisterSignal(changeling, SIGNAL_REMOVETRAIT(TRAIT_DEATHCOMA))
UnregisterSignal(changeling, COMSIG_MOB_STATCHANGE)




/// This proc is called to reset the chemical cost of the revival
/// as well as the revive ready flag and button states.
/datum/action/changeling/fakedeath/proc/reset_chemical_cost()
chemical_cost = 15
revive_ready = FALSE
build_all_button_icons(UPDATE_BUTTON_NAME|UPDATE_BUTTON_ICON)

/// Sets [revive_ready] to TRUE and updates the button icons.
/datum/action/changeling/fakedeath/proc/enable_revive(mob/living/changeling)
if(revive_ready)
Expand All @@ -68,7 +75,7 @@
if(HAS_TRAIT_FROM(source, TRAIT_DEATHCOMA, CHANGELING_TRAIT))
return

disable_revive(source)
disable_stasis_and_fakedeath(source)

/// Signal proc to exit fakedeath early if we're revived from being previously dead
/datum/action/changeling/fakedeath/proc/on_stat_change(mob/living/source, new_stat, old_stat)
Expand All @@ -79,6 +86,7 @@

source.cure_fakedeath(CHANGELING_TRAIT)
to_chat(source, span_changeling("We exit our stasis early."))
reset_chemical_cost()

/datum/action/changeling/fakedeath/proc/revive(mob/living/carbon/user)
if(!istype(user))
Expand Down Expand Up @@ -135,6 +143,14 @@

return ..()

/// We wait until after we actually deduct chemical cost (or don't deduct
/// if it's the 0 cost we get for revival) before we reset the chemical cost
/datum/action/changeling/fakedeath/try_to_sting(mob/living/user)
. = ..()
if (!. || !revive_ready)
return
reset_chemical_cost()

/datum/action/changeling/fakedeath/proc/can_enter_stasis(mob/living/user)
if(HAS_TRAIT_FROM(user, TRAIT_DEATHCOMA, CHANGELING_TRAIT))
user.balloon_alert(user, "already reviving!")
Expand Down
6 changes: 6 additions & 0 deletions tgui/packages/tgui-say/constants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export const RADIO_PREFIXES = {
id: 'binary',
label: '0101',
},

':g ': {
id: 'changeling',
label: 'Cling',
},

':c ': {
id: 'command',
label: 'Cmd',
Expand Down
2 changes: 2 additions & 0 deletions tgui/packages/tgui-say/styles/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $admin: #ffbbff;
$mentor: #d3df68;
$binary: #1e90ff;
$centcom: #2681a5;
$changeling: #4c701f;
$command: #fcdf03;
$engi: #f37746;
$hive: #855d85;
Expand All @@ -43,6 +44,7 @@ $_channel_map: (
'mentor': $mentor,
'binary': $binary,
'centcom': $centcom,
'changeling': $changeling,
'command': $command,
'engi': $engi,
'hive': $hive,
Expand Down

0 comments on commit cad62dc

Please sign in to comment.