Skip to content

Commit

Permalink
Shower related bug fixes (#20018)
Browse files Browse the repository at this point in the history
![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.
  • Loading branch information
FluffyGhoster authored Oct 10, 2024
1 parent af863b9 commit 30cf844
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 37 deletions.
3 changes: 3 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 20 additions & 17 deletions code/game/objects/effects/chem/water.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/structures/watercloset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
18 changes: 9 additions & 9 deletions code/game/turfs/simulated.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion code/modules/mob/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 17 additions & 8 deletions code/modules/reagents/Chemistry-Holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 61 additions & 0 deletions html/changelogs/fluffyghost-fixdoom.yml
Original file line number Diff line number Diff line change
@@ -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."

0 comments on commit 30cf844

Please sign in to comment.