-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathplant_genes.dm
461 lines (357 loc) · 15.1 KB
/
plant_genes.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
/datum/plant_gene
var/name
/// Skill gain from extracting this gene. Can only be gained once.
var/extract_value = 0
/datum/plant_gene/proc/get_name() // Used for manipulator display and gene disk name.
return name
/datum/plant_gene/proc/can_add(obj/item/seeds/S)
return !istype(S, /obj/item/seeds/sample) // Samples can't accept new genes
/datum/plant_gene/proc/Copy()
return new type
/datum/plant_gene/proc/apply_vars(obj/item/seeds/S) // currently used for fire resist, can prob. be further refactored
return
// Core plant genes store 5 main variables: lifespan, endurance, production, yield, potency
/datum/plant_gene/core
var/value
/datum/plant_gene/core/get_name()
return "[name] [value]"
/datum/plant_gene/core/proc/apply_stat(obj/item/seeds/S)
return
/datum/plant_gene/core/New(i = null)
..()
if(!isnull(i))
value = i
/datum/plant_gene/core/Copy()
var/datum/plant_gene/core/C = ..()
C.value = value
return C
/datum/plant_gene/core/can_add(obj/item/seeds/S)
if(!..())
return FALSE
return S.get_gene(src.type)
/datum/plant_gene/core/lifespan
name = "Lifespan"
value = 25
/datum/plant_gene/core/lifespan/apply_stat(obj/item/seeds/S)
S.lifespan = value
/datum/plant_gene/core/endurance
name = "Endurance"
value = 15
/datum/plant_gene/core/endurance/apply_stat(obj/item/seeds/S)
S.endurance = value
/datum/plant_gene/core/production
name = "Production Speed"
value = 6
/datum/plant_gene/core/production/apply_stat(obj/item/seeds/S)
S.production = value
/datum/plant_gene/core/yield
name = "Yield"
value = 3
/datum/plant_gene/core/yield/apply_stat(obj/item/seeds/S)
S.yield = value
/datum/plant_gene/core/potency
name = "Potency"
value = 10
/datum/plant_gene/core/potency/apply_stat(obj/item/seeds/S)
S.potency = value
/datum/plant_gene/core/weed_rate
name = "Weed Growth Rate"
value = 1
/datum/plant_gene/core/weed_rate/apply_stat(obj/item/seeds/S)
S.weed_rate = value
/datum/plant_gene/core/weed_chance
name = "Weed Vulnerability"
value = 5
/datum/plant_gene/core/weed_chance/apply_stat(obj/item/seeds/S)
S.weed_chance = value
// Reagent genes store reagent ID and reagent ratio. Amount of reagent in the plant = 1 + (potency * rate)
/datum/plant_gene/reagent
name = "Nutriment"
var/reagent_id = /datum/reagent/consumable/nutriment
var/rate = 0.04
/datum/plant_gene/reagent/get_name()
return "[name] production [rate*100]%"
/datum/plant_gene/reagent/proc/set_reagent(reag_id)
reagent_id = reag_id
name = "UNKNOWN"
var/datum/reagent/R = GLOB.chemical_reagents_list[reag_id]
if(R && R.type == reagent_id)
name = R.name
/datum/plant_gene/reagent/New(reag_id = null, reag_rate = 0)
..()
if(reag_id && reag_rate)
set_reagent(reag_id)
rate = reag_rate
/datum/plant_gene/reagent/Copy()
var/datum/plant_gene/reagent/G = ..()
G.name = name
G.reagent_id = reagent_id
G.rate = rate
return G
/datum/plant_gene/reagent/can_add(obj/item/seeds/S)
if(!..())
return FALSE
for(var/datum/plant_gene/reagent/R in S.genes)
if(R.reagent_id == reagent_id)
return FALSE
return TRUE
// Various traits affecting the product. Each must be somehow useful.
/datum/plant_gene/trait
var/rate = 0.05
var/examine_line = ""
var/trait_id // must be set and equal for any two traits of the same type
extract_value = 150
/datum/plant_gene/trait/Copy()
var/datum/plant_gene/trait/G = ..()
G.rate = rate
return G
/datum/plant_gene/trait/can_add(obj/item/seeds/S)
if(!..())
return FALSE
for(var/datum/plant_gene/trait/R in S.genes)
if(trait_id && R.trait_id == trait_id)
return FALSE
if(type == R.type)
return FALSE
return TRUE
/datum/plant_gene/trait/proc/on_new(obj/item/reagent_containers/food/snacks/grown/G, newloc)
return
/datum/plant_gene/trait/proc/on_consume(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/target)
return
/datum/plant_gene/trait/proc/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/target)
return
/datum/plant_gene/trait/proc/on_squash(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
return
/datum/plant_gene/trait/proc/on_attack(obj/item/reagent_containers/food/snacks/grown/G, mob/living/target, mob/living/user, def_zone)
return
/datum/plant_gene/trait/proc/on_attackby(obj/item/reagent_containers/food/snacks/grown/G, obj/item/I, mob/user)
return
/datum/plant_gene/trait/proc/on_throw_impact(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
return
/datum/plant_gene/trait/squash
// Allows the plant to be squashed when thrown or slipped on, leaving a colored mess and trash type item behind.
// Also splashes everything in target turf with reagents and applies other trait effects (teleporting, etc) to the target by on_squash.
// For code, see grown.dm
name = "Liquid Contents"
examine_line = span_info("It has a lot of liquid contents inside.")
/datum/plant_gene/trait/squash/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/C)
// Squash the plant on slip.
G.squash(C)
/datum/plant_gene/trait/slip
// Makes plant slippery, unless it has a grown-type trash. Then the trash gets slippery.
// Applies other trait effects (teleporting, etc) to the target by on_slip.
name = "Slippery Skin"
rate = 1.6
examine_line = span_info("It has a very slippery skin.")
/datum/plant_gene/trait/slip/on_new(obj/item/reagent_containers/food/snacks/grown/G, newloc)
..()
if(istype(G) && ispath(G.trash, /obj/item/grown))
return
var/obj/item/seeds/seed = G.get_plant_seed()
var/stun_len = seed.potency * rate
if(!istype(G, /obj/item/grown/bananapeel) && (!G.reagents || !G.reagents.has_reagent(/datum/reagent/lube)))
stun_len /= 3
G.AddComponent(/datum/component/slippery, min(stun_len,140), NONE, CALLBACK(src, PROC_REF(handle_slip), G))
/datum/plant_gene/trait/slip/proc/handle_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/M)
for(var/datum/plant_gene/trait/T in G.seed.genes)
T.on_slip(G, M)
/datum/plant_gene/trait/cell_charge
// Cell recharging trait. Charges all mob's power cells to (potency*rate)% mark when eaten.
// Generates sparks on squash.
// Small (potency*rate*5) chance to shock squish or slip target for (potency*rate*5) damage.
// Also affects plant batteries see capatative cell production datum
name = "Electrical Activity"
rate = 0.2
/datum/plant_gene/trait/cell_charge/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/C)
var/power = G.seed.potency*rate
if(prob(power))
C.electrocute_act(round(power), G, 1, zone = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)) // you stepped on it, so check protection on the legs
/datum/plant_gene/trait/cell_charge/on_squash(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
if(iscarbon(target))
var/mob/living/carbon/C = target
var/power = G.seed.potency*rate
if(prob(power))
C.electrocute_act(round(power), G, 1, zone = null)
/datum/plant_gene/trait/cell_charge/on_consume(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/target)
if(!G.reagents.total_volume)
var/batteries_recharged = 0
for(var/obj/item/stock_parts/cell/C in target.get_all_contents())
var/newcharge = min(G.seed.potency*0.01*C.maxcharge, C.maxcharge)
if(C.charge < newcharge)
C.charge = newcharge
if(isobj(C.loc))
var/obj/O = C.loc
O.update_appearance(UPDATE_ICON) //update power meters and such
C.update_appearance(UPDATE_ICON)
batteries_recharged = 1
if(batteries_recharged)
to_chat(target, span_notice("Your batteries are recharged!"))
/datum/plant_gene/trait/glow
// Makes plant glow. Makes plant in tray glow too.
// Adds 1 + potency*rate light range and potency*(rate + 0.01) light_power to products.
name = "Bioluminescence"
rate = 0.03
examine_line = span_info("It emits a soft glow.")
trait_id = "glow"
var/glow_color = "#C3E381"
/datum/plant_gene/trait/glow/proc/glow_range(obj/item/seeds/seed)
return 1.4 + seed.potency * rate
/datum/plant_gene/trait/glow/proc/glow_power(obj/item/seeds/seed)
return max(seed.potency * (rate + 0.01), 0.1)
/datum/plant_gene/trait/glow/on_new(obj/item/our_plant, newloc)
. = ..()
if(!.)
return
var/obj/item/seeds/our_seed = our_plant.get_plant_seed()
our_plant.light_system = MOVABLE_LIGHT
our_plant.AddComponent(/datum/component/overlay_lighting, glow_range(our_seed), glow_power(our_seed), glow_color)
/datum/plant_gene/trait/glow/shadow
//makes plant emit slightly purple shadows
//adds -potency*(rate*0.2) light power to products
name = "Shadow Emission"
rate = 0.04
glow_color = "#AAD84B"
/datum/plant_gene/trait/glow/shadow/glow_power(obj/item/seeds/S)
return -max(S.potency*(rate*0.2), 0.2)
/datum/plant_gene/trait/glow/white
name = "White Bioluminescence"
glow_color = "#FFFFFF"
/datum/plant_gene/trait/glow/red
//Colored versions of bioluminescence.
name = "Red Bioluminescence"
glow_color = "#FF3333"
/datum/plant_gene/trait/glow/yellow
//not the disgusting glowshroom yellow hopefully
name = "Yellow Bioluminescence"
glow_color = "#FFFF66"
/datum/plant_gene/trait/glow/green
//oh no, now I'm radioactive
name = "Green Bioluminescence"
glow_color = "#99FF99"
/datum/plant_gene/trait/glow/blue
//the best one
name = "Blue Bioluminescence"
glow_color = "#6699FF"
/datum/plant_gene/trait/glow/purple
//did you know that Notepad++ doesnt think bioluminescence is a word
name = "Purple Bioluminescence"
glow_color = "#D966FF"
/datum/plant_gene/trait/glow/pink
//gay tide station pride
name = "Pink Bioluminescence"
glow_color = "#FFB3DA"
/datum/plant_gene/trait/teleport
// Makes plant teleport people when squashed or slipped on.
// Teleport radius is calculated as max(round(potency*rate), 1)
name = "Bluespace Activity"
rate = 0.05
/datum/plant_gene/trait/teleport/on_new(obj/item/reagent_containers/food/snacks/grown/G, newloc)
..()
G.throw_range = min(G.throw_range, 3)
/datum/plant_gene/trait/teleport/on_squash(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
if(isliving(target))
var/teleport_radius = max(round(G.seed.potency * rate), 1) //max of 5
var/turf/T = get_turf(target)
new /obj/effect/decal/cleanable/molten_object(T) //Leave a pile of goo behind for dramatic effect...
do_teleport(target, T, teleport_radius, channel = TELEPORT_CHANNEL_BLUESPACE)
if(iscarbon(target))
var/mob/living/carbon/C = target
C.adjust_disgust(15) //Two teleports is safe
C.adjust_confusion(7 SECONDS)
/datum/plant_gene/trait/teleport/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/C)
var/teleport_radius = max(round(G.seed.potency * rate), 1) //max of 5
var/turf/T = get_turf(C)
to_chat(C, span_warning("You slip through spacetime!"))
do_teleport(C, T, teleport_radius, channel = TELEPORT_CHANNEL_BLUESPACE)
if(prob(50))
do_teleport(G, T, teleport_radius, channel = TELEPORT_CHANNEL_BLUESPACE)
else
new /obj/effect/decal/cleanable/molten_object(T) //Leave a pile of goo behind for dramatic effect...
qdel(G)
/datum/plant_gene/trait/maxchem
// 2x to max reagents volume.
name = "Densified Chemicals"
rate = 2
/datum/plant_gene/trait/maxchem/on_new(obj/item/reagent_containers/food/snacks/grown/G, newloc)
..()
G.reagents.maximum_volume *= rate
/datum/plant_gene/trait/repeated_harvest
name = "Perennial Growth"
/datum/plant_gene/trait/repeated_harvest/can_add(obj/item/seeds/S)
if(!..())
return FALSE
if(istype(S, /obj/item/seeds/replicapod))
return FALSE
return TRUE
/datum/plant_gene/trait/battery
name = "Capacitive Cell Production"
/datum/plant_gene/trait/battery/on_attackby(obj/item/reagent_containers/food/snacks/grown/G, obj/item/I, mob/user)
if(istype(I, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/C = I
if(C.use(5))
to_chat(user, span_notice("You add some cable to [G] and slide it inside the battery encasing."))
var/obj/item/stock_parts/cell/potato/pocell = new /obj/item/stock_parts/cell/potato(user.loc)
pocell.icon_state = G.icon_state
pocell.maxcharge = G.seed.potency * 20
// The secret of potato supercells!
var/datum/plant_gene/trait/cell_charge/CG = G.seed.get_gene(/datum/plant_gene/trait/cell_charge)
if(CG) // Cell charge max is now 40MJ or otherwise known as 400KJ (Same as bluespace powercells)
pocell.maxcharge *= CG.rate*100
pocell.chargerate = G.seed.potency * 40
pocell.charge = pocell.maxcharge
pocell.name = "[G.name] battery"
pocell.desc = "A rechargeable plant-based power cell. This one has a rating of [DisplayEnergy(pocell.maxcharge)], and you should not swallow it."
if(G.reagents.has_reagent(/datum/reagent/toxin/plasma, 2))
pocell.rigged = TRUE
qdel(G)
else
to_chat(user, span_warning("You need five lengths of cable to make a [G] battery!"))
/datum/plant_gene/trait/stinging
name = "Hypodermic Prickles"
/datum/plant_gene/trait/stinging/on_slip(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
if(isliving(target))
on_attack(G, target, null, pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
/datum/plant_gene/trait/stinging/on_attack(obj/item/reagent_containers/food/snacks/grown/G, mob/living/target, mob/living/user, def_zone)
var/obj/item/bodypart/BP = target.get_bodypart(def_zone)
if(G.reagents && G.reagents.total_volume && target.reagents && target.can_inject(user, 0, def_zone) && !(BP && BP.status == BODYPART_ROBOTIC))
if(user)
var/contained = G.reagents.log_list()
user.log_message("pricked [target == user ? "themselves" : target ] ([contained]).", INDIVIDUAL_ATTACK_LOG)
if(target != user && target.ckey && user.ckey) // injecting people with plants now creates admin logs (stolen from hypospray code)
log_attack("[user.name] ([user.ckey]) pricked [target.name] ([target.ckey]) with [G], which had [contained] (COMBAT MODE: [user.combat_mode ? "ON" : "OFF"])")
var/injecting_amount = G.seed.potency * 0.2 * clamp(1 - target.getarmor(def_zone, BIO)/100, 0, 1) // A number between 0 and 20, reduced by bio armor as a percent
if(injecting_amount < 1)
return
var/fraction = min(injecting_amount/G.reagents.total_volume, 1)
G.reagents.reaction(target, INJECT, fraction)
G.reagents.trans_to(target, injecting_amount)
to_chat(target, span_danger("You are pricked by [G]!"))
/datum/plant_gene/trait/smoke
name = "gaseous decomposition"
/datum/plant_gene/trait/smoke/on_squash(obj/item/reagent_containers/food/snacks/grown/G, atom/target)
var/datum/effect_system/fluid_spread/smoke/chem/S = new
var/splat_location = get_turf(target)
var/smoke_amount = round(sqrt(G.seed.potency * 0.1), 1)
S.attach(splat_location)
S.set_up(smoke_amount, location = splat_location, carry = G.reagents)
S.start()
G.reagents.clear_reagents()
/datum/plant_gene/trait/fire_resistance // Lavaland
name = "Fire Resistance"
extract_value = 500
/datum/plant_gene/trait/fire_resistance/apply_vars(obj/item/seeds/S)
if(!(S.resistance_flags & FIRE_PROOF))
S.resistance_flags |= FIRE_PROOF
/datum/plant_gene/trait/fire_resistance/on_new(obj/item/reagent_containers/food/snacks/grown/G, newloc)
if(!(G.resistance_flags & FIRE_PROOF))
G.resistance_flags |= FIRE_PROOF
/datum/plant_gene/trait/plant_type // Parent type
name = "you shouldn't see this"
trait_id = "plant_type"
/datum/plant_gene/trait/plant_type/weed_hardy
name = "Weed Adaptation"
/datum/plant_gene/trait/plant_type/fungal_metabolism
name = "Fungal Vitality"
/datum/plant_gene/trait/plant_type/alien_properties
name ="?????"
extract_value = 500