Job system should be working now. I had a '==' where a '&' should have been that would cause it to only work when you had one job of the same level and department selected.

The loyalty implant box now spawn in the HoS' locker and not in nullspace.
Gave the HoS' locker a secbelt.
The revolver now use the proper bullet.
Robotics spawn with their labcoat/toolbox.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2346 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
mport2004@gmail.com
2011-10-12 23:00:48 +00:00
parent fcee5ff1be
commit 67d4ceffb0
20 changed files with 146 additions and 158 deletions

View File

@@ -84,5 +84,7 @@
H.equip_if_possible(new /obj/item/clothing/under/rank/roboticist(H), H.slot_w_uniform)
H.equip_if_possible(new /obj/item/clothing/shoes/black(H), H.slot_shoes)
H.equip_if_possible(new /obj/item/device/pda/engineering(H), H.slot_belt)
H.equip_if_possible(new /obj/item/clothing/suit/labcoat(H), H.slot_wear_suit)
H.equip_if_possible(new /obj/item/clothing/gloves/black(H), H.slot_gloves)
H.equip_if_possible(new /obj/item/weapon/storage/toolbox/mechanical(H), H.slot_l_hand)
return 1

View File

@@ -17,78 +17,3 @@
proc/equip(var/mob/living/carbon/human/H)
return 1
var/datum/jobs/jobs = new/datum/jobs()
/datum/jobs
var/list/datum/job/all_jobs = list()
proc/get_all_jobs()
return all_jobs
//This proc returns all the jobs which are NOT admin only
proc/get_normal_jobs()
// var/list/datum/job/normal_jobs = list()
// for(var/datum/job/J in all_jobs)
// if(!J.admin_only)
// normal_jobs += J
// return normal_jobs
//This proc returns all the jobs which are admin only
proc/get_admin_jobs()
// var/list/datum/job/admin_jobs = list()
// for(var/datum/job/J in all_jobs)
// if(J.admin_only)
// admin_jobs += J
// return admin_jobs
//This proc returns the job datum of the job with the alias or job title given as the argument. Returns an empty string otherwise.
proc/get_job(var/alias)
// for(var/datum/job/J in all_jobs)
// if(J.is_job_alias(alias))
// return J
return ""
//This proc returns a string with the default job title for the job with the given alias. Returns an empty string otherwise.
proc/get_job_title(var/alias)
// for(var/datum/job/J in all_jobs)
// if(J.is_job_alias(alias))
// return J.title
return ""
/*
//This proc returns all the job datums of the workers whose boss has the alias provided. (IE Engineer under Chief Engineer, etc.)
proc/get_jobs_under(var/boss_alias)
var/boss_title = get_job_title(boss_alias)
var/list/datum/job/employees = list()
for(var/datum/job/J in all_jobs)
if(boss_title in J.bosses)
employees += J
return employees*/
//This proc returns the chosen vital and high priority jobs that the person selected. It goes from top to bottom of the list, until it finds a job which does not have such priority.
//Example: Choosing (in this order): CE, Captain, Engineer, RD will only return CE and Captain, as RD is assumed as being an unwanted choice.
//This proc is used in the allocation algorithm when deciding vital and high priority jobs.
/* proc/get_prefered_high_priority_jobs()
var/list/datum/job/hp_jobs = list()
for(var/datum/job/J in all_jobs)
if(J.assignment_priority == HIGH_PRIORITY_JOB || J.assignment_priority == VITAL_PRIORITY_JOB)
hp_jobs += J
else
break
return hp_jobs
//If only priority is given, it will return the jobs of only that priority, if end_priority is set it will return the jobs with their priority higher or equal to var/priority and lower or equal to end_priority. end_priority must be higher than 0.
proc/get_jobs_by_priority(var/priority, var/end_priority = 0)
var/list/datum/job/priority_jobs = list()
if(end_priority)
if(end_priority < priority)
return
for(var/datum/job/J in all_jobs)
if(J.assignment_priority >= priority && J.assignment_priority <= end_priority)
priority_jobs += J
else
for(var/datum/job/J in all_jobs)
if(J.assignment_priority == priority)
priority_jobs += J
return priority_jobs*/

