diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index c522ad5028..c474411603 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -119,8 +119,8 @@ synd_mind.current << "If you feel you are not up to this task, give your ID to another operative." synd_mind.current << "In your hand you will find a special item capable of triggering a greater challenge for your team. Examine it carefully and consult with your fellow operatives before activating it." - var/obj/item/device/nuclear_challenge/challenge = new /obj/item/device/nuclear_challenge - synd_mind.current.equip_to_slot_or_del(challenge, slot_r_hand) + var/obj/item/device/nuclear_challenge/vote/voter = new /obj/item/device/nuclear_challenge/vote() + synd_mind.current.equip_to_slot_or_del(voter, slot_l_hand) var/list/foundIDs = synd_mind.current.search_contents_for(/obj/item/weapon/card/id) if(foundIDs.len) @@ -179,6 +179,8 @@ if(synd_mob.backbag == 2) synd_mob.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/satchel_norm(synd_mob), slot_back) synd_mob.equip_to_slot_or_del(new /obj/item/weapon/gun/projectile/automatic/pistol(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/device/nuclear_challenge/vote/voter = new /obj/item/device/nuclear_challenge/vote() + synd_mob.equip_to_slot_or_del(voter, slot_l_hand) var/obj/item/device/radio/uplink/U = new /obj/item/device/radio/uplink(synd_mob) U.hidden_uplink.uplink_owner="[synd_mob.key]" diff --git a/code/game/gamemodes/nuclear/nuclear_challenge.dm b/code/game/gamemodes/nuclear/nuclear_challenge.dm index e8bcffa5c5..ddb97b4ea8 100644 --- a/code/game/gamemodes/nuclear/nuclear_challenge.dm +++ b/code/game/gamemodes/nuclear/nuclear_challenge.dm @@ -10,24 +10,94 @@ desc = "Use to send a declaration of hostilities to the target, delaying your shuttle departure for 20 minutes while they prepare for your assault. \ Such a brazen move will attract the attention of powerful benefactors within the Syndicate, who will supply your team with a massive amount of bonus telecrystals. \ Must be used within five minutes, or your benefactors will lose interest." + var/used = 0 /obj/item/device/nuclear_challenge/attack_self(mob/living/user) + if(!doChecks(user)) + return + + var/are_you_sure = alert(user, "Are you sure you want to alert the enemy crew? You will receive [round(CHALLENGE_TC_PER_PLAYER*player_list.len)] bonus Telecrystals for declaring War.", "Declare war?", "Yes", "No") + + if(are_you_sure == "Yes") + if(!doChecks(user)) + return + declare_nuclear_war(user) + used = 1 + else + user << "On second thought, the element of surprise isn't so bad after all." + +/obj/item/device/nuclear_challenge/proc/doChecks(mob/living/user) + if(loc != user) + return 0 + if(used) + user << "You have already voted." + return 0 if(player_list.len < CHALLENGE_MIN_PLAYERS) user << "The enemy crew is too small to be worth declaring war on." - return + return 0 if(user.z != ZLEVEL_CENTCOM) user << "You have to be at your base to use this." - return + return 0 if(world.time > CHALLENGE_TIME_LIMIT) user << "It's too late to declare hostilities. Your benefactors are already busy with other schemes. You'll have to make do with what you have on hand." + return 0 + + return 1 + +//The voting version + +/obj/item/device/nuclear_challenge/vote + name = "Declaration of War (Challenge Mode) Voter" + icon_state = "gangtool-yellow" + item_state = "walkietalkie" + desc = "Use to cast your vote for sending a declaration of hostilities to the target, delaying your shuttle departure for 20 minutes while they prepare for your assault. \ + Such a brazen move will attract the attention of powerful benefactors within the Syndicate, who will supply your team with a massive amount of bonus telecrystals. \ + Must be used within five minutes, or your benefactors will lose interest." + var/global/yesVotes = 0 + var/global/noVotes = 0 + var/global/votesNeeded = 3 + +/obj/item/device/nuclear_challenge/vote/attack_self(mob/living/user) + if(!doChecks(user)) return - var/are_you_sure = alert(user, "Consult your team carefully before you declare war on [station_name()]]. Are you sure you want to alert the enemy crew? You will receive [round(CHALLENGE_TC_PER_PLAYER*player_list.len)] bonus Telecrystals for declaring War.", "Declare war?", "Yes", "No") - if(are_you_sure == "No") - user << "On second thought, the element of surprise isn't so bad after all." + var/are_you_sure = alert(user, "Are you sure you want to vote to alert the enemy crew? You will receive [round(CHALLENGE_TC_PER_PLAYER*player_list.len)] bonus Telecrystals for declaring War. You cannot change your vote if you select Yes or No.", "Declare war?", "Yes", "No", "Cancel Vote") + + if(!doChecks(user)) return + if(are_you_sure == "Yes") + used = 1 + yesVotes++ + announce("[usr.real_name] has voted YES for war. There are [yesVotes] for war and [noVotes] against war.") + if(yesVotes >= votesNeeded) + declare_nuclear_war(user) + else if(are_you_sure == "No") + used = 1 + noVotes++ + announce("[usr.real_name] has voted NO for war. There are [yesVotes] for war and [noVotes] against war.") + else + user << "You decide to think it over more." + +/obj/item/device/nuclear_challenge/vote/doChecks(mob/living/user) + if(!..()) + return 0 + + if(yesVotes >= votesNeeded) + user << "Your vote no longer matters, your comrades have decided for you." + return 0 + + return 1 + +/obj/item/device/nuclear_challenge/vote/proc/announce(var/annoucement) + for(var/obj/item/device/nuclear_challenge/vote/V in world) + var/mob/living/mob = get(V.loc,/mob/living) + if(mob) + mob.show_message("\icon[V] [annoucement]", 2) + + +/proc/declare_nuclear_war(mob/living/user) var/war_declaration = "[user.real_name] has declared his intent to utterly destroy [station_name()] with a nuclear device, and dares the crew to try and stop them." priority_announce(war_declaration, title = "Declaration of War", sound = 'sound/machines/Alarm.ogg') user << "You've attracted the attention of powerful forces within the syndicate. A bonus bundle of telecrystals has been granted to your team. Great things await you if you complete the mission."