Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
e594c6c
Update README.md
Bibby0110 Sep 7, 2021
3fc4aa5
AI is now a tcomms hub
Bibby0110 Sep 8, 2021
89aac3b
Revert "Update README.md"
Bibby0110 Sep 8, 2021
73be38f
testing map items
Bibby0110 Sep 14, 2021
dcac832
REF passing
Bibby0110 Sep 14, 2021
70f8b94
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Sep 14, 2021
f1d9eda
AI projects baseplate
Bibby0110 Sep 14, 2021
d8cf63f
oops more changes
Bibby0110 Sep 14, 2021
780777c
Update ai_dashboard.dm
Bibby0110 Sep 16, 2021
50fdce7
zonk
Bibby0110 Sep 23, 2021
0f02b3c
project code
Bibby0110 Oct 12, 2021
4de4c64
bug fixing for 30 minutes i love it
Bibby0110 Oct 12, 2021
eb782ec
minor dash changes
Bibby0110 Oct 14, 2021
c6a29ac
Upgrades finished plus leftovers
Bibby0110 Oct 16, 2021
d81bb82
Update expansion_card_holder.dm
Bibby0110 Oct 16, 2021
2c95f71
changes
Bibby0110 Oct 31, 2021
7ddbcd7
polish
Bibby0110 Nov 13, 2021
9b5a719
Merge branch 'master' into hal9001
Bibby0110 Nov 13, 2021
6f41148
yogmap
Bibby0110 Nov 13, 2021
d1471a6
Basic Upgrades
Bibby0110 Nov 13, 2021
03d6d38
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Nov 13, 2021
c302ff1
it needs to also compile...
Bibby0110 Nov 13, 2021
f047eec
Update examine.dm
Bibby0110 Nov 13, 2021
c01e723
e
Bibby0110 Nov 18, 2021
889ea13
sci and some sat changes
patpol4 Nov 20, 2021
0af9a10
this until bibby wakes up and explains things
patpol4 Nov 20, 2021
367137f
better core
patpol4 Nov 20, 2021
23cd9d2
Merge remote-tracking branch 'origin/master' into hal9001
Bibby0110 Nov 27, 2021
59dcb5b
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Nov 27, 2021
951030f
HOW FIX MAP CONFLICT
Bibby0110 Nov 27, 2021
a8fc8e8
Update ai_controlpanel.dm
Bibby0110 Nov 27, 2021
ba48144
Update YogStation.dmm
Bibby0110 Nov 27, 2021
fb9d215
ok i think this works??
Bibby0110 Nov 27, 2021
be22b9a
bug fixes
Bibby0110 Nov 29, 2021
b0300e7
Widescreen hud + various fixes
Bibby0110 Nov 29, 2021
87f07f8
revert build tools changes
Bibby0110 Nov 29, 2021
d6def91
Update login.dm
Bibby0110 Nov 29, 2021
3ee9a10
small fixes
Bibby0110 Nov 30, 2021
9e36eb3
no infinite loop thanks
Bibby0110 Nov 30, 2021
1933f05
Update decentralized_os.dm
Bibby0110 Nov 30, 2021
b29723e
Update decentralized_os.dm
Bibby0110 Nov 30, 2021
1f9b888
Update decentralized_os.dm
Bibby0110 Nov 30, 2021
edda45e
NO MORE INFINITE LOOPS EVER
Bibby0110 Nov 30, 2021
36e2141
small changes
Bibby0110 Nov 30, 2021
4ca86cb
Merge branch 'master' into hal9001
Bibby0110 Dec 5, 2021
fa782f4
meta
Bibby0110 Dec 5, 2021
6e8f473
delta
Bibby0110 Dec 5, 2021
a356c2f
kilo
Bibby0110 Dec 5, 2021
7b6ef20
malf AI works
Bibby0110 Dec 5, 2021
e931bef
ui compiles
Bibby0110 Dec 5, 2021
f51c40a
Update AiDashboard.js
Bibby0110 Dec 5, 2021
5b35940
Update AiDashboard.js
Bibby0110 Dec 5, 2021
d6d0e3f
Update expansion_card_holder.dm (#12818)
Bibby0110 Dec 5, 2021
85ca355
this should fix the crash
Bibby0110 Dec 6, 2021
8c60837
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Dec 6, 2021
c3705c7
this should actually fix the crashes, for good
Bibby0110 Dec 6, 2021
73d6751
logging fixes
Bibby0110 Dec 6, 2021
ee554d0
Fixed firewall causing AI download to speed up (#12838)
adamsong Dec 7, 2021
5baef34
small fixes
Bibby0110 Dec 7, 2021
81d2305
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Dec 7, 2021
7a8e41b
Various minor fixes
Bibby0110 Dec 9, 2021
79a7ae8
Merge branch 'master' into hal9001
Bibby0110 Dec 9, 2021
d5c3101
Linter
Bibby0110 Dec 9, 2021
3aa0fd5
map changes (#12852)
ToasterBiome Dec 9, 2021
0541ef6
Automatic changelog generation #12852 [ci skip]
Yogbot-13 Dec 9, 2021
330b6fc
Update ai_data_core.dm
Bibby0110 Dec 9, 2021
8509ac8
vox fix
Bibby0110 Dec 9, 2021
ee1c8ea
fixes oversights (#12859)
ToasterBiome Dec 10, 2021
da49461
Automatic changelog generation #12859 [ci skip]
Yogbot-13 Dec 10, 2021
0c85f3f
Merge branch 'master' into hal9001
Bibby0110 Dec 14, 2021
16e8701
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Dec 14, 2021
0567777
Merge branch 'master' into hal9001
Bibby0110 Dec 14, 2021
ef03290
conflict fixed
Bibby0110 Dec 14, 2021
58945cd
more logging
Bibby0110 Dec 14, 2021
d3384df
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Dec 14, 2021
1f8cad3
lots of bug fixes
Bibby0110 Dec 14, 2021
38c1dab
oops
Bibby0110 Dec 14, 2021
597e41f
Update _ai_machinery.dm
Bibby0110 Dec 14, 2021
56f0dae
Update ai_data_core.dm
Bibby0110 Dec 14, 2021
77c47ef
Update ai_data_core.dm
Bibby0110 Dec 14, 2021
b8cf104
Update expansion_card_holder.dm
Bibby0110 Dec 14, 2021
ef3bece
Minor fixes (Including weird fail on can_see when you've just spawned…
Bibby0110 Dec 15, 2021
83d8289
oldstation goodbye
Bibby0110 Dec 16, 2021
49c1166
maps
Bibby0110 Dec 16, 2021
833619a
removes the AI core from the game
Bibby0110 Dec 16, 2021
95b6a6a
missed one
Bibby0110 Dec 16, 2021
593fd13
spans
Bibby0110 Dec 16, 2021
7e5251a
Merge branch 'hal9001' of https://github.com/yogstation13/Yogstation …
Bibby0110 Dec 16, 2021
463473f
induction start
Bibby0110 Dec 16, 2021
ccf8cfa
Update AiDashboard.js
Bibby0110 Dec 16, 2021
3310e3b
induction start
Bibby0110 Dec 16, 2021
0df6bdb
Update AiDashboard.js
Bibby0110 Dec 16, 2021
26e1060
Merge branch 'more_ai_upgrades' of https://github.com/yogstation13/Yo…
Bibby0110 Dec 17, 2021
f1f62fd
Revert "Merge branch 'more_ai_upgrades' of https://github.com/yogstat…
Bibby0110 Dec 17, 2021
f0bbf04
Target abilities
Bibby0110 Dec 22, 2021
7833b04
linter happy
Bibby0110 Dec 22, 2021
7cfd7db
Merge branch 'master' into more_ai_upgrades
Bibby0110 Dec 25, 2021
9def9ed
Update ai.dm
Bibby0110 Dec 25, 2021
6e05021
Fixes to induction, oops
Bibby0110 Dec 27, 2021
c2e8a6f
Merge branch 'master' into more_ai_upgrades
Bibby0110 Dec 28, 2021
1e284f8
Update ai_dashboard.dm
Bibby0110 Dec 28, 2021
d1de033
Create surveillance.dm
Bibby0110 Jan 1, 2022
68b3667
Camera Memory Tracker
Bibby0110 Jan 1, 2022
97c28f8
Update Malf_Modules.dm
Bibby0110 Jan 1, 2022
b9ad8d5
Merge remote-tracking branch 'origin/master' into more_ai_upgrades
Bibby0110 Jan 3, 2022
5414a7b
Update ai_dashboard.dm
Bibby0110 Jan 7, 2022
d193917
Update ai_dashboard.dm
Bibby0110 Jan 8, 2022
d4a58f8
Merge branch 'master' into more_ai_upgrades
SomeguyManperson Jan 10, 2022
f2d9e12
Update ai.dm
Bibby0110 Jan 12, 2022
8f8611f
Update surveillance.dm
Bibby0110 Jan 12, 2022
1813806
Update surveillance.dm
Bibby0110 Jan 12, 2022
db26aeb
Merge branch 'master' into more_ai_upgrades
Bibby0110 Jan 16, 2022
1a5def4
Update surveillance.dm
Bibby0110 Jan 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/__DEFINES/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@
//AI Project Categories.
#define AI_PROJECT_HUDS "Sensor HUDs"
#define AI_PROJECT_CAMERAS "Visiblity Upgrades"
#define AI_PROJECT_INDUCTION "Induction"
#define AI_PROJECT_SURVEILLANCE "Surveillance"
#define AI_PROJECT_MISC "Misc."
//Update this list if you add any new ones, else the category won't show up in the UIs
GLOBAL_LIST_INIT(ai_project_categories, list(
AI_PROJECT_HUDS,
AI_PROJECT_CAMERAS,
AI_PROJECT_SURVEILLANCE,
AI_PROJECT_INDUCTION,
AI_PROJECT_MISC
))

///How much is the AI download progress increased by per tick? Multiplied by a modifer on the AI if they have upgraded. Need to reach 100 to be downloaded
#define AI_DOWNLOAD_PER_PROCESS 0.75
///Check for tracked individual coming into view every X ticks
#define AI_CAMERA_MEMORY_TICKS 15
17 changes: 13 additions & 4 deletions code/_onclick/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,21 @@
hangup_all_calls()
add_hiddenprint(usr)

/* Humans (With upgrade) */
/* Humans (With upgrades) */
/mob/living/carbon/human/AIShiftClick(mob/living/silicon/ai/user)
if(!user.canExamineHumans)
return

if(user.client && (user.client.eye == user.eyeobj || user.client.eye == user.loc))
user.examinate(src)
if(user.canExamineHumans)
user.examinate(src)
if(user.canCameraMemoryTrack)
if(name == "Unknown")
to_chat(user, span_warning("Unable to track 'Unknown' persons! Their name must be visible."))
return
if(src == user.cameraMemoryTarget)
to_chat(user, span_warning("Stop tracking this individual? <a href='?src=[REF(user)];stopTrackHuman=1'>\[UNTRACK\]</a>"))
else
to_chat(user, span_warning("Track this individual? <a href='?src=[REF(user)];trackHuman=[src.name]'>\[TRACK\]</a>"))
return

//
// Override TurfAdjacent for AltClicking
Expand Down
25 changes: 20 additions & 5 deletions code/modules/antagonists/traitor/equipment/Malf_Modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/AI_Module))
var/mob/living/silicon/ai/owner_AI
/// If we have multiple uses of the same power
var/uses
///How many uses can we store up? Only used for non-antag AI upgrade
var/max_uses
///delete the ability when we're out of uses?
var/delete_on_empty = TRUE
/// If we automatically use up uses on each activation
var/auto_use_uses = TRUE
/// If applicable, the time in deciseconds we have to wait before using any more modules
var/cooldown_period
//Can our uses be recharged using CPU in the reworked AI system?
var/can_be_recharged = FALSE

/datum/action/innate/ai/New()
. = ..()
max_uses = uses

/datum/action/innate/ai/Grant(mob/living/L)
. = ..()
Expand All @@ -47,6 +57,9 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/AI_Module))
return

/datum/action/innate/ai/Trigger()
if(uses <= 0 && !isnull(uses))
to_chat(owner, span_warning("[name] has no more uses! Charge it using CPU cycles in your dashboard."))
return FALSE
. = ..()
if(auto_use_uses)
adjust_uses(-1)
Expand All @@ -58,9 +71,10 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/AI_Module))
if(!silent && uses)
to_chat(owner, span_notice("[name] now has <b>[uses]</b> use[uses > 1 ? "s" : ""] remaining."))
if(!uses)
if(initial(uses) > 1) //no need to tell 'em if it was one-use anyway!
if(initial(uses) > 1 || !delete_on_empty) //no need to tell 'em if it was one-use anyway!
to_chat(owner, span_warning("[name] has run out of uses!"))
qdel(src)
if(delete_on_empty)
qdel(src)

