Opacity refactor (#52881)

Moves all opacity var manipulation to a proc which sends a signal.
    light_blocker element for movable opaque atoms made, which tracks its movement and updates the affected turfs for proper lighting updates.
    has_opaque_atom boolean replaced by the opacity_sources lazylist to keep track of the sources, and a directional_opacity which serves a similar function but also allows for future expansion with on-border opaque objects (not yet implemented).
    Some opacity-related sight procs optimized as a result of this.
    Some variables moved to the object's definition.
    A define or two added into the mix for clarity.
    Some code cleaning, like turning booleans into their defines.
    One file renamed for clarity.

Changelog

cl
balance: Mechs no longer block sight. It's a non-trivial cost for the lighting system with little to no gain.
/cl
This commit is contained in:
Rohesie
2020-08-19 13:24:20 +12:00
committed by GitHub
parent deb043ccec
commit 25f670f8de
63 changed files with 220 additions and 160 deletions
+3 -1
View File
@@ -165,7 +165,9 @@
///from base of atom/attack_paw(): (mob/user)
#define COMSIG_ATOM_ATTACK_PAW "atom_attack_paw"
#define COMPONENT_NO_ATTACK_HAND (1<<0) //works on all 3.
//This signal return value bitflags can be found in __DEFINES/misc.dm
///from base of atom/set_opacity(): (new_opacity)
#define COMSIG_ATOM_SET_OPACITY "atom_set_opacity"
//from base of atom/movable/on_enter_storage(): (datum/component/storage/concrete/master_storage)
#define COMISG_STORAGE_ENTERED "storage_entered"
//from base of atom/movable/on_exit_storage(): (datum/component/storage/concrete/master_storage)
+4 -1
View File
@@ -4,9 +4,12 @@
#define ALL (~0) //For convenience.
#define NONE 0
GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768))
/* Directions */
///All the cardinal direction bitflags.
#define ALL_CARDINALS (NORTH|SOUTH|EAST|WEST)
// for /datum/var/datum_flags
#define DF_USE_TAG (1<<0)
#define DF_VAR_EDITED (1<<1)
@@ -4,3 +4,5 @@
#define CHANGETURF_SKIP 8 // A flag for PlaceOnTop to just instance the new turf instead of calling ChangeTurf. Used for uninitialized turfs NOTHING ELSE
#define CHANGETURF_INHERIT_AIR 16 // Inherit air from previous turf. Implies CHANGETURF_IGNORE_AIR
#define CHANGETURF_RECALC_ADJACENT 32 //Immediately recalc adjacent atmos turfs instead of queuing.
#define IS_OPAQUE_TURF(turf) (turf.directional_opacity == ALL_CARDINALS)
+2 -2
View File
@@ -262,7 +262,7 @@
Y1+=s
while(Y1!=Y2)
T=locate(X1,Y1,Z)
if(T.opacity)
if(IS_OPAQUE_TURF(T))
return 0
Y1+=s
else
@@ -278,7 +278,7 @@
else
X1+=signX //Line exits tile horizontally
T=locate(X1,Y1,Z)
if(T.opacity)
if(IS_OPAQUE_TURF(T))
return 0
return 1
#undef SIGNV
+4 -8
View File
@@ -461,17 +461,13 @@ Turf and target are separate in case you want to teleport some distance from a t
current = get_step_towards(current, target_turf)
while(current != target_turf)
if(steps > length)
return 0
if(current.opacity)
return 0
for(var/thing in current)
var/atom/A = thing
if(A.opacity)
return 0
return FALSE
if(IS_OPAQUE_TURF(current))
return FALSE
current = get_step_towards(current, target_turf)
steps++
return TRUE
return 1
//Repopulates sortedAreas list
/proc/repopulate_sorted_areas()
+2 -2
View File
@@ -11,7 +11,7 @@
olddens = parent_atom.density
oldopac = parent_atom.opacity
parent_atom.density = 0
parent_atom.opacity = 0
parent_atom.set_opacity(FALSE)
if(isliving(parent_atom))
var/mob/living/L = parent_atom
L.add_movespeed_modifier(/datum/movespeed_modifier/shrink_ray)
@@ -31,7 +31,7 @@
var/atom/parent_atom = parent
parent_atom.transform = parent_atom.transform.Scale(2,2)
parent_atom.density = olddens
parent_atom.opacity = oldopac
parent_atom.set_opacity(oldopac)
if(isliving(parent_atom))
var/mob/living/L = parent_atom
L.remove_movespeed_modifier(/datum/movespeed_modifier/shrink_ray)
+35
View File
@@ -0,0 +1,35 @@
/**
* Attached to movable atoms with opacity. Listens to them move and updates their old and new turf loc's opacity accordingly.
*/
/datum/element/light_blocking
element_flags = ELEMENT_DETACH
/datum/element/light_blocking/Attach(datum/target)
. = ..()
if(!ismovable(target))
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/on_target_move)
var/atom/movable/movable_target = target
if(isturf(movable_target.loc))
var/turf/turf_loc = movable_target.loc
turf_loc.add_opacity_source(target)
/datum/element/light_blocking/Detach(atom/movable/target)
. = ..()
UnregisterSignal(target, list(COMSIG_MOVABLE_MOVED))
var/atom/movable/movable_target = target
if(isturf(movable_target.loc))
var/turf/turf_loc = movable_target.loc
turf_loc.remove_opacity_source(target)
///Updates old and new turf loc opacities.
/datum/element/light_blocking/proc/on_target_move(atom/movable/source, atom/OldLoc, Dir, Forced = FALSE)
if(isturf(OldLoc))
var/turf/old_turf = OldLoc
old_turf.remove_opacity_source(source)
if(isturf(source.loc))
var/turf/new_turf = source.loc
new_turf.add_opacity_source(source)
-4
View File
@@ -204,10 +204,6 @@
if (light_power && light_range)
update_light()
if (opacity && isturf(loc))
var/turf/T = loc
T.has_opaque_atom = TRUE // No need to recalculate it in this case, it's guaranteed to be on afterwards anyways.
if (length(smoothing_groups))
sortTim(smoothing_groups) //In case it's not properly ordered, let's avoid duplicate entries with the same values.
SET_BITFLAG_LIST(smoothing_groups)
+5 -7
View File
@@ -54,6 +54,7 @@
///Used for the calculate_adjacencies proc for icon smoothing.
var/can_be_unanchored = FALSE
/atom/movable/Initialize(mapload)
. = ..()
switch(blocks_emissive)
@@ -63,6 +64,8 @@
render_target = ref(src)
em_block = new(src, render_target)
vis_contents += em_block
if(opacity)
AddElement(/datum/element/light_blocking)
/atom/movable/Destroy(force)
@@ -79,13 +82,8 @@
air_update_turf(TRUE)
loc.handle_atom_del(src)
// If we have opacity, make sure to tell (potentially) affected light sources.
if(opacity && isturf(loc))
var/turf/turf_loc = loc
var/old_has_opaque_atom = turf_loc.has_opaque_atom
turf_loc.recalc_atom_opacity()
if(old_has_opaque_atom != turf_loc.has_opaque_atom)
turf_loc.reconsider_lights()
if(opacity)
RemoveElement(/datum/element/light_blocking)
invisibility = INVISIBILITY_ABSTRACT
+28 -28
View File
@@ -64,7 +64,7 @@
*/
/obj/machinery/door/airlock/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/glass/incinerator
@@ -82,28 +82,28 @@
id_tag = INCINERATOR_SYNDICATELAVA_AIRLOCK_EXTERIOR
/obj/machinery/door/airlock/command/glass
opacity = 0
opacity = FALSE
glass = TRUE
normal_integrity = 400
/obj/machinery/door/airlock/engineering/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/engineering/glass/critical
critical_machine = TRUE //stops greytide virus from opening & bolting doors in critical positions, such as the SM chamber.
/obj/machinery/door/airlock/security/glass
opacity = 0
opacity = FALSE
glass = TRUE
normal_integrity = 400
/obj/machinery/door/airlock/medical/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/research/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/research/glass/incinerator
@@ -121,30 +121,30 @@
id_tag = INCINERATOR_TOXMIX_AIRLOCK_EXTERIOR
/obj/machinery/door/airlock/mining/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/atmos/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/atmos/glass/critical
critical_machine = TRUE //stops greytide virus from opening & bolting doors in critical positions, such as the SM chamber.
/obj/machinery/door/airlock/science/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/virology/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/maintenance/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/maintenance/external/glass
opacity = 0
opacity = FALSE
glass = TRUE
normal_integrity = 200
@@ -159,7 +159,7 @@
assemblytype = /obj/structure/door_assembly/door_assembly_gold
/obj/machinery/door/airlock/gold/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/silver
@@ -168,7 +168,7 @@
assemblytype = /obj/structure/door_assembly/door_assembly_silver
/obj/machinery/door/airlock/silver/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/diamond
@@ -180,7 +180,7 @@
/obj/machinery/door/airlock/diamond/glass
normal_integrity = 950
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/uranium
@@ -201,7 +201,7 @@
return
/obj/machinery/door/airlock/uranium/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/plasma
@@ -242,7 +242,7 @@
return ..()
/obj/machinery/door/airlock/plasma/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/bananium
@@ -253,7 +253,7 @@
doorOpen = 'sound/items/bikehorn.ogg'
/obj/machinery/door/airlock/bananium/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/sandstone
@@ -262,7 +262,7 @@
assemblytype = /obj/structure/door_assembly/door_assembly_sandstone
/obj/machinery/door/airlock/sandstone/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/wood
@@ -271,7 +271,7 @@
assemblytype = /obj/structure/door_assembly/door_assembly_wood
/obj/machinery/door/airlock/wood/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/titanium
@@ -283,7 +283,7 @@
/obj/machinery/door/airlock/titanium/glass
normal_integrity = 350
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/bronze
@@ -294,7 +294,7 @@
/obj/machinery/door/airlock/bronze/seethru
assemblytype = /obj/structure/door_assembly/door_assembly_bronze/seethru
opacity = 0
opacity = FALSE
glass = TRUE
//////////////////////////////////
/*
@@ -307,7 +307,7 @@
assemblytype = /obj/structure/door_assembly/door_assembly_public
/obj/machinery/door/airlock/public/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/public/glass/incinerator
@@ -337,7 +337,7 @@
assemblytype = /obj/structure/door_assembly/door_assembly_ext
/obj/machinery/door/airlock/external/glass
opacity = 0
opacity = FALSE
glass = TRUE
//////////////////////////////////
@@ -418,7 +418,7 @@
assemblytype = /obj/structure/door_assembly/door_assembly_shuttle
/obj/machinery/door/airlock/shuttle/glass
opacity = 0
opacity = FALSE
glass = TRUE
/obj/machinery/door/airlock/abductor
@@ -515,7 +515,7 @@
/obj/machinery/door/airlock/cult/glass
glass = TRUE
opacity = 0
opacity = FALSE
/obj/machinery/door/airlock/cult/glass/friendly
friendly = TRUE
@@ -531,7 +531,7 @@
/obj/machinery/door/airlock/cult/unruned/glass
glass = TRUE
opacity = 0
opacity = FALSE
/obj/machinery/door/airlock/cult/unruned/glass/friendly
friendly = TRUE
@@ -552,7 +552,7 @@
name = "large glass airlock"
icon = 'icons/obj/doors/airlocks/glass_large/glass_large.dmi'
overlays_file = 'icons/obj/doors/airlocks/glass_large/overlays.dmi'
opacity = 0
opacity = FALSE
assemblytype = null
glass = TRUE
bound_width = 64 // 2x1
+1 -1
View File
@@ -2,7 +2,7 @@
name = "glass alarm airlock"
icon = 'icons/obj/doors/airlocks/station2/glass.dmi'
overlays_file = 'icons/obj/doors/airlocks/station2/overlays.dmi'
opacity = 0
opacity = FALSE
assemblytype = /obj/structure/door_assembly/door_assembly_public
glass = TRUE
+1 -1
View File
@@ -4,7 +4,7 @@
desc = "It opens and closes."
icon = 'icons/obj/doors/Doorint.dmi'
icon_state = "door1"
opacity = 1
opacity = TRUE
density = TRUE
move_resist = MOVE_FORCE_VERY_STRONG
layer = OPEN_DOOR_LAYER
+1 -1
View File
@@ -22,7 +22,7 @@
/obj/machinery/door/poddoor/preopen
icon_state = "open"
density = FALSE
opacity = 0
opacity = FALSE
/obj/machinery/door/poddoor/ert
name = "hardened blast door"
+1 -1
View File
@@ -10,7 +10,7 @@
/obj/machinery/door/poddoor/shutters/preopen
icon_state = "open"
density = FALSE
opacity = 0
opacity = FALSE
/obj/machinery/door/poddoor/shutters/indestructible
name = "hardened shutters"
+1 -1
View File
@@ -20,6 +20,6 @@
icon = 'icons/turf/shuttle.dmi'
name = "door"
icon_state = "door1"
opacity = 1
opacity = TRUE
density = TRUE
explosion_block = 1
+1 -1
View File
@@ -12,7 +12,7 @@
armor = list("melee" = 20, "bullet" = 50, "laser" = 50, "energy" = 50, "bomb" = 10, "bio" = 100, "rad" = 100, "fire" = 70, "acid" = 100)
visible = FALSE
flags_1 = ON_BORDER_1
opacity = 0
opacity = FALSE
CanAtmosPass = ATMOS_PASS_PROC
interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_REQUIRES_SILICON | INTERACT_MACHINE_OPEN
var/obj/item/electronics/airlock/electronics = null
+1 -1
View File
@@ -5,7 +5,7 @@
icon_state = "hypnochair"
circuit = /obj/item/circuitboard/machine/hypnochair
density = TRUE
opacity = 0
opacity = FALSE
var/mob/living/carbon/victim = null ///Keeps track of the victim to apply effects if it teleports away
var/interrogating = FALSE ///Is the device currently interrogating someone?
+2 -2
View File
@@ -5,7 +5,7 @@
icon_state = "shield-old"
density = TRUE
move_resist = INFINITY
opacity = 0
opacity = FALSE
anchored = TRUE
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
max_integrity = 200 //The shield can only take so much beating (prevents perma-prisons)
@@ -107,7 +107,7 @@
icon = 'icons/obj/objects.dmi'
icon_state = "shieldoff"
density = TRUE
opacity = 0
opacity = FALSE
anchored = FALSE
pressure_resistance = 2*ONE_ATMOSPHERE
req_access = list(ACCESS_ENGINE)
+1 -1
View File
@@ -18,7 +18,7 @@
color = "#87878715"
stepsound = null
turnsound = null
opacity = 0
/obj/mecha/combat/reticence/loaded/Initialize()
. = ..()
-1
View File
@@ -3,7 +3,6 @@
desc = "Exosuit"
icon = 'icons/mecha/mecha.dmi'
density = TRUE //Dense. To raise the heat.
opacity = TRUE //opaque. Menacing.
move_force = MOVE_FORCE_VERY_STRONG
move_resist = MOVE_FORCE_EXTREMELY_STRONG
resistance_flags = FIRE_PROOF | ACID_PROOF
+1 -1
View File
@@ -9,7 +9,7 @@
icon = 'icons/mecha/mecha.dmi'
density = TRUE
anchored = FALSE
opacity = 0
opacity = FALSE
var/list/welder_salvage = list(/obj/item/stack/sheet/plasteel, /obj/item/stack/sheet/metal, /obj/item/stack/rods)
var/salvage_num = 5
var/list/crowbar_salvage = list()
-1
View File
@@ -19,7 +19,6 @@
enclosed = FALSE //Normal ripley has an open cockpit design
enter_delay = 10 //can enter in a quarter of the time of other mechs
exit_delay = 10
opacity = FALSE //Ripley has a window
/// Amount of Goliath hides attached to the mech
var/hides = 0
/// List of all things in Ripley's Cargo Compartment
+1 -1
View File
@@ -4,7 +4,7 @@
desc = "Burbling corrosive stuff."
icon_state = "acid"
density = FALSE
opacity = 0
opacity = FALSE
anchored = TRUE
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF
layer = ABOVE_NORMAL_TURF_LAYER
+1 -1
View File
@@ -7,7 +7,7 @@
invisibility = INVISIBILITY_ABSTRACT //nope, can't see this
anchored = TRUE
density = TRUE
opacity = 0
opacity = FALSE
var/static/list/AllTeleporters
@@ -1,7 +1,7 @@
/obj/effect/particle_effect/expl_particles
name = "fire"
icon_state = "explosion_particle"
opacity = 1
opacity = TRUE
anchored = TRUE
/obj/effect/particle_effect/expl_particles/Initialize()
@@ -27,7 +27,7 @@
name = "fire"
icon = 'icons/effects/96x96.dmi'
icon_state = "explosion"
opacity = 1
opacity = TRUE
anchored = TRUE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
pixel_x = -32
@@ -8,7 +8,7 @@
/obj/effect/particle_effect/foam
name = "foam"
icon_state = "foam"
opacity = 0
opacity = FALSE
anchored = TRUE
density = FALSE
layer = EDGED_TURF_LAYER
@@ -257,7 +257,7 @@
icon = 'icons/effects/effects.dmi'
icon_state = "metalfoam"
density = TRUE
opacity = 1 // changed in New()
opacity = TRUE // changed in New()
anchored = TRUE
layer = EDGED_TURF_LAYER
resistance_flags = FIRE_PROOF | ACID_PROOF
@@ -8,7 +8,7 @@
icon_state = "smoke"
pixel_x = -32
pixel_y = -32
opacity = 0
opacity = FALSE
layer = FLY_LAYER
anchored = TRUE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
+1 -1
View File
@@ -3,7 +3,7 @@
name = "FORCEWALL"
icon_state = "m_shield"
anchored = TRUE
opacity = 0
opacity = FALSE
density = TRUE
CanAtmosPass = ATMOS_PASS_DENSITY
var/timeleft = 300 //Set to 0 for permanent forcefields (ugh)
+1 -1
View File
@@ -4,7 +4,7 @@
name = "glowshroom"
desc = "Mycena Bregprox, a species of mushroom that glows in the dark."
anchored = TRUE
opacity = 0
opacity = FALSE
density = FALSE
icon = 'icons/obj/lighting.dmi'
icon_state = "glowshroom" //replaced in New
+1 -1
View File
@@ -12,7 +12,7 @@ RLD
/obj/item/construction
name = "not for ingame use"
desc = "A device used to rapidly build and deconstruct. Reload with metal, plasteel, glass or compressed matter cartridges."
opacity = 0
opacity = FALSE
density = FALSE
anchored = FALSE
flags_1 = CONDUCT_1
+1 -1
View File
@@ -14,7 +14,7 @@ RSF
var/spent_icon_state = "rsf_empty"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
opacity = 0
opacity = FALSE
density = FALSE
anchored = FALSE
item_flags = NOBLUDGEON
@@ -4,7 +4,7 @@
icon = 'icons/obj/machines/implantchair.dmi'
icon_state = "implantchair"
density = TRUE
opacity = 0
opacity = FALSE
var/ready = TRUE
var/replenishing = FALSE
+2 -2
View File
@@ -55,7 +55,7 @@
icon = 'icons/obj/smooth_structures/alien/resin_wall.dmi'
icon_state = "smooth"
density = TRUE
opacity = 1
opacity = TRUE
anchored = TRUE
smoothing_flags = SMOOTH_CORNERS
smoothing_groups = list(SMOOTH_GROUP_ALIEN_RESIN)
@@ -91,7 +91,7 @@
desc = "Resin just thin enough to let light pass through."
icon = 'icons/obj/smooth_structures/alien/resin_membrane.dmi'
icon_state = "smooth"
opacity = 0
opacity = FALSE
max_integrity = 160
resintype = "membrane"
smoothing_groups = list(SMOOTH_GROUP_ALIEN_RESIN, SMOOTH_GROUP_ALIEN_WALLS)
+1 -1
View File
@@ -9,7 +9,7 @@
icon_state = "wall"
layer = LOW_OBJ_LAYER
density = TRUE
opacity = 1
opacity = TRUE
max_integrity = 100
smoothing_flags = SMOOTH_CORNERS
smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS)
+2 -2
View File
@@ -7,7 +7,7 @@
icon_state = "minibar"
anchored = TRUE
density = FALSE
opacity = 0
opacity = FALSE
var/deconstructible = TRUE
/obj/structure/fluff/attackby(obj/item/I, mob/living/user, params)
@@ -261,4 +261,4 @@
deconstructible = FALSE
/obj/structure/fluff/hedge/opaque //useful for mazes and such
opacity = 1
opacity = TRUE
+1 -1
View File
@@ -6,7 +6,7 @@
icon_state = "shotguncase"
anchored = FALSE
density = TRUE
opacity = 0
opacity = FALSE
var/case_type = ""
var/gun_category = /obj/item/gun
var/open = TRUE
+1 -1
View File
@@ -1,7 +1,7 @@
/obj/structure/sign
icon = 'icons/obj/decals.dmi'
anchored = TRUE
opacity = 0
opacity = FALSE
density = FALSE
layer = SIGN_LAYER
custom_materials = list(/datum/material/plastic = 2000)
+2 -2
View File
@@ -441,13 +441,13 @@
density = TRUE
open = FALSE
if(opaque_closed)
opacity = TRUE
set_opacity(TRUE)
else
icon_state = "[icon_type]-open"
layer = SIGN_LAYER
density = FALSE
open = TRUE
opacity = FALSE
set_opacity(FALSE)
/obj/structure/curtain/attackby(obj/item/W, mob/user)
if (istype(W, /obj/item/toy/crayon))
+1 -1
View File
@@ -576,7 +576,7 @@
/obj/structure/window/reinforced/tinted
name = "tinted window"
icon_state = "twindow"
opacity = 1
opacity = TRUE
/obj/structure/window/reinforced/tinted/frosted
name = "frosted window"
icon_state = "fwindow"
+3 -3
View File
@@ -103,7 +103,7 @@
name = "propulsion engine"
icon_state = "propulsion"
desc = "A standard reliable bluespace engine used by many forms of shuttles."
opacity = 1
opacity = TRUE
/obj/structure/shuttle/engine/propulsion/left
name = "left propulsion engine"
@@ -136,7 +136,7 @@
/obj/structure/shuttle/engine/large
name = "engine"
opacity = 1
opacity = TRUE
icon = 'icons/obj/2x2.dmi'
icon_state = "large_engine"
desc = "A very large bluespace engine used to propel very large ships."
@@ -146,7 +146,7 @@
/obj/structure/shuttle/engine/huge
name = "engine"
opacity = 1
opacity = TRUE
icon = 'icons/obj/3x3.dmi'
icon_state = "huge_engine"
desc = "An extremely large bluespace engine used to propel extremely large ships."
+3 -4
View File
@@ -77,11 +77,11 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
if(flags & CHANGETURF_SKIP)
return new path(src)
var/old_opacity = opacity
var/old_dynamic_lighting = dynamic_lighting
var/old_affecting_lights = affecting_lights
var/old_lighting_object = lighting_object
var/old_corners = corners
var/old_directional_opacity = directional_opacity
var/old_exl = explosion_level
var/old_exi = explosion_id
@@ -117,12 +117,11 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
W.blueprint_data = old_bp
if(SSlighting.initialized)
recalc_atom_opacity()
lighting_object = old_lighting_object
affecting_lights = old_affecting_lights
corners = old_corners
if (old_opacity != opacity || dynamic_lighting != old_dynamic_lighting)
reconsider_lights()
directional_opacity = old_directional_opacity
recalculate_directional_opacity()
if (dynamic_lighting != old_dynamic_lighting)
if (IS_DYNAMIC_LIGHTING(src))
+3 -3
View File
@@ -1,6 +1,6 @@
/turf/closed
layer = CLOSED_TURF_LAYER
opacity = 1
opacity = TRUE
density = TRUE
blocks_air = TRUE
flags_1 = RAD_PROTECT_CONTENTS_1 | RAD_NO_CONTAMINATE_1
@@ -114,7 +114,7 @@
/turf/closed/indestructible/fakeglass
name = "window"
icon_state = "fake_window"
opacity = 0
opacity = FALSE
smoothing_flags = SMOOTH_CORNERS
icon = 'icons/obj/smooth_structures/reinforced_window.dmi'
@@ -127,7 +127,7 @@
/turf/closed/indestructible/opsglass
name = "window"
icon_state = "plastitanium_window"
opacity = 0
opacity = FALSE
smoothing_flags = SMOOTH_CORNERS
icon = 'icons/obj/smooth_structures/plastitanium_window.dmi'
+1 -1
View File
@@ -10,7 +10,7 @@
canSmoothWith = list(SMOOTH_GROUP_MINERAL_WALLS)
baseturfs = /turf/open/floor/plating/asteroid/airless
initial_gas_mix = AIRLESS_ATMOS
opacity = 1
opacity = TRUE
density = TRUE
layer = EDGED_TURF_LAYER
temperature = TCMB
+1 -1
View File
@@ -3,7 +3,7 @@
desc = "A huge chunk of reinforced metal used to separate rooms."
icon = 'icons/turf/walls/reinforced_wall.dmi'
icon_state = "r_wall"
opacity = 1
opacity = TRUE
density = TRUE
var/d_state = INTACT
+1 -1
View File
@@ -61,7 +61,7 @@
update_light()
if (opacity)
has_opaque_atom = TRUE
directional_opacity = ALL_CARDINALS
ComponentInitialize()
+17 -8
View File
@@ -3,6 +3,7 @@ GLOBAL_LIST_EMPTY(station_turfs)
icon = 'icons/turf/floors.dmi'
flags_1 = CAN_BE_DIRTY_1
vis_flags = VIS_INHERIT_ID|VIS_INHERIT_PLANE // Important for interaction with and visualization of openspace.
luminosity = 1
var/intact = 1
@@ -37,6 +38,21 @@ GLOBAL_LIST_EMPTY(station_turfs)
///Icon-smoothing variable to map a diagonal wall corner with a fixed underlay.
var/list/fixed_underlay = null
var/dynamic_lighting = TRUE
var/tmp/lighting_corners_initialised = FALSE
///List of light sources affecting this turf.
var/tmp/list/datum/light_source/affecting_lights
///Our lighting object.
var/tmp/atom/movable/lighting_object/lighting_object
var/tmp/list/datum/lighting_corner/corners
///Which directions does this turf block the vision of, taking into account both the turf's opacity and the movable opacity_sources.
var/directional_opacity = NONE
///Lazylist of movable atoms providing opacity sources.
var/list/atom/movable/opacity_sources
/turf/vv_edit_var(var_name, new_value)
var/static/list/banned_edits = list("x", "y", "z")
@@ -99,7 +115,7 @@ GLOBAL_LIST_EMPTY(station_turfs)
SEND_SIGNAL(T, COMSIG_TURF_MULTIZ_NEW, src, UP)
if (opacity)
has_opaque_atom = TRUE
directional_opacity = ALL_CARDINALS
// apply materials properly from the default custom_materials value
set_custom_materials(custom_materials)
@@ -288,13 +304,6 @@ GLOBAL_LIST_EMPTY(station_turfs)
if(QDELETED(mover))
return FALSE //We were deleted.
/turf/Entered(atom/movable/AM)
..()
// If an opaque movable atom moves around we need to potentially update visibility.
if (AM.opacity)
has_opaque_atom = TRUE // Make sure to do this before reconsider_lights(), incase we're on instant updates. Guaranteed to be on in this case.
reconsider_lights()
/turf/open/Entered(atom/movable/AM)
..()
@@ -5,7 +5,7 @@
light_range = 2
desc = "A thick wall of writhing tendrils."
density = FALSE //this being false causes two bugs, being able to attack blob tiles behind other blobs and being unable to move on blob tiles in no gravity, but turning it to 1 causes the blob mobs to be unable to path through blobs, which is probably worse.
opacity = 0
opacity = FALSE
anchored = TRUE
layer = BELOW_MOB_LAYER
CanAtmosPass = ATMOS_PASS_PROC
@@ -419,7 +419,7 @@
/turf/proc/conductivity_directions()
if(archived_cycle < SSair.times_fired)
archive()
return NORTH|SOUTH|EAST|WEST
return ALL_CARDINALS
/turf/open/conductivity_directions()
if(blocks_air)
@@ -23,7 +23,7 @@
return ..()
/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/SetInitDirections()
initialize_directions = NORTH|SOUTH|EAST|WEST
initialize_directions = ALL_CARDINALS
initialize_directions &= ~dir
/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/update_icon()
@@ -7,7 +7,7 @@
name = "4-way pipe manifold"
desc = "A manifold composed of heat-exchanging pipes."
initialize_directions = NORTH|SOUTH|EAST|WEST
initialize_directions = ALL_CARDINALS
device_type = QUATERNARY
@@ -27,7 +27,7 @@
return ..()
/obj/machinery/atmospherics/pipe/manifold/SetInitDirections()
initialize_directions = NORTH|SOUTH|EAST|WEST
initialize_directions = ALL_CARDINALS
initialize_directions &= ~dir
/obj/machinery/atmospherics/pipe/manifold/update_icon()
@@ -7,7 +7,7 @@
name = "4-way pipe manifold"
desc = "A manifold composed of regular pipes."
initialize_directions = NORTH|SOUTH|EAST|WEST
initialize_directions = ALL_CARDINALS
device_type = QUATERNARY
@@ -246,7 +246,7 @@
density = FALSE
anchored = TRUE
invisibility = INVISIBILITY_ABSTRACT
opacity = 0
opacity = FALSE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
var/mob/holder
var/phase_time = 0
+1 -1
View File
@@ -21,7 +21,7 @@
desc = "A great place for storing knowledge."
anchored = FALSE
density = TRUE
opacity = 0
opacity = FALSE
resistance_flags = FLAMMABLE
max_integrity = 200
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 0)
+23 -12
View File
@@ -41,25 +41,36 @@
light = new/datum/light_source(src, .)
// Should always be used to change the opacity of an atom.
// It notifies (potentially) affected light sources so they can update (if needed).
/**
* Updates the atom's opacity value.
*
* This exists to act as a hook for associated behavior.
* It notifies (potentially) affected light sources so they can update (if needed).
*/
/atom/proc/set_opacity(new_opacity)
if (new_opacity == opacity)
return
SEND_SIGNAL(src, COMSIG_ATOM_SET_OPACITY, new_opacity)
. = opacity
opacity = new_opacity
var/turf/T = loc
if (!isturf(T))
/atom/movable/set_opacity(new_opacity)
. = ..()
if(isnull(.) || !isturf(loc))
return
if (new_opacity == TRUE)
T.has_opaque_atom = TRUE
T.reconsider_lights()
if(opacity)
AddElement(/datum/element/light_blocking)
else
var/old_has_opaque_atom = T.has_opaque_atom
T.recalc_atom_opacity()
if (old_has_opaque_atom != T.has_opaque_atom)
T.reconsider_lights()
RemoveElement(/datum/element/light_blocking)
/turf/set_opacity(new_opacity)
. = ..()
if(isnull(.))
return
recalculate_directional_opacity()
/atom/movable/Moved(atom/OldLoc, Dir)
+1 -1
View File
@@ -224,7 +224,7 @@
for(T in view(CEILING(light_range, 1), source_turf))
if((!IS_DYNAMIC_LIGHTING(T) && !T.light_sources))
continue
if(!T.has_opaque_atom)
if(!IS_OPAQUE_TURF(T))
if (!T.lighting_corners_initialised)
T.generate_missing_corners()
for (thing in T.corners)
+34 -24
View File
@@ -1,14 +1,3 @@
/turf
var/dynamic_lighting = TRUE
luminosity = 1
var/tmp/lighting_corners_initialised = FALSE
var/tmp/list/datum/light_source/affecting_lights // List of light sources affecting this turf.
var/tmp/atom/movable/lighting_object/lighting_object // Our lighting object.
var/tmp/list/datum/lighting_corner/corners
var/tmp/has_opaque_atom = FALSE // Not to be confused with opacity, this will be TRUE if there's any opaque atom on the tile.
// Causes any affecting light sources to be queued for a visibility update, for example a door got opened.
/turf/proc/reconsider_lights()
var/datum/light_source/L
@@ -86,21 +75,42 @@
return !lighting_object.luminosity
// Can't think of a good name, this proc will recalculate the has_opaque_atom variable.
/turf/proc/recalc_atom_opacity()
has_opaque_atom = opacity
if (!has_opaque_atom)
for (var/atom/A in src.contents) // Loop through every movable atom on our tile PLUS ourselves (we matter too...)
if (A.opacity)
has_opaque_atom = TRUE
break
/turf/Exited(atom/movable/Obj, atom/newloc)
. = ..()
///Proc to add movable sources of opacity on the turf and let it handle lighting code.
/turf/proc/add_opacity_source(atom/movable/new_source)
LAZYADD(opacity_sources, new_source)
if(opacity)
return
recalculate_directional_opacity()
///Proc to remove movable sources of opacity on the turf and let it handle lighting code.
/turf/proc/remove_opacity_source(atom/movable/old_source)
LAZYREMOVE(opacity_sources, old_source)
if(opacity) //Still opaque, no need to worry on updating.
return
recalculate_directional_opacity()
///Calculate on which directions this turfs block view.
/turf/proc/recalculate_directional_opacity()
. = directional_opacity
if(opacity)
directional_opacity = ALL_CARDINALS
if(. != directional_opacity)
reconsider_lights()
return
directional_opacity = NONE
for(var/am in opacity_sources)
var/atom/movable/opacity_source = am
if(opacity_source.flags_1 & ON_BORDER_1)
directional_opacity |= opacity_source.dir
else //If fulltile and opaque, then the whole tile blocks view, no need to continue checking.
directional_opacity = ALL_CARDINALS
break
if(. != directional_opacity && (. == ALL_CARDINALS || directional_opacity == ALL_CARDINALS))
reconsider_lights() //The lighting system only cares whether the tile is fully concealed from all directions or not.
if (Obj && Obj.opacity)
recalc_atom_opacity() // Make sure to do this before reconsider_lights(), incase we're on instant updates.
reconsider_lights()
/turf/proc/change_area(area/old_area, area/new_area)
if(SSlighting.initialized)
@@ -460,7 +460,7 @@ Difficulty: Medium
icon = 'icons/effects/fire.dmi'
icon_state = "1"
anchored = TRUE
opacity = 0
opacity = FALSE
density = TRUE
CanAtmosPass = ATMOS_PASS_DENSITY
duration = 82
@@ -10,7 +10,7 @@ It is possible to destroy the net by the occupant or someone else.
icon_state = "energynet"
density = TRUE//Can't pass through.
opacity = 0//Can see through.
opacity = FALSE //Can see through.
mouse_opacity = MOUSE_OPACITY_ICON//So you can hit it with stuff.
anchored = TRUE//Can't drag/grab the net.
layer = ABOVE_ALL_MOB_LAYER
+1 -1
View File
@@ -145,7 +145,7 @@
x_hit += target_x
y_hit += target_y
hit = locate(round(x_hit, 1), round(y_hit, 1), z)
if(hit.opacity)
if(IS_OPAQUE_TURF(hit))
return
if(hit.x == 1 || hit.x == world.maxx || hit.y == 1 || hit.y == world.maxy) //edge of the map
break
+1 -1
View File
@@ -97,7 +97,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
anchored = TRUE // Crap like fireball projectiles are proc_holders, this is needed so fireballs don't get blown back into your face via atmos etc.
pass_flags = PASSTABLE
density = FALSE
opacity = 0
opacity = FALSE
var/school = "evocation" //not relevant at now, but may be important later if there are changes to how spells work. the ones I used for now will probably be changed... maybe spell presets? lacking flexibility but with some other benefit?
+1 -1
View File
@@ -322,7 +322,7 @@
on_mob.forceMove(scanning)
for(var/i in 1 to light_beam_distance)
scanning = get_step(scanning, scandir)
if(scanning.opacity || scanning.has_opaque_atom)
if(IS_OPAQUE_TURF(scanning))
stop = TRUE
var/obj/effect/abstract/eye_lighting/L = LAZYACCESS(eye_lighting, i)
if(stop)
+2 -1
View File
@@ -114,7 +114,7 @@
#include "code\__DEFINES\time.dm"
#include "code\__DEFINES\tools.dm"
#include "code\__DEFINES\traits.dm"
#include "code\__DEFINES\turf_flags.dm"
#include "code\__DEFINES\turfs.dm"
#include "code\__DEFINES\typeids.dm"
#include "code\__DEFINES\vehicles.dm"
#include "code\__DEFINES\vv.dm"
@@ -563,6 +563,7 @@
#include "code\datums\elements\embed.dm"
#include "code\datums\elements\firestacker.dm"
#include "code\datums\elements\forced_gravity.dm"
#include "code\datums\elements\light_blocking.dm"
#include "code\datums\elements\selfknockback.dm"
#include "code\datums\elements\snail_crawl.dm"
#include "code\datums\elements\squish.dm"