Optimizes steal objective (#15337)

This commit is contained in:
dearmochi
2021-01-23 22:54:44 +00:00
committed by GitHub
parent 58ccdbffe4
commit 9f7bd2b560
2 changed files with 25 additions and 17 deletions
+8 -17
View File
@@ -371,36 +371,27 @@ GLOBAL_LIST_INIT(potential_theft_objectives, (subtypesof(/datum/theft_objective)
var/theft_area
/datum/objective/steal/proc/get_location()
if(steal_target.location_override)
return steal_target.location_override
var/list/obj/item/steal_candidates = get_all_of_type(steal_target.typepath, subtypes = TRUE)
for(var/obj/item/candidate in steal_candidates)
if(!is_admin_level(candidate.loc.z))
theft_area = get_area(candidate.loc)
return "[theft_area]"
return "an unknown area"
return steal_target.location_override || "an unknown area"
/datum/objective/steal/find_target()
var/loop=50
while(!steal_target && loop > 0)
loop--
var/thefttype = pick(GLOB.potential_theft_objectives)
var/potential = GLOB.potential_theft_objectives.Copy()
while(!steal_target && length(potential))
var/thefttype = pick_n_take(potential)
var/datum/theft_objective/O = new thefttype
if(owner.assigned_role in O.protected_jobs)
continue
if(O in owner.targets)
continue
if(O.flags & 2)
if(O.flags & 2) // THEFT_FLAG_UNIQUE
continue
steal_target = O
steal_target = O
explanation_text = "Steal [steal_target]. One was last seen in [get_location()]. "
if(islist(O.protected_jobs) && O.protected_jobs.len)
explanation_text += "It may also be in the possession of the [jointext(O.protected_jobs, ", ")]."
if(length(O.protected_jobs))
explanation_text += "It may also be in the possession of the [english_list(O.protected_jobs, and_text = " or ")]."
return
explanation_text = "Free Objective."
/datum/objective/steal/proc/select_target()
var/list/possible_items_all = GLOB.potential_theft_objectives+"custom"
var/new_target = input("Select target:", "Objective target", null) as null|anything in possible_items_all
+17
View File
@@ -31,26 +31,31 @@
name = "the captain's antique laser gun"
typepath = /obj/item/gun/energy/laser/captain
protected_jobs = list("Captain")
location_override = "the Captain's Office"
/datum/theft_objective/captains_jetpack
name = "the captain's deluxe jetpack"
typepath = /obj/item/tank/jetpack/oxygen/captain
protected_jobs = list("Captain")
location_override = "the Captain's Office"
/datum/theft_objective/captains_rapier
name = "the captain's rapier"
typepath = /obj/item/melee/rapier
protected_jobs = list("Captain")
location_override = "the Captain's Office"
/datum/theft_objective/hoslaser
name = "the head of security's X-01 multiphase energy gun"
typepath = /obj/item/gun/energy/gun/hos
protected_jobs = list("Head Of Security")
location_override = "the Head of Security's Office"
/datum/theft_objective/hand_tele
name = "a hand teleporter"
typepath = /obj/item/hand_tele
protected_jobs = list("Captain", "Research Director", "Chief Engineer")
location_override = "Teleporter"
/datum/theft_objective/ai
name = "a functional AI"
@@ -68,17 +73,20 @@
name = "a compact defibrillator"
typepath = /obj/item/defibrillator/compact
protected_jobs = list("Chief Medical Officer", "Paramedic")
location_override = "the Chief Medical Officer's Office"
/datum/theft_objective/magboots
name = "the chief engineer's advanced magnetic boots"
typepath = /obj/item/clothing/shoes/magboots/advance
protected_jobs = list("Chief Engineer")
location_override = "the Chief Engineer's Office"
/datum/theft_objective/blueprints
name = "the station blueprints"
typepath = /obj/item/areaeditor/blueprints/ce
protected_jobs = list("Chief Engineer")
altitems = list(/obj/item/photo)
location_override = "the Chief Engineer's Office"
/datum/objective_item/steal/blueprints/check_special_completion(obj/item/I)
if(istype(I, /obj/item/areaeditor/blueprints/ce))
@@ -93,35 +101,42 @@
name = "the medal of captaincy"
typepath = /obj/item/clothing/accessory/medal/gold/captain
protected_jobs = list("Captain")
location_override = "the Captain's Office"
/datum/theft_objective/nukedisc
name = "the nuclear authentication disk"
typepath = /obj/item/disk/nuclear
protected_jobs = list("Captain")
location_override = "the Captain's Office"
/datum/theft_objective/reactive
name = "the reactive teleport armor"
typepath = /obj/item/clothing/suit/armor/reactive/teleport
protected_jobs = list("Research Director")
location_override = "the Research Director's Office"
/datum/theft_objective/steal/documents
name = "any set of secret documents of any organization"
typepath = /obj/item/documents //Any set of secret documents. Doesn't have to be NT's
location_override = "the Vault"
/datum/theft_objective/hypospray
name = "the Chief Medical Officer's hypospray"
typepath = /obj/item/reagent_containers/hypospray/CMO
protected_jobs = list("Chief Medical Officer")
location_override = "the Chief Medical Officer's Office"
/datum/theft_objective/ablative
name = "an ablative armor vest"
typepath = /obj/item/clothing/suit/armor/laserproof
protected_jobs = list("Head of Security", "Warden")
location_override = "the Armory"
/datum/theft_objective/krav
name = "the warden's krav maga martial arts gloves"
typepath = /obj/item/clothing/gloves/color/black/krav_maga/sec
protected_jobs = list("Head Of Security", "Warden")
location_override = "the Warden's Office"
/datum/theft_objective/number
var/min=0
@@ -160,7 +175,9 @@
/datum/theft_objective/unique/docs_red
name = "the \"Red\" secret documents"
typepath = /obj/item/documents/syndicate/red
location_override = "a Syndicate agent's possession"
/datum/theft_objective/unique/docs_blue
name = "the \"Blue\" secret documents"
typepath = /obj/item/documents/syndicate/blue
location_override = "a Syndicate agent's possession"