Skip to content

Commit

Permalink
Merge pull request #3423 from MistakeNot4892/invis
Browse files Browse the repository at this point in the history
Replacing invisibility magic numbers with defines/helper where possible.
  • Loading branch information
out-of-phaze authored Oct 11, 2023
2 parents e28f150 + 1b3fe2b commit 643d9cd
Show file tree
Hide file tree
Showing 50 changed files with 86 additions and 95 deletions.
1 change: 1 addition & 0 deletions code/__defines/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define LEVEL_EDGE_CON 3

// Invisibility constants.
#define INVISIBILITY_NONE 0
#define INVISIBILITY_LIGHTING 20
#define INVISIBILITY_LEVEL_ONE 35
#define INVISIBILITY_LEVEL_TWO 45
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/ability_screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@

/obj/screen/ability_master/on_update_icon()
if(ability_objects.len)
set_invisibility(0)
set_invisibility(INVISIBILITY_NONE)
else
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)

/obj/screen/ability_master/proc/add_ability(var/name_given)
if(!name) return
Expand Down
4 changes: 2 additions & 2 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@

/datum/hud/proc/update_stamina()
if(mymob && stamina_bar)
stamina_bar.invisibility = INVISIBILITY_MAXIMUM
stamina_bar.set_invisibility(INVISIBILITY_MAXIMUM)
var/stamina = mymob.get_stamina()
if(stamina < 100)
stamina_bar.invisibility = 0
stamina_bar.set_invisibility(INVISIBILITY_NONE)
stamina_bar.icon_state = "prog_bar_[FLOOR(stamina/5)*5][(stamina >= 5) && (stamina <= 25) ? "_fail" : null]"

/datum/hud/proc/hide_inventory()
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var/global/obj/screen/robot_inventory
if(isrobot(usr) && !usr.incapacitated())
var/mob/living/silicon/robot/R = usr
R.drop_item()
invisibility = INVISIBILITY_MAXIMUM
set_invisibility(INVISIBILITY_MAXIMUM)
alpha = 0

/mob/living/silicon/robot
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystems/typing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Updated 09/10/2022 to include chatbar using Spookerton's SStyping system from Po
/atom/movable/typing_indicator/proc/show_typing_indicator()

// Make it visible after being hidden.
set_invisibility(0)
set_invisibility(INVISIBILITY_NONE)

// Update the appearance.
if(ismob(master))
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/cult_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
M.AddMovementHandler(/datum/movement_handler/mob/transformation)
M.icon = null
M.overlays.len = 0
M.set_invisibility(101)
M.set_invisibility(INVISIBILITY_ABSTRACT)

if(isrobot(M))
var/mob/living/silicon/robot/Robot = M
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/cult/cultify/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
icon = 'icons/mob/mob.dmi'
icon_state = "ghost-narsie"
cut_overlays()
set_invisibility(0)
set_invisibility(INVISIBILITY_NONE)
to_chat(src, SPAN_SINISTER("Even as a non-corporal being, you can feel Nar-Sie's presence altering you. You are now visible to everyone."))

/mob/living/on_defilement()
Expand All @@ -20,7 +20,7 @@
G.icon = 'icons/mob/mob.dmi'
G.icon_state = "ghost-narsie"
G.overlays.Cut()
G.set_invisibility(0)
G.set_invisibility(INVISIBILITY_NONE)
to_chat(G, "<span class='sinister'>You feel relieved as what's left of your soul finally escapes its prison of flesh.</span>")
else
dust()
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/ghosts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,5 @@
else
ghost_magic_cd = world.time + 60 SECONDS
to_chat(src, "<span class='info'>You are now visible.</span>")
set_invisibility(0)
set_invisibility(INVISIBILITY_NONE)
mouse_opacity = MOUSE_OPACITY_UNCLICKABLE // This is so they don't make people invincible to melee attacks by hovering over them
2 changes: 1 addition & 1 deletion code/game/machinery/Beacon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
. = ..()
var/turf/T = get_turf(src)
beacon = new /obj/item/radio/beacon(T)
beacon.invisibility = INVISIBILITY_MAXIMUM
beacon.set_invisibility(INVISIBILITY_MAXIMUM)

hide(!T.is_plating())

Expand Down
6 changes: 3 additions & 3 deletions code/game/objects/effects/bump_teleporter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ var/global/list/BUMP_TELEPORTERS = list()
name = "bump-teleporter"
icon = 'icons/mob/screen1.dmi'
icon_state = "x2"
var/id = null //id of this bump_teleporter.
var/id_target = null //id of bump_teleporter which this moves you to.
invisibility = 101 //nope, can't see this
var/id = null //id of this bump_teleporter.
var/id_target = null //id of bump_teleporter which this moves you to.
invisibility = INVISIBILITY_ABSTRACT //nope, can't see this
anchored = TRUE
density = TRUE
opacity = FALSE
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/effects/decals/Cleanable/humans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ var/global/list/image/splatter_cache=list()

