From b5613d239d05d11b59deaab461426ce281144821 Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Mon, 21 Aug 2023 12:02:27 -0700
Subject: [PATCH] Adds a new Fungal Growth event, makes fungus re-harvestable
(#21928)
* the fungus is amongus
* us -> al
* Update code/game/objects/effects/decals/Cleanable/misc_cleanables.dm
Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com>
* Update code/game/objects/effects/decals/Cleanable/misc_cleanables.dm
Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com>
* Update code/game/objects/effects/decals/Cleanable/misc_cleanables.dm
fineeee
Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com>
---------
Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com>
---
.../decals/Cleanable/misc_cleanables.dm | 24 +++++++++++++++++++
code/game/objects/effects/effects.dm | 4 ++++
code/modules/events/event_container.dm | 3 +++
code/modules/events/wallrot.dm | 21 +++++++++++++---
4 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/code/game/objects/effects/decals/Cleanable/misc_cleanables.dm b/code/game/objects/effects/decals/Cleanable/misc_cleanables.dm
index 625c70555bf1..0076975c7f02 100644
--- a/code/game/objects/effects/decals/Cleanable/misc_cleanables.dm
+++ b/code/game/objects/effects/decals/Cleanable/misc_cleanables.dm
@@ -277,6 +277,30 @@
icon_state = "flour"
color = "#D5820B"
scoop_reagents = list("fungus" = 10)
+ no_clear = TRUE
+ var/timer_id
+
+/obj/effect/decal/cleanable/fungus/examine(mob/user)
+ . = ..()
+ if(no_scoop)
+ . += "There's not a lot here, you probably wouldn't be able to harvest anything useful."
+ else
+ . += "There's enough here to scrape into a beaker."
+
+/obj/effect/decal/cleanable/fungus/on_scoop()
+ alpha = 128
+ no_scoop = TRUE
+
+ timer_id = addtimer(CALLBACK(src, PROC_REF(recreate)), rand(5 MINUTES, 10 MINUTES), TIMER_STOPPABLE)
+
+/obj/effect/decal/cleanable/fungus/Destroy()
+ . = ..()
+ deltimer(timer_id)
+
+/obj/effect/decal/cleanable/fungus/proc/recreate()
+ alpha = 255
+ reagents.add_reagent_list(scoop_reagents)
+ no_scoop = FALSE
/obj/effect/decal/cleanable/confetti //PARTY TIME!
name = "confetti"
diff --git a/code/game/objects/effects/effects.dm b/code/game/objects/effects/effects.dm
index 57684e61b9a9..2ca15c2fe7a6 100644
--- a/code/game/objects/effects/effects.dm
+++ b/code/game/objects/effects/effects.dm
@@ -125,6 +125,7 @@
to_chat(user, "[I] is full!")
return
to_chat(user, "You scoop [src] into [I]!")
+ on_scoop()
reagents.trans_to(I, reagents.total_volume)
if(!reagents.total_volume && !no_clear) //scooped up all of it
qdel(src)
@@ -144,3 +145,6 @@
/obj/effect/decal/blob_act(obj/structure/blob/B)
if(B && B.loc == loc)
qdel(src)
+
+/obj/effect/decal/proc/on_scoop()
+ return
diff --git a/code/modules/events/event_container.dm b/code/modules/events/event_container.dm
index 7143d0e4b4c8..15e67ff9da92 100644
--- a/code/modules/events/event_container.dm
+++ b/code/modules/events/event_container.dm
@@ -7,6 +7,7 @@
#define ASSIGNMENT_MEDICAL "Medical"
#define ASSIGNMENT_SCIENTIST "Scientist"
#define ASSIGNMENT_SECURITY "Security"
+#define ASSIGNMENT_CHEMIST "Chemist"
GLOBAL_LIST_INIT(severity_to_string, list(EVENT_LEVEL_MUNDANE = "Mundane", EVENT_LEVEL_MODERATE = "Moderate", EVENT_LEVEL_MAJOR = "Major"))
GLOBAL_LIST_EMPTY(event_last_fired)
@@ -141,6 +142,7 @@ GLOBAL_LIST_EMPTY(event_last_fired)
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Vermin Infestation",/datum/event/infestation, 100, list(ASSIGNMENT_JANITOR = 100)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Sentience", /datum/event/sentience, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Wallrot", /datum/event/wallrot, 0, list(ASSIGNMENT_ENGINEER = 30, ASSIGNMENT_GARDENER = 50)),
+ new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Fungal Growth", /datum/event/wallrot/fungus, 50, list(ASSIGNMENT_CHEMIST = 50)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Koi School", /datum/event/carp_migration/koi, 80),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Camera Failure", /datum/event/camera_failure, 100, list(ASSIGNMENT_ENGINEER = 10)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Fake Virus", /datum/event/fake_virus, 50),
@@ -218,3 +220,4 @@ GLOBAL_LIST_EMPTY(event_last_fired)
#undef ASSIGNMENT_MEDICAL
#undef ASSIGNMENT_SCIENTIST
#undef ASSIGNMENT_SECURITY
+#undef ASSIGNMENT_CHEMIST
diff --git a/code/modules/events/wallrot.dm b/code/modules/events/wallrot.dm
index f7f5b4e435b1..19ceae7a4c83 100644
--- a/code/modules/events/wallrot.dm
+++ b/code/modules/events/wallrot.dm
@@ -1,29 +1,44 @@
/datum/event/wallrot/start()
INVOKE_ASYNC(src, PROC_REF(spawn_wallrot))
+/datum/event/wallrot/proc/apply_to_turf(turf/T)
+ var/turf/simulated/wall/W = T
+ W.rot()
+
+/datum/event/wallrot/proc/is_valid_candidate(turf/T)
+ return TRUE
+
/datum/event/wallrot/proc/spawn_wallrot()
var/turf/simulated/wall/center = null
// 100 attempts
for(var/i in 0 to 100)
var/turf/candidate = locate(rand(1, world.maxx), rand(1, world.maxy), level_name_to_num(MAIN_STATION))
- if(iswallturf(candidate))
+ if(iswallturf(candidate) && is_valid_candidate(candidate))
center = candidate
break
if(!center)
return
// Make sure at least one piece of wall rots!
- center.rot()
+ apply_to_turf(center)
// Have a chance to rot lots of other walls.
var/rotcount = 0
var/actual_severity = severity * rand(5, 10)
for(var/turf/simulated/wall/W in range(5, center))
if(prob(50))
- W.rot()
+ apply_to_turf(W)
rotcount++
// Only rot up to severity walls
if(rotcount >= actual_severity)
break
+
+/datum/event/wallrot/fungus
+
+/datum/event/wallrot/fungus/is_valid_candidate(turf/T)
+ return istype(get_area(T), /area/maintenance)
+
+/datum/event/wallrot/fungus/apply_to_turf(turf/T)
+ new /obj/effect/decal/cleanable/fungus(T)