Skip to content

Commit

Permalink
Ports 80012 from tgstation
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian0930 committed Apr 7, 2024
1 parent a26d0fe commit 20fc62a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 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 @@ -686,16 +686,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

0 comments on commit 20fc62a

Please sign in to comment.