View File

@@ -6,6 +6,8 @@ var/global/datum/controller/occupations/job_master
list/occupations = list()
//Players who need jobs
list/unassigned = list()
//Debug info
list/job_debug = list()
proc/SetupOccupations(var/faction = "Station")
@@ -22,38 +24,53 @@ var/global/datum/controller/occupations/job_master
return 1
proc/GetJob(var/name)
if(!name) return null
proc/Debug(var/text)
if(!Debug2) return 0
job_debug.Add(text)
// world << text
return 1
proc/GetJob(var/rank)
if(!rank) return null
for(var/datum/job/J in occupations)
if(!J) continue
if(J.title == name) return J
if(J.title == rank) return J
return null
proc/AssignRole(var/mob/new_player/player, var/job, var/latejoin = 0)
if((player) && (player.mind) && (job))
var/datum/job/J = GetJob(job)
if(jobban_isbanned(player, job)) return 0
if( J && ( (J.current_positions < J.total_positions) || ((J.current_positions < J.spawn_positions) && !latejoin)) )
player.mind.assigned_role = J.title
proc/AssignRole(var/mob/new_player/player, var/rank, var/latejoin = 0)
Debug("Running AR, Player: [player], Rank: [rank], LJ: [latejoin]")
if((player) && (player.mind) && (rank))
var/datum/job/job = GetJob(rank)
if(!job) return 0
if(jobban_isbanned(player, rank)) return 0
var/position_limit = job.total_positions
if(!latejoin)
position_limit = job.spawn_positions
if(job.current_positions < position_limit)
Debug("Player: [player] is now Rank: [rank], JCP:[job.current_positions], JPL:[position_limit]")
player.mind.assigned_role = rank
unassigned -= player
J.current_positions++
job.current_positions++
return 1
Debug("AR has failed, Player: [player], Rank: [rank]")
return 0
proc/FindOccupationCandidates(datum/job/job, level, flag)
Debug("Running FOC, Job: [job], Level: [level], Flag: [flag]")
var/list/candidates = list()
for(var/mob/new_player/player in unassigned)
if(jobban_isbanned(player, job.title)) continue
if(flag && (!player.preferences.be_special & flag)) continue
switch(level)
if(1)
if(job.flag == player.preferences.GetJobDepartment(job, level)) candidates += player
if(2)
if(job.flag == player.preferences.GetJobDepartment(job, level)) candidates += player
if(3)
if(job.flag == player.preferences.GetJobDepartment(job, level)) candidates += player
if(jobban_isbanned(player, job.title))
Debug("FOC isbanned failed, Player: [player]")
continue
if(flag && (!player.preferences.be_special & flag))
Debug("FOC flag failed, Player: [player], Flag: [flag], ")
continue
if(player.preferences.GetJobDepartment(job, level) & job.flag)
Debug("FOC pass, Player: [player], Level:[level]")
candidates += player
return candidates
@@ -115,6 +132,7 @@ var/global/datum/controller/occupations/job_master
**/
proc/DivideOccupations()
//Setup new player list and get the jobs list
Debug("Running DO")
SetupOccupations()
//Get the players who are ready
@@ -122,41 +140,57 @@ var/global/datum/controller/occupations/job_master
if((player) && (player.client) && (player.ready) && (player.mind) && (!player.mind.assigned_role))
unassigned += player
Debug("DO, Len: [unassigned.len]")
if(unassigned.len == 0) return 0
//Shuffle players and jobs
unassigned = shuffle(unassigned)
// occupations = shuffle(occupations) check and see if we can do this one
//Select one head
FillHeadPosition()
//Check for an AI
FillAIPosition()
//Assistants are checked first
Debug("DO, Running Assistant Check 1")
var/datum/job/assist = new /datum/job/assistant()
var/list/assistant_candidates = FindOccupationCandidates(assist, 3)
Debug("AC1, Candidates: [assistant_candidates.len]")
for(var/mob/new_player/player in assistant_candidates)
Debug("AC1 pass, Player: [player]")
AssignRole(player, "Assistant")
assistant_candidates -= player
Debug("DO, AC1 end")
//Select one head
Debug("DO, Running Head Check")
FillHeadPosition()
Debug("DO, Head Check end")
//Check for an AI
Debug("DO, Running AI Check")
FillAIPosition()
Debug("DO, AI Check end")
//Other jobs are now checked
Debug("DO, Running Standard Check")
for(var/level = 1 to 3)
for(var/datum/job/job in occupations)
Debug("Checking job: [job]")
if(!job) continue
if(!unassigned.len) break
if(job.current_positions >= job.spawn_positions) continue
var/list/candidates = FindOccupationCandidates(job, level)
while(candidates.len && (job.current_positions < job.spawn_positions))
var/mob/new_player/candidate = pick(candidates)
if(!AssignRole(candidate, job.title))
Debug("Selcted: [candidate], for: [job.title]")
AssignRole(candidate, job.title)
candidates -= candidate
Debug("DO, Standard Check end")
Debug("DO, Running AC2")
for(var/mob/new_player/player in unassigned)
Debug("AC2 Assistant located, Player: [player]")
AssignRole(player, "Assistant")
return 1
proc/EquipRank(var/mob/living/carbon/human/H, var/rank, var/joined_late)
proc/EquipRank(var/mob/living/carbon/human/H, var/rank, var/joined_late = 0)
if(!H) return 0
var/datum/job/job = GetJob(rank)
if(job)

