[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

View File

@@ -66,18 +66,18 @@ SUBSYSTEM_DEF(job)
SetupOccupations()
return type_occupations[jobtype]
/datum/controller/subsystem/job/proc/AssignRole(mob/dead/new_player/player, rank, latejoin=0)
/datum/controller/subsystem/job/proc/AssignRole(mob/dead/new_player/player, rank, latejoin = FALSE)
Debug("Running AR, Player: [player], Rank: [rank], LJ: [latejoin]")
if(player && player.mind && rank)
var/datum/job/job = GetJob(rank)
if(!job)
return 0
return FALSE
if(jobban_isbanned(player, rank))
return 0
return FALSE
if(!job.player_old_enough(player.client))
return 0
return FALSE
if(job.required_playtime_remaining(player.client))
return 0
return FALSE
var/position_limit = job.total_positions
if(!latejoin)
position_limit = job.spawn_positions
@@ -85,9 +85,9 @@ SUBSYSTEM_DEF(job)
player.mind.assigned_role = rank
unassigned -= player
job.current_positions++
return 1
return TRUE
Debug("AR has failed, Player: [player], Rank: [rank]")
return 0
return FALSE
/datum/controller/subsystem/job/proc/FindOccupationCandidates(datum/job/job, level, flag)
@@ -224,6 +224,8 @@ SUBSYSTEM_DEF(job)
if(SSticker.triai)
for(var/datum/job/ai/A in occupations)
A.spawn_positions = 3
for(var/obj/effect/landmark/start/ai/secondary/S in GLOB.start_landmarks_list)
S.latejoin_active = TRUE
//Get the players who are ready
for(var/mob/dead/new_player/player in GLOB.player_list)
@@ -359,7 +361,7 @@ SUBSYSTEM_DEF(job)
return 1
//Gives the player the stuff he should have with his rank
/datum/controller/subsystem/job/proc/EquipRank(mob/M, rank, joined_late=0)
/datum/controller/subsystem/job/proc/EquipRank(mob/M, rank, joined_late = FALSE)
var/mob/dead/new_player/N
var/mob/living/H
if(!joined_late)
@@ -382,6 +384,7 @@ SUBSYSTEM_DEF(job)
if(locate(/mob/living) in sloc.loc)
continue
S = sloc
sloc.used = TRUE
break
if(length(GLOB.jobspawn_overrides[rank]))
S = pick(GLOB.jobspawn_overrides[rank])
@@ -396,9 +399,13 @@ SUBSYSTEM_DEF(job)
H.mind.assigned_role = rank
if(job)
<<<<<<< HEAD
if(!job.dresscodecompliant)// CIT CHANGE - dress code compliance
equip_loadout(N, H) // CIT CHANGE - allows players to spawn with loadout items
var/new_mob = job.equip(H)
=======
var/new_mob = job.equip(H, null, null, joined_late)
>>>>>>> 0c27e22... Latejoin Silicons (#36560)
if(ismob(new_mob))
H = new_mob
if(!joined_late)
@@ -406,23 +413,28 @@ SUBSYSTEM_DEF(job)
else
M = H
SSpersistence.antag_rep_change[M.client.ckey] += job.antag_rep
SSpersistence.antag_rep_change[M.client.ckey] += job.antag_rep
to_chat(M, "<b>You are the [rank].</b>")
to_chat(M, "<b>As the [rank] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")
to_chat(M, "<b>To speak on your departments radio, use the :h button. To see others, look closely at your headset.</b>")
if(job.req_admin_notify)
to_chat(M, "<b>You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via adminhelp.</b>")
if(CONFIG_GET(number/minimal_access_threshold))
to_chat(M, "<FONT color='blue'><B>As this station was initially staffed with a [CONFIG_GET(flag/jobs_have_minimal_access) ? "full crew, only your job's necessities" : "skeleton crew, additional access may"] have been added to your ID card.</B></font>")
if(job)
to_chat(M, "<b>As the [rank] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")
to_chat(M, "<b>To speak on your departments radio, use the :h button. To see others, look closely at your headset.</b>")
if(job.req_admin_notify)
to_chat(M, "<b>You are playing a job that is important for Game Progression. If you have to disconnect, please notify the admins via adminhelp.</b>")
if(CONFIG_GET(number/minimal_access_threshold))
to_chat(M, "<FONT color='blue'><B>As this station was initially staffed with a [CONFIG_GET(flag/jobs_have_minimal_access) ? "full crew, only your job's necessities" : "skeleton crew, additional access may"] have been added to your ID card.</B></font>")
if(job && H)
<<<<<<< HEAD
if(job.dresscodecompliant)// CIT CHANGE - dress code compliance
equip_loadout(N, H) // CIT CHANGE - allows players to spawn with loadout items
job.after_spawn(H, M)
equip_loadout(N, H, TRUE)//CIT CHANGE - makes players spawn with in-backpack loadout items properly. A little hacky but it works
//handle_roundstart_items(H, M.ckey, H.mind.assigned_role, H.mind.special_role) //CIT CHANGE - makes donators spawn with their items. This can safely be commented out when all of the donator items are migrated to the loadout system
=======
job.after_spawn(H, M, joined_late)
>>>>>>> 0c27e22... Latejoin Silicons (#36560)
return H

View File

@@ -323,11 +323,6 @@ SUBSYSTEM_DEF(ticker)
mode.post_setup()
GLOB.start_state = new /datum/station_state()
GLOB.start_state.count()
//Cleanup some stuff
for(var/obj/effect/landmark/start/S in GLOB.landmarks_list)
//Deleting Startpoints but we need the ai point to AI-ize people later
if(S.delete_after_roundstart)
qdel(S)
//assign crew objectives and generate miscreants
if(CONFIG_GET(flag/allow_extended_miscreants) && GLOB.master_mode == "extended")
@@ -341,6 +336,14 @@ SUBSYSTEM_DEF(ticker)
send2irc("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]:" : "of"] [hide_mode ? "secret":"[mode.name]"] has started[allmins.len ? ".":" with no active admins online!"]")
setup_done = TRUE
for(var/i in GLOB.start_landmarks_list)
var/obj/effect/landmark/start/S = i
if(istype(S)) //we can not runtime here. not in this important of a proc.
S.after_round_start()
else
stack_trace("[S] [S.type] found in start landmarks list, which isn't a start landmark!")
//These callbacks will fire after roundstart key transfer
/datum/controller/subsystem/ticker/proc/OnRoundstart(datum/callback/cb)
if(!HasRoundStarted())