/// Framework for ranged abilities that can have different effects by left-clicking stuff.
/datum/action/innate/ai/ranged
Expand All @@ -85,10 +99,11 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/AI_Module))
if(!silent && uses)
to_chat(owner, span_notice("[name] now has <b>[uses]</b> use[uses > 1 ? "s" : ""] remaining."))
if(!uses)
if(initial(uses) > 1) //no need to tell 'em if it was one-use anyway!
if(initial(uses) > 1 || !delete_on_empty) //no need to tell 'em if it was one-use anyway!
to_chat(owner, span_warning("[name] has run out of uses!"))
Remove(owner)
QDEL_IN(src, 100) //let any active timers on us finish up
if(delete_on_empty)
Remove(owner)
QDEL_IN(src, 100) //let any active timers on us finish up

/datum/action/innate/ai/ranged/Destroy()
QDEL_NULL(linked_ability)
Expand Down
46 changes: 37 additions & 9 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,19 @@
var/downloadSpeedModifier = 1

var/login_warned_temp = FALSE

//Do we have access to camera tracking?
var/canCameraMemoryTrack = FALSE
//The person we are tracking
var/cameraMemoryTarget = null
//We only check every X ticks
var/cameraMemoryTickCount = 0

//Did we get the death prompt?
var/is_dying = FALSE



