-
Notifications
You must be signed in to change notification settings - Fork 524
/
Copy pathweapon.dm
556 lines (493 loc) · 18.4 KB
/
weapon.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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
/obj/item/phone
name = "red phone"
desc = "Should anything ever go wrong..."
icon = 'icons/obj/radio.dmi'
icon_state = "red_phone"
obj_flags = OBJ_FLAG_CONDUCTABLE
force = 3
throwforce = 2.0
throw_speed = 1
throw_range = 4
w_class = WEIGHT_CLASS_SMALL
attack_verb = list("called", "rang")
hitsound = 'sound/weapons/ring.ogg'
/obj/item/rsp
name = "\improper Rapid-Seed-Producer (RSP)"
desc = "A device used to rapidly deploy seeds."
icon = 'icons/obj/tools.dmi'
icon_state = "rfd"
opacity = 0
density = 0
anchored = 0.0
var/stored_matter = 0
var/mode = 1
w_class = WEIGHT_CLASS_NORMAL
/obj/item/bikehorn
name = "bike horn"
desc = "A horn off of a bicycle."
icon = 'icons/obj/items.dmi'
icon_state = "bike_horn"
item_state = "bike_horn"
throwforce = 3
w_class = WEIGHT_CLASS_SMALL
throw_speed = 3
throw_range = 15
attack_verb = list("HONKED")
var/last_honk = 0
/obj/item/bikehorn/attack_self(mob/user as mob)
if(last_honk <= world.time - 20) //Spam limiter.
last_honk = world.time
playsound(src.loc, 'sound/items/bikehorn.ogg', 50, 1)
src.add_fingerprint(user)
return
/obj/item/cane
name = "cane"
desc = "A cane used by a true gentlemen. Or a clown."
icon = 'icons/obj/weapons.dmi'
icon_state = "cane"
item_state = "stick"
obj_flags = OBJ_FLAG_CONDUCTABLE
force = 15
throwforce = 7.0
w_class = WEIGHT_CLASS_BULKY
matter = list(DEFAULT_WALL_MATERIAL = 50)
attack_verb = list("bludgeoned", "whacked", "disciplined", "thrashed")
var/can_support = TRUE
/obj/item/cane/attack(mob/living/target_mob, mob/living/user, target_zone)
if(!(istype(target_mob) && istype(user)))
return ..()
var/targetIsHuman = ishuman(target_mob)
var/mob/living/carbon/human/targetashuman = target_mob
var/wasselfattack = 0
var/verbtouse = pick(attack_verb)
var/punct = "!"
var/class = "warning"
var/soundname = "swing_hit"
var/armorpercent = 0
var/wasblocked = 0
var/shoulddisarm = 0
var/damagetype = DAMAGE_PAIN
var/chargedelay = 4 // 4 half frames = 2 seconds
if(targetIsHuman && targetashuman == user)
wasselfattack = 1
if (user.a_intent == I_HURT)
target_zone = get_zone_with_miss_chance(target_zone, target_mob) //Vary the attack
damagetype = DAMAGE_BRUTE
if (targetIsHuman)
var/mob/living/carbon/human/targethuman = target_mob
armorpercent = targethuman.get_blocked_ratio(target_zone, DAMAGE_BRUTE, damage = force)*100
wasblocked = (targethuman.check_shields(force, src, user, target_zone, null) in list(BULLET_ACT_BLOCK, BULLET_ACT_FORCE_PIERCE))
var/damageamount = force
switch(user.a_intent)
if(I_HELP)
class = "notice"
punct = "."
soundname = 0
if (target_zone == BP_HEAD || target_zone == BP_EYES || target_zone == BP_MOUTH)
verbtouse = pick("tapped")
else
verbtouse = pick("tapped","poked","prodded","touched")
damageamount = 0
if(I_DISARM)
verbtouse = pick("smacked","slapped")
soundname = "punch"
if(targetIsHuman)
user.visible_message("<span class='[class]'>[user] flips [user.get_pronoun("his")] [name]...</span>", "<span class='[class]'>You flip [src], preparing a disarm...</span>")
if (do_mob(user,target_mob,chargedelay,display_progress=0))
if(!wasblocked && damageamount)
var/chancemod = (100 - armorpercent)*0.05*damageamount // Lower chance if lower damage + high armor. Base chance is 50% at 10 damage.
if(target_zone == BP_L_HAND || target_zone == BP_L_ARM)
if (prob(chancemod) && target_mob.l_hand && target_mob.l_hand != src)
shoulddisarm = 1
else if(target_zone == BP_R_HAND || target_zone == BP_R_ARM)
if (prob(chancemod) && target_mob.r_hand && target_mob.r_hand != src)
shoulddisarm = 2
else
if (prob(chancemod*0.5) && target_mob.l_hand && target_mob.l_hand != src)
shoulddisarm = 1
if (prob(chancemod*0.5) && target_mob.r_hand && target_mob.r_hand != src)
shoulddisarm += 2
else
user.visible_message("<span class='[class]'>[user] flips [user.get_pronoun("his")] [name] back to its original position.</span>", "<span class='[class]'>You flip [src] back to its original position.</span>")
return 0
damageamount *= 0.25
if(I_GRAB)
verbtouse = pick("hooked")
soundname = "punch"
if(targetIsHuman)
user.visible_message("<span class='[class]'>[user] flips [user.get_pronoun("his")] [name]...</span>", "<span class='[class]'>You flip [src], preparing a grab...</span>")
if (do_mob(user,target_mob,chargedelay,display_progress=0))
if(!wasblocked && damageamount)
user.start_pulling(target_mob)
else
verbtouse = pick("awkwardly tries to hook","fails to grab")
else
user.visible_message("<span class='[class]'>[user] flips [user.get_pronoun("his")] [name] back to its original position.</span>", "<span class='[class]'>You flip [src] back to its original position.</span>")
return 0
else
soundname = "punch"
damageamount *= 0.1
// Damage Logs
/////////////////////////
user.lastattacked = target_mob
target_mob.lastattacker = user
if(!no_attack_log)
user.attack_log += "\[[time_stamp()]\]<span class='warning'> Attacked [target_mob.name] ([target_mob.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damagetype)])</span>"
target_mob.attack_log += "\[[time_stamp()]\]<font color='orange'> Attacked by [user.name] ([user.ckey]) with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damagetype)])</font>"
msg_admin_attack("[key_name(user, highlight_special = 1)] attacked [key_name(target_mob, highlight_special = 1)] with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYE: [uppertext(damagetype)]) (<A href='byond://?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)",ckey=key_name(user),ckey_target=key_name(target_mob) )
/////////////////////////
var/washit = 0
var/endmessage1st
var/endmessage3rd
if(!target_zone || get_dist(user,target_mob) > 1) //Dodged
endmessage1st = "Your [name] was dodged by [target_mob]"
endmessage3rd = "[target_mob] dodged the [name]"
soundname = "punchmiss"
else if(wasblocked) // Blocked by Shield
endmessage1st = "Your [name] was blocked by [target_mob]"
endmessage3rd = "[target_mob] blocks the [name]"
soundname = "punchmiss"
else
washit = 1
var/noun = "[target_mob]"
var/selfnoun = "your"
if(shoulddisarm)
if(wasselfattack)
selfnoun = "your grip"
noun = "[target_mob.get_pronoun("his")] grip"
else
noun = "[target_mob]'s grip"
selfnoun = noun
if (targetIsHuman && shoulddisarm != 3) // Query: Can non-humans hold objects in hands?
var/mob/living/carbon/human/targethuman = target_mob
var/obj/item/organ/external/O = targethuman.get_organ(target_zone)
if (O.is_stump())
if(wasselfattack)
selfnoun = "your missing [O.name]"
noun = "[target_mob.get_pronoun("his")] missing [O.name]"
else
noun = "[target_mob]'s missing [O.name]"
selfnoun = noun
else
if(wasselfattack)
selfnoun = "your [O.name]"
noun = "[target_mob.get_pronoun("his")] [O.name]"
else
noun = "[target_mob]'s [O.name]"
selfnoun = noun
switch(shoulddisarm)
if(1)
endmessage1st = "You [verbtouse] the [target_mob.l_hand.name] out of [selfnoun]"
endmessage3rd = "[user] [verbtouse] the [target_mob.l_hand.name] out of [noun]"
target_mob.drop_l_hand()
if(2)
endmessage1st = "You [verbtouse] the [target_mob.r_hand.name] out of [selfnoun]"
endmessage3rd = "[user] [verbtouse] the [target_mob.r_hand.name] out of [noun]"
target_mob.drop_r_hand()
if(3)
endmessage1st = "You [verbtouse] both the [target_mob.r_hand.name] and the [target_mob.l_hand.name] out of [selfnoun]"
endmessage3rd = "[user] [verbtouse] both the [target_mob.r_hand.name] and the [target_mob.l_hand.name] out of [noun]"
target_mob.drop_l_hand()
target_mob.drop_r_hand()
else
endmessage1st = "You [verbtouse] [selfnoun] with the [name]"
endmessage3rd = "[user] [verbtouse] [noun] with the [name]"
if(damageamount > 0) // Poking will no longer do damage until there is some fix that makes it so that 0.0001 HALLOS doesn't cause bleed.
target_mob.standard_weapon_hit_effects(src, user, damageamount, armorpercent, target_zone)
user.visible_message("<span class='[class]'>[endmessage3rd][punct]</span>", "<span class='[class]'>[endmessage1st][punct]</span>")
user.do_attack_animation(target_mob)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(soundname)
playsound(src.loc, soundname, 50, 1, -1)
return washit
/obj/item/cane/concealed
var/concealed_blade
/obj/item/cane/concealed/New()
..()
var/obj/item/canesword/temp_blade = new(src)
concealed_blade = temp_blade
temp_blade.attack_self()
/obj/item/cane/concealed/attack_self(var/mob/user)
if(concealed_blade)
user.visible_message(SPAN_WARNING("[user] has unsheathed \a [concealed_blade] from [user.get_pronoun("his")] [src]!"), "You unsheathe \the [concealed_blade] from \the [src].")
// Calling drop/put in hands to properly call item drop/pickup procs
playsound(user.loc, 'sound/weapons/holster/sheathout.ogg', 50, 1)
user.drop_from_inventory(src)
user.put_in_hands(concealed_blade)
user.put_in_hands(src)
user.update_inv_l_hand(0)
user.update_inv_r_hand()
concealed_blade = null
update_icon()
else
..()
/obj/item/cane/concealed/attackby(obj/item/attacking_item, mob/user)
var/obj/item/canesword/attacking_canesword = attacking_item
if(!src.concealed_blade && istype(attacking_canesword))
user.visible_message(SPAN_WARNING("[user] has sheathed \a [attacking_canesword] into [user.get_pronoun("his")] [src]!"), "You sheathe \the [attacking_canesword] into \the [src].")
playsound(user.loc, 'sound/weapons/holster/sheathin.ogg', 50, 1)
user.drop_from_inventory(attacking_canesword)
attacking_canesword.forceMove(src)
src.concealed_blade = attacking_canesword
update_icon()
return TRUE
else
return ..()
/obj/item/cane/concealed/update_icon()
if(concealed_blade)
name = initial(name)
icon_state = initial(icon_state)
item_state = initial(item_state)
else
name = "cane shaft"
icon_state = "nullrod"
item_state = "foldcane"
/obj/item/cane/crutch
name = "crutch"
desc = "A long stick with a crosspiece at the top, used to help with walking."
icon_state = "crutch"
item_state = "crutch"
/obj/item/cane/white
name = "white cane"
desc = "A white cane, used by the visually impaired."
icon_state = "whitecane"
item_state = "whitecane"
can_support = FALSE
/obj/item/cane/shillelagh
name = "adhomian shillelagh"
desc = "A sturdy walking stick made from adhomian wood."
icon = 'icons/obj/tajara_items.dmi'
icon_state = "shillelagh"
item_state = "shillelagh"
contained_sprite = TRUE
/obj/item/cane/telecane
name = "telescopic cane"
desc = "A compact cane which can be collapsed for storage."
icon = 'icons/obj/item/telecane.dmi'
icon_state = "telecane"
contained_sprite = TRUE
w_class = WEIGHT_CLASS_SMALL
slot_flags = SLOT_BELT
drop_sound = 'sound/items/drop/crowbar.ogg'
pickup_sound = 'sound/items/pickup/crowbar.ogg'
var/on = FALSE
can_support = FALSE
/obj/item/cane/telecane/attack_self(mob/user)
on = !on
if(on)
user.visible_message(SPAN_WARNING("With a flick of their wrist, [user] extends their telescopic cane."), SPAN_WARNING("You extend the cane."), SPAN_WARNING("You hear an ominous click."))
icon_state = "telecane_1"
item_state = "telestick"
w_class = WEIGHT_CLASS_BULKY
slot_flags = null
force = 14
attack_verb = list("smacked", "struck", "slapped")
can_support = TRUE
else
user.visible_message(SPAN_NOTICE("\The [user] collapses their telescopic cane."), SPAN_NOTICE("You collapse the cane."), SPAN_NOTICE("You hear a click."))
icon_state = "telecane"
item_state = "telestick_0"
w_class = WEIGHT_CLASS_SMALL
slot_flags = SLOT_BELT
force = 3
attack_verb = list("hit", "punched")
can_support = FALSE
if(istype(user,/mob/living/carbon/human))
var/mob/living/carbon/human/H = user
H.update_inv_l_hand()
H.update_inv_r_hand()
playsound(src.loc, 'sound/weapons/click.ogg', 50, 1)
add_fingerprint(user)
/obj/item/disk
name = "disk"
icon = 'icons/obj/items.dmi'
item_icons = list(
slot_l_hand_str = 'icons/mob/items/lefthand_card.dmi',
slot_r_hand_str = 'icons/mob/items/righthand_card.dmi',
)
drop_sound = 'sound/items/drop/disk.ogg'
pickup_sound = 'sound/items/pickup/disk.ogg'
/obj/item/gift
name = "gift"
desc = "A wrapped item."
icon = 'icons/holidays/christmas/presents.dmi'
icon_state = "gift3"
var/size = 3.0
var/obj/item/gift = null
item_state = "gift"
w_class = WEIGHT_CLASS_BULKY
/obj/item/gift/random_pixel/Initialize()
. = ..()
pixel_x = rand(-16,16)
pixel_y = rand(-16,16)
/obj/item/SWF_uplink
name = "station-bounced radio"
desc = "Used to communicate, it appears."
icon = 'icons/obj/radio.dmi'
icon_state = "radio"
item_state = "radio"
contained_sprite = TRUE
var/temp = null
var/uses = 4.0
var/selfdestruct = 0.0
var/traitor_frequency = 0.0
var/obj/item/device/radio/origradio = null
obj_flags = OBJ_FLAG_CONDUCTABLE
slot_flags = SLOT_BELT
throwforce = 5
w_class = WEIGHT_CLASS_SMALL
throw_speed = 4
throw_range = 20
matter = list(MATERIAL_ALUMINIUM = 25, MATERIAL_PLASTIC = 75)
origin_tech = list(TECH_MAGNET = 1)
/obj/item/staff
name = "wizards staff"
desc = "A staff which only has the power to make you look like a nerd."
icon = 'icons/obj/wizard.dmi'
icon_state = "staff"
force = 3
throwforce = 5.0
throw_speed = 1
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
attack_verb = list("bludgeoned", "whacked", "disciplined")
/obj/item/staff/broom
name = "broom"
desc = "Used for sweeping, and flying into the night while cackling. Black cat not included."
icon = 'icons/obj/wizard.dmi'
icon_state = "broom"
/obj/item/staff/gentcane
name = "gentlemans cane"
desc = "An ebony can with an ivory tip."
icon = 'icons/obj/weapons.dmi'
icon_state = "cane"
item_state = "stick"
/obj/item/staff/stick
name = "stick"
desc = "A great tool to drag someone else's drinks across the bar."
icon = 'icons/obj/weapons.dmi'
icon_state = "qstaff0"
item_state = "stick"
force = 3
throwforce = 5.0
throw_speed = 1
throw_range = 5
w_class = WEIGHT_CLASS_SMALL
/obj/item/module
icon = 'icons/obj/module.dmi'
icon_state = "std_mod"
w_class = WEIGHT_CLASS_SMALL
item_state = "electronic"
obj_flags = OBJ_FLAG_CONDUCTABLE
usesound = 'sound/items/Deconstruct.ogg'
var/mtype = 1 // 1=electronic 2=hardware
/obj/item/module/card_reader
name = "card reader module"
icon_state = "card_mod"
desc = "An electronic module for reading data and ID cards."
/obj/item/module/power_control
name = "power control module"
icon_state = "power_mod"
desc = "Heavy-duty switching circuits for power control."
matter = list(DEFAULT_WALL_MATERIAL = 50, MATERIAL_GLASS = 50)
/obj/item/module/power_control/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.ismultitool())
var/obj/item/circuitboard/ghettosmes/new_circuit = new /obj/item/circuitboard/ghettosmes(get_turf(src))
to_chat(user, SPAN_NOTICE("You modify \the [src] into a makeshift PSU circuitboard."))
qdel(src)
user.put_in_hands(new_circuit)
return TRUE
/obj/item/module/id_auth
name = "\improper ID authentication module"
icon_state = "id_mod"
desc = "A module allowing secure authorization of ID cards."
/obj/item/module/cell_power
name = "power cell regulator module"
icon_state = "power_mod"
desc = "A converter and regulator allowing the use of power cells."
/obj/item/module/cell_power
name = "power cell charger module"
icon_state = "power_mod"
desc = "Charging circuits for power cells."
/obj/item/device/camera_bug
name = "camera bug"
icon = 'icons/obj/item/device/flash.dmi'
icon_state = "flash"
item_state = "flash"
w_class = WEIGHT_CLASS_TINY
throw_speed = 4
throw_range = 20
/obj/item/camera_bug/attack_self(mob/usr as mob)
var/list/cameras = new/list()
for (var/obj/machinery/camera/C in GLOB.cameranet.cameras)
if (C.bugged && C.status)
cameras.Add(C)
if (length(cameras) == 0)
to_chat(usr, SPAN_WARNING("No bugged functioning cameras found."))
return
var/list/friendly_cameras = new/list()
for (var/obj/machinery/camera/C in cameras)
friendly_cameras.Add(C.c_tag)
var/target = tgui_input_list(usr, "Select the camera to observe", "Camera Bug", friendly_cameras)
if (!target)
return
for (var/obj/machinery/camera/C in cameras)
if (C.c_tag == target)
target = C
break
if (usr.stat == 2) return
usr.client.eye = target
/obj/item/pai_cable
desc = "A flexible coated cable with a universal jack on one end."
name = "data cable"
icon = 'icons/obj/power.dmi'
icon_state = "wire1"
var/obj/machinery/machine
/obj/item/neuralbroke
name = "fried neural socket"
desc = "A Vaurca neural socket subjected to extreme heat. It's security chip appears to be fried."
icon = 'icons/obj/stock_parts.dmi'
icon_state = "neuralbroke"
/obj/item/neuralbroke/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.isscrewdriver())
new /obj/item/device/encryptionkey/hivenet(user.loc)
attacking_item.play_tool_sound(get_turf(src), 50)
to_chat(user, "You bypass the fried security chip and extract the encryption key.")
to_chat(user, "The fried neural socket crumbles away like dust.")
qdel(src)
return TRUE
/obj/item/storage/part_replacer
name = "rapid part exchange device"
desc = "Special mechanical module made to store, sort, and apply standard machine parts."
icon_state = "RPED"
item_state = "RPED"
icon = 'icons/obj/storage/misc.dmi'
contained_sprite = TRUE
w_class = WEIGHT_CLASS_HUGE
can_hold = list(/obj/item/stock_parts,/obj/item/reagent_containers/glass/beaker)
storage_slots = 50
use_to_pickup = TRUE
allow_quick_gather = TRUE
allow_quick_empty = TRUE
collection_mode = 1
display_contents_with_number = TRUE
max_w_class = WEIGHT_CLASS_NORMAL
max_storage_space = 100
/obj/item/ectoplasm
name = "ectoplasm"
desc = "spooky"
gender = PLURAL
icon = 'icons/obj/wizard.dmi'
icon_state = "ectoplasm"
/obj/item/anomaly_core
name = "anomaly core"
desc = "An advanced bluespace device, little is known about its applications, meriting research into its purpose."
icon = 'icons/obj/stock_parts.dmi'
icon_state = "anomaly_core"
origin_tech = list(TECH_MAGNET = 6, TECH_MATERIAL = 7, TECH_BLUESPACE = 8)
/obj/item/research
name = "research debugging device"
desc = "Instant research tool. For testing purposes only. PUTS ALL RESEARCH TECHS TO MAX, EVEN ILLEGAL AND ARCANE."
icon = 'icons/obj/stock_parts.dmi'
icon_state = "smes_coil"
origin_tech = list(TECH_MATERIAL = 19, TECH_ENGINEERING = 19, TECH_PHORON = 19, TECH_POWER = 19, TECH_BLUESPACE = 19, TECH_BIO = 19, TECH_COMBAT = 19, TECH_MAGNET = 19, TECH_DATA = 19, TECH_ILLEGAL = 19, TECH_ARCANE = 19)