From 54399594de19d5d527bce208bf7a71bdfb3dbda5 Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Thu, 2 Nov 2023 11:26:12 -0400 Subject: [PATCH] Fixes turrets being invisible (#79377) They're invisible by default apparently, not visible. When I was going over invisibility var sets I assumed the wrong default. fixes #79181 :cl: ninjanomnom fix: Fixes turrets being invisible when they shouldn't be /:cl: --- code/__DEFINES/sight.dm | 3 ++- code/game/atoms.dm | 6 +++--- code/game/machinery/porta_turret/portable_turret.dm | 8 ++++---- code/game/machinery/porta_turret/portable_turret_cover.dm | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/code/__DEFINES/sight.dm b/code/__DEFINES/sight.dm index ae5f4e48352..645e0094135 100644 --- a/code/__DEFINES/sight.dm +++ b/code/__DEFINES/sight.dm @@ -64,7 +64,8 @@ // INVISIBILITY PRIORITIES #define INVISIBILITY_PRIORITY_ADMIN 100 -#define INVISIBILITY_PRIORITY_BASIC_ANTI_INVISIBILITY 1 +#define INVISIBILITY_PRIORITY_TURRET_COVER 20 +#define INVISIBILITY_PRIORITY_BASIC_ANTI_INVISIBILITY 10 #define INVISIBILITY_PRIORITY_NONE 0 //------------------------ diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 1112de290f9..bb8f408f269 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -2271,12 +2271,12 @@ RecalculateInvisibility() /// Removes the specified invisibility source from the tracker -/atom/proc/RemoveInvisibility(source_id) +/atom/proc/RemoveInvisibility(id) if(!invisibility_sources) return - var/list/priority_data = invisibility_sources[source_id] - invisibility_sources -= source_id + var/list/priority_data = invisibility_sources[id] + invisibility_sources -= id if(length(invisibility_sources) == 0) invisibility_sources = null diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index cf4e4d1e7e7..11f4bb1dd55 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -326,7 +326,7 @@ DEFINE_BITFIELD(turret_flags, list( //This code handles moving the turret around. After all, it's a portable turret! if(!anchored && !isinspace()) set_anchored(TRUE) - SetInvisibility(INVISIBILITY_MAXIMUM, id=type) + RemoveInvisibility(id=type) update_appearance() to_chat(user, span_notice("You secure the exterior bolts on the turret.")) if(has_cover) @@ -336,7 +336,7 @@ DEFINE_BITFIELD(turret_flags, list( set_anchored(FALSE) to_chat(user, span_notice("You unsecure the exterior bolts on the turret.")) power_change() - RemoveInvisibility(type) + SetInvisibility(INVISIBILITY_NONE, id=type) qdel(cover) //deletes the cover, and the turret instance itself becomes its own cover. else if(I.GetID()) @@ -407,7 +407,7 @@ DEFINE_BITFIELD(turret_flags, list( . = ..() if(.) power_change() - RemoveInvisibility(type) + SetInvisibility(INVISIBILITY_NONE, id=type) spark_system.start() //creates some sparks because they look cool qdel(cover) //deletes the cover - no need on keeping it there! @@ -514,7 +514,7 @@ DEFINE_BITFIELD(turret_flags, list( return if(machine_stat & BROKEN) return - RemoveInvisibility(type) + SetInvisibility(INVISIBILITY_NONE, id=type) raising = 1 if(cover) flick("popup", cover) diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm index a4582875574..082881fc2fa 100644 --- a/code/game/machinery/porta_turret/portable_turret_cover.dm +++ b/code/game/machinery/porta_turret/portable_turret_cover.dm @@ -43,12 +43,12 @@ if(!parent_turret.anchored) parent_turret.set_anchored(TRUE) to_chat(user, span_notice("You secure the exterior bolts on the turret.")) - parent_turret.RemoveInvisibility(type) + parent_turret.SetInvisibility(INVISIBILITY_NONE, id=type, priority=INVISIBILITY_PRIORITY_TURRET_COVER) parent_turret.update_appearance() else parent_turret.set_anchored(FALSE) to_chat(user, span_notice("You unsecure the exterior bolts on the turret.")) - parent_turret.SetInvisibility(INVISIBILITY_MAXIMUM, id=type) + parent_turret.SetInvisibility(INVISIBILITY_MAXIMUM, id=type, priority=INVISIBILITY_PRIORITY_TURRET_COVER) parent_turret.update_appearance() qdel(src) return