Few changes to how round start works.

Station Roles are picked before Syndie Roles unless it is nuke or wizard
People should no longer spawn in space because they did not get a job.
Heads and such should no longer get a role they should not have.
Rounds now have a minimum number of players required for it to start up.
Also the atmos pipes should stop exploding all over the place.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1974 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
mport2004@gmail.com
2011-08-03 05:59:10 +00:00
parent 7c7252fab3
commit 0f15fd1567
18 changed files with 240 additions and 350 deletions

View File

@@ -21,9 +21,9 @@ datum/pipe_network
update = 0 update = 0
reconcile_air() //equalize_gases(gases) reconcile_air() //equalize_gases(gases)
//Give pipelines their process call for pressure checking and what not //Give pipelines their process call for pressure checking and what not. Have to remove pressure checks for the time being as pipes dont radiate heat - Mport
for(var/datum/pipeline/line_member in line_members) //for(var/datum/pipeline/line_member in line_members)
line_member.process() // line_member.process()
proc/build_network(obj/machinery/atmospherics/start_normal, obj/machinery/atmospherics/reference) proc/build_network(obj/machinery/atmospherics/start_normal, obj/machinery/atmospherics/reference)
//Purpose: Generate membership roster //Purpose: Generate membership roster

View File

@@ -18,7 +18,7 @@ datum/pipeline
..() ..()
proc/process() proc/process()//This use to be called called from the pipe networks
//Check to see if pressure is within acceptable limits //Check to see if pressure is within acceptable limits
var/pressure = air.return_pressure() var/pressure = air.return_pressure()

View File

@@ -1,10 +1,12 @@
/datum/game_mode/blob /datum/game_mode/blob
name = "blob" name = "blob"
config_tag = "blob" config_tag = "blob"
required_players = 0
var/stage = 0 var/stage = 0
var/next_stage = 0 var/next_stage = 0
/datum/game_mode/blob/announce() /datum/game_mode/blob/announce()
world << "<B>The current game mode is - <font color='green'>Blob</font>!</B>" world << "<B>The current game mode is - <font color='green'>Blob</font>!</B>"
world << "<B>A dangerous alien organism is rapidly spreading throughout the station!</B>" world << "<B>A dangerous alien organism is rapidly spreading throughout the station!</B>"

View File

@@ -5,6 +5,8 @@
/datum/game_mode/changeling /datum/game_mode/changeling
name = "changeling" name = "changeling"
config_tag = "changeling" config_tag = "changeling"
restricted_jobs = list("AI", "Cyborg")
required_players = 15
var var
const const
@@ -52,20 +54,24 @@
world << "<B>The current game mode is - Changeling!</B>" world << "<B>The current game mode is - Changeling!</B>"
world << "<B>There is an alien changeling on the station. Do not let the changeling succeed!</B>" world << "<B>There is an alien changeling on the station. Do not let the changeling succeed!</B>"
/datum/game_mode/changeling/can_start() /*/datum/game_mode/changeling/can_start()
for(var/mob/new_player/P in world) for(var/mob/new_player/P in world)
if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) if(P.client && P.ready && !jobban_isbanned(P, "Syndicate"))
return 1 return 1
return 0 return 0*/
/datum/game_mode/changeling/pre_setup() /datum/game_mode/changeling/pre_setup()
var/list/datum/mind/possible_changelings = get_players_for_role(BE_CHANGELING) var/list/datum/mind/possible_changelings = get_players_for_role(BE_CHANGELING)
for(var/datum/mind/player in possible_changelings)
for(var/job in restricted_jobs)//Removing robots from the list
if(player.assigned_role == job)
possible_changelings -= player
if(possible_changelings.len>0) if(possible_changelings.len>0)
var/datum/mind/changeling = pick(possible_changelings) var/datum/mind/changeling = pick(possible_changelings)
//possible_changelings-=changeling //possible_changelings-=changeling
changelings += changeling changelings += changeling
var/mob/new_player/player = changeling.current
player.jobs_restricted_by_gamemode = nonhuman_positions
modePlayer += changelings modePlayer += changelings
return 1 return 1
else else

View File

@@ -2,28 +2,34 @@
name = "traitor+changeling" name = "traitor+changeling"
config_tag = "traitorchan" config_tag = "traitorchan"
traitors_possible = 3 //hard limit on traitors if scaling is turned off traitors_possible = 3 //hard limit on traitors if scaling is turned off
restricted_jobs = list("AI", "Cyborg")
required_players = 20
/datum/game_mode/traitor/changeling/announce() /datum/game_mode/traitor/changeling/announce()
world << "<B>The current game mode is - Traitor+Changeling!</B>" world << "<B>The current game mode is - Traitor+Changeling!</B>"
world << "<B>There is an alien creature on the station along with some syndicate operatives out for their own gain! Do not let the changeling and the traitors succeed!</B>" world << "<B>There is an alien creature on the station along with some syndicate operatives out for their own gain! Do not let the changeling and the traitors succeed!</B>"
/datum/game_mode/traitor/changeling/can_start() /*/datum/game_mode/traitor/changeling/can_start()
var/count = 0 var/count = 0
for(var/mob/new_player/P in world) for(var/mob/new_player/P in world)
if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) if(P.client && P.ready && !jobban_isbanned(P, "Syndicate"))
count++ count++
if (count==2) if (count==2)
return 1 return 1
return 0 return 0*/
/datum/game_mode/traitor/changeling/pre_setup() /datum/game_mode/traitor/changeling/pre_setup()
var/list/datum/mind/possible_changelings = get_players_for_role(BE_CHANGELING) var/list/datum/mind/possible_changelings = get_players_for_role(BE_CHANGELING)
for(var/datum/mind/player in possible_changelings)
for(var/job in restricted_jobs)//Removing robots from the list
if(player.assigned_role == job)
possible_changelings -= player
if(possible_changelings.len>0) if(possible_changelings.len>0)
var/datum/mind/changeling = pick(possible_changelings) var/datum/mind/changeling = pick(possible_changelings)
//possible_changelings-=changeling //possible_changelings-=changeling
changelings += changeling changelings += changeling
var/mob/new_player/player = changeling.current
player.jobs_restricted_by_gamemode = nonhuman_positions
modePlayer += changelings modePlayer += changelings
return ..() return ..()
else else

View File

