Skip to content

Commit

Permalink
Generic game mode
Browse files Browse the repository at this point in the history
  • Loading branch information
CM Dev committed Jun 22, 2018
1 parent b82c762 commit 5bc37a7
Show file tree
Hide file tree
Showing 57 changed files with 644 additions and 954 deletions.
3 changes: 0 additions & 3 deletions ColonialMarinesALPHA.dme
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,9 @@
#include "code\game\gamemodes\intercept_report.dm"
#include "code\game\gamemodes\objective.dm"
#include "code\game\gamemodes\setupgame.dm"
#include "code\game\gamemodes\colonialmarines\big_red.dm"
#include "code\game\gamemodes\colonialmarines\colonialmarines.dm"
#include "code\game\gamemodes\colonialmarines\halloween2016.dm"
#include "code\game\gamemodes\colonialmarines\huntergames.dm"
#include "code\game\gamemodes\colonialmarines\ice_colony.dm"
#include "code\game\gamemodes\colonialmarines\prison.dm"
#include "code\game\gamemodes\colonialmarines\whiskey_outpost.dm"
#include "code\game\gamemodes\events\power_failure.dm"
#include "code\game\gamemodes\extended\extended.dm"
Expand Down
6 changes: 6 additions & 0 deletions code/#define/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
#define MAIN_AI_SYSTEM "ARES v3.2"
#define MAIN_SHIP_ESCAPE_POD_NUMBER 11

#define MAP_ICE_COLONY "Ice Colony"
#define MAP_LV_624 "LV-624"
#define MAP_BIG_RED "Solaris Ridge"
#define MAP_PRISON_STATION "Prison Station"
#define MAP_WHISKEY_OUTPOST "Whiskey Outpost"

/*
Trash Authority Directives
Defines for when we need to give commands to the trash authority in how to handle trash.
Expand Down
1 change: 1 addition & 0 deletions code/#define/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define MODE_HAS_FINISHED 8
#define MODE_FOG_ACTIVATED 16
#define MODE_INFECTION 32
#define MODE_HUMAN_ANTAGS 64

#define BE_ALIEN 1
#define BE_QUEEN 2
Expand Down
27 changes: 24 additions & 3 deletions code/controllers/voting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ datum/controller/vote


var/MapDaemon_UID = -1 //-1 by default so we know when to set it
var/force_mapdaemon_vote = 0

//Basically, this completely ignores the voting datum etc in favor of editing a simple a simple list, player_votes
//Upon request by MapDaemon, world/Topic() will it into JSON and send it away, so we do 0 handling in DM
Expand All @@ -355,6 +356,16 @@ var/MapDaemon_UID = -1 //-1 by default so we know when to set it

player_votes[src.ckey] = selection

/client/proc/forceMDMapVote()
set name = "Map Vote - Force Initiate"
set category = "Server"

force_mapdaemon_vote = !force_mapdaemon_vote
src << "<span class='notice'>The server will [force_mapdaemon_vote ? "now" : "no longer"] tell Mapdaemon to start a vote the next time possible.</span>"

message_admins("[src] is attempting to force a MapDaemon vote.")
log_admin("[src] is attempting to force a MapDaemon vote.")

//Uses an invalid ckey to rig the votes
//Special case for }}} handled in World/Topic()
//Set up so admins can fight over what the map will be, hurray
Expand Down Expand Up @@ -438,13 +449,23 @@ var/kill_map_daemon = 0
set category = "Server"

if(alert("Are you sure you want to kill MapDaemon?",, "Yes", "No") == "No") return
if(alert("Are you doubly sure you want to kill MapDaemon? It will be impossible to restart it for the duration of this round. If the round has been delayed it is too late to have any effect.",, "Yes", "No") == "No") return

kill_map_daemon = 1

alert("MapDaemon will be killed on next round-end check.")
message_admins("[src] just killed MapDaemon. It is unrecoverable.")
log_admin("[src] just killed MapDaemon. It is unrecoverable.")
message_admins("[src] just killed MapDaemon. It may be restarted with \"Map Vote - Revive MapDaemon\".")
log_admin("[src] just killed MapDaemon. It may be restarted with \"Map Vote - Revive MapDaemon\".")

/client/proc/reviveMapDaemon()
set name = "Map Vote - Revive MapDaemon"
set category = "Server"

kill_map_daemon = 0

message_admins("[src] is attempting to restart MapDaemon.")
log_admin("[src] is attempting to restart MapDaemon.")

run_mapdaemon_batch()

//Need to return 1 so that the thing calling hooks wont think that this failed
/hook/roundstart/proc/launchMapDaemon()
Expand Down
278 changes: 159 additions & 119 deletions code/game/gamemodes/cm_initialize.dm

Large diffs are not rendered by default.

204 changes: 1 addition & 203 deletions code/game/gamemodes/cm_process.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,218 +35,16 @@ This is meant for infestation type game modes for right now (marines vs. aliens,
of predators), but can be added to include variant game modes (like humans vs. humans).
*/

