From 30cf844cb4007fd23eff5014af5946ec8a0ffba8 Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Thu, 10 Oct 2024 19:48:06 +0200 Subject: [PATCH] Shower related bug fixes (#20018) ![Doom_cover_art](https://github.com/user-attachments/assets/216f8485-a8dc-490b-a526-f1acbfe7d8f6) Fixed monkey cubes under showers from turning the game into Doom 3. Fixed showers not showering you because of an improper early return on wet floors. Fixed blood overlays being wrongly cleared when you shower. Sonme code improvements. --- code/game/atoms.dm | 3 + code/game/objects/effects/chem/water.dm | 37 +++++------ code/game/objects/items.dm | 2 +- code/game/objects/structures/watercloset.dm | 6 ++ code/game/turfs/simulated.dm | 18 +++--- code/modules/mob/inventory.dm | 4 +- code/modules/reagents/Chemistry-Holder.dm | 25 +++++--- .../food/snacks/processed.dm | 2 +- html/changelogs/fluffyghost-fixdoom.yml | 61 +++++++++++++++++++ 9 files changed, 121 insertions(+), 37 deletions(-) create mode 100644 html/changelogs/fluffyghost-fixdoom.yml diff --git a/code/game/atoms.dm b/code/game/atoms.dm index fdea78fcd83..1709f6b2ff0 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -453,6 +453,9 @@ vomit.reagents.add_reagent(/singleton/reagent/acid/stomach, 5) /atom/proc/clean_blood() + SHOULD_CALL_PARENT(TRUE) + SHOULD_NOT_SLEEP(TRUE) + if(!simulated) return fluorescent = 0 diff --git a/code/game/objects/effects/chem/water.dm b/code/game/objects/effects/chem/water.dm index db8f7a72204..98473a47998 100644 --- a/code/game/objects/effects/chem/water.dm +++ b/code/game/objects/effects/chem/water.dm @@ -22,7 +22,7 @@ var/turf/T = get_turf(src) if(T && reagents) - if (wet_things(T)) + if(!wet_things(T)) break if(T == get_turf(target)) @@ -37,31 +37,34 @@ //Wets everything in the tile //A return value of 1 means that the wetting should stop. Either the water ran out or some error ocurred +/** + * Wets everything in the tile + * + * Returns `FALSE` if the water ran out or some error ocurred, or we should stop in general + */ /obj/effect/effect/water/proc/wet_things(var/turf/T) + SHOULD_NOT_SLEEP(TRUE) if (!reagents || reagents.total_volume <= 0) - return 1 + return FALSE reagents.touch_turf(T) var/list/mobshere = list() - for (var/mob/living/L in T) - mobshere.Add(L) - - - for (var/atom/B in T) - if (!ismob(B)) - reagents.touch(B) - - if (mobshere.len) - var/portion = 1 / mobshere.len + for(var/atom/atom_in_turf as anything in T) + if(isliving(atom_in_turf)) + mobshere.Add(atom_in_turf) + else if(!ismob(atom_in_turf)) + reagents.touch(atom_in_turf) + + if(length(mobshere)) + var/portion = 1 / length(mobshere) var/total = reagents.total_volume - for (var/mob/living/L in mobshere) - reagents.splash(L, total * portion) - return 1 - - return 0 + for(var/mob/living/mobsphere_living_mob as anything in mobshere) + reagents.splash(mobsphere_living_mob, total * portion) + return FALSE + return TRUE /obj/effect/effect/water/Move(turf/newloc) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 512a24848d6..0ddfedb2214 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -853,7 +853,7 @@ var/list/global/slot_flags_enumeration = list( /obj/item/clean_blood() . = ..() if(blood_overlay) - CutOverlays(blood_overlay, TRUE) + CutOverlays(blood_overlay, ATOM_ICON_CACHE_ALL) if(istype(src, /obj/item/clothing/gloves)) var/obj/item/clothing/gloves/G = src G.transfer_blood = 0 diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index 9e2289a845c..129ac00bc3c 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -224,6 +224,9 @@ /obj/machinery/shower/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs) SIGNAL_HANDLER + if(QDELETED(arrived)) + return + INVOKE_ASYNC(src, PROC_REF(wash), arrived) if(ismob(arrived)) mobpresent += 1 @@ -232,6 +235,9 @@ /obj/machinery/shower/proc/on_exit(atom/movable/gone, direction) SIGNAL_HANDLER + if(QDELETED(gone)) + return + if(ismob(gone)) mobpresent -= 1 diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 5d76097db7d..c35aa91f7d4 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -34,18 +34,17 @@ dirtoverlay = new/obj/effect/decal/cleanable/dirt(src) dirtoverlay.alpha = min((dirt - 50) * 5, 255) -/turf/simulated/Entered(atom/A, atom/OL) +/turf/simulated/Entered(atom/movable/arrived, atom/old_loc) if(movement_disabled && usr.ckey != movement_disabled_exception) to_chat(usr, SPAN_WARNING("Movement is admin-disabled.")) //This is to identify lag problems) return - if(istype(A,/mob/living)) - var/mob/living/M = A - if(src.wet_type && src.wet_amount) - if(M.buckled_to || (src.wet_type == 1 && M.m_intent == M_WALK)) - return + if(istype(arrived, /mob/living)) + var/mob/living/M = arrived + //if the turf is wet, the mob is not buckled, and either it's not wet with water or the mob is running, slip it + if(src.wet_type && src.wet_amount && !M.buckled_to && (src.wet_type != WET_TYPE_WATER || M.m_intent != M_WALK)) - //Water + //Defaults to a water slip var/slip_dist = 1 var/slip_stun = 6 var/floor_type = "wet" @@ -67,14 +66,15 @@ // Ugly hack :c Should never have multiple plants in the same tile. var/obj/effect/plant/plant = locate() in contents - if(plant) plant.trodden_on(M) + if(plant) + plant.trodden_on(M) // Dirt overlays. update_dirt() M.inertia_dir = 0 - ..(A, OL) + ..() /** * Slips a mob, moving it for N tiles diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 2e337b7a13d..3368f25e9c7 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -354,8 +354,10 @@ var/list/slot_equipment_priority = list( \ return 1 -//Attemps to remove an object on a mob. +///Attemps to remove an object on a mob /mob/proc/remove_from_mob(var/obj/O) + SHOULD_NOT_SLEEP(TRUE) + src.u_equip(O) if (src.client) src.client.screen -= O diff --git a/code/modules/reagents/Chemistry-Holder.dm b/code/modules/reagents/Chemistry-Holder.dm index 4490a462628..cf45ac8eb75 100644 --- a/code/modules/reagents/Chemistry-Holder.dm +++ b/code/modules/reagents/Chemistry-Holder.dm @@ -333,18 +333,27 @@ for(var/rtype in rtypes) . += src.trans_type_to(target, rtype, amounteach) -// When applying reagents to an atom externally, touch() is called to trigger any on-touch effects of the reagent. -// This does not handle transferring reagents to things. -// For example, splashing someone with water will get them wet and extinguish them if they are on fire, -// even if they are wearing an impermeable suit that prevents the reagents from contacting the skin. -/datum/reagents/proc/touch(var/atom/target) +/** + * When applying reagents to an atom externally, touch() is called to trigger any on-touch effects of the reagent + * + * This does not handle transferring reagents to things + * + * For example, splashing someone with water will get them wet and extinguish them if they are on fire, + * even if they are wearing an impermeable suit that prevents the reagents from contacting the skin + */ +/datum/reagents/proc/touch(atom/target) + SHOULD_NOT_SLEEP(TRUE) + + //No point if it's getting deleted + if(QDELETED(target)) + return + if(ismob(target)) touch_mob(target) - if(isturf(target)) + else if(isturf(target)) touch_turf(target) - if(isobj(target)) + else if(isobj(target)) touch_obj(target) - return /datum/reagents/proc/touch_mob(var/mob/living/target) if(!target || !istype(target) || !target.simulated) diff --git a/code/modules/reagents/reagent_containers/food/snacks/processed.dm b/code/modules/reagents/reagent_containers/food/snacks/processed.dm index 66d08a7bbbd..db44d1cce0c 100644 --- a/code/modules/reagents/reagent_containers/food/snacks/processed.dm +++ b/code/modules/reagents/reagent_containers/food/snacks/processed.dm @@ -44,7 +44,7 @@ if(istype(loc, /obj/item/gripper)) // fixes ghost cube when using syringe var/obj/item/gripper/G = loc G.drop_item() - var/mob/living/carbon/human/H = new(src.loc) + var/mob/living/carbon/human/H = new(get_turf(src)) H.set_species(monkey_type) H.real_name = H.species.get_random_name() H.name = H.real_name diff --git a/html/changelogs/fluffyghost-fixdoom.yml b/html/changelogs/fluffyghost-fixdoom.yml new file mode 100644 index 00000000000..b83fb939c28 --- /dev/null +++ b/html/changelogs/fluffyghost-fixdoom.yml @@ -0,0 +1,61 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed monkey cubes under showers from turning the game into Doom." + - bugfix: "Fixed showers not showering you because of an improper early return on wet floors." + - bugfix: "Fixed blood overlays being wrongly cleared when you shower." + - code_imp: "Sonme code improvements."