/obj/effect/decal/cleanable/blood/clean_blood()
fluorescent = 0
if(invisibility != 100)
set_invisibility(100)
if(invisibility != INVISIBILITY_ABSTRACT)
set_invisibility(INVISIBILITY_ABSTRACT)
amount = 0
STOP_PROCESSING(SSobj, src)
remove_extension(src, /datum/extension/scent)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/fluids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ var/global/obj/abstract/flood/flood_object = new
icon = 'icons/effects/liquids.dmi'
icon_state = "ocean"
alpha = 140
invisibility = 0
invisibility = INVISIBILITY_NONE

/obj/effect/fluid/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/landmarks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
icon = 'icons/mob/screen1.dmi'
icon_state = "x"
anchored = TRUE
invisibility = 101
invisibility = INVISIBILITY_ABSTRACT

/obj/abstract/landmark/start/Initialize()
tag = "start*[name]"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/manifest.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/obj/effect/manifest/Initialize()
. = ..()
invisibility = INVISIBILITY_ABSTRACT
set_invisibility(INVISIBILITY_ABSTRACT)

/obj/effect/manifest/proc/manifest()
var/dat = "<B>Crew Manifest</B>:<BR>"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/step_triggers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/obj/effect/step_trigger
var/affect_ghosts = 0
var/stopper = 1 // stops throwers
invisibility = 101 // nope cant see this shit
invisibility = INVISIBILITY_ABSTRACT // nope cant see this shit
anchored = TRUE

/obj/effect/step_trigger/proc/Trigger(var/atom/movable/A)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/robot/robot_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
return

O.mmi = W
O.set_invisibility(0)
O.set_invisibility(INVISIBILITY_NONE)
O.custom_name = created_name
O.updatename("Default")
B.mind.transfer_to(O)
Expand Down
16 changes: 8 additions & 8 deletions code/modules/abstract/_abstract.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/obj/abstract
name = ""
icon = 'icons/effects/landmarks.dmi'
icon_state = "x2"
simulated = FALSE
density = FALSE
anchored = TRUE
unacidable = TRUE
name = ""
icon = 'icons/effects/landmarks.dmi'
icon_state = "x2"
simulated = FALSE
density = FALSE
anchored = TRUE
unacidable = TRUE
abstract_type = /obj/abstract
invisibility = INVISIBILITY_ABSTRACT

/obj/abstract/Initialize()
. = ..()
Expand All @@ -15,7 +16,6 @@
opacity = FALSE
alpha = 0
mouse_opacity = MOUSE_OPACITY_UNCLICKABLE
invisibility = INVISIBILITY_MAXIMUM+1

/obj/abstract/explosion_act()
SHOULD_CALL_PARENT(FALSE)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/detectivework/tools/uvlight.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
A.fluorescent = 2 //To prevent light crosstalk.
if(A.invisibility)
scanned[A] = A.invisibility
A.set_invisibility(0)
A.set_invisibility(INVISIBILITY_NONE)
stored_alpha[A] = A.alpha
A.alpha = use_alpha
if(istype(A, /obj/item))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mechs/equipment/engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
anchored = TRUE
layer = ABOVE_HUMAN_LAYER
density = FALSE
invisibility = 0
invisibility = INVISIBILITY_NONE
atmos_canpass = CANPASS_NEVER
var/obj/item/mech_equipment/atmos_shields/shields
color = COLOR_SABER_BLUE
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
death(1)
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
icon = null
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)
UpdateLyingBuckledAndVerbStatus()
remove_from_dead_mob_list()
dump_contents()
Expand All @@ -30,7 +30,7 @@
var/atom/movable/overlay/animation = null
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
icon = null
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)

animation = new(loc)
animation.icon_state = "blank"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/alien/life.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Alien larva are quite simple.
/mob/living/carbon/alien/Life()
set invisibility = 0
set background = 1
set invisibility = FALSE
set background = TRUE
if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src)) return
if(!loc) return
..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
var/stamina = 100

/mob/living/carbon/human/Life()
set invisibility = 0
set invisibility = FALSE
set background = BACKGROUND_ENABLED

if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/life.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/mob/living/Life()
set invisibility = 0
set invisibility = FALSE
set background = BACKGROUND_ENABLED

