Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Adds support to the wet_floor component to avoid displaying its overlay, makes ice turfs no longer receive said wet overlay #330

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions code/datums/components/wet_floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
var/current_overlay
var/permanent = FALSE
var/last_process = 0
/// Should we display an overlay for this component? Useful mainly for turfs
/// that already look wets or just don't need the visuals for any other reason.
var/should_display_overlay = TRUE

/datum/component/wet_floor/InheritComponent(datum/newcomp, orig, strength, duration_minimum, duration_add, duration_maximum, _permanent)
/datum/component/wet_floor/InheritComponent(datum/newcomp, orig, strength, duration_minimum, duration_add, duration_maximum, _permanent, _should_display_overlay)
if(!newcomp) //We are getting passed the arguments of a would-be new component, but not a new component
add_wet(arglist(args.Copy(3)))
else //We are being passed in a full blown component
Expand All @@ -22,10 +25,11 @@
for(var/i in WF.time_left_list)
add_wet(text2num(i), WF.time_left_list[i])

/datum/component/wet_floor/Initialize(strength, duration_minimum, duration_add, duration_maximum, _permanent = FALSE)
/datum/component/wet_floor/Initialize(strength, duration_minimum, duration_add, duration_maximum, _permanent = FALSE, _should_display_overlay = TRUE)
if(!isopenturf(parent))
return COMPONENT_INCOMPATIBLE
add_wet(strength, duration_minimum, duration_add, duration_maximum)
should_display_overlay = _should_display_overlay
add_wet(strength, duration_minimum, duration_add, duration_maximum, _permanent, _should_display_overlay)
permanent = _permanent
if(!permanent)
START_PROCESSING(SSwet_floors, src)
Expand All @@ -50,6 +54,15 @@
return ..()

/datum/component/wet_floor/proc/update_overlay()
if(!should_display_overlay)
if(!current_overlay)
return

var/turf/parent_turf = parent
parent_turf.cut_overlay(current_overlay)
current_overlay = null
return

var/intended
if(!isfloorturf(parent))
intended = generic_turf_overlay
Expand All @@ -62,9 +75,9 @@
else
intended = water_overlay
if(current_overlay != intended)
var/turf/T = parent
T.cut_overlay(current_overlay)
T.add_overlay(intended)
var/turf/parent_turf = parent
parent_turf.cut_overlay(current_overlay)
parent_turf.add_overlay(intended)
current_overlay = intended

/datum/component/wet_floor/proc/AfterSlip(mob/living/slipped)
Expand Down Expand Up @@ -163,7 +176,7 @@

//NB it's possible we get deleted after this, due to inherit

/datum/component/wet_floor/proc/add_wet(type, duration_minimum = 0, duration_add = 0, duration_maximum = MAXIMUM_WET_TIME, _permanent = FALSE)
/datum/component/wet_floor/proc/add_wet(type, duration_minimum = 0, duration_add = 0, duration_maximum = MAXIMUM_WET_TIME, _permanent = FALSE, _should_display_overlay = TRUE)
var/static/list/allowed_types = list(TURF_WET_WATER, TURF_WET_LUBE, TURF_WET_ICE, TURF_WET_PERMAFROST, TURF_WET_SUPERLUBE)
if(duration_minimum <= 0 || !type)
return FALSE
Expand All @@ -179,6 +192,8 @@
permanent = TRUE
STOP_PROCESSING(SSwet_floors, src)

should_display_overlay = _should_display_overlay

/datum/component/wet_floor/proc/_do_add_wet(type, duration_minimum, duration_add, duration_maximum)
var/time = 0
if(LAZYACCESS(time_left_list, "[type]"))
Expand Down
4 changes: 2 additions & 2 deletions code/game/turfs/open/_open.dm
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@
slipper.AddComponent(/datum/component/force_move, target, FALSE)//spinning would be bad for ice, fucks up the next dir
return TRUE

/turf/open/proc/MakeSlippery(wet_setting = TURF_WET_WATER, min_wet_time = 0, wet_time_to_add = 0, max_wet_time = MAXIMUM_WET_TIME, permanent)
AddComponent(/datum/component/wet_floor, wet_setting, min_wet_time, wet_time_to_add, max_wet_time, permanent)
/turf/open/proc/MakeSlippery(wet_setting = TURF_WET_WATER, min_wet_time = 0, wet_time_to_add = 0, max_wet_time = MAXIMUM_WET_TIME, permanent = FALSE, should_display_overlay = TRUE)
AddComponent(/datum/component/wet_floor, wet_setting, min_wet_time, wet_time_to_add, max_wet_time, permanent, should_display_overlay)

/turf/open/proc/MakeDry(wet_setting = TURF_WET_WATER, immediate = FALSE, amount = INFINITY)
SEND_SIGNAL(src, COMSIG_TURF_MAKE_DRY, wet_setting, immediate, amount)
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/open/ice.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

/turf/open/misc/ice/Initialize(mapload)
. = ..()
MakeSlippery(TURF_WET_PERMAFROST, INFINITY, 0, INFINITY, TRUE)
MakeSlippery(TURF_WET_PERMAFROST, INFINITY, 0, INFINITY, TRUE, FALSE)

/turf/open/misc/ice/break_tile()
return
Expand Down
Loading