forked from tichys/Foundation-19-Temp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneric.dm
338 lines (292 loc) · 18 KB
/
generic.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
//Procedures in this file: Gneric surgery steps
//////////////////////////////////////////////////////////////////
// COMMON STEPS //
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// generic surgery step datum
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/
can_infect = 1
shock_level = 10
/datum/surgery_step/generic/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (isslime(target))
return 0
if (target_zone == BP_EYES) //there are specific steps for eye surgery
return 0
if (!hasorgans(target))
return 0
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if (affected == null)
return 0
if (affected.is_stump())
return 0
if (affected.robotic >= ORGAN_ROBOT)
return 0
return 1
//////////////////////////////////////////////////////////////////
// laser scalpel surgery step
// acts as both cutting and bleeder clamping surgery steps
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/cut_with_laser
allowed_tools = list(
/obj/item/weapon/scalpel/laser3 = 95, \
/obj/item/weapon/scalpel/laser2 = 85, \
/obj/item/weapon/scalpel/laser1 = 75, \
/obj/item/weapon/melee/energy/sword = 5
)
priority = 2
min_duration = 45
max_duration = 55
/datum/surgery_step/generic/cut_with_laser/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected && affected.open() == SURGERY_CLOSED && target_zone != BP_MOUTH
/datum/surgery_step/generic/cut_with_laser/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts the bloodless incision on [target]'s [affected.name] with \the [tool].", \
"You start the bloodless incision on [target]'s [affected.name] with \the [tool].")
target.custom_pain("You feel a horrible, searing pain in your [affected.name]!",50, affecting = affected)
..()
/datum/surgery_step/generic/cut_with_laser/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='notice'>[user] has made a bloodless incision on [target]'s [affected.name] with \the [tool].</span>", \
"<span class='notice'>You have made a bloodless incision on [target]'s [affected.name] with \the [tool].</span>",)
affected.createwound(CUT, affected.min_broken_damage/2, 1)
affected.do_clamp()
spread_germs_to_organ(affected, user)
/datum/surgery_step/generic/cut_with_laser/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand slips as the blade sputters, searing a long gash in [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='warning'>Your hand slips as the blade sputters, searing a long gash in [target]'s [affected.name] with \the [tool]!</span>")
affected.take_damage(15, 5, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
//////////////////////////////////////////////////////////////////
// laser scalpel surgery step
// acts as the cutting, bleeder clamping, and retractor surgery steps
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/incision_manager
allowed_tools = list(
/obj/item/weapon/scalpel/manager = 100
)
priority = 2
min_duration = 40
max_duration = 60
/datum/surgery_step/generic/incision_manager/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected && affected.open() == SURGERY_CLOSED && target_zone != BP_MOUTH
/datum/surgery_step/generic/incision_manager/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts to construct a prepared incision on and within [target]'s [affected.name] with \the [tool].", \
"You start to construct a prepared incision on and within [target]'s [affected.name] with \the [tool].")
target.custom_pain("You feel a horrible, searing pain in your [affected.name] as it is pushed apart!",50, affecting = affected)
..()
/datum/surgery_step/generic/incision_manager/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='notice'>[user] has constructed a prepared incision on and within [target]'s [affected.name] with \the [tool].</span>", \
"<span class='notice'>You have constructed a prepared incision on and within [target]'s [affected.name] with \the [tool].</span>",)
affected.createwound(CUT, affected.min_broken_damage/2, 1)
affected.do_clamp()
/datum/surgery_step/generic/incision_manager/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand jolts as the system sparks, ripping a gruesome hole in [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='warning'>Your hand jolts as the system sparks, ripping a gruesome hole in [target]'s [affected.name] with \the [tool]!</span>")
affected.take_damage(20, 15, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
//////////////////////////////////////////////////////////////////
// scalpel surgery step
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/cut_open
allowed_tools = list(
/obj/item/weapon/scalpel = 100, \
/obj/item/weapon/material/knife = 75, \
/obj/item/weapon/material/kitchen/utensil/knife = 75, \
/obj/item/weapon/broken_bottle = 50,
/obj/item/weapon/material/shard = 50, \
)
min_duration = 45
max_duration = 55
/datum/surgery_step/generic/cut_open/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if(!istype(affected))
return
if(affected.open())
var/datum/wound/cut/incision = affected.get_incision()
to_chat(user, "<span class='notice'>The [incision.desc] provides enough access, another incision isn't needed.</span>")
return SURGERY_FAILURE
return target_zone != BP_MOUTH
/datum/surgery_step/generic/cut_open/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts the incision on [target]'s [affected.name] with \the [tool].", \
"You start the incision on [target]'s [affected.name] with \the [tool].")
target.custom_pain("You feel a horrible pain as if from a sharp knife in your [affected.name]!",40, affecting = affected)
..()
/datum/surgery_step/generic/cut_open/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='notice'>[user] has made an incision on [target]'s [affected.name] with \the [tool].</span>", \
"<span class='notice'>You have made an incision on [target]'s [affected.name] with \the [tool].</span>",)
affected.createwound(CUT, affected.min_broken_damage/2, 1)
playsound(target.loc, 'sound/weapons/bladeslice.ogg', 15, 1)
/datum/surgery_step/generic/cut_open/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand slips, slicing open [target]'s [affected.name] in the wrong place with \the [tool]!</span>", \
"<span class='warning'>Your hand slips, slicing open [target]'s [affected.name] in the wrong place with \the [tool]!</span>")
affected.take_damage(10, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
//////////////////////////////////////////////////////////////////
// bleeder clamping surgery step
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/clamp_bleeders
allowed_tools = list(
/obj/item/weapon/hemostat = 100, \
/obj/item/stack/cable_coil = 75, \
/obj/item/device/assembly/mousetrap = 20
)
min_duration = 20
max_duration = 30
/datum/surgery_step/generic/clamp_bleeders/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected && affected.open() && !affected.clamped()
/datum/surgery_step/generic/clamp_bleeders/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts clamping bleeders in [target]'s [affected.name] with \the [tool].", \
"You start clamping bleeders in [target]'s [affected.name] with \the [tool].")
target.custom_pain("The pain in your [affected.name] is maddening!",40, affecting = affected)
..()
/datum/surgery_step/generic/clamp_bleeders/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='notice'>[user] clamps bleeders in [target]'s [affected.name] with \the [tool].</span>", \
"<span class='notice'>You clamp bleeders in [target]'s [affected.name] with \the [tool].</span>")
affected.do_clamp()
spread_germs_to_organ(affected, user)
playsound(target.loc, 'sound/items/Welder.ogg', 15, 1)
/datum/surgery_step/generic/clamp_bleeders/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand slips, tearing blood vessals and causing massive bleeding in [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='warning'>Your hand slips, tearing blood vessels and causing massive bleeding in [target]'s [affected.name] with \the [tool]!</span>",)
affected.take_damage(10, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
//////////////////////////////////////////////////////////////////
// retractor surgery step
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/retract_skin
allowed_tools = list(
/obj/item/weapon/retractor = 100, \
/obj/item/weapon/crowbar = 75,
/obj/item/weapon/material/knife = 50, \
/obj/item/weapon/material/kitchen/utensil/fork = 50
)
priority = 1
min_duration = 15
max_duration = 20
/datum/surgery_step/generic/retract_skin/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(..())
var/obj/item/organ/external/affected = target.get_organ(target_zone)
return affected && affected.open() == SURGERY_OPEN //&& !(affected.status & ORGAN_BLEEDING)
/datum/surgery_step/generic/retract_skin/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] starts to pry open the incision on [target]'s [affected.name] with \the [tool].", \
"You start to pry open the incision on [target]'s [affected.name] with \the [tool].")
target.custom_pain("It feels like the skin on your [affected.name] is on fire!",40,affecting = affected)
..()
/datum/surgery_step/generic/retract_skin/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='notice'>[user] keeps the incision open on [target]'s [affected.name] with \the [tool].</span>", \
"<span class='notice'>You keep the incision open on [target]'s [affected.name] with \the [tool].</span>")
var/datum/wound/W = affected.get_incision()
W.open_wound(min(W.damage * 2, W.damage_list[1] - W.damage)) //damage up to the max of the wound.
if(!affected.encased)
for(var/obj/item/weapon/implant/I in affected.implants)
I.exposed(true)
/datum/surgery_step/generic/retract_skin/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand slips, tearing the edges of the incision on [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='warning'>Your hand slips, tearing the edges of the incision on [target]'s [affected.name] with \the [tool]!</span>")
affected.take_damage(12, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
//////////////////////////////////////////////////////////////////
// skin cauterization surgery step
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/cauterize
allowed_tools = list(
/obj/item/weapon/cautery = 100, \
/obj/item/clothing/mask/smokable/cigarette = 75, \
/obj/item/weapon/flame/lighter = 50, \
/obj/item/weapon/weldingtool = 25
)
min_duration = 35
max_duration = 50
/datum/surgery_step/generic/cauterize/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if(target_zone == BP_MOUTH || target_zone == BP_EYES)
return FALSE
if(!hasorgans(target))
return FALSE
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if(!affected)
return FALSE
if(affected.robotic >= ORGAN_ROBOT)
return FALSE
if(!affected.get_incision(1))
to_chat(user, "<span class='warning'>There are no incisions on [target]'s [affected.name] that can be closed cleanly with \the [tool]!</span>")
return SURGERY_FAILURE
if(affected.is_stump()) // Copypasting some stuff here to avoid having to modify ..() for a single surgery
return affected.status & ORGAN_ARTERY_CUT
else
return affected.open()
/datum/surgery_step/generic/cauterize/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
var/datum/wound/cut/W = affected.get_incision()
user.visible_message("[user] is beginning to cauterize[W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool]." , \
"You are beginning to cauterize[W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].")
target.custom_pain("Your [affected.name] is being burned!",40,affecting = affected)
..()
/datum/surgery_step/generic/cauterize/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
var/datum/wound/cut/W = affected.get_incision()
user.visible_message("<span class='notice'>[user] cauterizes[W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].</span>", \
"<span class='notice'>You cauterize[W ? " \a [W.desc] on" : ""] \the [target]'s [affected.name] with \the [tool].</span>")
if(W)
W.close()
if(affected.is_stump())
affected.status &= ~ORGAN_ARTERY_CUT
/datum/surgery_step/generic/cauterize/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='warning'>Your hand slips, leaving a small burn on [target]'s [affected.name] with \the [tool]!</span>")
affected.take_damage(0, 3, used_weapon = tool)
//////////////////////////////////////////////////////////////////
// limb amputation surgery step
//////////////////////////////////////////////////////////////////
/datum/surgery_step/generic/amputate
allowed_tools = list(
/obj/item/weapon/circular_saw = 100, \
/obj/item/weapon/material/hatchet = 75
)
min_duration = 55
max_duration = 80
/datum/surgery_step/generic/amputate/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (target_zone == BP_EYES) //there are specific steps for eye surgery
return 0
if (!hasorgans(target))
return 0
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if (affected == null)
return 0
if (affected.open())
to_chat(user,"<span class='warning'>You can't get a clean cut with incisions getting in the way.</span>")
return SURGERY_FAILURE
return !affected.cannot_amputate
/datum/surgery_step/generic/amputate/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] is beginning to amputate [target]'s [affected.name] with \the [tool]." , \
"You are beginning to cut through [target]'s [affected.amputation_point] with \the [tool].")
target.custom_pain("Your [affected.amputation_point] is being ripped apart!",100,affecting = affected)
..()
/datum/surgery_step/generic/amputate/end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='notice'>[user] amputates [target]'s [affected.name] at the [affected.amputation_point] with \the [tool].</span>", \
"<span class='notice'>You amputate [target]'s [affected.name] with \the [tool].</span>")
affected.droplimb(1,DROPLIMB_EDGE)
/datum/surgery_step/generic/amputate/fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = target.get_organ(target_zone)
user.visible_message("<span class='warning'>[user]'s hand slips, sawing through the bone in [target]'s [affected.name] with \the [tool]!</span>", \
"<span class='warning'>Your hand slips, sawwing through the bone in [target]'s [affected.name] with \the [tool]!</span>")
affected.take_damage(30, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
affected.fracture()