From fb6b5905b3e31ba9768d70ac06f4c1a7ed1769a1 Mon Sep 17 00:00:00 2001
From: jimmyl <70376633+mc-oofert@users.noreply.github.com>
Date: Mon, 7 Nov 2022 18:34:48 +0100
Subject: [PATCH] Fixes plenty instances of 1-tile foam (#71132)
## About The Pull Request
All of these from what i heard were supposed to make all foam with range
"4" but most of these ranges were stupidly big so
Fixes 1 tile foam that was apparently not fixed after the foam refactor
in:
AI Upload Foam Dispensers, with a range of "4"
Hygienebot death, with a range of "2"
Clown cars taking damage, with a range of "4" and 25u of space lube.
(henk)
Clown plasmaman envirosuits extinguishment, with a range of "4" and 15u
of space lube. (hunke)
Soap suicide, with a range of "1"
Emagged cleanbots wetting the floor and making foam, with a range of "2"
Firebots when exposed to an atmos fire, firefighting foam with a range
of "3"

## Why It's Good For The Game
Fixes #68441
Makes firebots less ass
Also barely-functional code bad, functional code good
## Changelog
:cl:
fix: Fixes 1 tile foam in Foam Dispensers,Clown Cars, Hygiene
Bots,Firebots, Soap Suicide, Emagged cleanbots, and the clown plasmaman
envirosuit
/:cl:
---
code/game/machinery/ai_slipper.dm | 16 +++++++++-------
.../effect_system/fluid_spread/effects_foam.dm | 3 +++
code/game/objects/items/clown_items.dm | 4 +++-
.../under/jobs/Plasmaman/civilian_service.dm | 6 +++++-
.../mob/living/simple_animal/bot/cleanbot.dm | 4 +++-
.../mob/living/simple_animal/bot/firebot.dm | 4 +++-
.../mob/living/simple_animal/bot/hygienebot.dm | 4 +++-
code/modules/vehicles/cars/clowncar.dm | 6 +++++-
8 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/code/game/machinery/ai_slipper.dm b/code/game/machinery/ai_slipper.dm
index 1427f16e77b..b0f2e8ab857 100644
--- a/code/game/machinery/ai_slipper.dm
+++ b/code/game/machinery/ai_slipper.dm
@@ -10,8 +10,8 @@
armor = list(MELEE = 50, BULLET = 20, LASER = 20, ENERGY = 20, BOMB = 0, BIO = 0, FIRE = 50, ACID = 30)
var/uses = 20
- var/cooldown = 0
- var/cooldown_time = 100
+ COOLDOWN_DECLARE(foam_cooldown)
+ var/cooldown_time = 10 SECONDS // just about enough cooldown time so you cant waste foam
req_access = list(ACCESS_AI_UPLOAD)
/obj/machinery/ai_slipper/examine(mob/user)
@@ -21,7 +21,7 @@
/obj/machinery/ai_slipper/update_icon_state()
if(machine_stat & BROKEN)
return ..()
- if((machine_stat & NOPOWER) || cooldown_time > world.time || !uses)
+ if((machine_stat & NOPOWER) || !COOLDOWN_FINISHED(src, foam_cooldown) || !uses)
icon_state = "[base_icon_state]0"
return ..()
icon_state = "[base_icon_state]1"
@@ -34,12 +34,14 @@
if(!uses)
to_chat(user, span_warning("[src] is out of foam and cannot be activated!"))
return
- if(cooldown_time > world.time)
- to_chat(user, span_warning("[src] cannot be activated for [DisplayTimeText(world.time - cooldown_time)]!"))
+ if(!COOLDOWN_FINISHED(src, foam_cooldown))
+ to_chat(user, span_warning("[src] cannot be activated for [DisplayTimeText(COOLDOWN_TIMELEFT(src, foam_cooldown))]!"))
return
- new /obj/effect/particle_effect/fluid/foam(loc)
+ var/datum/effect_system/fluid_spread/foam/foam = new
+ foam.set_up(4, holder = src, location = loc)
+ foam.start()
uses--
to_chat(user, span_notice("You activate [src]. It now has [uses] uses of foam remaining."))
- cooldown = world.time + cooldown_time
+ COOLDOWN_START(src, foam_cooldown,cooldown_time)
power_change()
addtimer(CALLBACK(src, .proc/power_change), cooldown_time)
diff --git a/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm b/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm
index 6d0f7b7c95a..fbb757adbd7 100644
--- a/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm
@@ -253,6 +253,9 @@
return
foaming.adjust_wet_stacks(2)
+/// A factory which produces firefighting foam
+/datum/effect_system/fluid_spread/foam/firefighting
+ effect_type = /obj/effect/particle_effect/fluid/foam/firefighting
// Metal foam
diff --git a/code/game/objects/items/clown_items.dm b/code/game/objects/items/clown_items.dm
index 3b174b0c167..fddb761b7c5 100644
--- a/code/game/objects/items/clown_items.dm
+++ b/code/game/objects/items/clown_items.dm
@@ -113,7 +113,9 @@
/obj/item/soap/suicide_act(mob/user)
user.say(";FFFFFFFFFFFFFFFFUUUUUUUDGE!!", forced="soap suicide")
user.visible_message(span_suicide("[user] lifts [src] to [user.p_their()] mouth and gnaws on it furiously, producing a thick froth! [user.p_they(TRUE)]'ll never get that BB gun now!"))
- new /obj/effect/particle_effect/fluid/foam(loc)
+ var/datum/effect_system/fluid_spread/foam/foam = new
+ foam.set_up(1, holder = src, location = user.loc)
+ foam.start()
return (TOXLOSS)
/obj/item/soap/proc/should_clean(datum/cleaning_source, atom/atom_to_clean, mob/living/cleaner)
diff --git a/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm b/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm
index b5583748984..9417fb8dea4 100644
--- a/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm
+++ b/code/modules/clothing/under/jobs/Plasmaman/civilian_service.dm
@@ -131,4 +131,8 @@
extinguishes_left--
H.visible_message(span_warning("[H]'s suit spews space lube everywhere!"),span_warning("Your suit spews space lube everywhere!"))
H.extinguish_mob()
- new /obj/effect/particle_effect/fluid/foam(loc) //Truely terrifying.
+ var/datum/effect_system/fluid_spread/foam/foam = new
+ var/datum/reagents/foamreagent = new /datum/reagents(15)
+ foamreagent.add_reagent(/datum/reagent/lube, 15)
+ foam.set_up(4, holder = src, location = loc, carry = foamreagent)
+ foam.start() //Truly terrifying.
diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm
index c32189eb817..63a8cb6fa8b 100644
--- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm
@@ -408,7 +408,9 @@
current_floor.MakeSlippery(TURF_WET_WATER, min_wet_time = 20 SECONDS, wet_time_to_add = 15 SECONDS)
else
visible_message(span_danger("[src] whirs and bubbles violently, before releasing a plume of froth!"))
- new /obj/effect/particle_effect/fluid/foam(loc)
+ var/datum/effect_system/fluid_spread/foam/foam = new
+ foam.set_up(2, holder = src, location = loc)
+ foam.start()
/mob/living/simple_animal/bot/cleanbot/explode()
var/atom/drop_loc = drop_location()
diff --git a/code/modules/mob/living/simple_animal/bot/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm
index f572d0c828b..3d4fe509ff5 100644
--- a/code/modules/mob/living/simple_animal/bot/firebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/firebot.dm
@@ -265,7 +265,9 @@
/mob/living/simple_animal/bot/firebot/atmos_expose(datum/gas_mixture/air, exposed_temperature)
if(COOLDOWN_FINISHED(src, foam_cooldown))
- new /obj/effect/particle_effect/fluid/foam/firefighting(loc)
+ var/datum/effect_system/fluid_spread/foam/firefighting/foam = new
+ foam.set_up(3, holder = src, location = loc)
+ foam.start()
COOLDOWN_START(src, foam_cooldown, FOAM_INTERVAL)
/mob/living/simple_animal/bot/firebot/proc/spray_water(atom/target, mob/user)
diff --git a/code/modules/mob/living/simple_animal/bot/hygienebot.dm b/code/modules/mob/living/simple_animal/bot/hygienebot.dm
index df2e0802375..c3ebd96c711 100644
--- a/code/modules/mob/living/simple_animal/bot/hygienebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/hygienebot.dm
@@ -53,7 +53,9 @@
ADD_TRAIT(src, TRAIT_SPRAY_PAINTABLE, INNATE_TRAIT)
/mob/living/simple_animal/bot/hygienebot/explode()
- new /obj/effect/particle_effect/fluid/foam(loc)
+ var/datum/effect_system/fluid_spread/foam/foam = new
+ foam.set_up(2, holder = src, location = loc)
+ foam.start()
return ..()
diff --git a/code/modules/vehicles/cars/clowncar.dm b/code/modules/vehicles/cars/clowncar.dm
index a7ead4b6509..54282748c26 100644
--- a/code/modules/vehicles/cars/clowncar.dm
+++ b/code/modules/vehicles/cars/clowncar.dm
@@ -83,7 +83,11 @@
. = ..()
if(prob(33))
visible_message(span_danger("[src] spews out a ton of space lube!"))
- new /obj/effect/particle_effect/fluid/foam(loc) //YEET
+ var/datum/effect_system/fluid_spread/foam/foam = new
+ var/datum/reagents/foamreagent = new /datum/reagents(25)
+ foamreagent.add_reagent(/datum/reagent/lube, 25)
+ foam.set_up(4, holder = src, location = loc, carry = foamreagent)
+ foam.start()
/obj/vehicle/sealed/car/clowncar/attacked_by(obj/item/I, mob/living/user)
. = ..()