..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/ai/power.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@
active_power_usage = AI_POWERUSAGE_NORMAL * AI_POWERUSAGE_OXYLOSS_TO_WATTS_MULTIPLIER
use_power = POWER_USE_ACTIVE
power_channel = EQUIP
invisibility = INVISIBILITY_ABSTRACT
var/mob/living/silicon/ai/powered_ai = null
invisibility = 100

/obj/machinery/ai_powersupply/Initialize()
. = ..()
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/silicon/robot/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

SHOULD_CALL_PARENT(FALSE)

set invisibility = 0
set invisibility = FALSE
set background = 1

if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src))
Expand Down Expand Up @@ -128,10 +128,10 @@
process_med_hud(src,0,network = get_computer_network())

if(length(get_active_grabs()))
ui_drop_grab.invisibility = 0
ui_drop_grab.set_invisibility(INVISIBILITY_NONE)
ui_drop_grab.alpha = 255
else
ui_drop_grab.invisibility = INVISIBILITY_MAXIMUM
ui_drop_grab.set_invisibility(INVISIBILITY_ABSTRACT)
ui_drop_grab.alpha = 0

if (src.healths)
Expand Down
6 changes: 1 addition & 5 deletions code/modules/mob/new_player/new_player.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
/mob/new_player
universal_speak = TRUE
mob_sort_value = 10
invisibility = 101
invisibility = INVISIBILITY_ABSTRACT
simulated = FALSE

density = FALSE
stat = DEAD

movement_handlers = list()
anchored = TRUE // don't get pushed around

virtual_mob = null // Hear no evil, speak no evil

var/ready = 0
Expand All @@ -19,7 +16,6 @@
var/totalPlayers = 0
var/totalPlayersReady = 0
var/show_invalid_jobs = 0

var/datum/browser/panel

INITIALIZE_IMMEDIATE(/mob/new_player)
Expand Down
14 changes: 7 additions & 7 deletions code/modules/mob/transform_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
set_status(STAT_STUN, 1)
icon = null
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)
for(var/t in get_external_organs())
qdel(t)
var/atom/movable/overlay/animation = new /atom/movable/overlay(src)
Expand Down Expand Up @@ -56,7 +56,7 @@
drop_from_inventory(W)
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
icon = null
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)
return ..()

/mob/proc/AIize(move=1)
Expand All @@ -65,7 +65,7 @@


var/mob/living/silicon/ai/O = new (loc, global.using_map.default_law_type,,1)//No MMI but safety is in effect.
O.set_invisibility(0)
O.set_invisibility(INVISIBILITY_NONE)
O.aiRestorePowerRoutine = 0
if(mind)
mind.transfer_to(O)
Expand Down Expand Up @@ -112,14 +112,14 @@
refresh_visible_overlays()
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
icon = null
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)
for(var/t in get_external_organs())
qdel(t)

var/mob/living/silicon/robot/O = new supplied_robot_type( loc )

O.set_gender(gender)
O.set_invisibility(0)
O.set_invisibility(INVISIBILITY_NONE)

if(!mind)
mind_initialize()
Expand Down Expand Up @@ -149,7 +149,7 @@
refresh_visible_overlays()
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
icon = null
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)
for(var/t in get_external_organs()) //this really should not be necessary
qdel(t)

Expand Down Expand Up @@ -178,7 +178,7 @@
refresh_visible_overlays()
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
icon = null
set_invisibility(101)
set_invisibility(INVISIBILITY_ABSTRACT)

for(var/t in get_external_organs())
qdel(t)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/multiz/zmimic/mimic_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
layer = MIMICED_LIGHTING_LAYER
plane = OPENTURF_MAX_PLANE
blend_mode = BLEND_MULTIPLY
invisibility = 0
set_invisibility(INVISIBILITY_NONE)

if (icon_state == LIGHTING_BASE_ICON_STATE)
// We're using a color matrix, so just darken the colors across the board.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/organs/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@

splatter.update_icon()
splatter.fluorescent = 0
splatter.set_invisibility(0)
splatter.set_invisibility(INVISIBILITY_NONE)
return splatter

//Percentage of maximum blood volume.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/overmap/overmap_object.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var/global/list/overmap_unknown_ids = list()
return INITIALIZE_HINT_QDEL

if(requires_contact)
invisibility = INVISIBILITY_OVERMAP // Effects that require identification have their images cast to the client via sensors.
set_invisibility(INVISIBILITY_OVERMAP) // Effects that require identification have their images cast to the client via sensors.

if(scannable)
unknown_id = "[pick(global.phonetic_alphabet)]-[random_id(/obj/effect/overmap, 100, 999)]"
Expand Down
Loading

0 comments on commit 643d9cd

Please sign in to comment.