@@ -1,9 +1,10 @@
/datum/game_mode /datum/game_mode
var/list/datum/mind/cult = list() var
list/datum/mind/cult = list()
list/allwords = list("travel","self","see","hell","blood","join","tech","destroy", "other", "hide")
var/list/allwords = list("travel","self","see","hell","blood","join","tech","destroy", "other", "hide")
/proc/iscultist(mob/living/carbon/M as mob) /proc/iscultist(mob/living/carbon/M as mob)
return istype(M) && M.mind && ticker && ticker.mode && (M.mind in ticker.mode.cult) return istype(M) && M.mind && ticker && ticker.mode && (M.mind in ticker.mode.cult)
@@ -14,9 +15,12 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
!(mind.assigned_role in head_positions) && \ !(mind.assigned_role in head_positions) && \
!(mind.assigned_role in list("Security Officer", "Detective", "Chaplain", "Warden")) !(mind.assigned_role in list("Security Officer", "Detective", "Chaplain", "Warden"))
/datum/game_mode/cult /datum/game_mode/cult
name = "cult" name = "cult"
config_tag = "cult" config_tag = "cult"
restricted_jobs = list("Chaplain", "Security Officer", "Warden", "Detective", "AI", "Cyborg", "Captain", "Head of Personnel", "Head of Security", "Chief Engineer", "Research Director", "Chief Medical Officer")
required_players = 15
var/datum/mind/sacrifice_target = null var/datum/mind/sacrifice_target = null
var/finished = 0 var/finished = 0
@@ -24,7 +28,6 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds) var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds)
var/list/startwords = list("blood","join","self","hell") var/list/startwords = list("blood","join","self","hell")
//var/list/startwords = list("travel","blood","join","hell","self","see")
var/list/objectives = list() var/list/objectives = list()
@@ -35,18 +38,22 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
var/const/max_cultists_to_start = 4 var/const/max_cultists_to_start = 4
var/acolytes_survived = 0 var/acolytes_survived = 0
/datum/game_mode/cult/announce() /datum/game_mode/cult/announce()
world << "<B>The current game mode is - Cult!</B>" world << "<B>The current game mode is - Cult!</B>"
world << "<B>Some crewmembers are attempting to start a cult!<BR>\nCultists - complete your objectives. Convert crewmembers to your cause by using the convert rune. Remember - there is no you, there is only the cult.<BR>\nPersonnel - Do not let the cult succeed in its mission. Brainwashing them with the chaplain's bible reverts them to whatever CentCom-allowed faith they had.</B>" world << "<B>Some crewmembers are attempting to start a cult!<BR>\nCultists - complete your objectives. Convert crewmembers to your cause by using the convert rune. Remember - there is no you, there is only the cult.<BR>\nPersonnel - Do not let the cult succeed in its mission. Brainwashing them with the chaplain's bible reverts them to whatever CentCom-allowed faith they had.</B>"
/datum/game_mode/cult/can_start()
/*/datum/game_mode/cult/can_start()
var/list/cultists_possible = get_players_for_role(BE_CULTIST) var/list/cultists_possible = get_players_for_role(BE_CULTIST)
if (cultists_possible.len < min_cultists_to_start) if (cultists_possible.len < min_cultists_to_start)
return 0 return 0
var/non_cultists = num_players() - min(max_cultists_to_start,cultists_possible.len) var/non_cultists = num_players() - min(max_cultists_to_start,cultists_possible.len)
if (non_cultists < 1) if (non_cultists < 1)
return 0 return 0
return 1 return 1*/
/datum/game_mode/cult/pre_setup() /datum/game_mode/cult/pre_setup()
if(prob(50)) if(prob(50))
@@ -55,19 +62,23 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
else else
objectives += "eldergod" objectives += "eldergod"
objectives += "sacrifice" objectives += "sacrifice"
var/list/cultists_possible = get_players_for_role(BE_CULTIST) var/list/cultists_possible = get_players_for_role(BE_CULTIST)
for(var/datum/mind/player in cultists_possible)
for(var/job in restricted_jobs)//Removing heads and such from the list
if(player.assigned_role == job)
cultists_possible -= player
for(var/cultists_number = 1 to max_cultists_to_start) for(var/cultists_number = 1 to max_cultists_to_start)
if(!cultists_possible.len)
break
var/datum/mind/cultist = pick(cultists_possible) var/datum/mind/cultist = pick(cultists_possible)
cultists_possible -= cultist cultists_possible -= cultist
cult += cultist cult += cultist
var/mob/new_player/player = cultist.current
player.jobs_restricted_by_gamemode = list("Chaplain", "Security Officer", "Warden", "Detective")+nonhuman_positions+head_positions
return (cult.len>0) return (cult.len>0)
/datum/game_mode/cult/post_setup()
/datum/game_mode/cult/post_setup()
modePlayer += cult modePlayer += cult
if("sacrifice" in objectives) if("sacrifice" in objectives)
var/list/possible_targets = get_unconvertables() var/list/possible_targets = get_unconvertables()
@@ -92,6 +103,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
send_intercept() send_intercept()
..() ..()
/datum/game_mode/cult/proc/memoize_cult_objectives(var/datum/mind/cult_mind) /datum/game_mode/cult/proc/memoize_cult_objectives(var/datum/mind/cult_mind)
for(var/obj_count = 1,obj_count <= objectives.len,obj_count++) for(var/obj_count = 1,obj_count <= objectives.len,obj_count++)
var/explanation var/explanation
@@ -110,6 +122,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
cult_mind.current << "The convert rune is join blood self" cult_mind.current << "The convert rune is join blood self"
cult_mind.memory += "The convert rune is join blood self<BR>" cult_mind.memory += "The convert rune is join blood self<BR>"
/datum/game_mode/proc/equip_cultist(mob/living/carbon/human/mob) /datum/game_mode/proc/equip_cultist(mob/living/carbon/human/mob)
if(!istype(mob)) if(!istype(mob))
return return
@@ -128,6 +141,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
mob << "You have a talisman in your [where], one that will help you start the cult on this station. Use it well and remember - there are others." mob << "You have a talisman in your [where], one that will help you start the cult on this station. Use it well and remember - there are others."
return 1 return 1
/datum/game_mode/cult/grant_runeword(mob/living/carbon/human/cult_mob, var/word) /datum/game_mode/cult/grant_runeword(mob/living/carbon/human/cult_mob, var/word)
if (!word) if (!word)
if(startwords.len > 0) if(startwords.len > 0)
@@ -135,6 +149,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
startwords -= word startwords -= word
return ..(cult_mob,word) return ..(cult_mob,word)
/datum/game_mode/proc/grant_runeword(mob/living/carbon/human/cult_mob, var/word) /datum/game_mode/proc/grant_runeword(mob/living/carbon/human/cult_mob, var/word)
if(!wordtravel) if(!wordtravel)
runerandom() runerandom()
@@ -169,6 +184,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
cult_mob << "\red You remember one thing from the dark teachings of your master... [wordexp]" cult_mob << "\red You remember one thing from the dark teachings of your master... [wordexp]"
cult_mob.mind.store_memory("<B>You remember that</B> [wordexp]", 0, 0) cult_mob.mind.store_memory("<B>You remember that</B> [wordexp]", 0, 0)
/datum/game_mode/proc/add_cultist(datum/mind/cult_mind) //BASE /datum/game_mode/proc/add_cultist(datum/mind/cult_mind) //BASE
if (!istype(cult_mind)) if (!istype(cult_mind))
return 0 return 0
@@ -177,11 +193,13 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
update_cult_icons_added(cult_mind) update_cult_icons_added(cult_mind)
return 1 return 1
/datum/game_mode/cult/add_cultist(datum/mind/cult_mind) //INHERIT /datum/game_mode/cult/add_cultist(datum/mind/cult_mind) //INHERIT
if (!..(cult_mind)) if (!..(cult_mind))
return return
memoize_cult_objectives(cult_mind) memoize_cult_objectives(cult_mind)
/datum/game_mode/proc/remove_cultist(datum/mind/cult_mind) /datum/game_mode/proc/remove_cultist(datum/mind/cult_mind)
if(cult_mind in cult) if(cult_mind in cult)
cult -= cult_mind cult -= cult_mind
@@ -191,6 +209,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
for(var/mob/M in viewers(cult_mind.current)) for(var/mob/M in viewers(cult_mind.current))
M << "<FONT size = 3>[cult_mind.current] looks like they just reverted to their old faith!</FONT>" M << "<FONT size = 3>[cult_mind.current] looks like they just reverted to their old faith!</FONT>"
/datum/game_mode/proc/update_all_cult_icons() /datum/game_mode/proc/update_all_cult_icons()
spawn(0) spawn(0)
for(var/datum/mind/cultist in cult) for(var/datum/mind/cultist in cult)
@@ -208,6 +227,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
var/I = image('mob.dmi', loc = cultist_1.current, icon_state = "cult") var/I = image('mob.dmi', loc = cultist_1.current, icon_state = "cult")
cultist.current.client.images += I cultist.current.client.images += I
/datum/game_mode/proc/update_cult_icons_added(datum/mind/cult_mind) /datum/game_mode/proc/update_cult_icons_added(datum/mind/cult_mind)
spawn(0) spawn(0)
for(var/datum/mind/cultist in cult) for(var/datum/mind/cultist in cult)
@@ -220,6 +240,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
var/image/J = image('mob.dmi', loc = cultist.current, icon_state = "cult") var/image/J = image('mob.dmi', loc = cultist.current, icon_state = "cult")
cult_mind.current.client.images += J cult_mind.current.client.images += J
/datum/game_mode/proc/update_cult_icons_removed(datum/mind/cult_mind) /datum/game_mode/proc/update_cult_icons_removed(datum/mind/cult_mind)
spawn(0) spawn(0)
for(var/datum/mind/cultist in cult) for(var/datum/mind/cultist in cult)
@@ -235,6 +256,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
if(I.icon_state == "cult") if(I.icon_state == "cult")
del(I) del(I)
/datum/game_mode/cult/proc/get_unconvertables() /datum/game_mode/cult/proc/get_unconvertables()
var/list/ucs = list() var/list/ucs = list()
for(var/mob/living/carbon/human/player in world) for(var/mob/living/carbon/human/player in world)
@@ -242,6 +264,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
ucs += player.mind ucs += player.mind
return ucs return ucs
/datum/game_mode/cult/proc/check_cult_victory() /datum/game_mode/cult/proc/check_cult_victory()
var/cult_fail = 0 var/cult_fail = 0
if(objectives.Find("survive")) if(objectives.Find("survive"))
@@ -254,6 +277,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
return cult_fail //if any objectives aren't met, failure return cult_fail //if any objectives aren't met, failure
/datum/game_mode/cult/proc/check_survive() /datum/game_mode/cult/proc/check_survive()
acolytes_survived = 0 acolytes_survived = 0
for(var/datum/mind/cult_mind in cult) for(var/datum/mind/cult_mind in cult)
@@ -266,6 +290,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
else else
return 1 return 1
/datum/game_mode/cult/declare_completion() /datum/game_mode/cult/declare_completion()
if(!check_cult_victory()) if(!check_cult_victory())
@@ -303,6 +328,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des
..() ..()
return 1 return 1
/datum/game_mode/proc/auto_declare_completion_cult() /datum/game_mode/proc/auto_declare_completion_cult()
if (cult.len!=0 || (ticker && istype(ticker.mode,/datum/game_mode/cult))) if (cult.len!=0 || (ticker && istype(ticker.mode,/datum/game_mode/cult)))
world << "<FONT size = 2><B>The cultists were: </B></FONT>" world << "<FONT size = 2><B>The cultists were: </B></FONT>"