View File

@@ -264,7 +264,7 @@ var/global/list/autolathe_recipes_hidden = list( \
new /obj/item/device/radio/electropack(), \
new /obj/item/weapon/weldingtool/largetank(), \
new /obj/item/weapon/handcuffs(), \
new /obj/item/ammo_magazine(), \
new /obj/item/ammo_magazine/a357(), \
new /obj/item/ammo_casing/shotgun(), \
new /obj/item/ammo_casing/shotgun/dart(), \
/* new /obj/item/weapon/shield/riot(), */ \

View File

@@ -244,7 +244,7 @@ Pod/Blast Doors computer
carddesc += "</form>"
carddesc += "<b>Assignment:</b> "
jobs = "<span id='alljobsslot'><a href='#' onclick='showAll()'>[target_rank]</a></span>" //CHECK THIS
var/jobs = "<span id='alljobsslot'><a href='#' onclick='showAll()'>[target_rank]</a></span>" //CHECK THIS
var/accesses = ""
if(istype(src,/obj/machinery/computer/card/centcom))

View File

@@ -6,16 +6,16 @@
New()
..()
sleep(2)
new /obj/item/clothing/suit/captunic( src )
new /obj/item/clothing/head/helmet/cap( src )
new /obj/item/clothing/under/rank/captain( src )
new /obj/item/clothing/suit/armor/vest( src )
new /obj/item/clothing/gloves/captain( src )
new /obj/item/clothing/head/helmet/swat( src )
new /obj/item/clothing/shoes/brown( src )
new /obj/item/device/radio/headset/heads/captain( src )
new /obj/item/clothing/suit/captunic(src)
new /obj/item/clothing/head/helmet/cap(src)
new /obj/item/clothing/under/rank/captain(src)
new /obj/item/clothing/suit/armor/vest(src)
new /obj/item/clothing/gloves/captain(src)
new /obj/item/clothing/head/helmet/swat(src)
new /obj/item/clothing/shoes/brown(src)
new /obj/item/device/radio/headset/heads/captain(src)
new /obj/item/weapon/reagent_containers/food/drinks/flask(src)
new /obj/item/weapon/gun/energy/gun( src )
new /obj/item/weapon/gun/energy/gun(src)
return
@@ -55,12 +55,13 @@
new /obj/item/clothing/head/helmet(src)
new /obj/item/device/radio/headset/heads/hos(src)
new /obj/item/weapon/shield/riot(src)
new /obj/item/weapon/storage/lockbox/loyalty(src)
new /obj/item/weapon/storage/flashbang_kit(src)
new /obj/item/weapon/storage/belt/security(src)
new /obj/item/weapon/melee/baton(src)
new /obj/item/weapon/gun/energy/gun(src)
new /obj/item/device/flash(src)
new /obj/item/clothing/glasses/sunglasses/sechud(src)
new /obj/item/weapon/storage/flashbang_kit(src)
new /obj/item/weapon/storage/lockbox/loyalty()
new /obj/item/weapon/melee/baton(src)
return
@@ -77,8 +78,8 @@
new /obj/item/clothing/suit/armor/vest(src)
new /obj/item/clothing/head/helmet/warden(src)
new /obj/item/device/radio/headset/headset_sec(src)
new /obj/item/weapon/storage/belt/security(src)
new /obj/item/weapon/storage/flashbang_kit(src)
new /obj/item/weapon/storage/belt/security(src)
new /obj/item/weapon/melee/baton(src)
new /obj/item/weapon/gun/energy/taser(src)
new /obj/item/clothing/glasses/sunglasses/sechud(src)

View File

@@ -98,7 +98,7 @@
if("revolver_ammo")
if (uses >= 2)
uses -= 2
new /obj/item/ammo_magazine(get_turf(hostpda))
new /obj/item/ammo_magazine/a357(get_turf(hostpda))
if("suffocation_revolver_ammo")
if (uses >= 3)
uses -= 3

View File

@@ -84,7 +84,7 @@ Deathnettle
user.take_organ_damage(0,force)
/obj/item/weapon/grown/nettle/afterattack(atom/A as mob|obj, mob/user as mob)
if (force > 0)
if(force > 0)
force -= rand(1,(force/3)+1) // When you whack someone with it, leaves fall off
else
usr << "All the leaves have fallen off the nettle from violent whacking."

View File

@@ -92,7 +92,7 @@ SYNDICATE UPLINK
if("revolver_ammo")
if (src.uses >= 2)
src.uses -= 2
new /obj/item/ammo_magazine(get_turf(src))
new /obj/item/ammo_magazine/a357(get_turf(src))
if("suffocation_revolver_ammo")
if (uses >= 3)
uses -= 3

View File

@@ -280,7 +280,7 @@
if ("guns")
new /obj/item/weapon/gun/projectile(src)
new /obj/item/ammo_magazine(src)
new /obj/item/ammo_magazine/a357(src)
new /obj/item/weapon/card/emag(src)
new /obj/item/weapon/plastique(src)
return

View File

@@ -1443,6 +1443,16 @@
for(var/sig in lawchanges)
dat += "[sig]<BR>"
usr << browse(dat, "window=lawchanges;size=800x500")
if("list_job_debug")
var/dat = "<B>Job Debug info.</B><HR>"
if(job_master)
for(var/line in job_master.job_debug)
dat += "[line]<BR>"
dat+= "*******<BR><BR>"
for(var/datum/job/job in job_master.occupations)
if(!job) continue
dat += "job: [job.title], current_positions: [job.current_positions], total_positions: [job.total_positions] <BR>"
usr << browse(dat, "window=jobdebug;size=600x500")
if("check_antagonist")
if (ticker && ticker.current_state >= GAME_STATE_PLAYING)
var/dat = "<html><head><title>Round Status</title></head><body><h1><B>Round Status</B></h1>"
@@ -1932,6 +1942,7 @@
dat += {"
<B>Coder Secrets</B><BR>
<BR>
<A href='?src=\ref[src];secretsadmin=list_job_debug'>Show Job Debug</A><BR>
<A href='?src=\ref[src];secretscoder=spawn_objects'>Admin Log</A><BR>
"}
usr << browse(dat, "window=secrets")

View File

@@ -386,9 +386,10 @@
verbs -= /client/proc/toggleprayers
verbs -= /client/proc/jump_to_dead_group
verbs -= /client/proc/Blobize
verbs += /client/proc/toggle_clickproc //TODO ERRORAGE (Temporary proc while the enw clickproc is being tested)
verbs -= /client/proc/toggle_clickproc //TODO ERRORAGE (Temporary proc while the enw clickproc is being tested)
verbs -= /client/proc/toggle_hear_deadcast
verbs -= /client/proc/toggle_hear_radio
verbs -= /client/proc/tension_report
return

View File

@@ -426,7 +426,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
M.equip_if_possible(new /obj/item/weapon/cloaking_device(M), M.slot_r_store)
M.equip_if_possible(new /obj/item/weapon/gun/projectile(M), M.slot_r_hand)
M.equip_if_possible(new /obj/item/ammo_magazine(M), M.slot_l_store)
M.equip_if_possible(new /obj/item/ammo_magazine/a357(M), M.slot_l_store)
if ("tournament chef") //Steven Seagal FTW
M.equip_if_possible(new /obj/item/clothing/under/rank/chef(M), M.slot_w_uniform)
@@ -545,7 +545,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
sec_briefcase.contents += new /obj/item/weapon/spacecash/c1000
sec_briefcase.contents += new /obj/item/weapon/gun/energy/crossbow
sec_briefcase.contents += new /obj/item/weapon/gun/projectile/mateba
sec_briefcase.contents += new /obj/item/ammo_magazine
sec_briefcase.contents += new /obj/item/ammo_magazine/a357
sec_briefcase.contents += new /obj/item/weapon/plastique
M.equip_if_possible(sec_briefcase, M.slot_l_hand)
@@ -607,7 +607,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
M.equip_if_possible(new /obj/item/clothing/head/centhat(M), M.slot_head)
M.equip_if_possible(new /obj/item/weapon/gun/projectile/mateba(M), M.slot_belt)
M.equip_if_possible(new /obj/item/weapon/zippo(M), M.slot_r_store)
M.equip_if_possible(new /obj/item/ammo_magazine(M), M.slot_l_store)
M.equip_if_possible(new /obj/item/ammo_magazine/a357(M), M.slot_l_store)
var/obj/item/weapon/card/id/W = new(M)
W.name = "[M.real_name]'s ID Card"

View File

@@ -160,7 +160,7 @@ var/global/sent_strike_team = 0
equip_if_possible(new /obj/item/weapon/storage/backpack/security(src), slot_back)
equip_if_possible(new /obj/item/weapon/storage/box(src), slot_in_backpack)
equip_if_possible(new /obj/item/ammo_magazine(src), slot_in_backpack)
equip_if_possible(new /obj/item/ammo_magazine/a357(src), slot_in_backpack)
equip_if_possible(new /obj/item/weapon/storage/firstaid/regular(src), slot_in_backpack)
equip_if_possible(new /obj/item/weapon/storage/flashbang_kit(src), slot_in_backpack)
equip_if_possible(new /obj/item/device/flashlight(src), slot_in_backpack)

View File

@@ -208,34 +208,32 @@
new_player_panel()
/* proc/IsJobAvailable(rank)
if(((occupations[rank] < 0) || (countJob(rank) < occupations[rank])) && !jobban_isbanned(src,rank))
proc/IsJobAvailable(rank)
var/datum/job/job = job_master.GetJob(rank)
if(!job) return 0
if(job.current_positions >= job.total_positions) return 0
if(jobban_isbanned(src,rank)) return 0
return 1
else
return 0*/
proc/AttemptLateSpawn(rank)
var/datum/job/job = job_master.GetJob(rank)
if(job && (job.current_positions < job.total_positions))
if(!IsJobAvailable(rank))
src << alert("[rank] is not available. Please try another.")
return 0
var/mob/living/carbon/human/character = create_character()
var/icon/char_icon = getFlatIcon(character,0)//We're creating out own cache so it's not needed.
if(job_master.AssignRole(character, rank, 1))
job_master.AssignRole(character, rank, 1)
job_master.EquipRank(character, rank, 1)
if(character.mind)
if(character.mind.assigned_role != "Cyborg")
ManifestLateSpawn(character,char_icon)
if(ticker)
character.loc = pick(latejoin)
AnnounceArrival(character, rank)
if(character.mind)
if(character.mind.assigned_role == "Cyborg")
character.Robotize()
else//Adds late joiners to minds so they can be linked to objectives.
if(character.mind.assigned_role != "Cyborg")
ManifestLateSpawn(character,char_icon)
ticker.minds += character.mind//Cyborgs and AIs handle this in the transform proc.
del(src)
else
src << alert("[rank] is not available. Please try another.")
character.Robotize()
del(src)
proc/AnnounceArrival(var/mob/living/carbon/human/character, var/rank)
@@ -319,7 +317,7 @@
var/dat = "<html><body>"
dat += "Choose from the following open positions:<br>"
for(var/datum/job/job in job_master.occupations)
if(job && ((job.title == "Assistant") || (job.current_positions < job.total_positions)))
if(job && IsJobAvailable(job.title))
dat += "<a href='byond://?src=\ref[src];SelectedJob=[job.title]'>[job.title]</a><br>"
src << browse(dat, "window=latechoices;size=300x640;can_close=0")

View File

@@ -337,6 +337,7 @@ datum/preferences
else if(link_tags["job"])
SetJob(user, link_tags["job"])
else
if(job_master)
SetChoices(user)
return 1

View File

@@ -1,14 +1,14 @@
/obj/item/ammo_casing
name = "bullet casing"
desc = "A .357 bullet casing."
desc = "A bullet casing."
icon = 'ammo.dmi'
icon_state = "s-casing"
flags = FPRINT | TABLEPASS | CONDUCT | ONBELT
throwforce = 1
w_class = 1.0
var
caliber = "357" //Which kind of guns it can be loaded into
projectile_type = "/obj/item/projectile"//The bullet type to create when New() is called
caliber = "" //Which kind of guns it can be loaded into
projectile_type = ""//The bullet type to create when New() is called
obj/item/projectile/BB = null //The loaded bullet
@@ -46,7 +46,7 @@
//Boxes of ammo
/obj/item/ammo_magazine
name = "ammo box (.357)"
desc = "A box of .357 ammo"
desc = "A box of ammo"
icon_state = "357"
icon = 'ammo.dmi'
flags = FPRINT | TABLEPASS | CONDUCT | ONBELT

View File

@@ -1,3 +1,12 @@
/obj/item/ammo_magazine/a357
name = "ammo box (.357)"
desc = "A box of .357 ammo"
icon_state = "357"
ammo_type = "/obj/item/ammo_casing/a357"
max_ammo = 8
/obj/item/ammo_magazine/a75
name = "ammo magazine (.75)"
icon_state = "gyro"

View File

@@ -1,3 +1,9 @@
/obj/item/ammo_casing/a357
desc = "A .357 bullet casing."
caliber = "357"
projectile_type = "/obj/item/projectile/bullet"
/obj/item/ammo_casing/a418
desc = "A .418 bullet casing."
caliber = "357"

View File

@@ -8,7 +8,7 @@
m_amt = 1000
var
ammo_type = "/obj/item/ammo_casing"
ammo_type = "/obj/item/ammo_casing/a357"
list/loaded = list()
max_shells = 7
load_method = 0 //0 = Single shells or quick loader, 1 = magazine