/mob/living/silicon/ai/Initialize(mapload, datum/ai_laws/L, mob/target_ai, shunted)
. = ..()
if(!target_ai) //If there is no player/brain inside.
Expand Down Expand Up @@ -248,7 +257,14 @@
M.update()



/mob/living/silicon/ai/proc/add_verb_ai(addedVerb)
add_verb(src, addedVerb)
if(istype(loc, /obj/machinery/ai/data_core)) //A BYOND bug requires you to be viewing your core before your verbs update
var/obj/machinery/ai/data_core/core = loc
forceMove(get_turf(loc))
view_core()
sleep(1)
forceMove(core)

/mob/living/silicon/ai/verb/pick_icon()
set category = "AI Commands"
Expand Down Expand Up @@ -504,6 +520,25 @@
return
if(M)
M.transfer_ai(AI_MECH_HACK, src, usr) //Called om the mech itself.

if(href_list["stopTrackHuman"])
if(!cameraMemoryTarget)
return
to_chat(src, span_notice("Target no longer being tracked."))
cameraMemoryTarget = null

if(href_list["trackHuman"])
var/track_name = href_list["trackHuman"]
if(!track_name)
to_chat(src, span_warning("Unable to track target."))
return
if(cameraMemoryTarget)
to_chat(src, span_warning("Old target discarded. Exclusively tracking new target."))
else
to_chat(src, span_notice("Now tracking new target, [track_name]."))

