[READY]AI latejoins

This commit is contained in:
kevinz000
2018-04-05 01:09:52 -07:00
committed by CitadelStationBot
parent 49fd917fee
commit 38ae8beefc
11 changed files with 199 additions and 83 deletions
+12 -7
View File
@@ -53,19 +53,24 @@
//Only override this proc
//H is usually a human unless an /equip override transformed it
/datum/job/proc/after_spawn(mob/living/H, mob/M)
/datum/job/proc/after_spawn(mob/living/H, mob/M, latejoin = FALSE)
//do actions on H but send messages to M as the key may not have been transferred_yet
/datum/job/proc/announce(mob/living/carbon/human/H)
if(head_announce)
announce_head(H, head_announce)
/datum/job/proc/override_latejoin_spawn(mob/living/carbon/human/H) //Return TRUE to force latejoining to not automatically place the person in latejoin shuttle/whatever.
return FALSE
//Used for a special check of whether to allow a client to latejoin as this job.
/datum/job/proc/special_check_latejoin(client/C)
return TRUE
//Don't override this unless the job transforms into a non-human (Silicons do this for example)
/datum/job/proc/equip(mob/living/carbon/human/H, visualsOnly = FALSE, announce = TRUE)
/datum/job/proc/equip(mob/living/carbon/human/H, visualsOnly = FALSE, announce = TRUE, latejoin = FALSE)
if(!H)
return 0
return FALSE
if(CONFIG_GET(flag/enforce_human_authority) && (title in GLOB.command_positions))
if(H.dna.species.id != "human")
@@ -106,8 +111,8 @@
//If the configuration option is set to require players to be logged as old enough to play certain jobs, then this proc checks that they are, otherwise it just returns 1
/datum/job/proc/player_old_enough(client/C)
if(available_in_days(C) == 0)
return 1 //Available in 0 days = available right now = player is old enough to play.
return 0
return TRUE //Available in 0 days = available right now = player is old enough to play.
return FALSE
/datum/job/proc/available_in_days(client/C)
@@ -123,7 +128,7 @@
return max(0, minimal_player_age - C.player_age)
/datum/job/proc/config_check()
return 1
return TRUE
/datum/job/proc/map_check()
return TRUE
+41 -6
View File
@@ -6,21 +6,35 @@ AI
flag = AI_JF
department_flag = ENGSEC
faction = "Station"
total_positions = 0
total_positions = 1
spawn_positions = 1
selection_color = "#ccffcc"
supervisors = "your laws"
req_admin_notify = 1
req_admin_notify = TRUE
minimal_player_age = 30
exp_requirements = 180
exp_type = EXP_TYPE_CREW
antag_rep = 20
var/do_special_check = TRUE
/datum/job/ai/equip(mob/living/carbon/human/H)
return H.AIize(FALSE)
/datum/job/ai/equip(mob/living/carbon/human/H, visualsOnly, announce, latejoin)
. = H.AIize(latejoin)
/datum/job/ai/after_spawn(mob/living/silicon/ai/AI, mob/M)
AI.rename_self("ai", M.client)
/datum/job/ai/after_spawn(mob/H, mob/M, latejoin)
. = ..()
if(latejoin)
var/obj/structure/AIcore/latejoin_inactive/lateJoinCore
for(var/obj/structure/AIcore/latejoin_inactive/P in GLOB.latejoin_ai_cores)
if(P.is_available())
lateJoinCore = P
GLOB.latejoin_ai_cores -= P
break
if(lateJoinCore)
lateJoinCore.available = FALSE
H.forceMove(lateJoinCore.loc)
qdel(lateJoinCore)
var/mob/living/silicon/ai/AI = H
AI.rename_self("ai", M.client) //If this runtimes oh well jobcode is fucked.
//we may have been created after our borg
if(SSticker.current_state == GAME_STATE_SETTING_UP)
@@ -28,6 +42,27 @@ AI
if(!R.connected_ai)
R.TryConnectToAI()
if(latejoin)
announce(AI)
/datum/job/ai/override_latejoin_spawn()
return TRUE
/datum/job/ai/special_check_latejoin(client/C)
if(!do_special_check)
return TRUE
for(var/i in GLOB.latejoin_ai_cores)
var/obj/structure/AIcore/latejoin_inactive/LAI = i
if(istype(LAI))
if(LAI.is_available())
return TRUE
return FALSE
/datum/job/ai/announce(mob/living/silicon/ai/AI)
. = ..()
var/area/A = get_area(AI)
var/turf/T = get_turf(AI)
SSticker.OnRoundstart(CALLBACK(GLOBAL_PROC, .proc/minor_announce, "[AI] has been downloaded to an empty bluespace-networked AI core at [COORD(T)], [A.name]."))
/datum/job/ai/config_check()
return CONFIG_GET(flag/allow_ai)