View File

@@ -1,6 +1,7 @@
/datum/game_mode/extended /datum/game_mode/extended
name = "extended" name = "extended"
config_tag = "extended" config_tag = "extended"
required_players = 0
/datum/game_mode/announce() /datum/game_mode/announce()
world << "<B>The current game mode is - Extended Role-Playing!</B>" world << "<B>The current game mode is - Extended Role-Playing!</B>"
@@ -11,5 +12,5 @@
spawn_exporation_packs() spawn_exporation_packs()
return 1 return 1
/datum/game_mode/extended/can_start() //datum/game_mode/extended/can_start()
return (num_players() > 0) // return (num_players() > 0)

View File

@@ -1,48 +1,75 @@
/* /*
* GAMEMODES (by Rastaf0) * GAMEMODES (by Rastaf0)
* *
* In the new mode system all special roles are fully supported. * In the new mode system all special roles are fully supported.
* You can have proper wizards/traitors/changelings/cultists during any mode. * You can have proper wizards/traitors/changelings/cultists during any mode.
* Only two things really depends on gamemode: * Only two things really depends on gamemode:
* 1. Starting roles, equipment and preparations * 1. Starting roles, equipment and preparations
* 2. Conditions of finishing the round. * 2. Conditions of finishing the round.
* *
*/ */
/datum/game_mode /datum/game_mode
var/name = "invalid" var
var/config_tag = null name = "invalid"
var/intercept_hacked = 0 config_tag = null
var/list/datum/mind/modePlayer = new intercept_hacked = 0
var/votable = 1 votable = 1
var/probability = 1 probability = 1
var/station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm
var/explosion_in_progress = 0 //sit back and relax explosion_in_progress = 0 //sit back and relax
list/datum/mind/modePlayer = new
list/restricted_jobs = list()
required_players = 0
/datum/game_mode/proc/announce() //to be calles when round starts /datum/game_mode/proc/announce() //to be calles when round starts
world << "<B>Notice</B>: [src] did not define announce()" world << "<B>Notice</B>: [src] did not define announce()"
/datum/game_mode/proc/can_start() //to help game select mode
///can_start()
///Checks to see if the game can be setup and ran with the current number of players or whatnot.
/datum/game_mode/proc/can_start()
var/playerC = 0
for(var/mob/new_player/player in world)
if((player.client)&&(player.ready))
playerC++
if(playerC >= required_players)
return 1
return 0 return 0
/datum/game_mode/proc/pre_setup() //select players for special roles
///pre_setup()
///Attempts to select players for special roles the mode might have.
/datum/game_mode/proc/pre_setup()
return 1 return 1
/datum/game_mode/proc/post_setup() //do irreversible preparations
///post_setup()
///Everyone should now be on the station and have their normal gear. This is the place to give the special roles extra things
/datum/game_mode/proc/post_setup()
return 1 return 1
///process()
///Called by the gameticker
/datum/game_mode/proc/process() /datum/game_mode/proc/process()
return 0
/datum/game_mode/proc/check_finished() //to be called by ticker /datum/game_mode/proc/check_finished() //to be called by ticker
if(emergency_shuttle.location==2 || station_was_nuked) if(emergency_shuttle.location==2 || station_was_nuked)
return 1 return 1
return 0 return 0
/datum/game_mode/proc/declare_completion() /datum/game_mode/proc/declare_completion()
return return 0
/datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. /datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere.
return 0
/datum/game_mode/proc/send_intercept() /datum/game_mode/proc/send_intercept()
var/intercepttext = "<FONT size = 3><B>Cent. Com. Update</B> Requested staus information:</FONT><HR>" var/intercepttext = "<FONT size = 3><B>Cent. Com. Update</B> Requested staus information:</FONT><HR>"
@@ -80,6 +107,7 @@
command_alert("Summary downloaded and printed out at all communications consoles.", "Enemy communication intercept. Security Level Elevated.") command_alert("Summary downloaded and printed out at all communications consoles.", "Enemy communication intercept. Security Level Elevated.")
world << sound('intercept.ogg') world << sound('intercept.ogg')
/datum/game_mode/proc/get_players_for_role(var/role, override_jobbans=1) /datum/game_mode/proc/get_players_for_role(var/role, override_jobbans=1)
var/list/candidates = list() var/list/candidates = list()
for(var/mob/new_player/player in world) for(var/mob/new_player/player in world)
@@ -98,16 +126,22 @@
for(var/mob/new_player/player in world) for(var/mob/new_player/player in world)
if (player.client && player.ready) if (player.client && player.ready)
candidates += player.mind candidates += player.mind
return candidates return candidates
/datum/game_mode/proc/check_player_role_pref(var/role, var/mob/new_player/player)
if(player.preferences.be_special & role)
return 1
return 0
/datum/game_mode/proc/num_players() /datum/game_mode/proc/num_players()
. = 0 . = 0
for(var/mob/new_player/P in world) for(var/mob/new_player/P in world)
if(P.client && P.ready) if(P.client && P.ready)
. ++ . ++
/////////////////////////////////// ///////////////////////////////////
//Keeps track of all living heads// //Keeps track of all living heads//
/////////////////////////////////// ///////////////////////////////////
@@ -118,6 +152,7 @@
heads += player.mind heads += player.mind
return heads return heads
//////////////////////////// ////////////////////////////
//Keeps track of all heads// //Keeps track of all heads//
//////////////////////////// ////////////////////////////