//===================================================\\
//PROCESS GAME MODE\\
//===================================================\\
/datum/game_mode/proc/pre_setup_infestation()
round_fog = new
var/xeno_tunnels[] = new
var/monkey_spawns[] = new
var/map_items[] = new
var/obj/effect/blocker/fog/F
for(var/obj/effect/landmark/L in landmarks_list)
switch(L.name)
if("hunter_primary")
cdel(L)
if("hunter_secondary")
cdel(L)
if("crap_item")
cdel(L)
if("good_item")
cdel(L)
if("block_hellhound")
cdel(L)
if("fog blocker")
F = new(L.loc)
round_fog += F
cdel(L)
if("xeno tunnel")
xeno_tunnels += L.loc
cdel(L)
if("monkey_spawn")
monkey_spawns += L.loc
cdel(L)
if("map item")
map_items += L.loc
cdel(L)

// Spawn gamemode-specific map items
for(var/obj/effect/landmark/map_item/MI)
var/turf/T = pick(map_items)
map_items -= T
if(ticker.mode.name == "LV-624") new /obj/item/map/lazarus_landing_map(T)
else if(ticker.mode.name == "Ice Colony") new /obj/item/map/ice_colony_map(T)
else if(ticker.mode.name == "Solaris Ridge") new /obj/item/map/big_red_map(T)
else if(ticker.mode.name == "Prison Station") new /obj/item/map/FOP_map(T)
else
return

if(monkey_amount && monkey_types.len)
//var/debug_tally = 0
for(var/i = monkey_amount, i > 0, i--)
var/turf/T = pick(monkey_spawns)
monkey_spawns -= T
var/monkey_to_spawn = pick(monkey_types)
new monkey_to_spawn(T)
//debug_tally++

//message_admins("SPAWNED [debug_tally] MONKEYS") //DO NOT LEAVE THIS UNCOMMENTED, THIS IS DEV INFO ONLY

if(!round_fog.len) round_fog = null //No blockers?
else
round_time_fog = rand(-2500,2500)
flags_round_type |= MODE_FOG_ACTIVATED
var/obj/structure/tunnel/T
var/i = 0
var/turf/t
while(xeno_tunnels.len && i++ < 3)
t = pick(xeno_tunnels)
xeno_tunnels -= t
T = new(t)
T.id = "hole[i]"

r_TRU

//===================================================\\
//PROCESS GAME MODE\\
//===================================================\\
#define FOG_DELAY_INTERVAL 27000 // 45 minutes
/datum/game_mode/proc/process_infestation()
if(--round_started > 0) r_FAL //Initial countdown, just to be safe, so that everyone has a chance to spawn before we check anything.

if(!round_finished)
for(var/datum/hive_status/hive in hive_datum)
if(hive.xeno_queen_timer && --hive.xeno_queen_timer <= 1) xeno_message("The Hive is ready for a new Queen to evolve.", 3, hive.hivenumber)

