-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathnuclear_challenge.dm
127 lines (100 loc) · 5.38 KB
/
nuclear_challenge.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/// The number of telecrystals per player
#define CHALLENGE_TELECRYSTALS_PER_PLAYER 7
/// How long the operatives have to declare war
#define CHALLENGE_TIME_LIMIT (5 MINUTES)
/// How long after declaring war before the operatives can show up
#define CHALLENGE_SHUTTLE_DELAY (25 MINUTES) // 25 minutes, so the ops have at least 5 minutes before the shuttle is callable.
GLOBAL_LIST_EMPTY(jam_on_wardec)
/obj/item/nuclear_challenge
name = "Declaration of War (Challenge Mode)"
icon = 'icons/obj/device.dmi'
icon_state = "gangtool-red"
item_state = "radio"
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
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/declaring_war = FALSE
var/uplink_type = /obj/item/uplink/nuclear
/obj/item/nuclear_challenge/attack_self(mob/living/user)
if(!check_allowed(user))
return
declaring_war = TRUE
var/are_you_sure = tgui_alert(user, "Consult your team carefully before you declare war on [station_name()]]. Are you sure you want to alert the enemy crew? You have [DisplayTimeText(world.time-SSticker.round_start_time - CHALLENGE_TIME_LIMIT)] to decide", "Declare war?", list("Yes", "No"))
declaring_war = FALSE
if(!check_allowed(user))
return
if(are_you_sure == "No")
to_chat(user, "On second thought, the element of surprise isn't so bad after all.")
return
var/war_declaration = "[user.real_name] has declared [user.p_their()] intent to utterly destroy [station_name()] with a nuclear device, and dares the crew to try and stop [user.p_them()]."
declaring_war = TRUE
var/custom_threat = tgui_alert(user, "Do you want to customize your declaration?", "Customize?", list("Yes", "No"))
declaring_war = FALSE
if(!check_allowed(user))
return
if(custom_threat == "Yes")
declaring_war = TRUE
war_declaration = stripped_input(user, "Insert your custom declaration", "Declaration")
declaring_war = FALSE
if(!check_allowed(user) || !war_declaration)
return
priority_announce(war_declaration, title = "Declaration of War", sound = 'sound/machines/alarm.ogg', has_important_message = TRUE)
SSsecurity_level.set_level(SEC_LEVEL_GAMMA)
to_chat(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.")
for(var/V in GLOB.syndicate_shuttle_boards)
var/obj/item/circuitboard/computer/syndicate_shuttle/board = V
board.challenge = TRUE
for(var/obj/machinery/computer/camera_advanced/shuttle_docker/D in GLOB.jam_on_wardec)
D.jammed = TRUE
var/list/orphans = list()
var/list/uplinks = list()
for (var/datum/mind/M in get_antag_minds(/datum/antagonist/nukeop))
if (iscyborg(M.current))
continue
var/datum/component/uplink/uplink = M.find_syndicate_uplink()
if (!uplink)
orphans += M.current
continue
uplinks += uplink
var/tc_to_distribute = CHALLENGE_TELECRYSTALS_PER_PLAYER * GLOB.player_list.len
var/tc_per_nukie = round(tc_to_distribute / (length(orphans)+length(uplinks)))
for (var/datum/component/uplink/uplink in uplinks)
uplink.telecrystals += tc_per_nukie
tc_to_distribute -= tc_per_nukie
for (var/mob/living/L in orphans)
var/TC = new /obj/item/stack/telecrystal(user.drop_location(), tc_per_nukie)
to_chat(L, span_warning("Your uplink could not be found so your share of the team's bonus telecrystals has been bluespaced to your [L.put_in_hands(TC) ? "hands" : "feet"]."))
tc_to_distribute -= tc_per_nukie
if (tc_to_distribute > 0) // What shall we do with the remainder...
for (var/mob/living/simple_animal/hostile/carp/cayenne/C in GLOB.mob_living_list)
if (C.stat != DEAD)
var/obj/item/stack/telecrystal/TC = new(C.drop_location(), tc_to_distribute)
TC.throw_at(get_step(C, C.dir), 3, 3)
C.visible_message(span_notice("[C] coughs up a half-digested telecrystal"),span_usernotice("You cough up a half-digested telecrystal!"))
break
CONFIG_SET(number/shuttle_refuel_delay, max(CONFIG_GET(number/shuttle_refuel_delay), CHALLENGE_SHUTTLE_DELAY))
SSblackbox.record_feedback("amount", "nuclear_challenge_mode", 1)
qdel(src)
/obj/item/nuclear_challenge/proc/check_allowed(mob/living/user)
if(declaring_war)
to_chat(user, "You are already in the process of declaring war! Make your mind up.")
return FALSE
if(!user.onSyndieBase())
to_chat(user, "You have to be at your base to use this.")
return FALSE
if(world.time-SSticker.round_start_time > CHALLENGE_TIME_LIMIT)
to_chat(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 FALSE
for(var/V in GLOB.syndicate_shuttle_boards)
var/obj/item/circuitboard/computer/syndicate_shuttle/board = V
if(board.moved)
to_chat(user, "The shuttle has already been moved! You have forfeit the right to declare war.")
return FALSE
return TRUE
/obj/item/nuclear_challenge/clownops
uplink_type = /obj/item/uplink/clownop
#undef CHALLENGE_TELECRYSTALS_PER_PLAYER
#undef CHALLENGE_TIME_LIMIT
#undef CHALLENGE_SHUTTLE_DELAY