View File

@@ -52,12 +52,12 @@ var/global/datum/controller/gameticker/ticker
del(mode) del(mode)
current_state = GAME_STATE_PREGAME current_state = GAME_STATE_PREGAME
world << "<B>Unable to start [master_mode].</B> Not enough players. Reverting to pre-game lobby." world << "<B>Unable to start [master_mode].</B> Not enough players. Reverting to pre-game lobby."
ResetOccupations()
return 0 return 0
//Configure mode and assign player to special mode stuff //Configure mode and assign player to special mode stuff
var/can_continue
if (src.mode.config_tag == "revolution") /* if (src.mode.config_tag == "revolution")
var/tries=5 var/tries=5
do do
can_continue = src.mode.pre_setup() can_continue = src.mode.pre_setup()
@@ -67,13 +67,16 @@ var/global/datum/controller/gameticker/ticker
current_state = GAME_STATE_PREGAME current_state = GAME_STATE_PREGAME
world << "<B>Error setting up revolution.</B> Not enough players. Reverting to pre-game lobby." world << "<B>Error setting up revolution.</B> Not enough players. Reverting to pre-game lobby."
return 0 return 0
else else*/
can_continue = src.mode.pre_setup()
if(!can_continue) DivideOccupations() //Distribute jobs
del(mode) var/can_continue = src.mode.pre_setup()//Setup special modes
current_state = GAME_STATE_PREGAME if(!can_continue)
world << "<B>Error setting up [master_mode].</B> Reverting to pre-game lobby." del(mode)
return 0 current_state = GAME_STATE_PREGAME
world << "<B>Error setting up [master_mode].</B> Reverting to pre-game lobby."
ResetOccupations()
return 0
if(hide_mode) if(hide_mode)
var/list/modes = new var/list/modes = new
@@ -85,22 +88,22 @@ var/global/datum/controller/gameticker/ticker
else else
src.mode.announce() src.mode.announce()
distribute_jobs() //Distribute jobs and announce the captain
create_characters() //Create player characters and transfer them create_characters() //Create player characters and transfer them
collect_minds() collect_minds()
data_core.manifest()
equip_characters() equip_characters()
data_core.manifest()
current_state = GAME_STATE_PLAYING current_state = GAME_STATE_PLAYING
mode.post_setup()
//Cleanup some stuff spawn(0)//Forking here so we dont have to wait for this to finish
for(var/obj/landmark/start/S in world) mode.post_setup()
//Deleting Startpoints but we need the ai point to AI-ize people later //Cleanup some stuff
if (S.name != "AI") for(var/obj/landmark/start/S in world)
del(S) //Deleting Startpoints but we need the ai point to AI-ize people later
if (S.name != "AI")
world << "<FONT color='blue'><B>Enjoy the game!</B></FONT>" del(S)
world << sound('welcome.ogg') // Skie spawn(-1)
world << "<FONT color='blue'><B>Enjoy the game!</B></FONT>"
world << sound('welcome.ogg') // Skie
spawn (3000) spawn (3000)
start_events() start_events()
@@ -116,15 +119,6 @@ var/global/datum/controller/gameticker/ticker
return 1 return 1
/datum/controller/gameticker /datum/controller/gameticker
proc/distribute_jobs()
DivideOccupations() //occupations can be distributes already by gamemode, it is okay. --rastaf0
var/captainless=1
for(var/mob/new_player/player in world)
if(player.mind && player.mind.assigned_role=="Captain")
captainless=0
break
if (captainless)
world << "Captainship not forced on anyone."
proc/create_characters() proc/create_characters()
for(var/mob/new_player/player in world) for(var/mob/new_player/player in world)
@@ -135,16 +129,25 @@ var/global/datum/controller/gameticker/ticker
else if(player.mind) else if(player.mind)
player.create_character() player.create_character()
del(player) del(player)
proc/collect_minds() proc/collect_minds()
for(var/mob/living/player in world) for(var/mob/living/player in world)
if(player.mind) if(player.mind)
ticker.minds += player.mind ticker.minds += player.mind
proc/equip_characters() proc/equip_characters()
var/captainless=1
for(var/mob/living/carbon/human/player in world) for(var/mob/living/carbon/human/player in world)
if(player.mind && player.mind.assigned_role) if(player.mind && player.mind.assigned_role)
if(player.mind.assigned_role != "MODE") if(player.mind.assigned_role != "MODE")
player.Equip_Rank(player.mind.assigned_role) player.Equip_Rank(player.mind.assigned_role)
if(player.mind.assigned_role == "Captain")
captainless=0
if (captainless)
world << "Captainship not forced on anyone."
proc/process() proc/process()
if(current_state != GAME_STATE_PLAYING) if(current_state != GAME_STATE_PLAYING)
@@ -170,29 +173,6 @@ var/global/datum/controller/gameticker/ticker
return 1 return 1
/*
/datum/controller/gameticker/proc/timeup()
if (shuttle_left) //Shuttle left but its leaving or arriving again
check_win() //Either way, its not possible
return
if (src.shuttle_location == shuttle_z)
move_shuttle(locate(/area/shuttle), locate(/area/arrival/shuttle))
src.timeleft = shuttle_time_in_station
src.shuttle_location = 1
world << "<B>The Emergency Shuttle has docked with the station! You have [ticker.timeleft/600] minutes to board the Emergency Shuttle.</B>"
else //marker2
world << "<B>The Emergency Shuttle is leaving!</B>"
shuttle_left = 1
shuttlecoming = 0
check_win()
return
*/
/datum/controller/gameticker/proc/declare_completion() /datum/controller/gameticker/proc/declare_completion()
@@ -225,70 +205,3 @@ var/global/datum/controller/gameticker/ticker
call(mode, handler)() call(mode, handler)()
return 1 return 1
/////
/////SETTING UP THE GAME
/////
/////
/////MAIN PROCESS PART
/////
/*
/datum/controller/gameticker/proc/game_process()
switch(mode.name)
if("deathmatch","monkey","nuclear emergency","Corporate Restructuring","revolution","traitor",
"wizard","extended")
do
if (!( shuttle_frozen ))
if (src.timing == 1)
src.timeleft -= 10
else
if (src.timing == -1.0)
src.timeleft += 10
if (src.timeleft >= shuttle_time_to_arrive)
src.timeleft = null
src.timing = 0
if (prob(0.5))
spawn_meteors()
if (src.timeleft <= 0 && src.timing)
src.timeup()
sleep(10)
while(src.processing)
return
//Standard extended process (incorporates most game modes).
//Put yours in here if you don't know where else to put it.
if("AI malfunction")
do
check_win()
ticker.AItime += 10
sleep(10)
if (ticker.AItime == 6000)
world << "<FONT size = 3><B>Cent. Com. Update</B> AI Malfunction Detected</FONT>"
world << "\red It seems we have provided you with a malfunctioning AI. We're very sorry."
while(src.processing)
return
//malfunction process
if("meteor")
do
if (!( shuttle_frozen ))
if (src.timing == 1)
src.timeleft -= 10
else
if (src.timing == -1.0)
src.timeleft += 10
if (src.timeleft >= shuttle_time_to_arrive)
src.timeleft = null
src.timing = 0
for(var/i = 0; i < 10; i++)
spawn_meteors()
if (src.timeleft <= 0 && src.timing)
src.timeup()
sleep(10)
while(src.processing)
return
//meteor mode!!! MORE METEORS!!!
else
return
//Anything else, like sandbox, return.
*/