// Automated bioscan / Queen Mother message
if(world.time > bioscan_current_interval) //If world time is greater than required bioscan time.
announce_bioscans() //Announce the results of the bioscan to both sides.
bioscan_current_interval += bioscan_ongoing_interval //Add to the interval based on our set interval time.

if(++round_checkwin >= 5) //Only check win conditions every 5 ticks.
if(flags_round_type & MODE_FOG_ACTIVATED && world.time >= (FOG_DELAY_INTERVAL + round_time_lobby + round_time_fog)) disperse_fog()//Some RNG thrown in.
check_win()
round_checkwin = 0

#undef FOG_DELAY_INTERVAL

//===================================================\\
//CHECK VICTORY\\
//===================================================\\
/datum/game_mode/proc/check_win_infestation()
var/living_player_list[] = count_humans_and_xenos(EvacuationAuthority.get_affected_zlevels())
var/num_humans = living_player_list[1]
var/num_xenos = living_player_list[2]

if(EvacuationAuthority.dest_status == NUKE_EXPLOSION_FINISHED) round_finished = MODE_GENERIC_DRAW_NUKE //Nuke went off, ending the round.
if(EvacuationAuthority.dest_status < NUKE_EXPLOSION_IN_PROGRESS) //If the nuke ISN'T in progress. We do not want to end the round before it detonates.
if(!num_humans && num_xenos) //No humans remain alive.
if(EvacuationAuthority.evac_status > EVACUATION_STATUS_STANDING_BY) round_finished = MODE_INFESTATION_X_MINOR //Evacuation successfully took place. //TODO Find out if anyone made it on.
else round_finished = MODE_INFESTATION_X_MAJOR //Evacuation did not take place. Everyone died.
else if(num_humans && !num_xenos)
if(EvacuationAuthority.evac_status > EVACUATION_STATUS_STANDING_BY) round_finished = MODE_INFESTATION_M_MINOR //Evacuation successfully took place.
else round_finished = MODE_INFESTATION_M_MAJOR //Humans destroyed the xenomorphs.
else if(!num_humans && !num_xenos) round_finished = MODE_INFESTATION_DRAW_DEATH //Both were somehow destroyed.

//If the queen is dead after a period of time, this will end the game.
/datum/game_mode/proc/check_queen_status(queen_time)
set waitfor = 0
var/datum/hive_status/hive = hive_datum[XENO_HIVE_NORMAL]
hive.xeno_queen_timer = queen_time
if(!(flags_round_type & MODE_INFESTATION)) return
xeno_queen_deaths += 1
var/num_last_deaths = xeno_queen_deaths
sleep(QUEEN_DEATH_COUNTDOWN)
//We want to make sure that another queen didn't die in the interim.

if(xeno_queen_deaths == num_last_deaths && !round_finished && !hive.living_xeno_queen ) round_finished = MODE_INFESTATION_M_MINOR


/datum/game_mode/proc/check_win_infection()
var/living_player_list[] = count_humans_and_xenos(EvacuationAuthority.get_affected_zlevels())
var/num_humans = living_player_list[1]
var/zed = living_player_list[2]
// world << "ZED: [zed]"
// world << "Humie: [num_humans]"

if(num_humans <=0 && zed >= 1)
round_finished = MODE_INFECTION_ZOMBIE_WIN

return

//===================================================\\
//ANNOUNCE COMPLETION\\
//===================================================\\
/datum/game_mode/proc/declare_completion_infestation() //TO DO: Change the file path to something better. This is not only for infestation anymore.
//world << "<span class='round_header'>[round_finished]</span>"
world << "<span class='round_header'>|Round Complete|</span>"
feedback_set_details("round_end_result",round_finished)


