-
Notifications
You must be signed in to change notification settings - Fork 1
/
Projectiles.dm
356 lines (278 loc) · 7.66 KB
/
Projectiles.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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
/*****************************************************
**** PROJECTILES.DM REWRITEN BY KUMO ON 8/14/12 ****
*****************************************************/
atom
var
{
de_dignore = 0 // <--- If true, bullets will ignore the density of said object and continue through them.
}
proc
calculate_bullet_damage(var/dmg = 0, var/mob/player/client/owner = null)
if(dmg && owner)
var/new_dmg = round(rand((dmg-dmg/2), (dmg+dmg/2)))+20
new_dmg = new_dmg*owner.rank/2
if(prob(10)) // <--- CRITICAL HIT!
new_dmg = new_dmg*2
return new_dmg
else
return 5 // <--- Default to 5 becaue fuck you.
Projectiles
parent_type = /obj
icon = 'icons/_Bullets.dmi'
layer = TURF_LAYER+2
is_garbage = 1
var/tmp {
speed = 1 // <--- The delay in ticks of each step; lower the number, the faster it moves!
damage = 0 // <--- The average damage that the projectile does.
max_dist = 100 // <--- The maximum distance the projectile can travel before being recycled.
mob/player/client/owner // <--- The owner of the projectile; i.e. the player who shot it.
turf/wloc // <--- No clue; possibly/probably drop this.
}
GC() // <--- The 'Garbage Collection' proc. This defines how an object is treated if it gets recycled.
src.max_dist = initial(src.max_dist) // <--- Restore the max_dist to what it should be.
src.damage = 0
src.loc = null
src.owner = null
garbage.Add(src)
proc
impact_damage(var/atom/movable/A) // <--- This is called when the projectile bumps into something. FORMERLY DE_D()
if(A)
switch(A.rtype)
if(3) // <--- If it's a zombie..
var/Enemies/E = A
E.health -= calculate_bullet_damage(src.damage, src.owner)
if(prob(60)) // <--- Here is where we drop blood.
var/Effects/Blood/O = garbage.Grab(/Effects/Blood)
if(O)
O.icon_state = "blood[rand(1,9)]"
O.pixel_y = rand(-8, 16)
O.loc = E.loc
O.DE_EO() // <--- Cleanup the blood and recycle!
if(E.health < 1)
if(src.owner)
src.owner.kills += E.points
src.owner.exp += E.points+E.points/2
A.Death()
src.owner.rank_up()
return 1
if(43)
var/obj/enviroment/hazard/barrel/B = A
if(!B.owner)
if(src.owner)
B.owner = src.owner
B.Death()
return 1
tile_check(var/turf/T) // <--- Check if the tile can be entered/passed by a projectile. FORMERLY DE_T
if(T)
if(T.x <= 1 || T.x >= world.maxx || T.y <= 1 || T.y >= world.maxy || T.density && !T.de_dignore)
return 1 // <--- If the above, you cannot pass the tile!
after_effect() // <--- What happens with the projectile after travelling. FORMERLY DE_A
src.GC()
bullet_travel() // <--- How the projectile travels, etc. FORMERLY DE_L
var
count = src.max_dist
cancel_tc = 0
while(count > 0) // <--- While the value of count is greater than 0.
if(gameover)
src.wloc = null
return
var/turf/T = src.loc
if(src.tile_check(T))
cancel_tc++
break
for(var/atom/movable/A in T)
if(!A || !A.density || A.is_good_bad || A.de_dignore)
continue
src.impact_damage(A)
cancel_tc++
break
if(cancel_tc)
break
count--
if(src.wloc)
if(src.loc != src.wloc)
step(src, get_dir(src, src.wloc))
else
break
else
step(src, src.dir)
sleep(MOVEDELAY/2 + src.speed)
src.wloc = null
src.after_effect()
// <----------------------------- PROJECTILES ------------------------------->
shotgun_spread // <--- FORMERLY shotgun_blast
icon_state = "spread"
speed = 0
max_dist = 8
pistol_bullet
icon_state = "bullet"
speed = 0
max_dist = 40
magnum_bullet
icon_state = "bullet"
speed = 0
max_dist = 12
rifle_bullet
icon_state = "bullet"
speed = 0
max_dist = 40
burst_bullet
icon_state = "bullet"
speed = 0
max_dist = 50
bolt
icon_state = "bolt"
speed = 0
max_dist = 40
flamethrower_bullet
icon_state = "fireblast"
speed = 0
max_dist = 8
impact_damage(var/atom/movable/A)
if(A)
switch(A.rtype)
if(3)
A.fire_damage(70, 3, src.owner)
return 1
if(43)
var/obj/enviroment/hazard.barrel/B = A
if(!B.owner)
if(src.owner)
B.owner = src.owner
B.Death()
return 1
bullet_travel()
var
count = src.max_dist
cancel_tc = 0
while(count > 0) // <--- While the value of count is greater than 0.
if(gameover)
src.wloc = null
return
var/turf/T = src.loc
if(src.tile_check(T))
cancel_tc++
break
for(var/atom/movable/A in T)
if(!A || !A.density || A.is_good_bad || A.de_dignore)
continue
src.impact_damage(A)
cancel_tc++
break
if(cancel_tc)
break
count--
if(src.wloc)
if(src.loc != src.wloc)
step(src, get_dir(src, src.wloc))
else
break
else
if(prob(40) && count <= src.max_dist-5)
var/obj/triggys/hazards/fire/O = garbage.Grab(/obj/triggys/hazards/fire)
if(O)
O.pixel_x = rand(-4, 4)
O.pixel_y = rand(-4, 4)
O.icon_state = "fire[rand(1,2)]"
O.loc = src.loc
O.owner = src.owner
spawn(rand(50, 100))
O.GC()
step(src, src.dir)
sleep(MOVEDELAY/2 + src.speed)
src.wloc = null
src.after_effect()
after_effect()
var/list/F = new/list()
for(var/turf/T in de_view(2, src))
if(!T || T.density)
continue
for(var/atom/movable/A in T)
if(!A || !A.density || A.is_dead)
continue
switch(A.rtype)
if(1, 2)
var/mob/player/P = A
if(P.gamein)
P.fire_damage(20, 5, src.owner)
if(3)
var/mob/M = A
M.fire_damage(40, 5, src.owner)
if(43)
var/obj/enviroment/hazard/barrel/B = A
if(!B.owner)
if(src.owner)
B.owner = src.owner
B.fire_damage(20, 5, src.owner, 1)
F += T
if(length(F))
var/ftc = rand(3, 8)
for(var/i = 1, i <= ftc, i++)
if(!length(F))
break
var/obj/triggys/hazards/fire/O = garbage.Grab(/obj/triggys/hazards/fire)
if(O)
O.pixel_x = rand(-4, 4)
O.pixel_y = rand(-4, 4)
O.icon_state = "fire[rand(1,2)]"
var/turf/tp = pick(F)
O.loc = tp
O.owner = src.owner
F -= tp
spawn(rand(50, 100))
O.GC()
src.GC()
autoshotgun_blast
icon_state = "spread"
speed = 0
max_dist = 5
molotov
icon_state = "molotov"
speed = 0
max_dist = 7
after_effect()
var/list/F = new/list()
for(var/turf/T in de_view(2, src))
if(!T||T.density) continue
for(var/atom/movable/A in T)
if(!A||!A.density||A.is_dead) continue
switch(A.rtype)
if(1,2)
var/mob/player/P = A
if(P.gamein)
P.fire_damage(20, 5, src.owner)
if(3)
var/mob/M = A
M.fire_damage(40, 5, src.owner)
if(43)
var/obj/enviroment/hazard/barrel/O = A
if(!O.owner) if(src.owner) O.owner = src.owner
O.fire_damage(20, 5, src.owner, 1)
F += T
if(length(F))
var/ftc = rand(8, 16)
for(var/i = 1, i <= ftc, i++)
if(!length(F)) break
var/obj/triggys/hazards/fire/O = garbage.Grab(/obj/triggys/hazards/fire)
if(O)
O.pixel_x = rand(-4, 4)
O.pixel_y = rand(-4, 4)
O.icon_state = "fire[rand(1,2)]"
var/turf/tp = pick(F)
O.loc = tp
O.owner = src.owner
F -= tp
spawn(rand(200, 400)) O.GC()
src.GC()
grenade
icon_state = "grenade"
speed = 0
max_dist = 7
after_effect()
src.Explode(3, 500, src.owner)
launch_grenade
icon_state = "launchgrenade"
speed = 0
max_dist = 15
after_effect()
src.Explode(3, 500, src.owner)