mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
[MIRROR] Fix Turf Transparency for MultiZ [MDB IGNORE] (#10349)
* Fix Turf Transparency for MultiZ * Fixing some conflicts Co-authored-by: Tim <timothymtorres@gmail.com> Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
This commit is contained in:
co-authored by
Tim
GoldenAlpharex
parent
f1430f116b
commit
39b9e3aefc
@@ -1,27 +1,29 @@
|
||||
|
||||
/datum/element/turf_z_transparency
|
||||
element_flags = ELEMENT_DETACH
|
||||
var/show_bottom_level = FALSE
|
||||
var/is_openspace = FALSE
|
||||
|
||||
///This proc sets up the signals to handle updating viscontents when turfs above/below update. Handle plane and layer here too so that they don't cover other obs/turfs in Dream Maker
|
||||
/datum/element/turf_z_transparency/Attach(datum/target, show_bottom_level = TRUE)
|
||||
/datum/element/turf_z_transparency/Attach(datum/target, is_openspace = FALSE)
|
||||
. = ..()
|
||||
if(!isturf(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
var/turf/our_turf = target
|
||||
|
||||
src.show_bottom_level = show_bottom_level
|
||||
|
||||
our_turf.plane = OPENSPACE_PLANE
|
||||
our_turf.layer = OPENSPACE_LAYER
|
||||
if(is_openspace)
|
||||
our_turf.plane = OPENSPACE_PLANE
|
||||
|
||||
RegisterSignal(target, COMSIG_TURF_MULTIZ_DEL, .proc/on_multiz_turf_del)
|
||||
RegisterSignal(target, COMSIG_TURF_MULTIZ_NEW, .proc/on_multiz_turf_new)
|
||||
|
||||
ADD_TRAIT(our_turf, TURF_Z_TRANSPARENT_TRAIT, ELEMENT_TRAIT(type))
|
||||
|
||||
update_multiz(our_turf, TRUE, TRUE)
|
||||
var/turf/below_turf = our_turf.below()
|
||||
if(below_turf)
|
||||
our_turf.vis_contents += below_turf
|
||||
update_multi_z(our_turf)
|
||||
|
||||
/datum/element/turf_z_transparency/Detach(datum/source)
|
||||
. = ..()
|
||||
@@ -31,15 +33,11 @@
|
||||
REMOVE_TRAIT(our_turf, TURF_Z_TRANSPARENT_TRAIT, ELEMENT_TRAIT(type))
|
||||
|
||||
///Updates the viscontents or underlays below this tile.
|
||||
/datum/element/turf_z_transparency/proc/update_multiz(turf/our_turf, prune_on_fail = FALSE, init = FALSE)
|
||||
/datum/element/turf_z_transparency/proc/update_multi_z(turf/our_turf)
|
||||
var/turf/below_turf = our_turf.below()
|
||||
if(!below_turf)
|
||||
our_turf.vis_contents.len = 0
|
||||
if(!show_bottom_level(our_turf) && prune_on_fail) //If we cant show whats below, and we prune on fail, change the turf to plating as a fallback
|
||||
our_turf.ChangeTurf(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR)
|
||||
return FALSE
|
||||
if(init)
|
||||
our_turf.vis_contents += below_turf
|
||||
add_baseturf_underlay(our_turf)
|
||||
|
||||
if(isclosedturf(our_turf)) //Show girders below closed turfs
|
||||
var/mutable_appearance/girder_underlay = mutable_appearance('icons/obj/structures.dmi', "girder", layer = TURF_LAYER-0.01)
|
||||
@@ -56,7 +54,7 @@
|
||||
if(dir != DOWN)
|
||||
return
|
||||
|
||||
update_multiz(our_turf)
|
||||
update_multi_z(our_turf)
|
||||
|
||||
/datum/element/turf_z_transparency/proc/on_multiz_turf_new(turf/our_turf, turf/below_turf, dir)
|
||||
SIGNAL_HANDLER
|
||||
@@ -64,12 +62,12 @@
|
||||
if(dir != DOWN)
|
||||
return
|
||||
|
||||
update_multiz(our_turf)
|
||||
update_multi_z(our_turf)
|
||||
|
||||
///Called when there is no real turf below this turf
|
||||
/datum/element/turf_z_transparency/proc/show_bottom_level(turf/our_turf)
|
||||
if(!show_bottom_level)
|
||||
return FALSE
|
||||
/datum/element/turf_z_transparency/proc/add_baseturf_underlay(turf/our_turf)
|
||||
if(is_openspace) // we don't ever want our bottom turf to be openspace
|
||||
our_turf.ChangeTurf(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR)
|
||||
var/turf/path = SSmapping.level_trait(our_turf.z, ZTRAIT_BASETURF) || /turf/open/space
|
||||
if(!ispath(path))
|
||||
path = text2path(path)
|
||||
@@ -79,4 +77,3 @@
|
||||
var/mutable_appearance/underlay_appearance = mutable_appearance(initial(path.icon), initial(path.icon_state), layer = TURF_LAYER-0.02, plane = PLANE_SPACE)
|
||||
underlay_appearance.appearance_flags = RESET_ALPHA | RESET_COLOR
|
||||
our_turf.underlays += underlay_appearance
|
||||
return TRUE
|
||||
|
||||
@@ -148,7 +148,7 @@ Simple datum which is instanced once per type and is used for every object of sa
|
||||
O.clawfootstep = turf_sound_override
|
||||
O.heavyfootstep = turf_sound_override
|
||||
if(alpha < 255)
|
||||
T.AddElement(/datum/element/turf_z_transparency, TRUE)
|
||||
T.AddElement(/datum/element/turf_z_transparency)
|
||||
return
|
||||
|
||||
/datum/material/proc/get_greyscale_config_for(datum/greyscale_config/config_path)
|
||||
@@ -202,7 +202,7 @@ Simple datum which is instanced once per type and is used for every object of sa
|
||||
|
||||
/datum/material/proc/on_removed_turf(turf/T, amount, material_flags)
|
||||
if(alpha < 255)
|
||||
T.RemoveElement(/datum/element/turf_z_transparency, FALSE)
|
||||
T.RemoveElement(/datum/element/turf_z_transparency)
|
||||
|
||||
/**
|
||||
* This proc is called when the mat is found in an item that's consumed by accident. see /obj/item/proc/on_accidental_consumption.
|
||||
|
||||
@@ -7,47 +7,43 @@
|
||||
*/
|
||||
/turf/open/floor/catwalk_floor //the base type, meant to look like a maintenance panel
|
||||
icon = 'icons/turf/floors/catwalk_plating.dmi'
|
||||
icon_state = "maint_below"
|
||||
icon_state = "maint_above"
|
||||
name = "catwalk floor"
|
||||
desc = "Flooring that shows its contents underneath. Engineers love it!"
|
||||
baseturfs = /turf/open/floor/plating
|
||||
floor_tile = /obj/item/stack/tile/catwalk_tile
|
||||
layer = CATWALK_LAYER
|
||||
plane = GAME_PLANE
|
||||
footstep = FOOTSTEP_CATWALK
|
||||
overfloor_placed = TRUE
|
||||
underfloor_accessibility = UNDERFLOOR_VISIBLE
|
||||
var/covered = TRUE
|
||||
var/above_state = "maint_above" //Icon-state for the overlay
|
||||
|
||||
var/catwalk_type = "maint"
|
||||
var/static/list/catwalk_underlays = list()
|
||||
|
||||
/turf/open/floor/catwalk_floor/Initialize(mapload)
|
||||
. = ..()
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
|
||||
GLOBAL_LIST_EMPTY(catwalk_overlay_masterlist) //Stores all the above_states for the different types of catwalk
|
||||
|
||||
/turf/open/floor/catwalk_floor/update_overlays()
|
||||
. = ..()
|
||||
if(!covered)
|
||||
return //Updating the overlay with nothing actually removes it, in this case. Somehow.
|
||||
if(!GLOB.catwalk_overlay_masterlist[above_state])
|
||||
//Generate a new overlay and add it to the global list
|
||||
var/image/catwalk_overlay = new()
|
||||
catwalk_overlay.icon = icon
|
||||
catwalk_overlay.icon_state = above_state
|
||||
catwalk_overlay.plane = GAME_PLANE
|
||||
catwalk_overlay.layer = CATWALK_LAYER
|
||||
GLOB.catwalk_overlay_masterlist[above_state] = catwalk_overlay
|
||||
. += GLOB.catwalk_overlay_masterlist[above_state]
|
||||
if(!catwalk_underlays[catwalk_type])
|
||||
var/mutable_appearance/plating_underlay = mutable_appearance(icon, "[catwalk_type]_below", TURF_LAYER)
|
||||
catwalk_underlays[catwalk_type] = plating_underlay
|
||||
underlays += catwalk_underlays[catwalk_type]
|
||||
update_appearance()
|
||||
|
||||
/turf/open/floor/catwalk_floor/screwdriver_act(mob/living/user, obj/item/tool)
|
||||
. = ..()
|
||||
covered = !covered
|
||||
if(!covered)
|
||||
underfloor_accessibility = UNDERFLOOR_INTERACTABLE
|
||||
layer = TURF_LAYER
|
||||
plane = FLOOR_PLANE
|
||||
icon_state = "[catwalk_type]_below"
|
||||
else
|
||||
underfloor_accessibility = UNDERFLOOR_VISIBLE
|
||||
layer = CATWALK_LAYER
|
||||
plane = GAME_PLANE
|
||||
icon_state = "[catwalk_type]_above"
|
||||
user.balloon_alert(user, "[!covered ? "cover removed" : "cover added"]")
|
||||
update_icon(UPDATE_OVERLAYS)
|
||||
update_appearance()
|
||||
|
||||
/turf/open/floor/catwalk_floor/crowbar_act(mob/user, obj/item/crowbar)
|
||||
if(covered)
|
||||
@@ -55,40 +51,40 @@ GLOBAL_LIST_EMPTY(catwalk_overlay_masterlist) //Stores all the above_states for
|
||||
return FALSE
|
||||
. = ..()
|
||||
|
||||
|
||||
//Reskins! More fitting with most of our tiles, and appear as a radial on the base type
|
||||
/turf/open/floor/catwalk_floor/iron
|
||||
name = "iron plated catwalk floor"
|
||||
icon_state = "iron_below"
|
||||
above_state = "iron_above"
|
||||
icon_state = "iron_above"
|
||||
floor_tile = /obj/item/stack/tile/catwalk_tile/iron
|
||||
catwalk_type = "iron"
|
||||
|
||||
|
||||
/turf/open/floor/catwalk_floor/iron_white
|
||||
name = "white plated catwalk floor"
|
||||
icon_state = "whiteiron_below"
|
||||
above_state = "whiteiron_above"
|
||||
icon_state = "whiteiron_above"
|
||||
floor_tile = /obj/item/stack/tile/catwalk_tile/iron_white
|
||||
catwalk_type = "whiteiron"
|
||||
|
||||
/turf/open/floor/catwalk_floor/iron_dark
|
||||
name = "dark plated catwalk floor"
|
||||
icon_state = "darkiron_below"
|
||||
above_state = "darkiron_above"
|
||||
icon_state = "darkiron_above"
|
||||
floor_tile = /obj/item/stack/tile/catwalk_tile/iron_dark
|
||||
catwalk_type = "darkiron"
|
||||
|
||||
/turf/open/floor/catwalk_floor/flat_white
|
||||
name = "white large plated catwalk floor"
|
||||
icon_state = "flatwhite_below"
|
||||
above_state = "flatwhite_above"
|
||||
icon_state = "flatwhite_above"
|
||||
floor_tile = /obj/item/stack/tile/catwalk_tile/flat_white
|
||||
catwalk_type = "flatwhite"
|
||||
|
||||
/turf/open/floor/catwalk_floor/titanium
|
||||
name = "titanium plated catwalk floor"
|
||||
icon_state = "titanium_below"
|
||||
above_state = "titanium_above"
|
||||
icon_state = "titanium_above"
|
||||
floor_tile = /obj/item/stack/tile/catwalk_tile/titanium
|
||||
catwalk_type = "titanium"
|
||||
|
||||
/turf/open/floor/catwalk_floor/iron_smooth //the original green type
|
||||
name = "smooth plated catwalk floor"
|
||||
icon_state = "smoothiron_below"
|
||||
above_state = "smoothiron_above"
|
||||
icon_state = "smoothiron_above"
|
||||
floor_tile = /obj/item/stack/tile/catwalk_tile/iron_smooth
|
||||
catwalk_type = "smoothiron"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
/turf/open/floor/glass/LateInitialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/turf_z_transparency, TRUE)
|
||||
AddElement(/datum/element/turf_z_transparency)
|
||||
|
||||
/turf/open/floor/glass/reinforced
|
||||
name = "Reinforced glass floor"
|
||||
|
||||
@@ -36,7 +36,7 @@ GLOBAL_DATUM_INIT(openspace_backdrop_one_for_all, /atom/movable/openspace_backdr
|
||||
|
||||
/turf/open/openspace/LateInitialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/turf_z_transparency, FALSE)
|
||||
AddElement(/datum/element/turf_z_transparency, is_openspace = TRUE)
|
||||
|
||||
/turf/open/openspace/ChangeTurf(path, list/new_baseturfs, flags)
|
||||
UnregisterSignal(src, COMSIG_ATOM_CREATED)
|
||||
|
||||
@@ -127,14 +127,17 @@
|
||||
if(!on || status != LIGHT_OK)
|
||||
return
|
||||
|
||||
// var/area/A = get_area(src) SKYRAT EDIT REMOVAL
|
||||
if(emergency_mode || firealarm) //SKYRAT EDIT CHANGE
|
||||
. += mutable_appearance(overlay_icon, "[base_state]_emergency", layer, plane)
|
||||
/* SKYRAT EDIT START - ORIGINAL:
|
||||
var/area/local_area = get_area(src)
|
||||
if(emergency_mode || (local_area?.fire))
|
||||
*/
|
||||
if(emergency_mode || firealarm) // SKYRAT EDIT END
|
||||
. += mutable_appearance(overlay_icon, "[base_state]_emergency")
|
||||
return
|
||||
if(nightshift_enabled)
|
||||
. += mutable_appearance(overlay_icon, "[base_state]_nightshift", layer, plane)
|
||||
. += mutable_appearance(overlay_icon, "[base_state]_nightshift")
|
||||
return
|
||||
. += mutable_appearance(overlay_icon, base_state, layer, plane)
|
||||
. += mutable_appearance(overlay_icon, base_state)
|
||||
|
||||
//SKYRAT EDIT ADDITION BEGIN - AESTHETICS
|
||||
#define LIGHT_ON_DELAY_UPPER 3 SECONDS
|
||||
|
||||
Reference in New Issue
Block a user