if(flags_round_type & MODE_INFESTATION)
world << "<span class='round_body'>Thus ends the story of the brave men and women of the [MAIN_SHIP_NAME] and their struggle on [name].</span>"
world << "<span class='round_body'>End of Round Grief (EORG) is an IMMEDIATE 3 hour ban with no warnings, see rule #7 for more details.</span>"
var/musical_track
switch(round_finished)
if(MODE_INFESTATION_X_MAJOR) musical_track = pick('sound/theme/sad_loss1.ogg','sound/theme/sad_loss2.ogg')
if(MODE_INFESTATION_M_MAJOR) musical_track = pick('sound/theme/winning_triumph1.ogg','sound/theme/winning_triumph2.ogg')
if(MODE_INFESTATION_X_MINOR) musical_track = pick('sound/theme/neutral_melancholy1.ogg','sound/theme/neutral_melancholy2.ogg')
if(MODE_INFESTATION_M_MINOR) musical_track = pick('sound/theme/neutral_hopeful1.ogg','sound/theme/neutral_hopeful2.ogg')
if(MODE_INFESTATION_DRAW_DEATH) musical_track = pick('sound/theme/nuclear_detonation1.ogg','sound/theme/nuclear_detonation2.ogg') //This one is unlikely to play.
world << musical_track
else
switch(round_finished)
if(MODE_BATTLEFIELD_W_MAJOR)
world << "<span class='round_body'>The W-Y PMCs have successfully repelled the USCM assault and completed their objectives!</span>"
world << 'sound/misc/good_is_dumb.ogg'
if(MODE_BATTLEFIELD_M_MAJOR)
world << "<span class='round_body'>The marines have wiped out the PMC garrison and completed their objective! Hooah!</span>"
world << 'sound/misc/outstanding_marines.ogg'
if(MODE_BATTLEFIELD_W_MINOR)
world << "<span class='round_body'>The W-Y PMCs wiped out the marines, but they failed to complete their objective! W-Y won't be happy!</span>"
world << 'sound/misc/gone_to_plaid.ogg'
if(MODE_BATTLEFIELD_M_MINOR)
world << "<span class='round_body'>The marines glassed the W-Y mercs, but they failed to complete their objective! Incompetent baldies!</span>"
world << 'sound/misc/apcdestroyed.ogg'
if(MODE_BATTLEFIELD_DRAW_STALEMATE)
world << "<span class='round_body'>The marines completed their objective, but they failed to destroy the PMCs! W-Y will be coming back!</span>"
if(MODE_BATTLEFIELD_DRAW_DEATH)
world << "<span class='round_body'>Both the marines and the W-Y PMCs were annihilated! The nightmare continues!</span>"
world << 'sound/misc/Rerun.ogg'
if(MODE_GENERIC_DRAW_NUKE)
world << "<span class='round_body'>The nuclear explosion changed everything.</span>"
if(MODE_INFECTION_ZOMBIE_WIN)
world << "<span class='round_body'>The zombies have been victorious!</span>"

else world << "<span class='round_body'>Whoops, something went wrong with declare_completion(), blame the coders!</span>"

var/dat = ""
//if(flags_round_type & MODE_INFESTATION)
//var/living_player_list[] = count_humans_and_xenos()
//dat = "\nXenomorphs remaining: [living_player_list[2]]. Humans remaining: [living_player_list[1]]."
if(round_stats) round_stats << "[round_finished][dat]\nGame mode: [name]\nRound time: [duration2text()]\nEnd round player population: [clients.len]\nTotal xenos spawned: [round_statistics.total_xenos_created]\nTotal Preds spawned: [predators.len]\nTotal humans spawned: [round_statistics.total_humans_created][log_end]" // Logging to data/logs/round_stats.log

world << dat

declare_completion_announce_individual()
declare_completion_announce_predators()
if(flags_round_type & MODE_INFESTATION)
declare_completion_announce_xenomorphs()
declare_completion_announce_survivors()
declare_completion_announce_medal_awards()
return 1

/datum/game_mode/proc/declare_completion_announce_individual()
set waitfor = 0
sleep(45)
Expand Down
77 changes: 0 additions & 77 deletions code/game/gamemodes/colonialmarines/big_red.dm

This file was deleted.

Loading

0 comments on commit 5bc37a7

Please sign in to comment.