-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathtowercap.dm
381 lines (338 loc) · 11.7 KB
/
towercap.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
/obj/item/seeds/tower
name = "pack of tower-cap mycelium"
desc = "This mycelium grows into tower-cap mushrooms."
icon_state = "mycelium-tower"
species = "towercap"
plantname = "Tower Caps"
product = /obj/item/grown/log
lifespan = 80
endurance = 50
maturation = 15
production = 1
yield = 5
potency = 50
growthstages = 3
growing_icon = 'icons/obj/hydroponics/growing_mushrooms.dmi'
icon_dead = "towercap-dead"
genes = list(/datum/plant_gene/trait/plant_type/fungal_metabolism)
mutatelist = list(/obj/item/seeds/tower/steel)
reagents_add = list(/datum/reagent/carbon = 0.5)
/obj/item/seeds/tower/steel
name = "pack of steel-cap mycelium"
desc = "This mycelium grows into steel logs."
icon_state = "mycelium-steelcap"
species = "steelcap"
plantname = "Steel Caps"
product = /obj/item/grown/log/steel
mutatelist = list()
reagents_add = list(/datum/reagent/iron = 0.5)
rarity = 20
/obj/item/grown/log
seed = /obj/item/seeds/tower
name = "tower-cap log"
desc = "It's better than bad, it's good!"
icon_state = "logs"
force = 5
throwforce = 5
w_class = WEIGHT_CLASS_NORMAL
throw_speed = 2
throw_range = 3
attack_verb = list("bashed", "battered", "bludgeoned", "whacked")
var/plank_type = /obj/item/stack/sheet/mineral/wood
var/plank_name = "wooden planks"
var/static/list/accepted = typecacheof(list(/obj/item/reagent_containers/food/snacks/grown/tobacco,
/obj/item/reagent_containers/food/snacks/grown/tea,
/obj/item/reagent_containers/food/snacks/grown/ambrosia/vulgaris,
/obj/item/reagent_containers/food/snacks/grown/ambrosia/deus,
/obj/item/reagent_containers/food/snacks/grown/wheat))
/obj/item/grown/log/attackby(obj/item/W, mob/user, params)
if(W.is_sharp())
user.show_message(span_notice("You make [plank_name] out of \the [src]!"), MSG_VISUAL)
var/seed_modifier = 0
if(seed)
seed_modifier = round(seed.potency / 25)
var/obj/item/stack/plank = new plank_type(user.loc, 1 + seed_modifier)
var/old_plank_amount = plank.amount
for(var/obj/item/stack/ST in user.loc)
if(ST != plank && istype(ST, plank_type) && ST.amount < ST.max_amount)
ST.attackby(plank, user) //we try to transfer all old unfinished stacks to the new stack we created.
if(plank.amount > old_plank_amount)
to_chat(user, span_notice("You add the newly-formed [plank_name] to the stack. It now contains [plank.amount] [plank_name]."))
qdel(src)
if(CheckAccepted(W))
var/obj/item/reagent_containers/food/snacks/grown/leaf = W
if(leaf.dry)
user.show_message(span_notice("You wrap \the [W] around the log, turning it into a torch!"))
var/obj/item/flashlight/flare/torch/T = new /obj/item/flashlight/flare/torch(user.loc)
usr.dropItemToGround(W)
usr.put_in_active_hand(T)
qdel(leaf)
qdel(src)
return
else
to_chat(usr, "<span class ='warning'>You must dry this first!</span>")
else
return ..()
/obj/item/grown/log/proc/CheckAccepted(obj/item/I)
return is_type_in_typecache(I, accepted)
/obj/item/grown/log/tree
seed = null
name = "wood log"
desc = "TIMMMMM-BERRRRRRRRRRR!"
/obj/item/grown/log/steel
seed = /obj/item/seeds/tower/steel
name = "steel-cap log"
desc = "It's made of metal."
icon_state = "steellogs"
plank_type = /obj/item/stack/rods
plank_name = "rods"
/obj/item/grown/log/steel/CheckAccepted(obj/item/I)
return FALSE
/obj/item/seeds/bamboo
name = "pack of bamboo seeds"
desc = "Plant known for their flexible and resistant logs."
icon_state = "seed-bamboo"
species = "bamboo"
plantname = "Bamboo"
product = /obj/item/grown/log/bamboo
lifespan = 80
endurance = 70
maturation = 15
production = 2
yield = 5
potency = 50
growthstages = 2
growing_icon = 'icons/obj/hydroponics/growing.dmi'
icon_dead = "bamboo-dead"
genes = list(/datum/plant_gene/trait/repeated_harvest)
/obj/item/grown/log/bamboo
seed = /obj/item/seeds/bamboo
name = "bamboo log"
desc = "A long and resistant bamboo log."
icon_state = "bamboo"
plank_type = /obj/item/stack/sheet/mineral/bamboo
plank_name = "bamboo sticks"
/obj/item/grown/log/bamboo/CheckAccepted(obj/item/I)
return FALSE
/obj/structure/punji_sticks
name = "punji sticks"
desc = "Don't step on this."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "punji"
resistance_flags = FLAMMABLE
max_integrity = 30
density = FALSE
anchored = TRUE
buckle_lying = 90
/// Overlay we apply when impaling a mob.
var/mutable_appearance/stab_overlay
/obj/structure/punji_sticks/Initialize(mapload)
. = ..()
AddComponent(/datum/component/caltrop, min_damage = 20, max_damage = 30, flags = CALTROP_BYPASS_SHOES)
build_stab_overlay()
/obj/structure/punji_sticks/proc/build_stab_overlay()
stab_overlay = mutable_appearance(icon, "[icon_state]_stab", layer = ABOVE_MOB_LAYER)
/obj/structure/punji_sticks/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents)
. = ..()
if(same_z_layer)
return
build_stab_overlay()
update_appearance()
/obj/structure/punji_sticks/post_buckle_mob(mob/living/M)
update_appearance()
return ..()
/obj/structure/punji_sticks/post_unbuckle_mob(mob/living/M)
update_appearance()
return ..()
/obj/structure/punji_sticks/update_overlays()
. = ..()
if(length(buckled_mobs))
. += stab_overlay
/obj/structure/punji_sticks/intercept_zImpact(list/falling_movables, levels)
. = ..()
for(var/mob/living/fallen_mob in falling_movables)
if(LAZYLEN(buckled_mobs))
return
if(buckle_mob(fallen_mob, TRUE))
to_chat(fallen_mob, span_userdanger("You are impaled by [src]!"))
fallen_mob.apply_damage(25 * levels, BRUTE, sharpness = SHARP_POINTY)
if(iscarbon(fallen_mob))
var/mob/living/carbon/fallen_carbon = fallen_mob
fallen_carbon.emote("scream")
fallen_carbon.bleed(30)
. |= FALL_INTERCEPTED | FALL_NO_MESSAGE
/obj/structure/punji_sticks/unbuckle_mob(mob/living/buckled_mob, force, can_fall)
if(force)
return ..()
to_chat(buckled_mob, span_warning("You begin climbing out of [src]."))
buckled_mob.apply_damage(5, BRUTE, sharpness = SHARP_POINTY)
if(!do_after(buckled_mob, 5 SECONDS, target = src))
to_chat(buckled_mob, span_userdanger("You fail to detach yourself from [src]."))
return
return ..()
/////////BONFIRES//////////
/obj/structure/bonfire
name = "bonfire"
desc = "For grilling, broiling, charring, smoking, heating, roasting, toasting, simmering, searing, melting, and occasionally burning things."
icon = 'icons/obj/hydroponics/equipment.dmi'
icon_state = "bonfire"
light_color = LIGHT_COLOR_FIRE
density = FALSE
anchored = TRUE
buckle_lying = 0
var/burning = 0
var/burn_icon = "bonfire_on_fire" //for a softer more burning embers icon, use "bonfire_warm"
var/grill = FALSE
var/fire_stack_strength = 5
/obj/structure/bonfire/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_LIGHT_EATER_ACT, PROC_REF(on_light_eater))
//fire isn't one light source, it's several constantly appearing and disappearing... or something
/obj/structure/bonfire/proc/on_light_eater(atom/source, datum/light_eater)
SIGNAL_HANDLER
if(burning)
visible_message("The roaring fire of \the [src] refuses to fade.")
return COMPONENT_BLOCK_LIGHT_EATER
/obj/structure/bonfire/dense
density = TRUE
/obj/structure/bonfire/prelit/Initialize(mapload)
. = ..()
StartBurning()
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
)
AddElement(/datum/element/connect_loc, loc_connections)
/obj/structure/bonfire/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
if(istype(mover) && (mover.pass_flags & PASSTABLE))
return TRUE
if(mover.throwing)
return TRUE
/obj/structure/bonfire/attackby(obj/item/W, mob/living/user, params)
if(istype(W, /obj/item/stack/rods) && !can_buckle && !grill)
var/obj/item/stack/rods/R = W
var/choice = input(user, "What would you like to construct?", "Bonfire") as null|anything in list("Stake","Grill")
switch(choice)
if("Stake")
R.use(1)
can_buckle = TRUE
buckle_requires_restraints = TRUE
to_chat(user, span_italics("You add a rod to \the [src]."))
var/mutable_appearance/rod_underlay = mutable_appearance('icons/obj/hydroponics/equipment.dmi', "bonfire_rod")
rod_underlay.pixel_y = 16
underlays += rod_underlay
if("Grill")
R.use(1)
grill = TRUE
to_chat(user, span_italics("You add a grill to \the [src]."))
add_overlay("bonfire_grill")
else
return ..()
if(W.is_hot())
StartBurning()
if(grill)
if(!user.combat_mode && !(W.item_flags & ABSTRACT))
if(user.temporarilyRemoveItemFromInventory(W))
W.forceMove(get_turf(src))
var/list/click_params = params2list(params)
//Center the icon where the user clicked.
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
return
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
W.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
W.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
else
return ..()
/obj/structure/bonfire/attack_hand(mob/user)
. = ..()
if(.)
return
if(burning)
to_chat(user, span_warning("You need to extinguish [src] before removing the logs!"))
return
if(!has_buckled_mobs() && do_after(user, 5 SECONDS, src))
for(var/I in 1 to 5)
var/obj/item/grown/log/L = new /obj/item/grown/log(loc)
L.pixel_x += rand(1,4)
L.pixel_y += rand(1,4)
if(can_buckle || grill)
new /obj/item/stack/rods(loc, 1)
qdel(src)
return
/obj/structure/bonfire/proc/CheckOxygen()
if(isopenturf(loc))
var/turf/open/O = loc
if(O.air)
if(O.air.get_moles(GAS_O2) > 13)
return TRUE
return FALSE
/obj/structure/bonfire/proc/StartBurning()
if(!burning && CheckOxygen())
add_emitter(/obj/emitter/fire, "fire")
add_emitter(/obj/emitter/sparks/fire, "fire_spark")
add_emitter(/obj/emitter/fire_smoke, "smoke", 9)
icon_state = burn_icon
burning = TRUE
set_light(6)
Burn()
START_PROCESSING(SSobj, src)
/obj/structure/bonfire/fire_act(exposed_temperature, exposed_volume)
StartBurning()
/obj/structure/bonfire/proc/on_entered(datum/source, atom/movable/AM, ...)
if(burning & !grill)
Burn()
/obj/structure/bonfire/proc/Burn(delta_time = 2)
var/turf/current_location = get_turf(src)
current_location.hotspot_expose(1000,250 * delta_time,1)
for(var/A in current_location)
if(A == src)
continue
if(isobj(A))
var/obj/O = A
O.fire_act(1000, 250 * delta_time)
else if(isliving(A))
var/mob/living/L = A
L.adjust_fire_stacks(fire_stack_strength * 0.5 * delta_time)
L.ignite_mob()
/obj/structure/bonfire/proc/Cook(delta_time = 2)
var/turf/current_location = get_turf(src)
for(var/A in current_location)
var/obj/G = A
if(A == src)
continue
else if(isliving(A)) //It's still a fire, idiot.
var/mob/living/L = A
L.adjust_fire_stacks(fire_stack_strength * 0.5 * delta_time)
L.ignite_mob()
else if(G.GetComponent(/datum/component/grillable))
if(SEND_SIGNAL(G, COMSIG_ITEM_GRILLED, src) & COMPONENT_HANDLED_GRILLING)
continue
G.fire_act(1000) //Hot hot hot!
if(DT_PROB(5, delta_time))
visible_message("<span class='danger'>[G] doesn't seem to be doing too great on [src]!</span>")
else if(istype(A, /obj/item) && DT_PROB(10, delta_time))
var/obj/item/O = A
O.microwave_act()
/obj/structure/bonfire/process(delta_time)
if(!CheckOxygen())
extinguish()
return
if(!grill)
Burn(delta_time)
else
Cook(delta_time)
/obj/structure/bonfire/extinguish()
if(burning)
remove_emitter("fire")
remove_emitter("fire_spark")
remove_emitter("smoke")
icon_state = "bonfire"
burning = 0
set_light(0)
STOP_PROCESSING(SSobj, src)
/obj/structure/bonfire/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE)
if(..())
M.pixel_y += 13
/obj/structure/bonfire/unbuckle_mob(mob/living/buckled_mob, force=FALSE, can_fall = TRUE)
if(..())
buckled_mob.pixel_y -= 13