diff --git a/code/ATMOSPHERICS/datum_pipe_network.dm b/code/ATMOSPHERICS/datum_pipe_network.dm index 47ef15f924..ce74f6cfbf 100644 --- a/code/ATMOSPHERICS/datum_pipe_network.dm +++ b/code/ATMOSPHERICS/datum_pipe_network.dm @@ -21,9 +21,9 @@ datum/pipe_network update = 0 reconcile_air() //equalize_gases(gases) - //Give pipelines their process call for pressure checking and what not - for(var/datum/pipeline/line_member in line_members) - line_member.process() + //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) + // line_member.process() proc/build_network(obj/machinery/atmospherics/start_normal, obj/machinery/atmospherics/reference) //Purpose: Generate membership roster diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm index 40c07ca252..56cb989801 100644 --- a/code/ATMOSPHERICS/datum_pipeline.dm +++ b/code/ATMOSPHERICS/datum_pipeline.dm @@ -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 var/pressure = air.return_pressure() diff --git a/code/game/gamemodes/blob/blob.dm b/code/game/gamemodes/blob/blob.dm index 06c47a40ec..a9aa292f16 100644 --- a/code/game/gamemodes/blob/blob.dm +++ b/code/game/gamemodes/blob/blob.dm @@ -1,10 +1,12 @@ /datum/game_mode/blob name = "blob" config_tag = "blob" + required_players = 0 var/stage = 0 var/next_stage = 0 + /datum/game_mode/blob/announce() world << "The current game mode is - Blob!" world << "A dangerous alien organism is rapidly spreading throughout the station!" diff --git a/code/game/gamemodes/changeling/changeling.dm b/code/game/gamemodes/changeling/changeling.dm index 645cdfd7e8..874bcaaa8e 100644 --- a/code/game/gamemodes/changeling/changeling.dm +++ b/code/game/gamemodes/changeling/changeling.dm @@ -5,6 +5,8 @@ /datum/game_mode/changeling name = "changeling" config_tag = "changeling" + restricted_jobs = list("AI", "Cyborg") + required_players = 15 var const @@ -52,20 +54,24 @@ world << "The current game mode is - Changeling!" world << "There is an alien changeling on the station. Do not let the changeling succeed!" -/datum/game_mode/changeling/can_start() +/*/datum/game_mode/changeling/can_start() for(var/mob/new_player/P in world) if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) return 1 - return 0 + return 0*/ /datum/game_mode/changeling/pre_setup() 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) var/datum/mind/changeling = pick(possible_changelings) //possible_changelings-=changeling changelings += changeling - var/mob/new_player/player = changeling.current - player.jobs_restricted_by_gamemode = nonhuman_positions modePlayer += changelings return 1 else diff --git a/code/game/gamemodes/changeling/traitor_chan.dm b/code/game/gamemodes/changeling/traitor_chan.dm index 98c0811353..6c27efa345 100644 --- a/code/game/gamemodes/changeling/traitor_chan.dm +++ b/code/game/gamemodes/changeling/traitor_chan.dm @@ -2,28 +2,34 @@ name = "traitor+changeling" config_tag = "traitorchan" 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() world << "The current game mode is - Traitor+Changeling!" world << "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!" -/datum/game_mode/traitor/changeling/can_start() +/*/datum/game_mode/traitor/changeling/can_start() var/count = 0 for(var/mob/new_player/P in world) if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) count++ if (count==2) return 1 - return 0 + return 0*/ /datum/game_mode/traitor/changeling/pre_setup() 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) var/datum/mind/changeling = pick(possible_changelings) //possible_changelings-=changeling changelings += changeling - var/mob/new_player/player = changeling.current - player.jobs_restricted_by_gamemode = nonhuman_positions modePlayer += changelings return ..() else diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index 283c50cd74..9cbedf67cc 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -1,9 +1,10 @@ /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) 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 list("Security Officer", "Detective", "Chaplain", "Warden")) + /datum/game_mode/cult name = "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/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/list/startwords = list("blood","join","self","hell") - //var/list/startwords = list("travel","blood","join","hell","self","see") 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/acolytes_survived = 0 + /datum/game_mode/cult/announce() world << "The current game mode is - Cult!" world << "Some crewmembers are attempting to start a cult!
\nCultists - complete your objectives. Convert crewmembers to your cause by using the convert rune. Remember - there is no you, there is only the cult.
\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.
" -/datum/game_mode/cult/can_start() + +/*/datum/game_mode/cult/can_start() var/list/cultists_possible = get_players_for_role(BE_CULTIST) + if (cultists_possible.len < min_cultists_to_start) return 0 var/non_cultists = num_players() - min(max_cultists_to_start,cultists_possible.len) if (non_cultists < 1) return 0 - return 1 + return 1*/ + /datum/game_mode/cult/pre_setup() if(prob(50)) @@ -55,19 +62,23 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des else objectives += "eldergod" objectives += "sacrifice" - - + 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) + if(!cultists_possible.len) + break var/datum/mind/cultist = pick(cultists_possible) cultists_possible -= 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) -/datum/game_mode/cult/post_setup() +/datum/game_mode/cult/post_setup() modePlayer += cult if("sacrifice" in objectives) var/list/possible_targets = get_unconvertables() @@ -92,6 +103,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des send_intercept() ..() + /datum/game_mode/cult/proc/memoize_cult_objectives(var/datum/mind/cult_mind) for(var/obj_count = 1,obj_count <= objectives.len,obj_count++) 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.memory += "The convert rune is join blood self
" + /datum/game_mode/proc/equip_cultist(mob/living/carbon/human/mob) if(!istype(mob)) 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." return 1 + /datum/game_mode/cult/grant_runeword(mob/living/carbon/human/cult_mob, var/word) if (!word) if(startwords.len > 0) @@ -135,6 +149,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des startwords -= word return ..(cult_mob,word) + /datum/game_mode/proc/grant_runeword(mob/living/carbon/human/cult_mob, var/word) if(!wordtravel) 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.mind.store_memory("You remember that [wordexp]", 0, 0) + /datum/game_mode/proc/add_cultist(datum/mind/cult_mind) //BASE if (!istype(cult_mind)) return 0 @@ -177,11 +193,13 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des update_cult_icons_added(cult_mind) return 1 + /datum/game_mode/cult/add_cultist(datum/mind/cult_mind) //INHERIT if (!..(cult_mind)) return memoize_cult_objectives(cult_mind) + /datum/game_mode/proc/remove_cultist(datum/mind/cult_mind) if(cult_mind in cult) 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)) M << "[cult_mind.current] looks like they just reverted to their old faith!" + /datum/game_mode/proc/update_all_cult_icons() spawn(0) 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") cultist.current.client.images += I + /datum/game_mode/proc/update_cult_icons_added(datum/mind/cult_mind) spawn(0) 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") cult_mind.current.client.images += J + /datum/game_mode/proc/update_cult_icons_removed(datum/mind/cult_mind) spawn(0) 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") del(I) + /datum/game_mode/cult/proc/get_unconvertables() var/list/ucs = list() 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 return ucs + /datum/game_mode/cult/proc/check_cult_victory() var/cult_fail = 0 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 + /datum/game_mode/cult/proc/check_survive() acolytes_survived = 0 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 return 1 + /datum/game_mode/cult/declare_completion() if(!check_cult_victory()) @@ -303,6 +328,7 @@ var/list/allwords = list("travel","self","see","hell","blood","join","tech","des ..() return 1 + /datum/game_mode/proc/auto_declare_completion_cult() if (cult.len!=0 || (ticker && istype(ticker.mode,/datum/game_mode/cult))) world << "The cultists were: " diff --git a/code/game/gamemodes/extended/extended.dm b/code/game/gamemodes/extended/extended.dm index 5cef9adb0f..60b0c1f7e7 100644 --- a/code/game/gamemodes/extended/extended.dm +++ b/code/game/gamemodes/extended/extended.dm @@ -1,6 +1,7 @@ /datum/game_mode/extended name = "extended" config_tag = "extended" + required_players = 0 /datum/game_mode/announce() world << "The current game mode is - Extended Role-Playing!" @@ -11,5 +12,5 @@ spawn_exporation_packs() return 1 -/datum/game_mode/extended/can_start() - return (num_players() > 0) \ No newline at end of file +//datum/game_mode/extended/can_start() +// return (num_players() > 0) \ No newline at end of file diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 9f4b0eaf3d..c6db889263 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -1,48 +1,75 @@ /* * GAMEMODES (by Rastaf0) - * + * * In the new mode system all special roles are fully supported. * You can have proper wizards/traitors/changelings/cultists during any mode. * Only two things really depends on gamemode: * 1. Starting roles, equipment and preparations * 2. Conditions of finishing the round. - * + * */ /datum/game_mode - var/name = "invalid" - var/config_tag = null - var/intercept_hacked = 0 - var/list/datum/mind/modePlayer = new - var/votable = 1 - var/probability = 1 - var/station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm - var/explosion_in_progress = 0 //sit back and relax + var + name = "invalid" + config_tag = null + intercept_hacked = 0 + votable = 1 + probability = 1 + station_was_nuked = 0 //see nuclearbomb.dm and malfunction.dm + 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 world << "Notice: [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 -/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 -/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 + +///process() +///Called by the gameticker /datum/game_mode/proc/process() + return 0 + /datum/game_mode/proc/check_finished() //to be called by ticker if(emergency_shuttle.location==2 || station_was_nuked) return 1 return 0 + /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. + return 0 + /datum/game_mode/proc/send_intercept() var/intercepttext = "Cent. Com. Update Requested staus information:
" @@ -80,6 +107,7 @@ command_alert("Summary downloaded and printed out at all communications consoles.", "Enemy communication intercept. Security Level Elevated.") world << sound('intercept.ogg') + /datum/game_mode/proc/get_players_for_role(var/role, override_jobbans=1) var/list/candidates = list() for(var/mob/new_player/player in world) @@ -98,16 +126,22 @@ for(var/mob/new_player/player in world) if (player.client && player.ready) candidates += player.mind - 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() . = 0 for(var/mob/new_player/P in world) if(P.client && P.ready) . ++ + /////////////////////////////////// //Keeps track of all living heads// /////////////////////////////////// @@ -118,6 +152,7 @@ heads += player.mind return heads + //////////////////////////// //Keeps track of all heads// //////////////////////////// diff --git a/code/game/gamemodes/gameticker.dm b/code/game/gamemodes/gameticker.dm index 1820a71be0..6204fff512 100644 --- a/code/game/gamemodes/gameticker.dm +++ b/code/game/gamemodes/gameticker.dm @@ -52,12 +52,12 @@ var/global/datum/controller/gameticker/ticker del(mode) current_state = GAME_STATE_PREGAME world << "Unable to start [master_mode]. Not enough players. Reverting to pre-game lobby." + ResetOccupations() return 0 //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 do can_continue = src.mode.pre_setup() @@ -67,13 +67,16 @@ var/global/datum/controller/gameticker/ticker current_state = GAME_STATE_PREGAME world << "Error setting up revolution. Not enough players. Reverting to pre-game lobby." return 0 - else - can_continue = src.mode.pre_setup() - if(!can_continue) - del(mode) - current_state = GAME_STATE_PREGAME - world << "Error setting up [master_mode]. Reverting to pre-game lobby." - return 0 + else*/ + + DivideOccupations() //Distribute jobs + var/can_continue = src.mode.pre_setup()//Setup special modes + if(!can_continue) + del(mode) + current_state = GAME_STATE_PREGAME + world << "Error setting up [master_mode]. Reverting to pre-game lobby." + ResetOccupations() + return 0 if(hide_mode) var/list/modes = new @@ -85,22 +88,22 @@ var/global/datum/controller/gameticker/ticker else src.mode.announce() - distribute_jobs() //Distribute jobs and announce the captain create_characters() //Create player characters and transfer them collect_minds() - data_core.manifest() equip_characters() + data_core.manifest() current_state = GAME_STATE_PLAYING - mode.post_setup() - //Cleanup some stuff - for(var/obj/landmark/start/S in world) - //Deleting Startpoints but we need the ai point to AI-ize people later - if (S.name != "AI") - del(S) - - world << "Enjoy the game!" - world << sound('welcome.ogg') // Skie + spawn(0)//Forking here so we dont have to wait for this to finish + mode.post_setup() + //Cleanup some stuff + for(var/obj/landmark/start/S in world) + //Deleting Startpoints but we need the ai point to AI-ize people later + if (S.name != "AI") + del(S) + spawn(-1) + world << "Enjoy the game!" + world << sound('welcome.ogg') // Skie spawn (3000) start_events() @@ -116,15 +119,6 @@ var/global/datum/controller/gameticker/ticker return 1 /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() for(var/mob/new_player/player in world) @@ -135,16 +129,25 @@ var/global/datum/controller/gameticker/ticker else if(player.mind) player.create_character() del(player) + + proc/collect_minds() for(var/mob/living/player in world) if(player.mind) ticker.minds += player.mind + proc/equip_characters() + var/captainless=1 for(var/mob/living/carbon/human/player in world) if(player.mind && player.mind.assigned_role) if(player.mind.assigned_role != "MODE") 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() if(current_state != GAME_STATE_PLAYING) @@ -170,29 +173,6 @@ var/global/datum/controller/gameticker/ticker 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 << "The Emergency Shuttle has docked with the station! You have [ticker.timeleft/600] minutes to board the Emergency Shuttle." - - else //marker2 - world << "The Emergency Shuttle is leaving!" - shuttle_left = 1 - shuttlecoming = 0 - check_win() - return -*/ /datum/controller/gameticker/proc/declare_completion() @@ -225,70 +205,3 @@ var/global/datum/controller/gameticker/ticker call(mode, handler)() 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 << "Cent. Com. Update AI Malfunction Detected" - 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. -*/ diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index 493f3c48ed..64bf3ca95b 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -4,6 +4,7 @@ /datum/game_mode/malfunction name = "AI malfunction" config_tag = "malfunction" + required_players = 20 var/const/waittime_l = 600 var/const/waittime_h = 1800 // started at 1800 @@ -19,39 +20,29 @@ world << "The AI on the satellite has malfunctioned and must be destroyed." 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) if(P.client && P.ready && !jobban_isbanned(P, "AI") && !jobban_isbanned(P, "Syndicate")) 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 -/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() -/* 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) - /*if(malf_ai.len < 1) - world << "Uh oh, its malfunction and there is no AI! Please report this." - world << "Rebooting world in 5 seconds." - sleep(50) - world.Reboot() - return*/ + if(malf_ai.len < 1) + world << "Uh oh, its malfunction and there is no AI! Please report this." + world << "Rebooting world in 5 seconds." + sleep(50) + world.Reboot() + return AI_mind.current.verbs += /mob/living/silicon/ai/proc/choose_modules AI_mind.current:laws = new /datum/ai_laws/malfunction 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) all_dead = 0 return all_dead - + /datum/game_mode/malfunction/check_finished() if (station_captured && !to_nuke_or_not_to_nuke) return 1 @@ -210,7 +201,7 @@ else if (!station_captured && station_was_nuked) world << "Neutral Victory" world << "Everyone was killed by the nuclear blast!" - + else if (!station_captured && malf_dead && !station_was_nuked) world << "Human Victory" world << "The AI has been killed! The staff is victorious." diff --git a/code/game/gamemodes/meteor/meteor.dm b/code/game/gamemodes/meteor/meteor.dm index 7a562b8eca..498c743343 100644 --- a/code/game/gamemodes/meteor/meteor.dm +++ b/code/game/gamemodes/meteor/meteor.dm @@ -5,6 +5,7 @@ var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds) var/const/meteordelay = 2000 var/nometeors = 1 + required_players = 0 /datum/game_mode/meteor/announce() world << "The current game mode is - Meteor!" @@ -16,7 +17,7 @@ spawn(meteordelay) nometeors = 0 -/datum/game_mode/meteor/can_start() +/*/datum/game_mode/meteor/can_start() var/num_players = 0 for(var/mob/new_player/P in world) if(P.client && P.ready) @@ -25,7 +26,7 @@ if(num_players >= 10) return 1 // needs at least 10 players in order to play this mode - return 0 + return 0*/ /datum/game_mode/meteor/process() if (nometeors) return diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 96192df6f7..cc929024ef 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -5,6 +5,7 @@ /datum/game_mode/nuclear name = "nuclear emergency" config_tag = "nuclear" + required_players = 15 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) @@ -20,15 +21,9 @@ world << "A [syndicate_name()] Strike Force is approaching [station_name()]!" 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!\nSyndicate: Reclaim the disk and detonate the nuclear bomb anywhere on SS13.\nPersonnel: Hold the disk and escape with the disk on the shuttle!" -/datum/game_mode/nuclear/can_start() - if (num_players() < 2) +/datum/game_mode/nuclear/can_start()//This could be better, will likely have to recode it later + if(!..()) 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/agent_number = 0 @@ -55,8 +50,13 @@ for(var/datum/mind/synd_mind in syndicates) 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 - return 1 + + +/datum/game_mode/nuclear/pre_setup() + return 1 + + //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// /datum/game_mode/proc/update_all_synd_icons() diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index d86c1c7c22..04873be10e 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -14,11 +14,13 @@ /datum/game_mode/revolution name = "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/const/max_headrevs = 3 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) - /////////////////////////// //Announces the game type// /////////////////////////// @@ -26,13 +28,15 @@ world << "The current game mode is - Revolution!" world << "Some crewmembers are attempting to start a revolution!
\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.
\nPersonnel - Protect the heads of staff. Kill the leaders of the revolution, and brainwash the other revolutionaries (by beating them in the head).
" - +/* /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_heads = new + var/players = 0 for(var/mob/new_player/P in world) if (!P.client || !P.ready) continue + players++ if(!jobban_isbanned(P, "Syndicate")) possible_headrevs += P for (var/i in head_positions) @@ -40,6 +44,8 @@ possible_heads += P break //lets do as best as we can + if (players < min_players) + return 0 if (possible_headrevs.len==0) return 0 if (possible_heads.len==0) @@ -48,7 +54,7 @@ var/list/rest_heads = possible_heads - possible_headrevs return (rest_heads.len>0) return 1 //read as "maybe" - +*/ /////////////////////////////////////////////////////////////////////////////// //Gets the round setup, cancelling if there's not enough players at the start// @@ -56,30 +62,30 @@ /datum/game_mode/revolution/pre_setup() 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) if (possible_headrevs.len==0) break var/datum/mind/lenin = pick(possible_headrevs) possible_headrevs -= 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 - 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 + /datum/game_mode/revolution/post_setup() var/list/heads = get_living_heads() diff --git a/code/game/gamemodes/sandbox/sandbox.dm b/code/game/gamemodes/sandbox/sandbox.dm index 9d2daa7c20..77f0234b0e 100644 --- a/code/game/gamemodes/sandbox/sandbox.dm +++ b/code/game/gamemodes/sandbox/sandbox.dm @@ -1,6 +1,7 @@ /datum/game_mode/sandbox name = "sandbox" config_tag = "sandbox" + required_players = 0 /datum/game_mode/sandbox/announce() world << "The current game mode is - Sandbox!" diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 8702547801..542ea6b39c 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -5,7 +5,7 @@ /datum/game_mode/traitor name = "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_right_murder_target_l = 25 // lower bound on probability of naming right assassination target @@ -50,11 +50,11 @@ world << "The current game mode is - Traitor!" world << "There is a syndicate traitor on the station. Do not let the traitor succeed!" -/datum/game_mode/traitor/can_start() +/*/datum/game_mode/traitor/can_start() for(var/mob/new_player/P in world) if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) return 1 - return 0 + return 0*/ /datum/game_mode/traitor/pre_setup() var/list/possible_traitors = get_players_for_role(BE_TRAITOR) diff --git a/code/game/gamemodes/wizard/wizard.dm b/code/game/gamemodes/wizard/wizard.dm index c389c2efa5..ce6a988103 100644 --- a/code/game/gamemodes/wizard/wizard.dm +++ b/code/game/gamemodes/wizard/wizard.dm @@ -5,6 +5,7 @@ /datum/game_mode/wizard name = "wizard" config_tag = "wizard" + required_players = 0 var/finished = 0 @@ -55,18 +56,13 @@ world << "The current game mode is - Wizard!" world << "There is a \red SPACE WIZARD\black on the station. You can't let him achieve his objective!" -/datum/game_mode/wizard/can_start() - for(var/mob/new_player/P in world) - if(P.client && P.ready && !jobban_isbanned(P, "Syndicate")) - return 1 - return 0 - -/datum/game_mode/wizard/pre_setup() +/datum/game_mode/wizard/can_start()//This could be better, will likely have to recode it later + if(!..()) + return 0 var/list/datum/mind/possible_wizards = get_players_for_role(BE_WIZARD) if(possible_wizards.len==0) return 0 var/datum/mind/wizard = pick(possible_wizards) - //possible_wizards-=wizard wizards += wizard modePlayer += wizard wizard.assigned_role = "MODE" //So they aren't chosen for other jobs. @@ -78,6 +74,9 @@ wizard.current.loc = pick(wizardstart) return 1 +/datum/game_mode/wizard/pre_setup() + return 1 + /datum/game_mode/wizard/post_setup() for(var/datum/mind/wizard in wizards) forge_wizard_objectives(wizard) diff --git a/code/game/jobs/jobprocs.dm b/code/game/jobs/jobprocs.dm index 4481a21a44..429e39f381 100644 --- a/code/game/jobs/jobprocs.dm +++ b/code/game/jobs/jobprocs.dm @@ -6,8 +6,8 @@ if (player.preferences.occupation[level] == job) if (jobban_isbanned(player, job)) continue - if (player.jobs_restricted_by_gamemode && (job in player.jobs_restricted_by_gamemode)) - continue +// if (player.jobs_restricted_by_gamemode && (job in player.jobs_restricted_by_gamemode)) +// continue candidates += player return candidates @@ -15,7 +15,8 @@ /proc/ResetOccupations() for (var/mob/new_player/player in world) player.mind.assigned_role = null - player.jobs_restricted_by_gamemode = null + player.mind.special_role = null +// player.jobs_restricted_by_gamemode = null return /** Proc DivideOccupations @@ -26,9 +27,6 @@ var/list/unassigned = list() var/list/occupation_eligible = occupations.Copy() - if(ticker.mode.name == "AI malfunction") - occupation_eligible["AI"] = 0 - for (var/mob/new_player/player in world) if (player.client && player.ready && !player.mind.assigned_role) unassigned += player @@ -47,27 +45,40 @@ if (unassigned.len == 0) return 0 + //Check for a Captain first for (var/level = 1 to 3) var/list/candidates = FindOccupationCandidates(unassigned, "Captain", level) - if (candidates.len) var/mob/new_player/candidate = pick(candidates) unassigned -= candidate candidate.mind.assigned_role = "Captain" break - /* - // Not forcing a Captain -- TLE - if (captain_choice == null && unassigned.len > 0) + + //Then check for an AI + 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) for(var/mob/new_player/player in unassigned) - if(jobban_isbanned(player, "Captain")) + if(jobban_isbanned(player, "AI")) continue else - captain_choice = player + player.mind.assigned_role = "AI" + unassigned -= player break - unassigned -= captain_choice - */ - for (var/level = 1 to 3) //players with preferences set + //Now we can go though the rest of the jobs and players who set prefs + for (var/level = 1 to 3) + //Assistants are checked first for (var/occupation in assistant_occupations) if (unassigned.len == 0) break @@ -75,7 +86,7 @@ for (var/mob/new_player/candidate in candidates) candidate.mind.assigned_role = occupation unassigned -= candidate - + //Now everyone else for (var/occupation in occupation_eligible) if (unassigned.len == 0) break @@ -87,10 +98,9 @@ var/mob/new_player/candidate = pick_n_take(candidates) candidate.mind.assigned_role = occupation unassigned -= candidate - - if (unassigned.len) //unlucky players with preferences and players without preferences + //Last try to fill in any leftover jobs with leftover players + if (unassigned.len) var/list/vacancies = list() - var/list/failsafe = list() for (var/occ in occupation_eligible) for (var/i = 1 to occupation_eligible[occ]) vacancies += occ @@ -98,13 +108,6 @@ while (unassigned.len && vacancies.len) var/mob/new_player/candidate = pick_n_take(unassigned) 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 for (var/mob/new_player/player in unassigned) @@ -112,110 +115,10 @@ break 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 /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) if ("Chaplain") var/obj/item/weapon/storage/bible/B = new /obj/item/weapon/storage/bible/booze(src) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index e2113f1762..3acf443ca8 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -10,7 +10,7 @@ mob/new_player canmove = 0 anchored = 1 // don't get pushed around - var/list/jobs_restricted_by_gamemode +// var/list/jobs_restricted_by_gamemode 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