cameraMemoryTarget = track_name
cameraMemoryTickCount = 0

if(href_list["instant_download"])
if(!href_list["console"])
Expand Down Expand Up @@ -931,15 +966,8 @@
to_chat(src, "You are also capable of hacking APCs, which grants you more points to spend on your Malfunction powers. The drawback is that a hacked APC will give you away if spotted by the crew. Hacking an APC takes 30 seconds.")

view_core() //A BYOND bug requires you to be viewing your core before your verbs update
add_verb(src, /mob/living/silicon/ai/proc/choose_modules)
add_verb(src, /mob/living/silicon/ai/proc/toggle_download)
add_verb_ai(list(/mob/living/silicon/ai/proc/choose_modules, /mob/living/silicon/ai/proc/toggle_download))
malf_picker = new /datum/module_picker
if(istype(loc, /obj/machinery/ai/data_core)) //A BYOND bug requires you to be viewing your core before your verbs update
var/obj/machinery/ai/data_core/core = loc
forceMove(get_turf(loc))
view_core()
sleep(1)
forceMove(core)


/mob/living/silicon/ai/reset_perspective(atom/A)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,21 @@

for(var/datum/ai_project/AP as anything in available_projects)
data["available_projects"] += list(list("name" = AP.name, "description" = AP.description, "ram_required" = AP.ram_required, "available" = AP.canResearch(), "research_cost" = AP.research_cost, "research_progress" = AP.research_progress,
"assigned_cpu" = cpu_usage[AP.name] ? cpu_usage[AP.name] : 0, "research_requirements" = AP.research_requirements, "category" = AP.category))

