This repository has been archived by the owner on Sep 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
mines.dm
286 lines (230 loc) · 9.18 KB
/
mines.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/obj/effect/mine
name = "dummy mine"
desc = "Better stay away from that thing."
density = FALSE
anchored = TRUE
icon = 'icons/obj/items_and_weapons.dmi'
icon_state = "uglymine"
/// We manually check to see if we've been triggered in case multiple atoms cross us in the time between the mine being triggered and it actually deleting, to avoid a race condition with multiple detonations
var/triggered = FALSE
/// Can be set to FALSE if we want a short 'coming online' delay, then set to TRUE. Can still be set off by damage
var/armed = TRUE
/// If set, we default armed to FALSE and set it to TRUE after this long from initializing
var/arm_delay
/obj/effect/mine/Initialize()
. = ..()
if(arm_delay)
armed = FALSE
icon_state = "uglymine-inactive"
addtimer(CALLBACK(src, .proc/now_armed), arm_delay)
/obj/effect/mine/examine(mob/user)
. = ..()
if(!armed)
. += "\t<span class='information'>It appears to be inactive...</span>"
/// The effect of the mine
/obj/effect/mine/proc/mineEffect(mob/victim)
to_chat(victim, "<span class='danger'>*click*</span>")
/// If the landmine was previously inactive, this beeps and displays a message marking it active
/obj/effect/mine/proc/now_armed()
armed = TRUE
icon_state = "uglymine"
playsound(src, 'sound/machines/nuke/angry_beep.ogg', 40, FALSE, -2)
visible_message("<span class='danger'>\The [src] beeps softly, indicating it is now active.<span>", vision_distance = COMBAT_MESSAGE_RANGE)
/obj/effect/mine/Crossed(atom/movable/AM)
if(triggered || !isturf(loc) || !armed)
return
. = ..()
if(AM.movement_type & FLYING)
return
triggermine(AM)
/obj/effect/mine/take_damage(damage_amount, damage_type, damage_flag, sound_effect, attack_dir)
. = ..()
triggermine()
/// When something sets off a mine
/obj/effect/mine/proc/triggermine(atom/movable/triggerer)
if(triggered) //too busy detonating to detonate again
return
if(triggerer)
visible_message("<span class='danger'>[triggerer] sets off [icon2html(src, viewers(src))] [src]!</span>")
else
visible_message("<span class='danger'>[icon2html(src, viewers(src))] [src] detonates!</span>")
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
s.set_up(3, 1, src)
s.start()
if(ismob(triggerer))
mineEffect(triggerer)
triggered = TRUE
SEND_SIGNAL(src, COMSIG_MINE_TRIGGERED, triggerer)
qdel(src)
/obj/effect/mine/explosive
name = "explosive mine"
var/range_devastation = 0
var/range_heavy = 1
var/range_light = 2
var/range_flash = 3
/obj/effect/mine/explosive/mineEffect(mob/victim)
explosion(loc, range_devastation, range_heavy, range_light, range_flash)
/obj/effect/mine/stun
name = "stun mine"
var/stun_time = 80
/obj/effect/mine/stun/mineEffect(mob/living/victim)
if(isliving(victim))
victim.Paralyze(stun_time)
/obj/effect/mine/kickmine
name = "kick mine"
/obj/effect/mine/kickmine/mineEffect(mob/victim)
if(isliving(victim) && victim.client)
to_chat(victim, "<span class='userdanger'>You have been kicked FOR NO REISIN!</span>")
qdel(victim.client)
/obj/effect/mine/gas
name = "oxygen mine"
var/gas_amount = 360
var/gas_type = "o2"
/obj/effect/mine/gas/mineEffect(mob/victim)
atmos_spawn_air("[gas_type]=[gas_amount]")
/obj/effect/mine/gas/plasma
name = "plasma mine"
gas_type = "plasma"
/obj/effect/mine/gas/n2o
name = "\improper N2O mine"
gas_type = "n2o"
/obj/effect/mine/gas/water_vapor
name = "chilled vapor mine"
gas_amount = 500
gas_type = "water_vapor"
/obj/effect/mine/sound
name = "honkblaster 1000"
var/sound = 'sound/items/bikehorn.ogg'
/obj/effect/mine/sound/mineEffect(mob/victim)
playsound(loc, sound, 100, TRUE)
/obj/effect/mine/sound/bwoink
name = "bwoink mine"
sound = 'sound/effects/adminhelp.ogg'
/obj/effect/mine/pickup
name = "pickup"
desc = "pick me up"
icon = 'icons/effects/effects.dmi'
icon_state = "electricity2"
density = FALSE
var/duration = 0
/obj/effect/mine/pickup/Initialize()
. = ..()
animate(src, pixel_y = 4, time = 20, loop = -1)
/obj/effect/mine/pickup/triggermine(mob/victim)
if(triggered)
return
triggered = 1
invisibility = INVISIBILITY_ABSTRACT
mineEffect(victim)
qdel(src)
/obj/effect/mine/pickup/bloodbath
name = "Red Orb"
desc = "You feel angry just looking at it."
duration = 1200 //2min
color = "#FF0000"
/obj/effect/mine/pickup/bloodbath/mineEffect(mob/living/carbon/victim)
if(!victim.client || !istype(victim))
return
to_chat(victim, "<span class='reallybig redtext'>RIP AND TEAR</span>")
var/old_color = victim.client.color
var/static/list/red_splash = list(1,0,0,0.8,0.2,0, 0.8,0,0.2,0.1,0,0)
var/static/list/pure_red = list(0,0,0,0,0,0,0,0,0,1,0,0)
INVOKE_ASYNC(src, .proc/blood_delusion, victim)
var/obj/item/chainsaw/doomslayer/chainsaw = new(victim.loc)
victim.log_message("entered a blood frenzy", LOG_ATTACK)
ADD_TRAIT(chainsaw, TRAIT_NODROP, CHAINSAW_FRENZY_TRAIT)
victim.drop_all_held_items()
victim.put_in_hands(chainsaw, forced = TRUE)
chainsaw.attack_self(victim)
victim.reagents.add_reagent(/datum/reagent/medicine/adminordrazine,25)
to_chat(victim, "<span class='warning'>KILL, KILL, KILL! YOU HAVE NO ALLIES ANYMORE, KILL THEM ALL!</span>")
victim.client.color = pure_red
animate(victim.client,color = red_splash, time = 10, easing = SINE_EASING|EASE_OUT)
sleep(10)
animate(victim.client,color = old_color, time = duration)//, easing = SINE_EASING|EASE_OUT)
sleep(duration)
to_chat(victim, "<span class='notice'>Your bloodlust seeps back into the bog of your subconscious and you regain self control.</span>")
qdel(chainsaw)
victim.log_message("exited a blood frenzy", LOG_ATTACK)
qdel(src)
/obj/effect/mine/pickup/bloodbath/proc/blood_delusion(mob/living/carbon/victim)
new /datum/hallucination/delusion(victim, TRUE, "demon", duration, 0)
/obj/effect/mine/pickup/healing
name = "Blue Orb"
desc = "You feel better just looking at it."
color = "#0000FF"
/obj/effect/mine/pickup/healing/mineEffect(mob/living/carbon/victim)
if(!victim.client || !istype(victim))
return
to_chat(victim, "<span class='notice'>You feel great!</span>")
victim.revive(full_heal = TRUE, admin_revive = TRUE)
/obj/effect/mine/pickup/speed
name = "Yellow Orb"
desc = "You feel faster just looking at it."
color = "#FFFF00"
duration = 300
/obj/effect/mine/pickup/speed/mineEffect(mob/living/carbon/victim)
if(!victim.client || !istype(victim))
return
to_chat(victim, "<span class='notice'>You feel fast!</span>")
victim.add_movespeed_modifier(/datum/movespeed_modifier/yellow_orb)
sleep(duration)
victim.remove_movespeed_modifier(/datum/movespeed_modifier/yellow_orb)
to_chat(victim, "<span class='notice'>You slow down.</span>")
/// These mines spawn pellet_clouds around them when triggered
/obj/effect/mine/shrapnel
name = "shrapnel mine"
/// The type of projectiles we're shooting out of this
var/shrapnel_type = /obj/projectile/bullet/shrapnel
/// Broadly, how many pellets we're spawning, the total is n! - (n-1)! pellets, so don't set it too high. For reference, 15 is probably pushing it at MAX
var/shrapnel_magnitude = 3
/// If TRUE, we spawn extra pellets to eviscerate the person who stepped on it, otherwise it just spawns a ring of pellets around the tile we're on (making setting it off an offensive move)
var/shred_triggerer = FALSE
/obj/effect/mine/shrapnel/mineEffect(mob/victim)
return
/obj/effect/mine/shrapnel/triggermine(atom/movable/AM)
AddComponent(/datum/component/pellet_cloud, projectile_type=shrapnel_type, magnitude=shrapnel_magnitude)
return ..()
/obj/effect/mine/shrapnel/sting
name = "stinger mine"
shrapnel_type = /obj/projectile/bullet/pellet/stingball
/obj/effect/mine/shrapnel/capspawn
name = "\improper AP mine"
desc = "A defensive landmine filled with 'AP shrapnel', good for defending cramped spaces without breaching hulls. The AP stands for 'Asset Protection', though it's still plenty nasty against any fool who sets it off."
shrapnel_type = /obj/projectile/bullet/pellet/capmine
shrapnel_magnitude = 4
shred_triggerer = TRUE
arm_delay = 3 SECONDS
light_range = 1.6
light_power = 2
light_color = COLOR_VIVID_RED
/obj/effect/mine/shrapnel/capspawn/now_armed()
. = ..()
set_light_on(TRUE)
/obj/item/minespawner
name = "landmine deployment device"
desc = "When activated, will deploy an Asset Protection landmine after 3 seconds passes, perfect for high ranking NT officers looking to cover their assets from afar."
icon = 'icons/obj/device.dmi'
icon_state = "beacon"
var/mine_type = /obj/effect/mine/shrapnel/capspawn
var/active = FALSE
/obj/item/minespawner/attack_self(mob/user)
. = ..()
if(active)
return
if(iscarbon(user))
var/mob/living/carbon/user_human = user
user_human.throw_mode_on()
playsound(src, 'sound/weapons/armbomb.ogg', 70, TRUE)
to_chat(user, "<span class='warning'>You arm \the [src], causing it to shake! It will deploy in 3 seconds.</span>")
active = TRUE
addtimer(CALLBACK(src, .proc/deploy_mine), 3 SECONDS)
/// Deploys the mine and deletes itself
/obj/item/minespawner/proc/deploy_mine()
do_alert_animation()
playsound(loc, 'sound/machines/chime.ogg', 30, FALSE, -3)
var/obj/effect/mine/new_mine = new mine_type(get_turf(src))
visible_message("<span class='danger'>\The [src] releases a puff of smoke, revealing \a [new_mine]!</span>")
var/obj/effect/particle_effect/smoke/poof = new (get_turf(src))
poof.lifetime = 3
qdel(src)