View File

@@ -4,6 +4,7 @@
/datum/game_mode/malfunction /datum/game_mode/malfunction
name = "AI malfunction" name = "AI malfunction"
config_tag = "malfunction" config_tag = "malfunction"
required_players = 20
var/const/waittime_l = 600 var/const/waittime_l = 600
var/const/waittime_h = 1800 // started at 1800 var/const/waittime_h = 1800 // started at 1800
@@ -19,39 +20,29 @@
world << "<B>The AI on the satellite has malfunctioned and must be destroyed.</B>" world << "<B>The AI on the satellite has malfunctioned and must be destroyed.</B>"
world << "The AI satellite is deep in space and can only be accessed with the use of a teleporter! You have [AI_win_timeleft/60] minutes to disable it." world << "The AI satellite is deep in space and can only be accessed with the use of a teleporter! You have [AI_win_timeleft/60] minutes to disable it."
/datum/game_mode/malfunction/can_start() /*/datum/game_mode/malfunction/can_start()
for(var/mob/new_player/P in world) for(var/mob/new_player/P in world)
if(P.client && P.ready && !jobban_isbanned(P, "AI") && !jobban_isbanned(P, "Syndicate")) if(P.client && P.ready && !jobban_isbanned(P, "AI") && !jobban_isbanned(P, "Syndicate"))
return 1 return 1
return 0*/
/datum/game_mode/malfunction/pre_setup()
for(var/mob/new_player/player in world)
if(player.mind && player.mind.assigned_role == "AI")
malf_ai+=player.mind
if(malf_ai.len)
return 1
return 0 return 0
/datum/game_mode/malfunction/pre_setup() //sele
var/list/candidates = get_players_for_role(BE_MALF, override_jobbans=0)
for(var/datum/mind/player in candidates)
if (jobban_isbanned(player.current, "AI") )
candidates -= player
if (candidates.len==0)
return 0
var/datum/mind/ai_choice = pick(candidates)
malf_ai+=ai_choice //only one AI at the moment, but it can change
ai_choice.assigned_role = "AI"
return 1
/datum/game_mode/malfunction/post_setup() /datum/game_mode/malfunction/post_setup()
/* Obsolete and causes meta --rastaf0
for (var/obj/landmark/A in world)
if (A.name == "Malf-Gear-Closet")
new /obj/closet/malf/suits(A.loc)
del(A)
*/
for(var/datum/mind/AI_mind in malf_ai) for(var/datum/mind/AI_mind in malf_ai)
/*if(malf_ai.len < 1) if(malf_ai.len < 1)
world << "Uh oh, its malfunction and there is no AI! Please report this." world << "Uh oh, its malfunction and there is no AI! Please report this."
world << "Rebooting world in 5 seconds." world << "Rebooting world in 5 seconds."
sleep(50) sleep(50)
world.Reboot() world.Reboot()
return*/ return
AI_mind.current.verbs += /mob/living/silicon/ai/proc/choose_modules AI_mind.current.verbs += /mob/living/silicon/ai/proc/choose_modules
AI_mind.current:laws = new /datum/ai_laws/malfunction AI_mind.current:laws = new /datum/ai_laws/malfunction
AI_mind.current:malf_picker = new /datum/AI_Module/module_picker AI_mind.current:malf_picker = new /datum/AI_Module/module_picker
@@ -129,7 +120,7 @@
if (istype(AI_mind.current,/mob/living/silicon/ai) && AI_mind.current.stat!=2) if (istype(AI_mind.current,/mob/living/silicon/ai) && AI_mind.current.stat!=2)
all_dead = 0 all_dead = 0
return all_dead return all_dead
/datum/game_mode/malfunction/check_finished() /datum/game_mode/malfunction/check_finished()
if (station_captured && !to_nuke_or_not_to_nuke) if (station_captured && !to_nuke_or_not_to_nuke)
return 1 return 1
@@ -210,7 +201,7 @@
else if (!station_captured && station_was_nuked) else if (!station_captured && station_was_nuked)
world << "<FONT size = 3><B>Neutral Victory</B></FONT>" world << "<FONT size = 3><B>Neutral Victory</B></FONT>"
world << "<B>Everyone was killed by the nuclear blast!</B>" world << "<B>Everyone was killed by the nuclear blast!</B>"
else if (!station_captured && malf_dead && !station_was_nuked) else if (!station_captured && malf_dead && !station_was_nuked)
world << "<FONT size = 3><B>Human Victory</B></FONT>" world << "<FONT size = 3><B>Human Victory</B></FONT>"
world << "<B>The AI has been killed!</B> The staff is victorious." world << "<B>The AI has been killed!</B> The staff is victorious."

View File

@@ -5,6 +5,7 @@
var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds) var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds)
var/const/meteordelay = 2000 var/const/meteordelay = 2000
var/nometeors = 1 var/nometeors = 1
required_players = 0
/datum/game_mode/meteor/announce() /datum/game_mode/meteor/announce()
world << "<B>The current game mode is - Meteor!</B>" world << "<B>The current game mode is - Meteor!</B>"
@@ -16,7 +17,7 @@
spawn(meteordelay) spawn(meteordelay)
nometeors = 0 nometeors = 0
/datum/game_mode/meteor/can_start() /*/datum/game_mode/meteor/can_start()
var/num_players = 0 var/num_players = 0
for(var/mob/new_player/P in world) for(var/mob/new_player/P in world)
if(P.client && P.ready) if(P.client && P.ready)
@@ -25,7 +26,7 @@
if(num_players >= 10) if(num_players >= 10)
return 1 // needs at least 10 players in order to play this mode return 1 // needs at least 10 players in order to play this mode
return 0 return 0*/
/datum/game_mode/meteor/process() /datum/game_mode/meteor/process()
if (nometeors) return if (nometeors) return

View File

