Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Human AI #442

Draft
wants to merge 121 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
ccfdaed
wip
Zonespace27 Sep 7, 2024
c6b8a35
good enough for a technical test, probably.
Zonespace27 Sep 8, 2024
c25b26a
Merge branch 'master' of https://github.com/PvE-CMSS13/PvE-CMSS13 int…
Zonespace27 Sep 8, 2024
f8f7ddf
linters? nah
Zonespace27 Sep 8, 2024
ce3dbba
FUCK
Zonespace27 Sep 8, 2024
4d308fe
guh
Zonespace27 Sep 8, 2024
c7d4807
let's just leave this on tbh
Zonespace27 Sep 8, 2024
7dfe97f
Merge pull request #6 from Zonespace27/human-ai
xDanilcusx Sep 8, 2024
78425b0
fixing AI not fully appraising equip sometimes
xDanilcusx Sep 9, 2024
2dc77b5
disables overwatch (might re-enable it in the future but not sure yet…
Zonespace27 Sep 10, 2024
283dccc
faction datums + basic communication + panel fixes
Zonespace27 Sep 12, 2024
b8b6829
huh?
Zonespace27 Sep 12, 2024
0f41636
don't spawn AI human if action is cancelled
xDanilcusx Sep 12, 2024
4ef8055
face target when firing
xDanilcusx Sep 12, 2024
14dc359
Merge pull request #7 from Zonespace27/human-ai
xDanilcusx Sep 12, 2024
de732a4
AI not considering utility pouch fix
xDanilcusx Sep 13, 2024
8d41918
AI flamer fix
xDanilcusx Sep 13, 2024
79b9e95
firearm appraisal add-ons and facing targets
xDanilcusx Sep 13, 2024
c70ae4a
approach target when it's seems incapicated
xDanilcusx Sep 13, 2024
0c6d6da
Update code/modules/mob/living/carbon/human/ai/ai_equipment.dm
xDanilcusx Sep 13, 2024
e03d688
Update ai_brain.dm
xDanilcusx Sep 13, 2024
126d511
Update code/modules/mob/living/carbon/human/ai/firearm_appraisal.dm
xDanilcusx Sep 13, 2024
2843d74
Update code/modules/projectiles/guns/flamer/flamer.dm
xDanilcusx Sep 13, 2024
059588c
Merge pull request #1 from xDanilcusx/human-ai
Zonespace27 Sep 13, 2024
b24ea10
Merge branch 'master' of https://github.com/PvE-CMSS13/PvE-CMSS13 int…
Zonespace27 Sep 14, 2024
1e2a1c1
compile fix + bug fix
Zonespace27 Sep 14, 2024
1e7152b
faction management panel
Zonespace27 Sep 16, 2024
7ca0020
fixes a few bugs
Zonespace27 Sep 16, 2024
328dd91
upp lines by slayer, will be changed later
Zonespace27 Sep 16, 2024
1fe7616
Merge pull request #8 from Zonespace27/human-ai
xDanilcusx Sep 18, 2024
1e5e1cb
More firearm datums + AI equipment & item bugfixes + AI now throw nad…
Zonespace27 Sep 19, 2024
473c512
Retreating and pursuing
xDanilcusx Sep 19, 2024
f48085f
Pick up mags fix
xDanilcusx Sep 19, 2024
54cc736
Merge branch 'human-ai' into human-ai
xDanilcusx Sep 19, 2024
7b30f2d
Merge pull request #9 from Zonespace27/human-ai
xDanilcusx Sep 19, 2024
0e4e5e1
Merge issues
xDanilcusx Sep 19, 2024
59d88ad
Trowback -> Throwback and nade AI action define
xDanilcusx Sep 19, 2024
6927928
Merge pull request #2 from xDanilcusx/human-ai
Zonespace27 Sep 19, 2024
7d6a687
nits
Zonespace27 Sep 19, 2024
c213076
Moves HumanAI verbs to GM tab, adds a simple verb for fortifying rooms
Zonespace27 Sep 20, 2024
6a3fac2
modify recursion limit
Zonespace27 Sep 20, 2024
2c72024
pathfinding improvement
Zonespace27 Sep 24, 2024
ab10637
fixes unrelated bug to human AI, also fixes dropped items not being r…
Zonespace27 Sep 24, 2024
ee48c7e
CLEANUP
Zonespace27 Sep 24, 2024
0ce8fff
Respond to shots from afar & a bunch of tweaks/fixes (#3)
xDanilcusx Sep 24, 2024
9c891c6
changes to the PR since i didn't have perms to push directly
Zonespace27 Sep 24, 2024
e666279
AI no longer talk in crit
Zonespace27 Sep 29, 2024
d37f551
SADAR CLF AI, no more overdosing, pathfinding object improvements
Zonespace27 Sep 29, 2024
2e0024a
deletion in panel
Zonespace27 Sep 29, 2024
acb7474
fix lints
Zonespace27 Sep 29, 2024
5f3addb
moves safety checking to main gun appraisal datum
Zonespace27 Sep 29, 2024
fc20138
AI sniper
Zonespace27 Sep 30, 2024
bbde741
warns admins if AI is handcuffed
Zonespace27 Oct 1, 2024
cc2d838
AI is now a component
Zonespace27 Oct 1, 2024
74a72fe
Covering system rewrite & bunch of tweaks (#4)
xDanilcusx Oct 18, 2024
cbc09b3
quick-order verb
Zonespace27 Nov 3, 2024
7f15c87
not true
Zonespace27 Nov 3, 2024
11d125d
undef TESTING
Zonespace27 Nov 3, 2024
683880a
cade buff
Zonespace27 Nov 4, 2024
940113f
smartgun reloading
Zonespace27 Nov 4, 2024
bdbe076
BDI Refactor (#5)
xDanilcusx Nov 10, 2024
6735140
CLF lines courtesy of Zenith
Zonespace27 Nov 10, 2024
8c5b23e
reloading voicelines
Zonespace27 Nov 10, 2024
166f6a1
trailing commas
Zonespace27 Nov 10, 2024
05c6ede
deprecated var begone, also makes snipers not call out reloads
Zonespace27 Nov 10, 2024
03b9eb1
patrolling waypoints now immediately stops if entering combat, plus A…
Zonespace27 Nov 10, 2024
3bf7368
AI now can use the spearhead shotguns
Zonespace27 Nov 10, 2024
efdc5c1
AI now have unique reloading voicelines for internal-mag guns
Zonespace27 Nov 10, 2024
dc81cdc
CLF sniper with an SVD
Zonespace27 Nov 11, 2024
2bbf49e
Relocating point-blank stuff into base fire action (#7)
xDanilcusx Nov 12, 2024
59fe224
Secondary weapon support and some improvements (#6)
Zonespace27 Nov 13, 2024
91be333
guh
Zonespace27 Nov 13, 2024
bac6ae4
whoops
Zonespace27 Nov 16, 2024
102a64f
Defense Panel (#8)
Zonespace27 Nov 17, 2024
3c91fd9
fuck lol
Zonespace27 Nov 17, 2024
b575fbe
cades are 2x as resistant to bullets, plus a bunch of fixes
Zonespace27 Nov 17, 2024
863efb4
current targets ARE NOT GUARANTEED to be mobs
Zonespace27 Nov 18, 2024
b8f23eb
guess who pushed a broken commit
Zonespace27 Nov 23, 2024
6ebe185
Conversation (#9)
Zonespace27 Nov 26, 2024
c87291e
conversation tidbits
Zonespace27 Dec 3, 2024
a2c3891
WY voicelines courtesy of Zenith
Zonespace27 Dec 4, 2024
3def233
c
Zonespace27 Dec 6, 2024
49dad34
USCM AI lines by zenith
Zonespace27 Dec 8, 2024
7473169
more snipers
Zonespace27 Dec 8, 2024
2b42ec8
Merge branch 'master' of https://github.com/PvE-CMSS13/PvE-CMSS13 int…
Zonespace27 Dec 8, 2024
19509df
fixes CI
Zonespace27 Dec 8, 2024
5a77af4
clients can't be in conversations
Zonespace27 Dec 10, 2024
906b5de
some stuff i am cooking (#10)
xDanilcusx Dec 10, 2024
130581b
Weakflamer!!! (#11)
private-tristan Dec 11, 2024
ecb3b3b
no more conversations for now
Zonespace27 Dec 11, 2024
47014cf
synthmed
Zonespace27 Dec 12, 2024
6038dc4
xeno cultist lines circa Zenith
Zonespace27 Dec 12, 2024
ac551f1
working through the todo
Zonespace27 Dec 12, 2024
ff17780
bolt-actions and pump-actions now aren't silly
Zonespace27 Dec 12, 2024
408a60b
AI no longer like shooting through doors
Zonespace27 Dec 12, 2024
1456f2f
Update treat_ally.dm (#12)
xDanilcusx Dec 12, 2024
346214b
melee improvements
Zonespace27 Dec 12, 2024
63aa4ff
a
Zonespace27 Dec 13, 2024
5f8119c
breaching charge panel
Zonespace27 Dec 13, 2024
6d295f0
CLF flamer
Zonespace27 Dec 13, 2024
7f1d7c7
guh
Zonespace27 Dec 13, 2024
b46f776
AI sniper fix(?) and stuff
Zonespace27 Dec 13, 2024
6cfe7d3
snipers need to stop being weird please
Zonespace27 Dec 13, 2024
f4622ca
smoke lasts 2.5x longer
Zonespace27 Dec 13, 2024
1e5d0ac
small changes
Zonespace27 Dec 13, 2024
b0e503e
splints 3x as strong
Zonespace27 Dec 13, 2024
d397e1b
guh
Zonespace27 Dec 13, 2024
e279ed4
Quick order rewamp with some tweaks (#13)
xDanilcusx Dec 14, 2024
572a4af
projectile detection system
Zonespace27 Dec 14, 2024
36dd344
faction compat
Zonespace27 Dec 14, 2024
0592fc6
CLF care a bit less about FF with SADAR
Zonespace27 Dec 14, 2024
c5d5734
item pickup stop
Zonespace27 Dec 14, 2024
e9400fe
automatic human ai tweaks
Zonespace27 Dec 14, 2024
bf83404
a
Zonespace27 Dec 14, 2024
d5d42d8
squad spawner
Zonespace27 Dec 15, 2024
5d5fdbc
tweaks
Zonespace27 Dec 15, 2024
6ffaa2a
fuck
Zonespace27 Dec 15, 2024
c9eaaa7
fuck lol
Zonespace27 Dec 15, 2024
87d4e53
i should really test these things
Zonespace27 Dec 15, 2024
dc9e625
):
Zonespace27 Dec 15, 2024
a0bf87f
fire help, maybe
Zonespace27 Dec 15, 2024
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
12 changes: 12 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
//from /mob/living/carbon/human/equip_to_slot()
#define COMSIG_HUMAN_EQUIPPED_ITEM "human_equipped_item"

//from /mob/living/carbon/human/u_equip()
#define COMSIG_HUMAN_UNEQUIPPED_ITEM "human_unequipped_item"

/// From /mob/proc/equip_to_slot_if_possible()
#define COMSIG_HUMAN_ATTEMPTING_EQUIP "human_attempting_equip"
#define COMPONENT_HUMAN_CANCEL_ATTEMPT_EQUIP (1<<0)
Expand All @@ -74,3 +77,12 @@
/// From /mob/living/carbon/human/UnarmedAttack()
#define COMSIG_HUMAN_BEFORE_ATTACK_HAND "human_before_attack_hand"
#define COMPONENT_CANCEL_HUMAN_ATTACK_HAND (1<<0)

/// From /obj/item/restraint/proc/place_handcuffs() : ()
#define COMSIG_HUMAN_HANDCUFFED "human_handcuffed"

/// From /mob/living/carbon/human/proc/set_species() : (new_species)
#define COMSIG_HUMAN_SET_SPECIES "human_set_species"

/// From /mob/living/carbon/human/proc/get_human_ai_brain() : (datum/human_ai_brain/out_brain)
#define COMSIG_HUMAN_GET_AI_BRAIN "human_get_ai_brain"
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@
/// Cancels all running cloaking effects on target
#define COMSIG_MOB_EFFECT_CLOAK_CANCEL "mob_effect_cloak_cancel"

#define COMSIG_MOB_DROP_ITEM "mob_drop_item"

#define COMSIG_MOB_END_TUTORIAL "mob_end_tutorial"

#define COMSIG_MOB_NESTED "mob_nested"
12 changes: 12 additions & 0 deletions code/__DEFINES/equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -579,3 +579,15 @@ GLOBAL_LIST_INIT(uniform_categories, list(
#define PHONE_ON_BASE_UNIT_ICON_STATE "[initial(icon_state)]"
#define PHONE_OFF_BASE_UNIT_ICON_STATE "[initial(icon_state)]_ear"
#define PHONE_RINGING_ICON_STATE "[initial(icon_state)]_ring"

// Human AI flags
/// This item is classified as a healing item for the sake of human AI
#define HEALING_ITEM (1<<0)
/// This item is classified as ammunition for the sake of human AI
#define AMMUNITION_ITEM (1<<1)
/// This item is classified as a grenade for the sake of human AI
#define GRENADE_ITEM (1<<2)
/// This item is classified as a tool for the sake of human AI
#define TOOL_ITEM (1<<3)
/// This item is classified as a melee weapon for the sake of human AI
#define MELEE_WEAPON_ITEM (1<<4)
19 changes: 19 additions & 0 deletions code/__DEFINES/human_ai.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#define HUMAN_AI_HEALTHITEMS "health"
#define HUMAN_AI_AMMUNITION "ammo"
#define HUMAN_AI_GRENADES "grenades"
#define HUMAN_AI_TOOLS "tools"

#define ACTION_USING_HANDS (1<<0)
#define ACTION_USING_LEGS (1<<1)
#define ACTION_USING_MOUTH (1<<2)

/// Action is completed, delete this and move onto the next ongoing action
#define ONGOING_ACTION_COMPLETED "completed"
/// Action isn't finished, move onto the next ongoing action
#define ONGOING_ACTION_UNFINISHED "unfinished"
/// Action isn't finished, block any further actions from the AI this tick
#define ONGOING_ACTION_UNFINISHED_BLOCK "unfinished_block"

#define HUMAN_AI_MAX_PATHFINDING_RANGE 45

GLOBAL_LIST_EMPTY(ai_humans)
1 change: 1 addition & 0 deletions code/__DEFINES/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ GLOBAL_LIST_INIT(job_command_roles, JOB_COMMAND_ROLES_LIST)
#define JOB_UPP_ENGI "Sapper"
#define JOB_UPP_MEDIC "Sanitar"
#define JOB_UPP_SPECIALIST "Serzhant"
#define JOB_UPP_SNIPER "Marksman"
#define JOB_UPP_LEADER "Master Serzhant"
#define JOB_UPP_POLICE "Politsiya"
#define JOB_UPP_SUPPLY "Logistics Technician"
Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#define MODE_BYPASS_JOE (1<<11) // Toggles if ghosts can bypass Working Joe spawn limitations, does NOT bypass WL requirement. Off by default.
#define MODE_DISABLE_JOE_RESPAWN (1<<12) // Toggles if ghosts can respawn as Working Joes after dying as one when 15 minutes have passed. Off by default
#define MODE_NO_JOIN_AS_XENO (1<<13) // Toggles if players can join as xeno
#define MODE_HUMAN_AI_TWEAKS (1<<14) // Modifies some numbers to be more friendly to marines when fighting against human AI

#define ROUNDSTATUS_FOG_DOWN 1
#define ROUNDSTATUS_PODDOORS_OPEN 2
Expand Down Expand Up @@ -286,7 +287,7 @@ DEFINE_BITFIELD(whitelist_status, list(
#define FACTION_MONKEY "Monkey" // Nanu

#define FACTION_LIST_MARINE list(FACTION_MARINE, FACTION_ARMY, FACTION_NAVY)
#define FACTION_LIST_HUMANOID list(FACTION_MARINE, FACTION_PMC, FACTION_WY, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_MARSHAL, FACTION_UPP, FACTION_FREELANCER, FACTION_SURVIVOR, FACTION_NEUTRAL, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA, FACTION_ZOMBIE, FACTION_TWE)
#define FACTION_LIST_HUMANOID list(FACTION_MARINE, FACTION_PMC, FACTION_WY, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_MARSHAL, FACTION_UPP, FACTION_FREELANCER, FACTION_SURVIVOR, FACTION_NEUTRAL, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA, FACTION_ZOMBIE, FACTION_TWE, FACTION_ARMY, FACTION_NAVY)
#define FACTION_LIST_ERT_OTHER list(FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO)
#define FACTION_LIST_ERT_ALL list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY, FACTION_CLF, FACTION_CONTRACTOR, FACTION_UPP, FACTION_FREELANCER, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_MARSHAL, FACTION_TWE)
#define FACTION_LIST_WY list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY)
Expand Down
3 changes: 2 additions & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
#define SS_PRIORITY_SOUND 250
#define SS_PRIORITY_TICKER 200
#define SS_PRIORITY_XENO_AI 185
#define SS_PRIORITY_HUMAN_AI 182
#define SS_PRIORITY_NIGHTMARE 180
#define SS_PRIORITY_QUADTREE 160
#define SS_PRIORITY_CHAT 155
Expand All @@ -172,7 +173,7 @@
#define SS_PRIORITY_MOB 150
#define SS_PRIORITY_XENO 149
#define SS_PRIORITY_HUMAN 148
#define SS_PRIORITY_XENO_PATHFINDING 130
#define SS_PRIORITY_PATHFINDING 130
#define SS_PRIORITY_STAMINA 126
#define SS_PRIORITY_COMPONENT 125
#define SS_PRIORITY_NANOUI 120
Expand Down
4 changes: 2 additions & 2 deletions code/__DEFINES/xeno_ai.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define XENO_CALCULATING_PATH(X) (X in SSxeno_pathfinding.hash_path)
#define CALCULATING_PATH(X) (X in SSpathfinding.hash_path)

#define DIRECTION_CHANGE_PENALTY 2
#define NO_WEED_PENALTY 2
Expand Down Expand Up @@ -91,7 +91,7 @@ PROBABILITY CALCULATIONS ARE HERE


/// Special blockers for pathfinding or obstacle handling
#define XENO_AI_SPECIAL_BLOCKERS list(/obj/flamer_fire, /obj/vehicle/multitile, /turf/open/space, /turf/open/gm/river)
#define AI_SPECIAL_BLOCKERS list(/obj/flamer_fire, /mob/living, /obj/vehicle/multitile, /turf/open/space, /turf/open/gm/river)

// Friend-or-foe universal check
#define IS_SAME_HIVENUMBER(A,B) (A.hivenumber == B.hivenumber)
53 changes: 51 additions & 2 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
#define format_frequency(f) "[floor((f) / 10)].[(f) % 10]"

#define reverse_direction(direction) ( \
( dir & (NORTH|SOUTH) ? ~dir & (NORTH|SOUTH) : 0 ) | \
( dir & (EAST|WEST) ? ~dir & (EAST|WEST) : 0 ) \
( direction & (NORTH|SOUTH) ? ~direction & (NORTH|SOUTH) : 0 ) | \
( direction & (EAST|WEST) ? ~direction & (EAST|WEST) : 0 ) \
)

// The sane, counter-clockwise angle to turn to get from /direction/ A to /direction/ B
Expand Down Expand Up @@ -1735,6 +1735,55 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(
if(NORTHWEST)
return list(NORTHWEST, NORTH, WEST)

/// Makes a given dir cardinal. If the dir is non-cardinal, it will return both cardinal directions that make up the direction. Else, it will be a single-entry list returned.
/proc/make_dir_cardinal(direction)
switch(direction)
if(NORTH)
return list(NORTH)

if(EAST)
return list(EAST)

if(SOUTH)
return list(SOUTH)

if(WEST)
return list(WEST)

if(NORTHEAST)
return list(NORTH, EAST)

if(SOUTHEAST)
return list(EAST, SOUTH)

if(SOUTHWEST)
return list(SOUTH, WEST)

if(NORTHWEST)
return list(NORTH, WEST)

//straight directions get priority over diagonal directions in edge cases
/proc/angle2dir4ai(angle)
switch(angle) // 80/10 degrees diagonals/cardinals respectively
if (40 to 50)
return NORTHEAST
if (130 to 140)
return SOUTHEAST
if (220 to 230)
return SOUTHWEST
if (310 to 320)
return NORTHWEST
if (0 to 40)
return NORTH
if (50 to 130)
return EAST
if (140 to 220)
return SOUTH
if (230 to 310)
return WEST
else
return NORTH

/// Returns TRUE if the target is somewhere that the game should not interact with if possible
/// In this case, admin Zs and tutorial areas
/proc/should_block_game_interaction(atom/target)
Expand Down
2 changes: 1 addition & 1 deletion code/_compile_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@

//#define UNIT_TESTS //If this is uncommented, we do a single run though of the game setup and tear down process with unit tests in between

// #define TESTING
//#define TESTING
// #define REFERENCE_TRACKING
// #define GC_FAILURE_HARD_LOOKUP
74 changes: 74 additions & 0 deletions code/controllers/subsystem/human_ai.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

SUBSYSTEM_DEF(human_ai)
name = "Human AI"
priority = SS_PRIORITY_HUMAN_AI
wait = 0.2 SECONDS
/// A list of mobs scheduled to process
var/list/mob/living/carbon/human/current_run = list()

var/ai_kill = FALSE

/// List of current squads
var/list/datum/human_ai_squad/squads = list()

/// Dict of "id" : squad
var/list/squad_id_dict = list()

/// The current highest ID of any squad
var/highest_squad_id = 0

/// List of all existing orders
var/list/datum/ai_order/existing_orders = list()

var/list/human_ai_factions = list()

/datum/controller/subsystem/human_ai/Initialize()
for(var/faction_path in subtypesof(/datum/human_ai_faction))
var/datum/human_ai_faction/faction_obj = new faction_path
human_ai_factions[faction_obj.faction] = faction_obj
return SS_INIT_SUCCESS

/datum/controller/subsystem/human_ai/stat_entry(msg)
msg = "P:[length(GLOB.human_ai_brains)]"
return ..()

/datum/admins/proc/toggle_human_ai()
set name = "Toggle Human AI"
set category = "Game Master.HumanAI"

if(!check_rights(R_DEBUG))
return

SShuman_ai.ai_kill = !SShuman_ai.ai_kill
message_admins("[key_name_admin(usr)] [SShuman_ai.ai_kill? "killed" : "revived"] all human AI.")

/datum/controller/subsystem/human_ai/fire(resumed = FALSE)
if(ai_kill)
return

if(!resumed)
src.current_run = GLOB.human_ai_brains.Copy()
// Cache for sanic speed (lists are references anyways)
var/list/current_run = src.current_run
while(length(current_run))
var/datum/human_ai_brain/brain = current_run[length(current_run)]
current_run.len--
if(!QDELETED(brain) && !brain.tied_human?.client)
brain.process(wait * 0.1)

if(MC_TICK_CHECK)
return

/datum/controller/subsystem/human_ai/proc/create_new_squad()
highest_squad_id++
var/datum/human_ai_squad/new_squad = new
squads += new_squad
squad_id_dict["[highest_squad_id]"] = new_squad
return new_squad

/datum/controller/subsystem/human_ai/proc/get_squad(squad_id)
RETURN_TYPE(/datum/human_ai_squad)

if(!squad_id || !(squad_id in squad_id_dict))
return null
return squad_id_dict[squad_id]
Loading
Loading