/
energy.dm
314 lines (274 loc) · 10.3 KB
/
energy.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
/obj/item/melee/energy
icon = 'icons/obj/transforming_energy.dmi'
max_integrity = 200
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 100, ACID = 30)
attack_verb_continuous = list("hits", "taps", "pokes")
attack_verb_simple = list("hit", "tap", "poke")
resistance_flags = FIRE_PROOF
light_system = MOVABLE_LIGHT
light_range = 3
light_power = 1
light_on = FALSE
bare_wound_bonus = 20
stealthy_audio = TRUE
w_class = WEIGHT_CLASS_SMALL
/// The color of this energy based sword, for use in editing the icon_state.
var/sword_color_icon
/// Whether our blade is active or not.
var/blade_active = FALSE
/// Force while active.
var/active_force = 30
/// Throwforce while active.
var/active_throwforce = 20
/// Sharpness while active.
var/active_sharpness = SHARP_EDGED
/// Hitsound played attacking while active.
var/active_hitsound = 'sound/weapons/blade1.ogg'
/// Weight class while active.
var/active_w_class = WEIGHT_CLASS_BULKY
/// The heat given off when active.
var/active_heat = 3500
/obj/item/melee/energy/Initialize()
. = ..()
make_transformable()
AddComponent(/datum/component/butchering, _speed = 5 SECONDS, _butcher_sound = active_hitsound)
/obj/item/melee/energy/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/*
* Gives our item the transforming component, passing in our various vars.
*/
/obj/item/melee/energy/proc/make_transformable()
AddComponent(/datum/component/transforming, \
force_on = active_force, \
throwforce_on = active_throwforce, \
throw_speed_on = 4, \
sharpness_on = active_sharpness, \
hitsound_on = active_hitsound, \
w_class_on = active_w_class, \
attack_verb_continuous_on = list("attacks", "slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "cuts"), \
attack_verb_simple_on = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut"))
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
/obj/item/melee/energy/suicide_act(mob/user)
if(!blade_active)
attack_self(user)
user.visible_message(span_suicide("[user] is [pick("slitting [user.p_their()] stomach open with", "falling on")] [src]! It looks like [user.p_theyre()] trying to commit seppuku!"))
return (BRUTELOSS|FIRELOSS)
/obj/item/melee/energy/add_blood_DNA(list/blood_dna)
return FALSE
/obj/item/melee/energy/process(delta_time)
if(heat)
open_flame()
/obj/item/melee/energy/ignition_effect(atom/A, mob/user)
if(!heat && !blade_active)
return ""
var/in_mouth = ""
if(iscarbon(user))
var/mob/living/carbon/C = user
if(C.wear_mask)
in_mouth = ", barely missing [C.p_their()] nose"
. = span_warning("[user] swings [user.p_their()] [name][in_mouth]. [user.p_they(TRUE)] light[user.p_s()] [user.p_their()] [A.name] in the process.")
playsound(loc, hitsound, get_clamped_volume(), TRUE, -1)
add_fingerprint(user)
/*
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
*
* Updates our icon to have the correct color,
* updates the amount of heat our item gives out,
* enables / disables embedding, and
* starts / stops processing.
*
* Also gives feedback to the user and activates or deactives the glow.
*/
/obj/item/melee/energy/proc/on_transform(obj/item/source, mob/user, active)
SIGNAL_HANDLER
blade_active = active
if(active)
if(sword_color_icon)
icon_state = "[icon_state]_[sword_color_icon]"
if(embedding)
updateEmbedding()
heat = active_heat
START_PROCESSING(SSobj, src)
else
if(embedding)
disableEmbedding()
heat = initial(heat)
STOP_PROCESSING(SSobj, src)
balloon_alert(user, "[name] [active ? "enabled":"disabled"]")
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 35, TRUE)
set_light_on(active)
return COMPONENT_NO_DEFAULT_MESSAGE
/// Energy axe - extremely strong.
/obj/item/melee/energy/axe
name = "energy axe"
desc = "An energized battle axe."
icon_state = "axe"
lefthand_file = 'icons/mob/inhands/weapons/axes_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/axes_righthand.dmi'
hitsound = 'sound/weapons/bladeslice.ogg'
attack_verb_continuous = list("attacks", "chops", "cleaves", "tears", "lacerates", "cuts")
attack_verb_simple = list("attack", "chop", "cleave", "tear", "lacerate", "cut")
force = 40
throwforce = 25
throw_speed = 3
throw_range = 5
armour_penetration = 100
sharpness = SHARP_EDGED
w_class = WEIGHT_CLASS_NORMAL
flags_1 = CONDUCT_1
light_color = LIGHT_COLOR_LIGHT_CYAN
active_force = 150
active_throwforce = 30
active_w_class = WEIGHT_CLASS_HUGE
/obj/item/melee/energy/axe/make_transformable()
AddComponent(/datum/component/transforming, \
force_on = active_force, \
throwforce_on = active_throwforce, \
throw_speed_on = throw_speed, \
sharpness_on = sharpness, \
w_class_on = active_w_class)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
/obj/item/melee/energy/axe/suicide_act(mob/user)
user.visible_message(span_suicide("[user] swings [src] towards [user.p_their()] head! It looks like [user.p_theyre()] trying to commit suicide!"))
return (BRUTELOSS|FIRELOSS)
/// Energy swords.
/obj/item/melee/energy/sword
name = "energy sword"
desc = "May the force be within you."
icon_state = "e_sword"
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
hitsound = "swing_hit"
force = 3
throwforce = 5
throw_speed = 3
throw_range = 5
armour_penetration = 35
block_chance = 50
embedding = list("embed_chance" = 75, "impact_pain_mult" = 10)
/obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(blade_active)
return ..()
return FALSE
/obj/item/melee/energy/sword/cyborg
name = "cyborg energy sword"
sword_color_icon = "red"
/// The cell cost of hitting something.
var/hitcost = 50
/obj/item/melee/energy/sword/cyborg/attack(mob/target, mob/living/silicon/robot/user)
if(!user.cell)
return
var/obj/item/stock_parts/cell/our_cell = user.cell
if(blade_active && !(our_cell.use(hitcost)))
attack_self(user)
to_chat(user, span_notice("It's out of charge!"))
return
return ..()
/obj/item/melee/energy/sword/cyborg/cyborg_unequip(mob/user)
if(!blade_active)
return
attack_self(user)
/obj/item/melee/energy/sword/cyborg/saw //Used by medical Syndicate cyborgs
name = "energy saw"
desc = "For heavy duty cutting. It has a carbon-fiber blade in addition to a toggleable hard-light edge to dramatically increase sharpness."
icon = 'icons/obj/surgery.dmi'
icon_state = "esaw"
hitsound = 'sound/weapons/circsawhit.ogg'
force = 18
hitcost = 75 // Costs more than a standard cyborg esword.
w_class = WEIGHT_CLASS_NORMAL
sharpness = SHARP_EDGED
light_color = LIGHT_COLOR_LIGHT_CYAN
tool_behaviour = TOOL_SAW
toolspeed = 0.7 // Faster than a normal saw.
active_force = 30
sword_color_icon = null // Stops icon from breaking when turned on.
/obj/item/melee/energy/sword/cyborg/saw/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
return FALSE
// The colored energy swords we all know and love.
/obj/item/melee/energy/sword/saber
/// Assoc list of all possible saber colors to color define.
var/list/possible_colors = list(
"red" = COLOR_SOFT_RED,
"blue" = LIGHT_COLOR_LIGHT_CYAN,
"green" = LIGHT_COLOR_GREEN,
"purple" = LIGHT_COLOR_LAVENDER,
)
/// Whether this saber has beel multitooled.
var/hacked = FALSE
/obj/item/melee/energy/sword/saber/Initialize(mapload)
. = ..()
if(!sword_color_icon && LAZYLEN(possible_colors))
sword_color_icon = pick(possible_colors)
if(sword_color_icon)
set_light_color(possible_colors[sword_color_icon])
/obj/item/melee/energy/sword/saber/process()
. = ..()
if(hacked)
set_light_color(possible_colors[pick(possible_colors)])
/obj/item/melee/energy/sword/saber/red
sword_color_icon = "red"
/obj/item/melee/energy/sword/saber/blue
sword_color_icon = "blue"
/obj/item/melee/energy/sword/saber/green
sword_color_icon = "green"
/obj/item/melee/energy/sword/saber/purple
sword_color_icon = "purple"
/obj/item/melee/energy/sword/saber/attackby(obj/item/weapon, mob/living/user, params)
if(weapon.tool_behaviour == TOOL_MULTITOOL)
if(hacked)
to_chat(user, span_warning("It's already fabulous!"))
else
hacked = TRUE
sword_color_icon = "rainbow"
to_chat(user, span_warning("RNBW_ENGAGE"))
if(force >= active_force)
icon_state = "[initial(icon_state)]_on_rainbow"
user.update_inv_hands()
else
return ..()
/obj/item/melee/energy/sword/pirate
name = "energy cutlass"
desc = "Arrrr matey."
icon_state = "e_cutlass"
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
light_color = COLOR_RED
/// Energy blades, which are effectively perma-extended energy swords
/obj/item/melee/energy/blade
name = "energy blade"
desc = "A concentrated beam of energy in the shape of a blade. Very stylish... and lethal."
icon_state = "blade"
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
hitsound = 'sound/weapons/blade1.ogg'
attack_verb_continuous = list("attacks", "slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "cuts")
attack_verb_simple = list("attack", "slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut")
force = 30
throwforce = 1 // Throwing or dropping the item deletes it.
throw_speed = 3
throw_range = 1
sharpness = SHARP_EDGED
heat = 3500
w_class = WEIGHT_CLASS_BULKY
blade_active = TRUE
/// Our linked spark system that emits from our sword.
var/datum/effect_system/spark_spread/spark_system
//Most of the other special functions are handled in their own files. aka special snowflake code so kewl
/obj/item/melee/energy/blade/Initialize()
. = ..()
spark_system = new /datum/effect_system/spark_spread()
spark_system.set_up(5, 0, src)
spark_system.attach(src)
START_PROCESSING(SSobj, src)
/obj/item/melee/energy/blade/Destroy()
QDEL_NULL(spark_system)
return ..()
/obj/item/melee/energy/blade/make_transformable()
return FALSE
/obj/item/melee/energy/blade/hardlight
name = "hardlight blade"
desc = "An extremely sharp blade made out of hard light. Packs quite a punch."
icon_state = "lightblade"
inhand_icon_state = "lightblade"