@@ -5,6 +5,7 @@
/datum/game_mode/nuclear /datum/game_mode/nuclear
name = "nuclear emergency" name = "nuclear emergency"
config_tag = "nuclear" config_tag = "nuclear"
required_players = 15
var/const/agents_possible = 5 //If we ever need more syndicate agents. var/const/agents_possible = 5 //If we ever need more syndicate agents.
var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds) var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds)
@@ -20,15 +21,9 @@
world << "<B>A [syndicate_name()] Strike Force is approaching [station_name()]!</B>" world << "<B>A [syndicate_name()] Strike Force is approaching [station_name()]!</B>"
world << "A nuclear explosive was being transported by Nanotrasen to a military base. The transport ship mysteriously lost contact with Space Traffic Control (STC). About that time a strange disk was discovered around [station_name()]. It was identified by Nanotrasen as a nuclear auth. disk and now Syndicate Operatives have arrived to retake the disk and detonate SS13! Also, most likely Syndicate star ships are in the vicinity so take care not to lose the disk!\n<B>Syndicate</B>: Reclaim the disk and detonate the nuclear bomb anywhere on SS13.\n<B>Personnel</B>: Hold the disk and <B>escape with the disk</B> on the shuttle!" world << "A nuclear explosive was being transported by Nanotrasen to a military base. The transport ship mysteriously lost contact with Space Traffic Control (STC). About that time a strange disk was discovered around [station_name()]. It was identified by Nanotrasen as a nuclear auth. disk and now Syndicate Operatives have arrived to retake the disk and detonate SS13! Also, most likely Syndicate star ships are in the vicinity so take care not to lose the disk!\n<B>Syndicate</B>: Reclaim the disk and detonate the nuclear bomb anywhere on SS13.\n<B>Personnel</B>: Hold the disk and <B>escape with the disk</B> on the shuttle!"
/datum/game_mode/nuclear/can_start() /datum/game_mode/nuclear/can_start()//This could be better, will likely have to recode it later
if (num_players() < 2) if(!..())
return 0 return 0
for(var/mob/new_player/P in world)
if(P.client && P.ready && !jobban_isbanned(P, "Syndicate"))
return 1
return 0
/datum/game_mode/nuclear/pre_setup()
var/list/possible_syndicates = get_players_for_role(BE_OPERATIVE) var/list/possible_syndicates = get_players_for_role(BE_OPERATIVE)
var/agent_number = 0 var/agent_number = 0
@@ -55,8 +50,13 @@
for(var/datum/mind/synd_mind in syndicates) for(var/datum/mind/synd_mind in syndicates)
synd_mind.assigned_role = "MODE" //So they aren't chosen for other jobs. synd_mind.assigned_role = "MODE" //So they aren't chosen for other jobs.
synd_mind.special_role = "Syndicate"//So they actually have a special role/N synd_mind.special_role = "Syndicate"//So they actually have a special role/N
return 1 return 1
/datum/game_mode/nuclear/pre_setup()
return 1
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
/datum/game_mode/proc/update_all_synd_icons() /datum/game_mode/proc/update_all_synd_icons()

View File

@@ -14,11 +14,13 @@
/datum/game_mode/revolution /datum/game_mode/revolution
name = "revolution" name = "revolution"
config_tag = "revolution" config_tag = "revolution"
restricted_jobs = list("Security Officer", "Warden", "Detective", "AI", "Cyborg","Captain", "Head of Personnel", "Head of Security", "Chief Engineer", "Research Director", "Chief Medical Officer")
required_players = 20
var/finished = 0 var/finished = 0
var/const/max_headrevs = 3 var/const/max_headrevs = 3
var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds) var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds)
var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds) var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds)
/////////////////////////// ///////////////////////////
//Announces the game type// //Announces the game type//
/////////////////////////// ///////////////////////////
@@ -26,13 +28,15 @@
world << "<B>The current game mode is - Revolution!</B>" world << "<B>The current game mode is - Revolution!</B>"
world << "<B>Some crewmembers are attempting to start a revolution!<BR>\nRevolutionaries - Kill the Captain, HoP, HoS, CE, RD and CMO. Convert other crewmembers (excluding the heads of staff, and security officers) to your cause by flashing them. Protect your leaders.<BR>\nPersonnel - Protect the heads of staff. Kill the leaders of the revolution, and brainwash the other revolutionaries (by beating them in the head).</B>" world << "<B>Some crewmembers are attempting to start a revolution!<BR>\nRevolutionaries - Kill the Captain, HoP, HoS, CE, RD and CMO. Convert other crewmembers (excluding the heads of staff, and security officers) to your cause by flashing them. Protect your leaders.<BR>\nPersonnel - Protect the heads of staff. Kill the leaders of the revolution, and brainwash the other revolutionaries (by beating them in the head).</B>"
/*
/datum/game_mode/revolution/can_start() //this proc can not do its job properly for this gamemode, pre_setup can fail even whe can_start told everything is okay. --rastaf0 /datum/game_mode/revolution/can_start() //this proc can not do its job properly for this gamemode, pre_setup can fail even whe can_start told everything is okay. --rastaf0
var/list/mob/new_player/possible_headrevs = new var/list/mob/new_player/possible_headrevs = new
var/list/mob/new_player/possible_heads = new var/list/mob/new_player/possible_heads = new
var/players = 0
for(var/mob/new_player/P in world) for(var/mob/new_player/P in world)
if (!P.client || !P.ready) if (!P.client || !P.ready)
continue continue
players++
if(!jobban_isbanned(P, "Syndicate")) if(!jobban_isbanned(P, "Syndicate"))
possible_headrevs += P possible_headrevs += P
for (var/i in head_positions) for (var/i in head_positions)
@@ -40,6 +44,8 @@
possible_heads += P possible_heads += P
break break
//lets do as best as we can //lets do as best as we can
if (players < min_players)
return 0
if (possible_headrevs.len==0) if (possible_headrevs.len==0)
return 0 return 0
if (possible_heads.len==0) if (possible_heads.len==0)
@@ -48,7 +54,7 @@
var/list/rest_heads = possible_heads - possible_headrevs var/list/rest_heads = possible_heads - possible_headrevs
return (rest_heads.len>0) return (rest_heads.len>0)
return 1 //read as "maybe" return 1 //read as "maybe"
*/
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
//Gets the round setup, cancelling if there's not enough players at the start// //Gets the round setup, cancelling if there's not enough players at the start//
@@ -56,30 +62,30 @@
/datum/game_mode/revolution/pre_setup() /datum/game_mode/revolution/pre_setup()
var/list/datum/mind/possible_headrevs = get_players_for_role(BE_REV) var/list/datum/mind/possible_headrevs = get_players_for_role(BE_REV)
var/head_check = 0
for(var/mob/new_player/player in world)
if(player.mind.assigned_role in head_positions)
head_check = 1
break
for(var/datum/mind/player in possible_headrevs)
for(var/job in restricted_jobs)//Removing heads and such from the list
if(player.assigned_role == job)
possible_headrevs -= player
for (var/i=1 to max_headrevs) for (var/i=1 to max_headrevs)
if (possible_headrevs.len==0) if (possible_headrevs.len==0)
break break
var/datum/mind/lenin = pick(possible_headrevs) var/datum/mind/lenin = pick(possible_headrevs)
possible_headrevs -= lenin possible_headrevs -= lenin
head_revolutionaries += lenin head_revolutionaries += lenin
var/mob/new_player/player = lenin.current
player.jobs_restricted_by_gamemode = list("Security Officer", "Warden", "Detective")+nonhuman_positions+head_positions
if(head_revolutionaries.len==0) if((head_revolutionaries.len==0)||(!head_check))
return 0 return 0
DivideOccupations()
var/headless=1
for(var/mob/new_player/player in world)
if(player.mind && player.mind.assigned_role in head_positions)
headless=0
break
if (headless)
head_revolutionaries.len = 0
ResetOccupations() //clean up
return 0
return 1 return 1
/datum/game_mode/revolution/post_setup() /datum/game_mode/revolution/post_setup()
var/list/heads = get_living_heads() var/list/heads = get_living_heads()

