-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathsyringe_gun.dm
152 lines (130 loc) · 4.77 KB
/
syringe_gun.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
/obj/item/gun/syringe
name = "syringe gun"
desc = "Created by Blue Cross Medical for use by medical staff in the field, the syringe gun utilizes a spring-loaded mechanism to propel syringes across a large distance."
icon_state = "syringegun"
item_state = "syringegun"
w_class = WEIGHT_CLASS_NORMAL
throw_speed = 3
throw_range = 7
force = 4
materials = list(/datum/material/iron=2000)
clumsy_check = 0
fire_sound = 'sound/items/syringeproj.ogg'
var/load_sound = 'sound/weapons/shotguninsert.ogg'
var/list/syringes = list()
var/max_syringes = 1
var/has_syringe_overlay = TRUE ///If it has an overlay for inserted syringes. If true, the overlay is determined by the number of syringes inserted into it.
var/allow_piercing = FALSE // whether it can hold piercing syringes
/obj/item/gun/syringe/Initialize(mapload)
. = ..()
update_appearance(UPDATE_ICON)
chambered = new /obj/item/ammo_casing/syringegun(src)
/obj/item/gun/syringe/handle_atom_del(atom/A)
. = ..()
if(A in syringes)
syringes.Remove(A)
/obj/item/gun/syringe/recharge_newshot()
if(!syringes.len)
return
chambered.newshot()
/obj/item/gun/syringe/can_shoot()
return syringes.len
/obj/item/gun/syringe/process_chamber()
if(chambered && !chambered.BB) //we just fired
recharge_newshot()
update_appearance(UPDATE_ICON)
/obj/item/gun/syringe/examine(mob/user)
. = ..()
. += "Can hold [max_syringes] syringe\s. Has [syringes.len] syringe\s remaining."
/obj/item/gun/syringe/attack_self(mob/living/user)
if(!syringes.len)
to_chat(user, span_warning("[src] is empty!"))
return FALSE
var/obj/item/reagent_containers/syringe/S = syringes[syringes.len]
if(!S)
return FALSE
user.put_in_hands(S)
syringes.Remove(S)
to_chat(user, span_notice("You unload [S] from \the [src]."))
return TRUE
/obj/item/gun/syringe/attackby(obj/item/A, mob/user, params, show_msg = TRUE)
if(istype(A, /obj/item/reagent_containers/syringe))
var/obj/item/reagent_containers/syringe/syringe = A
if(syringe.proj_piercing && !allow_piercing)
to_chat(user, span_warning("[syringe] won't fit into [src]!"))
return FALSE
if(syringes.len < max_syringes)
if(!user.transferItemToLoc(A, src))
return FALSE
to_chat(user, span_notice("You load [A] into \the [src]."))
syringes += A
recharge_newshot()
update_appearance(UPDATE_ICON)
playsound(loc, load_sound, 40)
return TRUE
else
to_chat(user, span_warning("[src] cannot hold more syringes!"))
return FALSE
/obj/item/gun/syringe/update_overlays()
. = ..()
if(!has_syringe_overlay)
return
var/syringe_count = syringes.len
. += "[initial(icon_state)]_[syringe_count ? clamp(syringe_count, 1, initial(max_syringes)) : "empty"]"
/obj/item/gun/syringe/rapidsyringe
name = "rapid syringe gun"
desc = "A modification of the syringe gun design, using a rotating cylinder to store up to six syringes."
icon_state = "rapidsyringegun"
max_syringes = 6
allow_piercing = TRUE
/obj/item/gun/syringe/syndicate
name = "dart pistol"
desc = "A small spring-loaded sidearm that functions identically to a syringe gun."
icon_state = "syringe_pistol"
item_state = "gun" //Smaller inhand
w_class = WEIGHT_CLASS_SMALL
force = 2 //Also very weak because it's smaller
suppressed = TRUE //Softer fire sound
can_unsuppress = FALSE //Permanently silenced
allow_piercing = TRUE
/obj/item/gun/syringe/dna
name = "modified syringe gun"
desc = "A syringe gun that has been modified to fit DNA injectors instead of normal syringes."
allow_piercing = TRUE
/obj/item/gun/syringe/dna/Initialize(mapload)
. = ..()
chambered = new /obj/item/ammo_casing/dnainjector(src)
/obj/item/gun/syringe/dna/attackby(obj/item/A, mob/user, params, show_msg = TRUE)
if(istype(A, /obj/item/dnainjector))
var/obj/item/dnainjector/D = A
if(D.used)
to_chat(user, span_warning("This injector is used up!"))
return
if(syringes.len < max_syringes)
if(!user.transferItemToLoc(D, src))
return FALSE
to_chat(user, span_notice("You load \the [D] into \the [src]."))
syringes += D
recharge_newshot()
update_appearance(UPDATE_ICON)
playsound(loc, load_sound, 40)
return TRUE
else
to_chat(user, span_warning("[src] cannot hold more syringes!"))
return FALSE
/obj/item/gun/syringe/blowgun
name = "blowgun"
desc = "Fire syringes a short distance."
icon_state = "blowgun"
item_state = "blowgun"
fire_sound = 'sound/items/syringeproj.ogg'
no_pin_required = TRUE
trigger_guard = TRIGGER_GUARD_ALLOW_ALL //it's a fucking blowgun it shouldn't even have a triggerguard
/obj/item/gun/syringe/blowgun/Initialize(mapload)
. = ..()
update_appearance(UPDATE_ICON)
chambered = new /obj/item/ammo_casing/blowgun(src)
/obj/item/gun/syringe/blowgun/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0)
user.adjustStaminaLoss(25)
user.adjustOxyLoss(25)
..()