-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathpins.dm
248 lines (207 loc) · 8.78 KB
/
pins.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
/obj/item/firing_pin
name = "electronic firing pin"
desc = "A small authentication device, to be inserted into a firearm receiver to allow operation. NT safety regulations require all new designs to incorporate one."
icon = 'icons/obj/device.dmi'
icon_state = "firing_pin"
item_state = "pen"
flags_1 = CONDUCT_1
w_class = WEIGHT_CLASS_TINY
attack_verb = list("poked")
var/fail_message = span_warning("INVALID USER.")
var/selfdestruct = 0 // Explode when user check is failed.
var/force_replace = 0 // Can forcefully replace other pins.
var/pin_removeable = 0 // Can be replaced by any pin.
var/obj/item/gun/gun
/obj/item/firing_pin/New(newloc)
..()
if(istype(newloc, /obj/item/gun))
gun = newloc
/obj/item/firing_pin/afterattack(atom/target, mob/user, proximity_flag)
. = ..()
if(proximity_flag)
if(istype(target, /obj/item/gun))
var/obj/item/gun/G = target
if(G.no_pin_required)
return
if(G.pin && (force_replace || G.pin.pin_removeable))
G.pin.forceMove(get_turf(G))
if(!G.pin.gun_remove(user))
return
to_chat(user, "<span class ='notice'>You remove [G]'s old pin.</span>")
if(!G.pin)
if(!user.temporarilyRemoveItemFromInventory(src))
return
gun_insert(user, G)
to_chat(user, "<span class ='notice'>You insert [src] into [G].</span>")
else
to_chat(user, "<span class ='notice'>This firearm already has a firing pin installed.</span>")
/obj/item/firing_pin/emag_act(mob/user, obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
return FALSE
obj_flags |= EMAGGED
to_chat(user, span_notice("You override the authentication mechanism."))
return TRUE
///what do we do when we are being added to a gun
/obj/item/firing_pin/proc/gun_insert(mob/living/user, obj/item/gun/G)
gun = G
forceMove(gun)
gun.pin = src
return
///pin removal proc, return TRUE if the gun is still intact when it's done, false if there is a "tragic" "accident"
/obj/item/firing_pin/proc/gun_remove(mob/living/user)
gun.pin = null
gun = null
return TRUE
///can the pin be used by whoever is firing its gun
/obj/item/firing_pin/proc/pin_auth(mob/living/user)
return TRUE
///what happens if an authorization is failed, explodes if selfdestruct is TRUE
/obj/item/firing_pin/proc/auth_fail(mob/living/user)
user?.show_message(fail_message, MSG_VISUAL)
if(selfdestruct)
if(user)
user.show_message("[span_danger("SELF-DESTRUCTING...")]<br>", MSG_VISUAL)
to_chat(user, span_userdanger("[gun] explodes!"))
explosion(get_turf(gun), -1, 0, 2, 3)
if(gun)
qdel(gun)
/obj/item/firing_pin/magic
name = "magic crystal shard"
desc = "A small enchanted shard which allows magical weapons to fire."
/obj/item/firing_pin/clockie
name = "clockwork crystal shard"
desc = "A small enchanted shard which allows followers of Ratvar to use their weapons."
///can the pin be used by whoever is firing its gun
/obj/item/firing_pin/clockie/pin_auth(mob/living/user)
return is_clockcult(user)
// Test pin, works only near firing range.
/obj/item/firing_pin/test_range
name = "test-range firing pin"
desc = "This safety firing pin allows weapons to be fired within proximity to a firing range."
fail_message = span_warning("TEST RANGE CHECK FAILED.")
pin_removeable = TRUE
/obj/item/firing_pin/test_range/pin_auth(mob/living/user)
for(var/obj/machinery/magnetic_controller/M in range(user, 3))
return TRUE
return FALSE
// Implant pin, checks for implant
/obj/item/firing_pin/implant
name = "implant-keyed firing pin"
desc = "This is a security firing pin which only authorizes users who are implanted with a certain device."
fail_message = span_warning("IMPLANT CHECK FAILED.")
var/obj/item/implant/req_implant = null
/obj/item/firing_pin/implant/pin_auth(mob/living/user)
if(user)
for(var/obj/item/implant/I in user.implants)
if(req_implant && I.type == req_implant)
return TRUE
return FALSE
/obj/item/firing_pin/implant/mindshield
name = "mindshield firing pin"
desc = "This Security firing pin authorizes the weapon for only mindshield-implanted users."
icon_state = "firing_pin_loyalty"
req_implant = /obj/item/implant/mindshield
/obj/item/firing_pin/implant/pindicate
name = "syndicate firing pin"
desc = "War has changed. It’s no longer about nations, ideologies, or ethnicity. It’s an endless series of proxy battles fought by mercenaries and machines. War – and its consumption of life – has become a well-oiled machine. War has changed. ID-tagged soldiers carry ID-tagged weapons, use ID-tagged gear. Nanomachines inside their bodies enhance and regulate their abilities. Genetic control. Information control. Emotion control. Battlefield control. Everything is monitored and kept under control. War has changed. The age of deterrence has become the age of control . . . All in the name of averting catastrophe from weapons of mass destruction. And he who controls the battlefield . . . controls history. War has changed. When the battlefield is under total control . . . War becomes routine."
icon_state = "firing_pin_pindi"
req_implant = /obj/item/implant/weapons_auth
// Honk pin, clown's joke item.
// Can replace other pins. Replace a pin in cap's laser for extra fun!
/obj/item/firing_pin/clown
name = "hilarious firing pin"
desc = "Advanced clowntech that can convert any firearm into a far more useful object."
color = "#FFFF00"
fail_message = span_warning("HONK!")
force_replace = TRUE
/obj/item/firing_pin/clown/pin_auth(mob/living/user)
playsound(src, 'sound/items/bikehorn.ogg', 50, 1)
return FALSE
// Ultra-honk pin, clown's deadly joke item.
// A gun with ultra-honk pin is useful for clown and useless for everyone else.
/obj/item/firing_pin/clown/ultra/pin_auth(mob/living/user)
playsound(src.loc, 'sound/items/bikehorn.ogg', 50, 1)
if(user && (!(HAS_TRAIT(user, TRAIT_CLUMSY)) && !(user.mind && user.mind.assigned_role == "Clown")))
return FALSE
return TRUE
/obj/item/firing_pin/clown/ultra/gun_insert(mob/living/user, obj/item/gun/G)
..()
G.clumsy_check = FALSE
/obj/item/firing_pin/clown/ultra/gun_remove(mob/living/user)
gun.clumsy_check = initial(gun.clumsy_check)
..()
// Now two times deadlier!
/obj/item/firing_pin/clown/ultra/selfdestruct
desc = "Advanced clowntech that can convert any firearm into a far more useful object. It has a small nitrobananium charge on it."
selfdestruct = TRUE
// fun pin
// for when you need a gun to not be fired by anyone else ever
/obj/item/firing_pin/fucked
name = "syndicate ultrasecure firing pin"
desc = "Get fucked!"
selfdestruct = TRUE
/obj/item/firing_pin/fucked/pin_auth(mob/living/user)
if(faction_check(user.faction, list(ROLE_ANTAG), FALSE))
return TRUE
return FALSE
/obj/item/firing_pin/fucked/gun_remove(mob/living/user)
auth_fail(user)
return FALSE
// DNA-keyed pin.
// When you want to keep your toys for yourself.
/obj/item/firing_pin/dna
name = "DNA-keyed firing pin"
desc = "This is a DNA-locked firing pin which only authorizes one user. Attempt to fire once to DNA-link."
icon_state = "firing_pin_dna"
fail_message = span_warning("DNA CHECK FAILED.")
var/unique_enzymes = null
/obj/item/firing_pin/dna/afterattack(atom/target, mob/user, proximity_flag)
. = ..()
if(proximity_flag && iscarbon(target))
var/mob/living/carbon/M = target
if(M.dna && M.dna.unique_enzymes)
unique_enzymes = M.dna.unique_enzymes
to_chat(user, span_notice("DNA-LOCK SET."))
/obj/item/firing_pin/dna/pin_auth(mob/living/carbon/user)
if(user && user.dna && user.dna.unique_enzymes)
if(user.dna.unique_enzymes == unique_enzymes)
return TRUE
return FALSE
/obj/item/firing_pin/dna/auth_fail(mob/living/carbon/user)
if(!unique_enzymes)
if(user && user.dna && user.dna.unique_enzymes)
unique_enzymes = user.dna.unique_enzymes
to_chat(user, span_notice("DNA-LOCK SET."))
else
..()
/obj/item/firing_pin/dna/dredd
desc = "This is a DNA-locked firing pin which only authorizes one user. Attempt to fire once to DNA-link. It has a small explosive charge on it."
selfdestruct = TRUE
// Laser tag pins
/obj/item/firing_pin/tag
name = "laser tag firing pin"
desc = "A recreational firing pin, used in laser tag units to ensure users have their vests on."
fail_message = span_warning("SUIT CHECK FAILED.")
var/obj/item/clothing/suit/suit_requirement = null
var/tagcolor = ""
/obj/item/firing_pin/tag/pin_auth(mob/living/user)
if(ishuman(user))
var/mob/living/carbon/human/M = user
if(istype(M.wear_suit, suit_requirement))
return TRUE
to_chat(user, span_warning("You need to be wearing [tagcolor] laser tag armor!"))
return FALSE
/obj/item/firing_pin/tag/red
name = "red laser tag firing pin"
icon_state = "firing_pin_red"
suit_requirement = /obj/item/clothing/suit/redtag
tagcolor = "red"
/obj/item/firing_pin/tag/blue
name = "blue laser tag firing pin"
icon_state = "firing_pin_blue"
suit_requirement = /obj/item/clothing/suit/bluetag
tagcolor = "blue"
/obj/item/firing_pin/Destroy()
if(gun)
gun.pin = null
return ..()