View File

@@ -1,6 +1,7 @@
/datum/game_mode/sandbox /datum/game_mode/sandbox
name = "sandbox" name = "sandbox"
config_tag = "sandbox" config_tag = "sandbox"
required_players = 0
/datum/game_mode/sandbox/announce() /datum/game_mode/sandbox/announce()
world << "<B>The current game mode is - Sandbox!</B>" world << "<B>The current game mode is - Sandbox!</B>"

View File

@@ -5,7 +5,7 @@
/datum/game_mode/traitor /datum/game_mode/traitor
name = "traitor" name = "traitor"
config_tag = "traitor" config_tag = "traitor"
required_players = 0
var/const/prob_int_murder_target = 50 // intercept names the assassination target half the time var/const/prob_int_murder_target = 50 // intercept names the assassination target half the time
var/const/prob_right_murder_target_l = 25 // lower bound on probability of naming right assassination target var/const/prob_right_murder_target_l = 25 // lower bound on probability of naming right assassination target
@@ -50,11 +50,11 @@
world << "<B>The current game mode is - Traitor!</B>" world << "<B>The current game mode is - Traitor!</B>"
world << "<B>There is a syndicate traitor on the station. Do not let the traitor succeed!</B>" world << "<B>There is a syndicate traitor on the station. Do not let the traitor succeed!</B>"
/datum/game_mode/traitor/can_start() /*/datum/game_mode/traitor/can_start()
for(var/mob/new_player/P in world) for(var/mob/new_player/P in world)
if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) if(P.client && P.ready && !jobban_isbanned(P, "Syndicate"))
return 1 return 1
return 0 return 0*/
/datum/game_mode/traitor/pre_setup() /datum/game_mode/traitor/pre_setup()
var/list/possible_traitors = get_players_for_role(BE_TRAITOR) var/list/possible_traitors = get_players_for_role(BE_TRAITOR)

View File

@@ -5,6 +5,7 @@
/datum/game_mode/wizard /datum/game_mode/wizard
name = "wizard" name = "wizard"
config_tag = "wizard" config_tag = "wizard"
required_players = 0
var/finished = 0 var/finished = 0
@@ -55,18 +56,13 @@
world << "<B>The current game mode is - Wizard!</B>" world << "<B>The current game mode is - Wizard!</B>"
world << "<B>There is a \red SPACE WIZARD\black on the station. You can't let him achieve his objective!</B>" world << "<B>There is a \red SPACE WIZARD\black on the station. You can't let him achieve his objective!</B>"
/datum/game_mode/wizard/can_start() /datum/game_mode/wizard/can_start()//This could be better, will likely have to recode it later
for(var/mob/new_player/P in world) if(!..())
if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) return 0
return 1
return 0
/datum/game_mode/wizard/pre_setup()
var/list/datum/mind/possible_wizards = get_players_for_role(BE_WIZARD) var/list/datum/mind/possible_wizards = get_players_for_role(BE_WIZARD)
if(possible_wizards.len==0) if(possible_wizards.len==0)
return 0 return 0
var/datum/mind/wizard = pick(possible_wizards) var/datum/mind/wizard = pick(possible_wizards)
//possible_wizards-=wizard
wizards += wizard wizards += wizard
modePlayer += wizard modePlayer += wizard
wizard.assigned_role = "MODE" //So they aren't chosen for other jobs. wizard.assigned_role = "MODE" //So they aren't chosen for other jobs.
@@ -78,6 +74,9 @@
wizard.current.loc = pick(wizardstart) wizard.current.loc = pick(wizardstart)
return 1 return 1
/datum/game_mode/wizard/pre_setup()
return 1
/datum/game_mode/wizard/post_setup() /datum/game_mode/wizard/post_setup()
for(var/datum/mind/wizard in wizards) for(var/datum/mind/wizard in wizards)
forge_wizard_objectives(wizard) forge_wizard_objectives(wizard)

View File

