Files
CHOMPStation2/code/game/gamemodes/nuclear/nuclear.dm

384 lines
16 KiB
Plaintext

/datum/game_mode
var/list/datum/mind/syndicates = list()
/datum/game_mode/nuclear
name = "nuclear emergency"
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 - Nuclear Emergency!</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!"
/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 = "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()
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/list/turf/synd_spawn = list()
for(var/obj/effect/landmark/A in landmarks_list)
if(A.name == "Syndicate-Spawn")
synd_spawn += get_turf(A)
del(A)
continue
var/obj/effect/landmark/uplinklocker = 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/leader_selected = 0
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)
if(!config.objectives_disabled)
forge_syndicate_objectives(synd_mind)
greet_syndicate(synd_mind)
equip_syndicate(synd_mind.current)
if(!leader_selected)
prepare_syndicate_leader(synd_mind, nuke_code)
leader_selected = 1
spawnpos++
update_synd_icons_added(synd_mind)
update_all_synd_icons()
if(uplinklocker)
new /obj/structure/closet/syndicate/nuclear(uplinklocker.loc)
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)
if (nuke_code)
synd_mind.store_memory("<B>Syndicate Nuclear Bomb Code</B>: [nuke_code]", 0, 0)
synd_mind.current << "The nuclear authorization code is: <B>[nuke_code]</B>"
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 = synd_mind.current.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)
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()] agent!"
var/obj_count = 1
if(!config.objectives_disabled)
for(var/datum/objective/objective in syndicate.objectives)
syndicate.current << "<B>Objective #[obj_count]</B>: [objective.explanation_text]"
obj_count++
else
syndicate.current << "<font color=blue>Within the rules,</font> try to act as an opposing force to the crew. Further RP and try to make sure other players have </i>fun<i>! If you are confused or at a loss, always adminhelp, and before taking extreme actions, please try to also contact the administration! Think through your actions and make the roleplay immersive! <b>Please remember all rules aside from those without explicit exceptions apply to antagonists.</i></b>"
return
/datum/game_mode/proc/random_radio_frequency()
return 1337 // WHY??? -- Doohl
/datum/game_mode/proc/equip_syndicate(mob/living/carbon/human/synd_mob)
var/radio_freq = SYND_FREQ
var/obj/item/device/radio/R = new /obj/item/device/radio/headset/syndicate(synd_mob)
R.set_frequency(radio_freq)
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/ammo_magazine/a12mm(synd_mob), slot_in_backpack)
synd_mob.equip_to_slot_or_del(new /obj/item/ammo_magazine/a12mm(synd_mob), 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.equip_to_slot_or_del(new /obj/item/weapon/gun/projectile/automatic/c20r(synd_mob), slot_belt)
synd_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/box/engineer(synd_mob.back), slot_in_backpack)
var/obj/item/clothing/suit/space/rig/syndi/new_suit = new(synd_mob)
var/obj/item/clothing/head/helmet/space/rig/syndi/new_helmet = new(synd_mob)
if(synd_mob.species)
var/race = synd_mob.species.name
switch(race)
if("Unathi")
new_suit.species_restricted = list("Unathi")
if("Tajaran")
new_suit.species_restricted = list("Tajaran")
if("Skrell")
new_suit.species_restricted = list("Skrell")
synd_mob.equip_to_slot_or_del(new_suit, slot_wear_suit)
synd_mob.equip_to_slot_or_del(new_helmet, slot_head)
var/obj/item/weapon/implant/explosive/E = new/obj/item/weapon/implant/explosive(synd_mob)
E.imp_in = synd_mob
E.implanted = 1
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.location==2)
//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>Syndicate 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>Syndicate 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>Syndicate 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 syndicate operatives were:</B></FONT>"
for(var/datum/mind/syndicate in syndicates)
text += "<br>[syndicate.key] was [syndicate.name] ("
if(syndicate.current)
if(syndicate.current.stat == DEAD)
text += "died"
else
text += "survived"
if(syndicate.current.real_name != syndicate.name)
text += " as [syndicate.current.real_name]"
else
text += "body destroyed"
text += ")"
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