Skip to content

Commit

Permalink
Fixes turrets being invisible (tgstation#79377)
Browse files Browse the repository at this point in the history
They're invisible by default apparently, not visible. When I was going
over invisibility var sets I assumed the wrong default.

fixes tgstation#79181

🆑 ninjanomnom
fix: Fixes turrets being invisible when they shouldn't be
/🆑
  • Loading branch information
ninjanomnom authored Nov 2, 2023
1 parent bfe9993 commit 5439959
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion code/__DEFINES/sight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

//------------------------
Expand Down
6 changes: 3 additions & 3 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions code/game/machinery/porta_turret/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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())
Expand Down Expand Up @@ -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!

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/porta_turret/portable_turret_cover.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5439959

Please sign in to comment.