"assigned_cpu" = cpu_usage[AP.name] ? cpu_usage[AP.name] : 0, "research_requirements" = AP.research_requirements_text, "category" = AP.category))

var/list/ability_paths = list()
data["completed_projects"] = list()
data["chargeable_abilities"] = list()
for(var/datum/ai_project/P as anything in completed_projects)
data["completed_projects"] += list(list("name" = P.name, "description" = P.description, "ram_required" = P.ram_required, "running" = P.running, "category" = P.category))
data["completed_projects"] += list(list("name" = P.name, "description" = P.description, "ram_required" = P.ram_required, "running" = P.running, "category" = P.category, "can_be_run" = P.can_be_run))
if(P.ability_path && !(P.ability_path in ability_paths)) //Check that we've not already added a thing to recharge this type of ability
if(P.ability_recharge_cost <= 0)
continue
ability_paths += P.ability_path
var/datum/action/innate/ai/the_ability = locate(P.ability_path) in owner.actions
if(the_ability)
data["chargeable_abilities"] += list(list("assigned_cpu" = cpu_usage[P.name],"cost" = P.ability_recharge_cost, "progress" = P.ability_recharge_invested, "name" = the_ability.name,
"project_name" = P.name, "uses" = the_ability.uses, "max_uses" = the_ability.max_uses))

return data

Expand All @@ -114,11 +123,23 @@
to_chat(owner, span_notice("Instance of [params["project_name"]] succesfully ended."))
. = TRUE
if("allocate_cpu")
var/datum/ai_project/project = get_project_by_name(params["project_name"])

var/datum/ai_project/project = get_project_by_name(params["project_name"], TRUE)
if(!project || !set_project_cpu(project, text2num(params["amount"])))
to_chat(owner, span_warning("Unable to add CPU to [params["project_name"]]. Either not enough free CPU or project is unavailable."))
. = TRUE
if("allocate_recharge_cpu")
var/datum/ai_project/project = get_project_by_name(params["project_name"])
if(!has_completed_project(project.type))
return
var/datum/action/innate/ai/the_ability = locate(project.ability_path) in owner.actions
if(!the_ability)
return
if(the_ability.uses >= the_ability.max_uses)
to_chat(owner, span_warning("This action already has the maximum amount of charges!"))
return
if(!project || !set_project_cpu(project, text2num(params["amount"])))
to_chat(owner, span_warning("Unable to add CPU to [params["project_name"]]. Either not enough free CPU or ability recharge is unavailable."))
. = TRUE

/datum/ai_dashboard/proc/get_project_by_name(project_name, only_available = FALSE)
for(var/datum/ai_project/AP as anything in available_projects)
Expand All @@ -138,6 +159,17 @@

if(amount < 0)
return FALSE

if(has_completed_project(project.type) && !project.ability_recharge_cost)
if(!project.ability_recharge_cost)
return
var/datum/action/innate/ai/the_ability = locate(project.ability_path) in owner.actions
if(!the_ability)
return
if(the_ability.uses >= the_ability.max_uses)
return



var/total_cpu_used = 0
for(var/I in cpu_usage)
Expand Down Expand Up @@ -173,20 +205,33 @@

return FALSE

/datum/ai_dashboard/proc/has_completed_projects(project_name)
/datum/ai_dashboard/proc/has_completed_project(project_type)
for(var/datum/ai_project/P as anything in completed_projects)
if(P.name == project_name)
if(P.type == project_type)
return TRUE
return FALSE


/datum/ai_dashboard/proc/finish_project(datum/ai_project/project, notify_user = TRUE)
available_projects -= project
completed_projects += project
cpu_usage[project.name] = 0
project.finish()
if(notify_user)
to_chat(owner, span_notice("[project] has been completed. User input required."))

