Files
CHOMPStation2/code/game/gamemodes/nuclear/nuclear.dm
PsiOmega 87998f7eb1 Fixes #7295.
Cleans up round end summary.
Removes duplication of traitor summaries.
Attempts to improve how the traitor purchase log is presented.
Ghosts made manifest now have different names and assignments, otherwise one would get messages like "Anguished Phantom played as an Anguished Phantom".
Instead the message is "Anguished Phantom played as a Manifest Ghost".
2014-12-08 17:06:36 +01:00

346 lines
13 KiB
Plaintext

/*
MERCENARY ROUNDTYPE
*/
var/global/list/turf/synd_spawn = list()
/datum/game_mode
var/list/datum/mind/syndicates = list()
/datum/game_mode/nuclear
name = "mercenary"
config_tag = "nuclear"
required_players = 15
required_players_secret = 25 // 25 players - 5 players to be the nuke ops = 20 players remaining
required_enemies = 1
recommended_enemies = 5
uplink_welcome = "Corporate Backed Uplink Console:"
uplink_uses = 40
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_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds)
var/nukes_left = 1 // Call 3714-PRAY right now and order more nukes! Limited offer!
var/nuke_off_station = 0 //Used for tracking if the syndies actually haul the nuke to the station
var/syndies_didnt_escape = 0 //Used for tracking if the syndies got the shuttle off of the z-level
/datum/game_mode/nuclear/announce()
world << "<B>The current game mode is - Mercenary!</B>"
world << "<B>A [syndicate_name()] Strike Force is approaching [station_name()]!</B>"
/datum/game_mode/nuclear/can_start()//This could be better, will likely have to recode it later
if(!..())
return 0
var/list/possible_syndicates = get_players_for_role(BE_OPERATIVE)
var/agent_number = 0
/*
* if(possible_syndicates.len > agents_possible)
* agent_number = agents_possible
* else
* agent_number = possible_syndicates.len
*
* if(agent_number > n_players)
* agent_number = n_players/2
*/
if(possible_syndicates.len < 1)
return 0
//Antag number should scale to active crew.
var/n_players = num_players()
agent_number = Clamp((n_players/5), 2, 6)
if(possible_syndicates.len < agent_number)
agent_number = possible_syndicates.len
while(agent_number > 0)
var/datum/mind/new_syndicate = pick(possible_syndicates)
syndicates += new_syndicate
possible_syndicates -= new_syndicate //So it doesn't pick the same guy each time.
agent_number--
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 = "Mercenary"//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()
spawn(0)
for(var/datum/mind/synd_mind in syndicates)
if(synd_mind.current)
if(synd_mind.current.client)
for(var/image/I in synd_mind.current.client.images)
if(I.icon_state == "synd")
del(I)
for(var/datum/mind/synd_mind in syndicates)
if(synd_mind.current)
if(synd_mind.current.client)
for(var/datum/mind/synd_mind_1 in syndicates)
if(synd_mind_1.current)
var/I = image('icons/mob/mob.dmi', loc = synd_mind_1.current, icon_state = "synd")
synd_mind.current.client.images += I
/datum/game_mode/proc/update_synd_icons_added(datum/mind/synd_mind)
spawn(0)
if(synd_mind.current)
if(synd_mind.current.client)
var/I = image('icons/mob/mob.dmi', loc = synd_mind.current, icon_state = "synd")
synd_mind.current.client.images += I
/datum/game_mode/proc/update_synd_icons_removed(datum/mind/synd_mind)
spawn(0)
for(var/datum/mind/synd in syndicates)
if(synd.current)
if(synd.current.client)
for(var/image/I in synd.current.client.images)
if(I.icon_state == "synd" && I.loc == synd_mind.current)
del(I)
if(synd_mind.current)
if(synd_mind.current.client)
for(var/image/I in synd_mind.current.client.images)
if(I.icon_state == "synd")
del(I)
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
/datum/game_mode/nuclear/post_setup()
var/obj/effect/landmark/uplinkdevice = locate("landmark*Syndicate-Uplink") //i will be rewriting this shortly
var/obj/effect/landmark/nuke_spawn = locate("landmark*Nuclear-Bomb")
var/nuke_code = "[rand(10000, 99999)]"
var/datum/mind/leader = null
var/spawnpos = 1
for(var/datum/mind/synd_mind in syndicates)
if(spawnpos > synd_spawn.len)
spawnpos = 1
synd_mind.current.loc = synd_spawn[spawnpos]
synd_mind.current.real_name = "[syndicate_name()] Operative" // placeholder while we get their actual name
spawn(0)
NukeNameAssign(synd_mind)
forge_syndicate_objectives(synd_mind)
greet_syndicate(synd_mind)
equip_syndicate(synd_mind.current)
if(!leader)
prepare_syndicate_leader(synd_mind, nuke_code)
leader = synd_mind
spawnpos++
update_synd_icons_added(synd_mind)
update_all_synd_icons()
if(uplinkdevice)
var/obj/item/device/radio/uplink/U = new(uplinkdevice.loc)
if(leader)
U.hidden_uplink.uplink_owner = leader
U.hidden_uplink.uses = 40
if(nuke_spawn && synd_spawn.len > 0)
var/obj/machinery/nuclearbomb/the_bomb = new /obj/machinery/nuclearbomb(nuke_spawn.loc)
the_bomb.r_code = nuke_code
spawn (rand(waittime_l, waittime_h))
send_intercept()
return ..()
/datum/game_mode/proc/prepare_syndicate_leader(var/datum/mind/synd_mind, var/nuke_code)
var/obj/effect/landmark/code_spawn = locate("landmark*Nuclear-Code")
if (nuke_code)
synd_mind.store_memory("<B>Nuclear Bomb Code</B>: [nuke_code]", 0, 0)
synd_mind.current << "The nuclear authorization code is: <B>[nuke_code]</B>"
synd_mind.current << "To speak on the strike team's private channel use :t"
var/obj/item/weapon/paper/P = new
P.info = "The nuclear authorization code is: <b>[nuke_code]</b>"
P.name = "nuclear bomb code"
if (ticker.mode.config_tag=="nuclear")
P.loc = code_spawn.loc
else
var/mob/living/carbon/human/H = synd_mind.current
P.loc = H.loc
H.equip_to_slot_or_del(P, slot_r_store, 0)
H.update_icons()
else
nuke_code = "code will be provided later"
return
/datum/game_mode/proc/forge_syndicate_objectives(var/datum/mind/syndicate)
if (config.objectives_disabled)
return
var/datum/objective/nuclear/syndobj = new
syndobj.owner = syndicate
syndicate.objectives += syndobj
/datum/game_mode/proc/greet_syndicate(var/datum/mind/syndicate, var/you_are=1)
if (you_are)
syndicate.current << "\blue You are a [syndicate_name()] operative!"
show_objectives(syndicate)
/datum/game_mode/proc/random_radio_frequency()
return 1337 // WHY??? -- Doohl
/datum/game_mode/proc/equip_syndicate(mob/living/carbon/human/synd_mob)
var/obj/item/device/radio/R = new /obj/item/device/radio/headset/syndicate(synd_mob)
R.set_frequency(SYND_FREQ)
R.freerange = 1
synd_mob.equip_to_slot_or_del(R, slot_l_ear)
synd_mob.equip_to_slot_or_del(new /obj/item/clothing/under/syndicate(synd_mob), slot_w_uniform)
synd_mob.equip_to_slot_or_del(new /obj/item/clothing/shoes/black(synd_mob), slot_shoes)
synd_mob.equip_to_slot_or_del(new /obj/item/clothing/gloves/swat(synd_mob), slot_gloves)
synd_mob.equip_to_slot_or_del(new /obj/item/weapon/card/id/syndicate(synd_mob), slot_wear_id)
if(synd_mob.backbag == 2) synd_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack(synd_mob), slot_back)
if(synd_mob.backbag == 3) synd_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/satchel_norm(synd_mob), slot_back)
if(synd_mob.backbag == 4) synd_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/satchel(synd_mob), slot_back)
synd_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/box/engineer(synd_mob.back), slot_in_backpack)
synd_mob.equip_to_slot_or_del(new /obj/item/weapon/reagent_containers/pill/cyanide(synd_mob), slot_in_backpack)
synd_mob.update_icons()
return 1
/datum/game_mode/nuclear/check_win()
if (nukes_left == 0)
return 1
return ..()
/datum/game_mode/proc/is_operatives_are_dead()
for(var/datum/mind/operative_mind in syndicates)
if (!istype(operative_mind.current,/mob/living/carbon/human))
if(operative_mind.current)
if(operative_mind.current.stat!=2)
return 0
return 1
/datum/game_mode/nuclear/declare_completion()
if(config.objectives_disabled)
return
var/disk_rescued = 1
for(var/obj/item/weapon/disk/nuclear/D in world)
var/disk_area = get_area(D)
if(!is_type_in_list(disk_area, centcom_areas))
disk_rescued = 0
break
var/crew_evacuated = (emergency_shuttle.returned())
//var/operatives_are_dead = is_operatives_are_dead()
//nukes_left
//station_was_nuked
//derp //Used for tracking if the syndies actually haul the nuke to the station //no
//herp //Used for tracking if the syndies got the shuttle off of the z-level //NO, DON'T FUCKING NAME VARS LIKE THIS
if(!disk_rescued && station_was_nuked && !syndies_didnt_escape)
feedback_set_details("round_end_result","win - syndicate nuke")
world << "<FONT size = 3><B>Mercenary Major Victory!</B></FONT>"
world << "<B>[syndicate_name()] operatives have destroyed [station_name()]!</B>"
else if (!disk_rescued && station_was_nuked && syndies_didnt_escape)
feedback_set_details("round_end_result","halfwin - syndicate nuke - did not evacuate in time")
world << "<FONT size = 3><B>Total Annihilation</B></FONT>"
world << "<B>[syndicate_name()] operatives destroyed [station_name()] but did not leave the area in time and got caught in the explosion.</B> Next time, don't lose the disk!"
else if (!disk_rescued && !station_was_nuked && nuke_off_station && !syndies_didnt_escape)
feedback_set_details("round_end_result","halfwin - blew wrong station")
world << "<FONT size = 3><B>Crew Minor Victory</B></FONT>"
world << "<B>[syndicate_name()] operatives secured the authentication disk but blew up something that wasn't [station_name()].</B> Next time, don't lose the disk!"
else if (!disk_rescued && !station_was_nuked && nuke_off_station && syndies_didnt_escape)
feedback_set_details("round_end_result","halfwin - blew wrong station - did not evacuate in time")
world << "<FONT size = 3><B>[syndicate_name()] operatives have earned Darwin Award!</B></FONT>"
world << "<B>[syndicate_name()] operatives blew up something that wasn't [station_name()] and got caught in the explosion.</B> Next time, don't lose the disk!"
else if ( disk_rescued && is_operatives_are_dead())
feedback_set_details("round_end_result","loss - evacuation - disk secured - syndi team dead")
world << "<FONT size = 3><B>Crew Major Victory!</B></FONT>"
world << "<B>The Research Staff has saved the disc and killed the [syndicate_name()] Operatives</B>"
else if ( disk_rescued )
feedback_set_details("round_end_result","loss - evacuation - disk secured")
world << "<FONT size = 3><B>Crew Major Victory</B></FONT>"
world << "<B>The Research Staff has saved the disc and stopped the [syndicate_name()] Operatives!</B>"
else if (!disk_rescued && is_operatives_are_dead())
feedback_set_details("round_end_result","loss - evacuation - disk not secured")
world << "<FONT size = 3><B>Mercenary Minor Victory!</B></FONT>"
world << "<B>The Research Staff failed to secure the authentication disk but did manage to kill most of the [syndicate_name()] Operatives!</B>"
else if (!disk_rescued && crew_evacuated)
feedback_set_details("round_end_result","halfwin - detonation averted")
world << "<FONT size = 3><B>Mercenary Minor Victory!</B></FONT>"
world << "<B>[syndicate_name()] operatives recovered the abandoned authentication disk but detonation of [station_name()] was averted.</B> Next time, don't lose the disk!"
else if (!disk_rescued && !crew_evacuated)
feedback_set_details("round_end_result","halfwin - interrupted")
world << "<FONT size = 3><B>Neutral Victory</B></FONT>"
world << "<B>Round was mysteriously interrupted!</B>"
..()
return
/datum/game_mode/proc/auto_declare_completion_nuclear()
if( syndicates.len || (ticker && istype(ticker.mode,/datum/game_mode/nuclear)) )
var/text = "<FONT size = 2><B>The mercenaries were:</B></FONT>"
for(var/datum/mind/syndicate in syndicates)
text += print_player_full(syndicate)
world << text
return 1
/*/proc/nukelastname(var/mob/M as mob) //--All praise goes to NEO|Phyte, all blame goes to DH, and it was Cindi-Kate's idea. Also praise Urist for copypasta ho.
var/randomname = pick(last_names)
var/newname = copytext(sanitize(input(M,"You are the nuke operative [pick("Czar", "Boss", "Commander", "Chief", "Kingpin", "Director", "Overlord")]. Please choose a last name for your family.", "Name change",randomname)),1,MAX_NAME_LEN)
if (!newname)
newname = randomname
else
if (newname == "Unknown" || newname == "floor" || newname == "wall" || newname == "rwall" || newname == "_")
M << "That name is reserved."
return nukelastname(M)
return newname
*/
/proc/NukeNameAssign(var/datum/mind/synd_mind)
var/choose_name = input(synd_mind.current, "You are a [syndicate_name()] agent! What is your name?", "Choose a name") as text
if(!choose_name)
return
else
synd_mind.current.name = choose_name
synd_mind.current.real_name = choose_name
return