@@ -6,8 +6,8 @@
if (player.preferences.occupation[level] == job) if (player.preferences.occupation[level] == job)
if (jobban_isbanned(player, job)) if (jobban_isbanned(player, job))
continue continue
if (player.jobs_restricted_by_gamemode && (job in player.jobs_restricted_by_gamemode)) // if (player.jobs_restricted_by_gamemode && (job in player.jobs_restricted_by_gamemode))
continue // continue
candidates += player candidates += player
return candidates return candidates
@@ -15,7 +15,8 @@
/proc/ResetOccupations() /proc/ResetOccupations()
for (var/mob/new_player/player in world) for (var/mob/new_player/player in world)
player.mind.assigned_role = null player.mind.assigned_role = null
player.jobs_restricted_by_gamemode = null player.mind.special_role = null
// player.jobs_restricted_by_gamemode = null
return return
/** Proc DivideOccupations /** Proc DivideOccupations
@@ -26,9 +27,6 @@
var/list/unassigned = list() var/list/unassigned = list()
var/list/occupation_eligible = occupations.Copy() var/list/occupation_eligible = occupations.Copy()
if(ticker.mode.name == "AI malfunction")
occupation_eligible["AI"] = 0
for (var/mob/new_player/player in world) for (var/mob/new_player/player in world)
if (player.client && player.ready && !player.mind.assigned_role) if (player.client && player.ready && !player.mind.assigned_role)
unassigned += player unassigned += player
@@ -47,27 +45,40 @@
if (unassigned.len == 0) if (unassigned.len == 0)
return 0 return 0
//Check for a Captain first
for (var/level = 1 to 3) for (var/level = 1 to 3)
var/list/candidates = FindOccupationCandidates(unassigned, "Captain", level) var/list/candidates = FindOccupationCandidates(unassigned, "Captain", level)
if (candidates.len) if (candidates.len)
var/mob/new_player/candidate = pick(candidates) var/mob/new_player/candidate = pick(candidates)
unassigned -= candidate unassigned -= candidate
candidate.mind.assigned_role = "Captain" candidate.mind.assigned_role = "Captain"
break break
/*
// Not forcing a Captain -- TLE //Then check for an AI
if (captain_choice == null && unassigned.len > 0) for (var/level = 1 to 3)//Malf is a bit special as it replaces a normal job
var/list/candidates = FindOccupationCandidates(unassigned, "AI", level)
if(ticker.mode.name == "AI malfunction")
for(var/mob/new_player/player in candidates)
if(!player.preferences.be_special & BE_MALF)
candidates -= player
if (candidates.len)
var/mob/new_player/candidate = pick(candidates)
unassigned -= candidate
candidate.mind.assigned_role = "AI"
break
//Malf NEEDS an AI so force one
if((ticker.mode.name == "AI malfunction")&&(occupation_eligible["AI"] > 0))
unassigned = shuffle(unassigned) unassigned = shuffle(unassigned)
for(var/mob/new_player/player in unassigned) for(var/mob/new_player/player in unassigned)
if(jobban_isbanned(player, "Captain")) if(jobban_isbanned(player, "AI"))
continue continue
else else
captain_choice = player player.mind.assigned_role = "AI"
unassigned -= player
break break
unassigned -= captain_choice //Now we can go though the rest of the jobs and players who set prefs
*/ for (var/level = 1 to 3)
for (var/level = 1 to 3) //players with preferences set //Assistants are checked first
for (var/occupation in assistant_occupations) for (var/occupation in assistant_occupations)
if (unassigned.len == 0) if (unassigned.len == 0)
break break
@@ -75,7 +86,7 @@
for (var/mob/new_player/candidate in candidates) for (var/mob/new_player/candidate in candidates)
candidate.mind.assigned_role = occupation candidate.mind.assigned_role = occupation
unassigned -= candidate unassigned -= candidate
//Now everyone else
for (var/occupation in occupation_eligible) for (var/occupation in occupation_eligible)
if (unassigned.len == 0) if (unassigned.len == 0)
break break
@@ -87,10 +98,9 @@
var/mob/new_player/candidate = pick_n_take(candidates) var/mob/new_player/candidate = pick_n_take(candidates)
candidate.mind.assigned_role = occupation candidate.mind.assigned_role = occupation
unassigned -= candidate unassigned -= candidate
//Last try to fill in any leftover jobs with leftover players
if (unassigned.len) //unlucky players with preferences and players without preferences if (unassigned.len)
var/list/vacancies = list() var/list/vacancies = list()
var/list/failsafe = list()
for (var/occ in occupation_eligible) for (var/occ in occupation_eligible)
for (var/i = 1 to occupation_eligible[occ]) for (var/i = 1 to occupation_eligible[occ])
vacancies += occ vacancies += occ
@@ -98,13 +108,6 @@
while (unassigned.len && vacancies.len) while (unassigned.len && vacancies.len)
var/mob/new_player/candidate = pick_n_take(unassigned) var/mob/new_player/candidate = pick_n_take(unassigned)
var/occupation = pick_n_take(vacancies) var/occupation = pick_n_take(vacancies)
if(candidate.jobs_restricted_by_gamemode)
if(occupation in candidate.jobs_restricted_by_gamemode)
vacancies += occupation
failsafe += candidate
continue
candidate.mind.assigned_role = occupation candidate.mind.assigned_role = occupation
for (var/mob/new_player/player in unassigned) for (var/mob/new_player/player in unassigned)
@@ -112,110 +115,10 @@
break break
player.mind.assigned_role = pick(assistant_occupations) player.mind.assigned_role = pick(assistant_occupations)
for (var/mob/new_player/player in failsafe)
if (unassigned.len == 0)
break
player.mind.assigned_role = pick(assistant_occupations)
return 1 return 1
/mob/living/carbon/human/proc/Equip_Rank(rank, joined_late) /mob/living/carbon/human/proc/Equip_Rank(rank, joined_late)
/*
if(rank=="Clown")
if(alert("Do you want to be a clown or a mime?",,"Clown","Mime")=="Mime")
rank="Mime" //Why no work -- Urist
*/
/*if(joined_late && ticker.mode.name == "ctf")
var/red_team
var/green_team
for(var/mob/living/carbon/human/M in world)
if(M.client)
if(M.client.team == "Red")
red_team++
if(M.client.team == "Green")
green_team++
if(!src.client.team)
if(red_team > green_team)
src.client.team = "Green"
else
src.client.team = "Red"
src << "You are in the [src.client.team] Team!"
var/obj/item/device/radio/headset/H = new /obj/item/device/radio/headset(src)
src.equip_if_possible(H, slot_w_radio)
if(src.client.team == "Red")
H.set_frequency(1465)
src.equip_if_possible(new /obj/item/clothing/under/color/red(src), src.slot_w_uniform)
src.equip_if_possible(new /obj/item/clothing/suit/armor/tdome/red(src), slot_wear_suit)
else if(src.client.team == "Green")
H.set_frequency(1449)
src.equip_if_possible(new /obj/item/clothing/under/color/green(src), src.slot_w_uniform)
src.equip_if_possible(new /obj/item/clothing/suit/armor/tdome/green(src), slot_wear_suit)
src.equip_if_possible(new /obj/item/clothing/shoes/black(src), src.slot_shoes)
src.equip_if_possible(new /obj/item/clothing/mask/gas/emergency(src), src.slot_wear_mask)
src.equip_if_possible(new /obj/item/clothing/gloves/swat(src), src.slot_gloves)
src.equip_if_possible(new /obj/item/clothing/glasses/thermal(src), src.slot_glasses)
var/obj/item/weapon/tank/air/O = new /obj/item/weapon/tank/air(src)
src.equip_if_possible(O, src.slot_back)
src.internal = O
var/obj/item/weapon/card/id/W = new(src)
W.name = "[src.real_name]'s ID card ([src.client.team] Team)"
if(src.client.team == "Red")
W.access = access_red
else if(src.client.team == "Green")
W.access = access_green
else
world << "Unspecified team, [src.client.team]"
W.assignment = "[src.client.team] Team"
W.registered = src.real_name
src.equip_if_possible(W, src.slot_wear_id)
return
if(joined_late && ticker.mode.name == "deathmatch")
src.equip_if_possible(new /obj/item/clothing/under/color/black(src), src.slot_w_uniform)
src.equip_if_possible(new /obj/item/clothing/shoes/black(src), src.slot_shoes)
src.equip_if_possible(new /obj/item/clothing/suit/swat_suit/death_commando(src), src.slot_wear_suit)
src.equip_if_possible(new /obj/item/clothing/mask/gas/death_commando(src), src.slot_wear_mask)
src.equip_if_possible(new /obj/item/clothing/gloves/swat(src), src.slot_gloves)
src.equip_if_possible(new /obj/item/clothing/glasses/thermal(src), src.slot_glasses)
src.equip_if_possible(new /obj/item/weapon/gun/energy/pulse_rifle(src), src.slot_l_hand)
src.equip_if_possible(new /obj/item/weapon/flashbang(src), src.slot_r_store)
var/obj/item/weapon/tank/air/O = new /obj/item/weapon/tank/air(src)
src.equip_if_possible(O, src.slot_back)
src.internal = O
var/randomname = "Killiam Shakespeare"
if(commando_names.len)
randomname = pick(commando_names)
commando_names -= randomname
var/newname = input(src,"You are a death commando. Would you like to change your name?", "Character Creation", randomname)
if(!length(newname))
newname = randomname
newname = strip_html(newname,40)
src.real_name = newname
src.name = newname // there are WAY more things than this to change, I'm almost certain
var/obj/item/weapon/card/id/W = new(src)
W.name = "[newname]'s ID card (Death Commando)"
W.access = get_all_accesses()
W.assignment = "Death Commando"
W.registered = newname
src.equip_if_possible(W, src.slot_wear_id)
return
*/
switch(rank) switch(rank)
if ("Chaplain") if ("Chaplain")
var/obj/item/weapon/storage/bible/B = new /obj/item/weapon/storage/bible/booze(src) var/obj/item/weapon/storage/bible/B = new /obj/item/weapon/storage/bible/booze(src)

View File

@@ -10,7 +10,7 @@ mob/new_player
canmove = 0 canmove = 0
anchored = 1 // don't get pushed around anchored = 1 // don't get pushed around
var/list/jobs_restricted_by_gamemode // var/list/jobs_restricted_by_gamemode
Login() Login()
//Next line is commented out because seem it does nothing helpful and on the other hand it calls mob/new_player/Move() to EACH turf in the world. --rastaf0 //Next line is commented out because seem it does nothing helpful and on the other hand it calls mob/new_player/Move() to EACH turf in the world. --rastaf0