diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index d2e366f87f9..7b8d40cd831 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -7,7 +7,52 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming traits. */ -//mob traits + +// Traits applied to global objects + +/// GLOB trait, applied whenever something in the world wants to use the distortion plane +/// Distortion is an expensive effect, so it's worthwhile to keep it off until we care +#define TRAIT_DISTORTION_IN_USE(z_layer) "distortion_in_use_#[z_layer]" + +/// SSeconomy trait, if the market is crashing and people can't withdraw credits from ID cards. +#define TRAIT_MARKET_CRASHING "market_crashing" + +/// Traits given by station traits +#define STATION_TRAIT_ASSISTANT_GIMMICKS "station_trait_assistant_gimmicks" +#define STATION_TRAIT_BANANIUM_SHIPMENTS "station_trait_bananium_shipments" +#define STATION_TRAIT_BIGGER_PODS "station_trait_bigger_pods" +#define STATION_TRAIT_BIRTHDAY "station_trait_birthday" +#define STATION_TRAIT_BOTS_GLITCHED "station_trait_bot_glitch" +#define STATION_TRAIT_MACHINES_GLITCHED "station_trait_machine_glitch" +#define STATION_TRAIT_BRIGHT_DAY "station_trait_bright_day" +#define STATION_TRAIT_CARP_INFESTATION "station_trait_carp_infestation" +#define STATION_TRAIT_CYBERNETIC_REVOLUTION "station_trait_cybernetic_revolution" +#define STATION_TRAIT_ECONOMY_ALERTS "station_trait_economy_alerts" +#define STATION_TRAIT_EMPTY_MAINT "station_trait_empty_maint" +#define STATION_TRAIT_FILLED_MAINT "station_trait_filled_maint" +#define STATION_TRAIT_FORESTED "station_trait_forested" +#define STATION_TRAIT_HANGOVER "station_trait_hangover" +#define STATION_TRAIT_HUMAN_AI "station_trait_human_ai" +#define STATION_TRAIT_LATE_ARRIVALS "station_trait_late_arrivals" +#define STATION_TRAIT_LOANER_SHUTTLE "station_trait_loaner_shuttle" +#define STATION_TRAIT_MEDBOT_MANIA "station_trait_medbot_mania" +#define STATION_TRAIT_PDA_GLITCHED "station_trait_pda_glitched" +#define STATION_TRAIT_PREMIUM_INTERNALS "station_trait_premium_internals" +#define STATION_TRAIT_RADIOACTIVE_NEBULA "station_trait_radioactive_nebula" +#define STATION_TRAIT_RANDOM_ARRIVALS "station_trait_random_arrivals" +#define STATION_TRAIT_REVOLUTIONARY_TRASHING "station_trait_revolutionary_trashing" +#define STATION_TRAIT_SHUTTLE_SALE "station_trait_shuttle_sale" +#define STATION_TRAIT_SMALLER_PODS "station_trait_smaller_pods" +#define STATION_TRAIT_SPIDER_INFESTATION "station_trait_spider_infestation" +#define STATION_TRAIT_UNIQUE_AI "station_trait_unique_ai" +#define STATION_TRAIT_UNNATURAL_ATMOSPHERE "station_trait_unnatural_atmosphere" +#define STATION_TRAIT_SPIKED_DRINKS "station_trait_spiked_drinks" + +// Hud traits +/// This hud is owned by a client with an open escape menu +#define TRAIT_ESCAPE_MENU_OPEN "escape_menu_open" + +// Mob traits /// Forces the user to stay unconscious. #define TRAIT_KNOCKEDOUT "knockedout" /// Prevents voluntary movement. @@ -789,9 +834,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai ///If the crate is immune to the wrong content in manifest error #define TRAIT_NO_MANIFEST_CONTENTS_ERROR "no_manifest_contents_error" -///SSeconomy trait, if the market is crashing and people can't withdraw credits from ID cards. -#define TRAIT_MARKET_CRASHING "market_crashing" - // item traits #define TRAIT_NODROP "nodrop" /// cannot be inserted in a storage. @@ -1142,37 +1184,6 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai /// Has splattercasting #define TRAIT_SPLATTERCASTER "splattercaster" -///Traits given by station traits -#define STATION_TRAIT_ASSISTANT_GIMMICKS "station_trait_assistant_gimmicks" -#define STATION_TRAIT_BANANIUM_SHIPMENTS "station_trait_bananium_shipments" -#define STATION_TRAIT_BIGGER_PODS "station_trait_bigger_pods" -#define STATION_TRAIT_BIRTHDAY "station_trait_birthday" -#define STATION_TRAIT_BOTS_GLITCHED "station_trait_bot_glitch" -#define STATION_TRAIT_MACHINES_GLITCHED "station_trait_machine_glitch" -#define STATION_TRAIT_BRIGHT_DAY "station_trait_bright_day" -#define STATION_TRAIT_CARP_INFESTATION "station_trait_carp_infestation" -#define STATION_TRAIT_CYBERNETIC_REVOLUTION "station_trait_cybernetic_revolution" -#define STATION_TRAIT_ECONOMY_ALERTS "station_trait_economy_alerts" -#define STATION_TRAIT_EMPTY_MAINT "station_trait_empty_maint" -#define STATION_TRAIT_FILLED_MAINT "station_trait_filled_maint" -#define STATION_TRAIT_FORESTED "station_trait_forested" -#define STATION_TRAIT_HANGOVER "station_trait_hangover" -#define STATION_TRAIT_HUMAN_AI "station_trait_human_ai" -#define STATION_TRAIT_LATE_ARRIVALS "station_trait_late_arrivals" -#define STATION_TRAIT_LOANER_SHUTTLE "station_trait_loaner_shuttle" -#define STATION_TRAIT_MEDBOT_MANIA "station_trait_medbot_mania" -#define STATION_TRAIT_PDA_GLITCHED "station_trait_pda_glitched" -#define STATION_TRAIT_PREMIUM_INTERNALS "station_trait_premium_internals" -#define STATION_TRAIT_RADIOACTIVE_NEBULA "station_trait_radioactive_nebula" -#define STATION_TRAIT_RANDOM_ARRIVALS "station_trait_random_arrivals" -#define STATION_TRAIT_REVOLUTIONARY_TRASHING "station_trait_revolutionary_trashing" -#define STATION_TRAIT_SHUTTLE_SALE "station_trait_shuttle_sale" -#define STATION_TRAIT_SMALLER_PODS "station_trait_smaller_pods" -#define STATION_TRAIT_SPIDER_INFESTATION "station_trait_spider_infestation" -#define STATION_TRAIT_UNIQUE_AI "station_trait_unique_ai" -#define STATION_TRAIT_UNNATURAL_ATMOSPHERE "station_trait_unnatural_atmosphere" -#define STATION_TRAIT_SPIKED_DRINKS "station_trait_spiked_drinks" - ///Deathmatch traits #define TRAIT_DEATHMATCH_EXPLOSIVE_IMPLANTS "deathmath_explosive_implants" diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index 97c7d951e75..046a269a910 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -101,6 +101,9 @@ GLOBAL_LIST_INIT(traits_by_type, list( /area = list( "TRAIT_HAS_SHUTTLE_CONSTRUCTION_TURF" = TRAIT_HAS_SHUTTLE_CONSTRUCTION_TURF, ), + /datum/controller/global_vars = list( + "TRAIT_DISTORTION_IN_USE" = TRAIT_DISTORTION_IN_USE(0), + ), /datum/controller/subsystem/economy = list( "TRAIT_MARKET_CRASHING" = TRAIT_MARKET_CRASHING, ), @@ -139,6 +142,9 @@ GLOBAL_LIST_INIT(traits_by_type, list( /datum/deathmatch_lobby = list( "TRAIT_DEATHMATCH_EXPLOSIVE_IMPLANTS" = TRAIT_DEATHMATCH_EXPLOSIVE_IMPLANTS, ), + /datum/hud = list( + "TRAIT_ESCAPE_MENU_OPEN" = TRAIT_ESCAPE_MENU_OPEN, + ), /datum/wound = list( "TRAIT_WOUND_SCANNED" = TRAIT_WOUND_SCANNED, ), diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 698a1372284..3ad8beb6432 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -119,13 +119,14 @@ GLOBAL_LIST_INIT(available_erp_ui_styles, list( var/atom/movable/screen/healthdoll/healthdoll var/atom/movable/screen/spacesuit var/atom/movable/screen/hunger/hunger - // subtypes can override this to force a specific UI style + + /// Subtypes can override this to force a specific UI style var/ui_style var/erp_ui_style //SKYRAT EDIT - ADDITION - ERP ICONS FIX - // List of weakrefs to objects that we add to our screen that we don't expect to DO anything - // They typically use * in their render target. They exist solely so we can reuse them, - // and avoid needing to make changes to all idk 300 consumers if we want to change the appearance + /// List of weakrefs to objects that we add to our screen that we don't expect to DO anything + /// They typically use * in their render target. They exist solely so we can reuse them, + /// and avoid needing to make changes to all idk 300 consumers if we want to change the appearance var/list/asset_refs_for_reuse = list() /datum/hud/New(mob/owner) diff --git a/code/_onclick/hud/rendering/plane_masters/plane_master_subtypes.dm b/code/_onclick/hud/rendering/plane_masters/plane_master_subtypes.dm index d43bf17bfa6..25086885e5f 100644 --- a/code/_onclick/hud/rendering/plane_masters/plane_master_subtypes.dm +++ b/code/_onclick/hud/rendering/plane_masters/plane_master_subtypes.dm @@ -172,8 +172,26 @@ blend_mode = BLEND_ADD render_target = GRAVITY_PULSE_RENDER_TARGET render_relay_planes = list() + // We start out hidden as we do not need to render when there's no distortion on our level + start_hidden = TRUE -///Contains just the floor +/atom/movable/screen/plane_master/gravpulse/Initialize(mapload, datum/hud/hud_owner, datum/plane_master_group/home, offset) + . = ..() + RegisterSignal(GLOB, SIGNAL_ADDTRAIT(TRAIT_DISTORTION_IN_USE(offset)), PROC_REF(distortion_enabled)) + RegisterSignal(GLOB, SIGNAL_REMOVETRAIT(TRAIT_DISTORTION_IN_USE(offset)), PROC_REF(distortion_disabled)) + if(HAS_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(offset))) + distortion_enabled() + +/atom/movable/screen/plane_master/gravpulse/proc/distortion_enabled(datum/source) + SIGNAL_HANDLER + var/mob/our_mob = home?.our_hud?.mymob + unhide_plane(our_mob) + +/atom/movable/screen/plane_master/gravpulse/proc/distortion_disabled(datum/source) + SIGNAL_HANDLER + hide_plane() + +/// Contains just the floor /atom/movable/screen/plane_master/floor name = "Floor" documentation = "The well, floor. This is mostly used as a sorting mechanism, but it also lets us create a \"border\" around the game world plane, so its drop shadow will actually work." @@ -440,7 +458,9 @@ return remove_filter("AO") if(istype(mymob) && mymob.canon_client?.prefs?.read_preference(/datum/preference/toggle/ambient_occlusion)) - add_filter("AO", 1, drop_shadow_filter(x = 0, y = -2, size = 4, color = "#04080FAA")) + // We use outlines instead of drop shadow due to how extremely expensive it is, and there's no reason to use it for runechat + // which already has high drop shadow transparency at just 32 alpha, so outline does the job good enough + add_filter("AO", 1, outline_filter(size = 3, color = "#04080F20", flags = OUTLINE_SQUARE)) /atom/movable/screen/plane_master/balloon_chat name = "Balloon chat" @@ -480,3 +500,27 @@ appearance_flags = PLANE_MASTER|NO_CLIENT_COLOR render_relay_planes = list(RENDER_PLANE_MASTER) offsetting_flags = BLOCKS_PLANE_OFFSETTING|OFFSET_RELAYS_MATCH_HIGHEST + +/atom/movable/screen/plane_master/escape_menu/show_to(mob/mymob) + . = ..() + if(!.) + return + + var/datum/hud/our_hud = home.our_hud + if(!our_hud) + return + + RegisterSignal(our_hud, SIGNAL_ADDTRAIT(TRAIT_ESCAPE_MENU_OPEN), PROC_REF(escape_opened), override = TRUE) + RegisterSignal(our_hud, SIGNAL_REMOVETRAIT(TRAIT_ESCAPE_MENU_OPEN), PROC_REF(escape_closed), override = TRUE) + if(!HAS_TRAIT(our_hud, TRAIT_ESCAPE_MENU_OPEN)) + escape_closed() + +/atom/movable/screen/plane_master/escape_menu/proc/escape_opened(datum/source) + SIGNAL_HANDLER + var/mob/our_mob = home?.our_hud?.mymob + unhide_plane(our_mob) + +/atom/movable/screen/plane_master/escape_menu/proc/escape_closed(datum/source) + SIGNAL_HANDLER + var/mob/our_mob = home?.our_hud?.mymob + hide_plane(our_mob) diff --git a/code/_onclick/hud/rendering/render_plate.dm b/code/_onclick/hud/rendering/render_plate.dm index 8fb0dfae9c0..415539a66f1 100644 --- a/code/_onclick/hud/rendering/render_plate.dm +++ b/code/_onclick/hud/rendering/render_plate.dm @@ -79,8 +79,19 @@ /atom/movable/screen/plane_master/rendering_plate/game_plate/Initialize(mapload, datum/hud/hud_owner) . = ..() - add_filter("displacer", 1, displacement_map_filter(render_source = OFFSET_RENDER_TARGET(GRAVITY_PULSE_RENDER_TARGET, offset), size = 10)) add_relay_to(GET_NEW_PLANE(EMISSIVE_BLOOM_PLATE, offset), blend_override = BLEND_MULTIPLY) + RegisterSignal(GLOB, SIGNAL_ADDTRAIT(TRAIT_DISTORTION_IN_USE(offset)), PROC_REF(distortion_enabled)) + RegisterSignal(GLOB, SIGNAL_REMOVETRAIT(TRAIT_DISTORTION_IN_USE(offset)), PROC_REF(distortion_disabled)) + if(HAS_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(offset))) + distortion_enabled() + +/atom/movable/screen/plane_master/rendering_plate/game_plate/proc/distortion_enabled(datum/source) + SIGNAL_HANDLER + add_filter("displacer", 1, displacement_map_filter(render_source = OFFSET_RENDER_TARGET(GRAVITY_PULSE_RENDER_TARGET, offset), size = 10)) + +/atom/movable/screen/plane_master/rendering_plate/game_plate/proc/distortion_disabled(datum/source) + SIGNAL_HANDLER + remove_filter("displacer") /atom/movable/screen/plane_master/rendering_plate/game_plate/show_to(mob/mymob) . = ..() diff --git a/code/datums/components/hide_highest_offset.dm b/code/datums/components/hide_highest_offset.dm index eb5b5660db0..fd6aab7d504 100644 --- a/code/datums/components/hide_highest_offset.dm +++ b/code/datums/components/hide_highest_offset.dm @@ -6,13 +6,13 @@ if(!istype(parent, /atom/movable/screen/plane_master)) return RegisterSignal(SSmapping, COMSIG_PLANE_OFFSET_INCREASE, PROC_REF(on_offset_increase)) - offset_increase(SSmapping.max_plane_offset) + offset_increase(-1, SSmapping.max_plane_offset) /datum/component/plane_hide_highest_offset/proc/on_offset_increase(datum/source, old_offset, new_offset) SIGNAL_HANDLER - offset_increase(new_offset) + offset_increase(old_offset, new_offset) -/datum/component/plane_hide_highest_offset/proc/offset_increase(new_offset) +/datum/component/plane_hide_highest_offset/proc/offset_increase(old_offset, new_offset) var/atom/movable/screen/plane_master/plane_parent = parent var/mob/our_mob = plane_parent.home?.our_hud?.mymob var/our_offset = plane_parent.offset @@ -20,5 +20,5 @@ return if(our_offset == new_offset) plane_parent.hide_plane(our_mob) - else if(plane_parent.force_hidden) + else if(our_offset == old_offset && plane_parent.force_hidden) plane_parent.unhide_plane(our_mob) diff --git a/code/game/objects/effects/anomalies/anomalies_gravity.dm b/code/game/objects/effects/anomalies/anomalies_gravity.dm index f2b97862f1b..56a1130d453 100644 --- a/code/game/objects/effects/anomalies/anomalies_gravity.dm +++ b/code/game/objects/effects/anomalies/anomalies_gravity.dm @@ -7,6 +7,44 @@ pixel_x = -176 pixel_y = -176 +/atom/movable/warp_effect/Initialize(mapload) + . = ..() + var/turf/new_turf = get_turf(src) + if(new_turf) + var/new_offset = GET_TURF_PLANE_OFFSET(new_turf) + ADD_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(new_offset), ref(src)) + +/atom/movable/warp_effect/Destroy(force) + // Just in case I've forgotten how the movement api works + var/offset = GET_TURF_PLANE_OFFSET(loc) + REMOVE_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(offset), ref(src)) + return ..() + +/atom/movable/warp_effect/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change) + . = ..() + var/turf/new_turf = get_turf(src) + var/turf/old_turf = get_turf(old_loc) + if(!new_turf) + var/old_offset = GET_TURF_PLANE_OFFSET(old_turf) + REMOVE_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(old_offset), ref(src)) + return + else if(get_turf(old_loc)) + return + // If we're in a thing on a turf we COUNT as a distortion source + var/new_offset = GET_TURF_PLANE_OFFSET(new_turf) + ADD_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(new_offset), ref(src)) + +/atom/movable/warp_effect/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) + . = ..() + if(same_z_layer) + return + if(old_turf) + var/old_offset = GET_TURF_PLANE_OFFSET(old_turf) + REMOVE_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(old_offset), ref(src)) + if(new_turf) + var/new_offset = GET_TURF_PLANE_OFFSET(new_turf) + ADD_TRAIT(GLOB, TRAIT_DISTORTION_IN_USE(new_offset), ref(src)) + /obj/effect/anomaly/grav name = "gravitational anomaly" icon = 'icons/effects/effects.dmi' diff --git a/code/modules/client/preferences/ambient_occlusion.dm b/code/modules/client/preferences/ambient_occlusion.dm index cf8bf28c1e5..b0c5c84c1b4 100644 --- a/code/modules/client/preferences/ambient_occlusion.dm +++ b/code/modules/client/preferences/ambient_occlusion.dm @@ -6,5 +6,7 @@ /datum/preference/toggle/ambient_occlusion/apply_to_client(client/client, value) /// Backdrop for the game world plane. - for(var/atom/movable/screen/plane_master/plane_master as anything in client.mob?.hud_used?.get_true_plane_masters(GAME_PLANE)) + for(var/atom/movable/screen/plane_master/plane_master as anything in client.mob?.hud_used?.get_true_plane_masters(RENDER_PLANE_GAME_WORLD)) + plane_master.show_to(client.mob) + for(var/atom/movable/screen/plane_master/plane_master as anything in client.mob?.hud_used?.get_true_plane_masters(RUNECHAT_PLANE)) plane_master.show_to(client.mob) diff --git a/code/modules/escape_menu/escape_menu.dm b/code/modules/escape_menu/escape_menu.dm index a4b05b9c155..5d5ef4dbce1 100644 --- a/code/modules/escape_menu/escape_menu.dm +++ b/code/modules/escape_menu/escape_menu.dm @@ -21,6 +21,8 @@ GLOBAL_LIST_EMPTY(escape_menus) /datum/escape_menu /// The client that owns this escape menu var/client/client + /// A weakref to the hud this escape menu currently applies to + var/datum/weakref/our_hud_ref VAR_PRIVATE ckey @@ -41,6 +43,7 @@ GLOBAL_LIST_EMPTY(escape_menus) ckey = client?.ckey src.client = client + refresh_hud() base_holder = new(client) if(isnull(dim_screen)) @@ -64,11 +67,16 @@ GLOBAL_LIST_EMPTY(escape_menus) QDEL_NULL(base_holder) QDEL_NULL(page_holder) + var/datum/our_hud = our_hud_ref?.resolve() + if(our_hud) + REMOVE_TRAIT(our_hud, TRAIT_ESCAPE_MENU_OPEN, ref(src)) + GLOB.escape_menus -= ckey var/sound/esc_clear = sound(null, repeat = FALSE, channel = CHANNEL_ESCAPEMENU) //yes, I'm doing it like this with a null, no its absolutely intentional, cuts off the sound right as needed. SEND_SOUND(client, esc_clear) SEND_SOUND(client, 'sound/misc/escape_menu/esc_close.ogg') + client = null return ..() @@ -84,6 +92,19 @@ GLOBAL_LIST_EMPTY(escape_menus) if (menu_page == PAGE_LEAVE_BODY) qdel(src) + else + // Otherwise our client just switched bodies, let's update our hud + refresh_hud() + +/datum/escape_menu/proc/refresh_hud() + var/datum/old_hud = our_hud_ref?.resolve() + if(old_hud) + REMOVE_TRAIT(old_hud, TRAIT_ESCAPE_MENU_OPEN, ref(src)) + + var/datum/new_hud = client.mob?.hud_used + our_hud_ref = WEAKREF(new_hud) + if(new_hud) + ADD_TRAIT(new_hud, TRAIT_ESCAPE_MENU_OPEN, ref(src)) /datum/escape_menu/proc/show_page() PRIVATE_PROC(TRUE) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index a8db9240640..8b7f949d11c 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -169,7 +169,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) ///Hue shift of the zaps color based on the power of the crystal var/hue_angle_shift = 0 ///Reference to the warp effect - var/atom/movable/supermatter_warp_effect/warp + var/atom/movable/warp_effect/warp ///The power threshold required to transform the powerloss function into a linear function from a cubic function. var/powerloss_linear_threshold = 0 ///The offset of the linear powerloss function set so the transition is differentiable. diff --git a/code/modules/power/supermatter/supermatter_variants.dm b/code/modules/power/supermatter/supermatter_variants.dm index df01fe483f9..270994d0a10 100644 --- a/code/modules/power/supermatter/supermatter_variants.dm +++ b/code/modules/power/supermatter/supermatter_variants.dm @@ -53,14 +53,6 @@ anchored = TRUE moveable = FALSE -/atom/movable/supermatter_warp_effect - plane = GRAVITY_PULSE_PLANE - appearance_flags = PIXEL_SCALE // no tile bound so you can see it around corners and so - icon = 'icons/effects/light_overlays/light_352.dmi' - icon_state = "light" - pixel_x = -176 - pixel_y = -176 - /// Normal sm but small (sm sword recipe element) (wiz only) and adamantine pedestal for it /obj/machinery/power/supermatter_crystal/small name = "strangely small supermatter crystal"