/datum/ai_dashboard/proc/recharge_ability(datum/ai_project/project, notify_user = TRUE)
cpu_usage[project.name] = 0
if(!project.ability_path)
return
var/datum/action/innate/ai/ability = locate(project.ability_path) in owner.actions
if(!ability)
return
ability.uses++
project.ability_recharge_invested = 0

if(notify_user)
to_chat(owner, span_notice("'[ability.name]' has been recharged."))


//Stuff is handled in here per tick :)
/datum/ai_dashboard/proc/tick(seconds)
Expand Down Expand Up @@ -235,15 +280,25 @@
if(reduction_of_resources)
to_chat(owner, span_warning("Lack of computational capacity. Some programs may have been stopped."))


for(var/project_being_researched in cpu_usage)
if(!cpu_usage[project_being_researched])
continue

var/used_cpu = round(cpu_usage[project_being_researched] * seconds, 1)
var/datum/ai_project/project = get_project_by_name(project_being_researched, TRUE)
var/datum/ai_project/project = get_project_by_name(project_being_researched)
if(!project)
cpu_usage[project_being_researched] = 0
continue
if(has_completed_project(project.type)) //This means we're an ability recharging
project.ability_recharge_invested += used_cpu
if(project.ability_recharge_invested > project.ability_recharge_cost)
owner.playsound_local(owner, 'sound/machines/ping.ogg', 50, 0)
recharge_ability(project)
continue

project.research_progress += used_cpu
if(project.research_progress > project.research_cost)
owner.playsound_local(owner, 'sound/machines/ping.ogg', 50, 0)
finish_project(project)

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,20 @@ GLOBAL_LIST_EMPTY(ai_projects)
var/ram_required = 0
var/running = FALSE
//Text for canResearch()
var/research_requirements = "None"
var/research_requirements_text = "None"
//list of typepaths of required projects
var/research_requirements

//Passive upgrades and abilities below

///Should we be able to even run this program?
var/can_be_run = TRUE
///Path to our ability if we have any
var/ability_path = FALSE
///If we have an ability how many CPU cycles do they take to charge?
var/ability_recharge_cost = 0
///How much CPU have we invested in charging it up?
var/ability_recharge_invested = 0

var/mob/living/silicon/ai/ai
var/datum/ai_dashboard/dashboard
Expand All @@ -24,10 +37,17 @@ GLOBAL_LIST_EMPTY(ai_projects)
..()

/datum/ai_project/proc/canResearch()
if(!research_requirements)
return TRUE
for(var/P in research_requirements)
if(!dashboard.has_completed_project(P))
return FALSE
return TRUE

/datum/ai_project/proc/run_project(force_run = FALSE)
SHOULD_CALL_PARENT(TRUE)
if(!can_be_run)
return FALSE
if(!force_run)
if(!canRun())
return FALSE
Expand All @@ -44,3 +64,16 @@ GLOBAL_LIST_EMPTY(ai_projects)
/datum/ai_project/proc/canRun()
SHOULD_CALL_PARENT(TRUE)
return !running

//Run when project is finished. For passive upgrades or adding abilities.
/datum/ai_project/proc/finish()
return

/datum/ai_project/proc/add_ability(datum/action/innate/ai/ability)
var/datum/action/innate/ai/has_ability = locate(ability) in ai.actions
if(has_ability)
return FALSE

var/datum/action/AC = new ability()
AC.Grant(ai)
return AC
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
description = "Using experimental long range passive sensors should allow you to detect various implants such as loyalty implants and tracking implants."
research_cost = 1000
ram_required = 2
research_requirements = "None"
research_requirements_text = "None"
category = AI_PROJECT_HUDS

/datum/ai_project/security_hud/run_project(force_run = FALSE)
Expand Down Expand Up @@ -31,7 +31,7 @@
description = "Various data processing optimizations should allow you to gain extra knowledge about users when your medical and diagnostic hud is active."
research_cost = 750
ram_required = 1
research_requirements = "None"
research_requirements_text = "None"
category = AI_PROJECT_HUDS

/datum/ai_project/diag_med_hud/run_project(force_run = FALSE)
Expand Down
Loading