mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-13 02:13:06 +00:00
* Smoothing groups optimization, save 265ms with configs, more on production & w/ space ruins (#71989) This one is fun. On every /turf/Initialize and /atom/Initialize, we try to set `smoothing_groups` and `canSmoothWith` to a cached list of bitfields. At the type level, these are specified as lists of IDs, which are then `Join`ed in Initialize, and retrieved from the cache (or built from there). The problem is that the cache only misses about 60 times, but the cache hits more than a hundred thousand times. This means we eat the cost of `Join` (which is very very slow, because strings + BYOND), as well as the preliminary `length` checks, for every single atom. Furthermore, as you might remember, if you have any list variable set on a type, it'll create a hidden `(init)` proc to create the list. On turfs, that costs us about 60ms. This PR does a cool trick where we can completely eliminate the `Join` *and* the lists at the cost of a little more work when building the cache. The trick is that we replace the current type definitions with this: ```patch - smoothing_groups = list(SMOOTH_GROUP_TURF_OPEN, SMOOTH_GROUP_FLOOR_ASH) - canSmoothWith = list(SMOOTH_GROUP_FLOOR_ASH, SMOOTH_GROUP_CLOSED_TURFS) + smoothing_groups = SMOOTH_GROUP_TURF_OPEN + SMOOTH_GROUP_FLOOR_ASH + canSmoothWith = SMOOTH_GROUP_FLOOR_ASH + SMOOTH_GROUP_CLOSED_TURFS ``` These defines, instead of being numbers, are now segments of a string, delimited by commas. For instance, if ASH used to be 13, and CLOSED_TURFS used to be 37, this used to equal `list(13, 37)`. Now, it equals `"13,37,"`. Then, when the cache misses, we take that string, and treat it as part of a JSON list, and decode it from there. Meaning: ```java // Starting value "13,37," // We have a trailing comma, so add a dummy value "13,37,0" // Make it an array "[13,37,0]" // Decode list(13, 37, 0) // Chop off the dummy value list(13, 37) // Done! ``` This on its own eliminates 265ms *without space ruins*, with the combined savings of turf/Initialize, atom/Initialize, and the hidden (init) procs that no longer exist. Furthermore, there's some other fun stuff we gain from this approach emergently. We previously had a difference between `S_TURF` and `S_OBJ`. The idea is that if you have any smoothing groups with `S_OBJ`, then you will gain the `SMOOTH_OBJ` bitflag (though note to self, I need to check that the cost of adding this is actually worth it). This is achieved by the fact that `S_OBJ` simply takes the last turf, and adds onto that, meaning that if the biggest value in the sorting groups is greater than that, then we know we're going to be smoothing to objects. This new method provides a limitation here. BYOND has no way of converting a number to a string at compile time, meaning that we can't evaluate `MAX_S_TURF + offset` into a string. Instead, in order to preserve the nice UX, `S_OBJ` now instead opts to make the numbers negative. This means that what used to be something like: ```dm smoothing_groups = list(SMOOTH_GROUP_ALIEN_RESIN, SMOOTH_GROUP_ALIEN_WEEDS) ``` ...which may have been represented as ```dm smoothing_groups = list(15, MAX_S_TURF + 3) ``` ...will now become, at compile time: ```dm smoothing_groups = "15,-3," ``` Except! Because we guarantee smoothing groups are sorted through unit testing, this is actually going to look like: ```dm smoothing_groups = "-3,15," ``` Meaning that we can now check if we're smoothing with objects just by checking if `smoothing_groups[1] == "-"`, as that's the only way that is possible. Neat! Furthermore, though much simpler, what used to be `if (length(smoothing_groups))` (and canSmoothWith) on every single atom/Initialize and turf/Initialize can now be `if (smoothing_groups)`, since empty strings are falsy. `length` is about 15% slower than doing nothing, so in procs as hot as this, this gives some nice gains just on its own. For developers, very little changes. Instead of using `list`, you now use `+`. The order might change, as `S_OBJ` now needs to come first, but unit tests will catch you if you mess up. Also, you will notice that all `S_OBJ` have been increased by one. This is because we used to have `S_TURF(0)` and `S_OBJ(0)`, but with this new trick, -0 == 0, and so they conflicted and needed to be changed. * Sorting how did I miss it Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: Funce <funce.973@gmail.com>
432 lines
14 KiB
Plaintext
432 lines
14 KiB
Plaintext
/*
|
|
* False Walls
|
|
*/
|
|
/obj/structure/falsewall
|
|
name = "wall"
|
|
desc = "A huge chunk of metal used to separate rooms."
|
|
anchored = TRUE
|
|
//icon = 'icons/turf/walls/wall.dmi' //ORIGINAL
|
|
icon = 'modular_skyrat/modules/aesthetics/walls/icons/wall.dmi' //SKYRAT EDIT CHANGE - AESTHETICS
|
|
icon_state = "wall-0"
|
|
base_icon_state = "wall"
|
|
layer = LOW_OBJ_LAYER
|
|
density = TRUE
|
|
opacity = TRUE
|
|
max_integrity = 100
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_WALLS + SMOOTH_GROUP_CLOSED_TURFS
|
|
canSmoothWith = SMOOTH_GROUP_WALLS
|
|
can_be_unanchored = FALSE
|
|
can_atmos_pass = ATMOS_PASS_DENSITY
|
|
rad_insulation = RAD_MEDIUM_INSULATION
|
|
material_flags = MATERIAL_EFFECTS
|
|
var/mineral = /obj/item/stack/sheet/iron
|
|
var/mineral_amount = 2
|
|
var/walltype = /turf/closed/wall
|
|
var/girder_type = /obj/structure/girder/displaced
|
|
var/opening = FALSE
|
|
|
|
|
|
/obj/structure/falsewall/Initialize(mapload)
|
|
. = ..()
|
|
var/obj/item/stack/initialized_mineral = new mineral // Okay this kinda sucks.
|
|
set_custom_materials(initialized_mineral.mats_per_unit, mineral_amount)
|
|
qdel(initialized_mineral)
|
|
air_update_turf(TRUE, TRUE)
|
|
|
|
/obj/structure/falsewall/attack_hand(mob/user, list/modifiers)
|
|
if(opening)
|
|
return
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
opening = TRUE
|
|
update_appearance()
|
|
if(!density)
|
|
var/srcturf = get_turf(src)
|
|
for(var/mob/living/obstacle in srcturf) //Stop people from using this as a shield
|
|
opening = FALSE
|
|
return
|
|
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/structure/falsewall, toggle_open)), 5)
|
|
|
|
/obj/structure/falsewall/proc/toggle_open()
|
|
if(!QDELETED(src))
|
|
set_density(!density)
|
|
set_opacity(density)
|
|
opening = FALSE
|
|
update_appearance()
|
|
air_update_turf(TRUE, !density)
|
|
|
|
/obj/structure/falsewall/update_icon(updates=ALL)//Calling icon_update will refresh the smoothwalls if it's closed, otherwise it will make sure the icon is correct if it's open
|
|
. = ..()
|
|
if(!density || !(updates & UPDATE_SMOOTHING))
|
|
return
|
|
|
|
if(opening)
|
|
smoothing_flags = NONE
|
|
clear_smooth_overlays()
|
|
else
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
QUEUE_SMOOTH(src)
|
|
|
|
/obj/structure/falsewall/update_icon_state()
|
|
if(opening)
|
|
icon_state = "fwall_[density ? "opening" : "closing"]"
|
|
return ..()
|
|
icon_state = density ? "[base_icon_state]-[smoothing_junction]" : "fwall_open"
|
|
return ..()
|
|
|
|
/obj/structure/falsewall/proc/ChangeToWall(delete = 1)
|
|
var/turf/T = get_turf(src)
|
|
T.PlaceOnTop(walltype)
|
|
if(delete)
|
|
qdel(src)
|
|
return T
|
|
|
|
/obj/structure/falsewall/tool_act(mob/living/user, obj/item/tool)
|
|
if(!opening)
|
|
return ..()
|
|
to_chat(user, span_warning("You must wait until the door has stopped moving!"))
|
|
return TOOL_ACT_TOOLTYPE_SUCCESS
|
|
|
|
/obj/structure/falsewall/screwdriver_act(mob/living/user, obj/item/tool)
|
|
if(!density)
|
|
to_chat(user, span_warning("You can't reach, close it first!"))
|
|
return
|
|
var/turf/loc_turf = get_turf(src)
|
|
if(loc_turf.density)
|
|
to_chat(user, span_warning("[src] is blocked!"))
|
|
return TOOL_ACT_TOOLTYPE_SUCCESS
|
|
if(!isfloorturf(loc_turf))
|
|
to_chat(user, span_warning("[src] bolts must be tightened on the floor!"))
|
|
return TOOL_ACT_TOOLTYPE_SUCCESS
|
|
user.visible_message(span_notice("[user] tightens some bolts on the wall."), span_notice("You tighten the bolts on the wall."))
|
|
ChangeToWall()
|
|
return TOOL_ACT_TOOLTYPE_SUCCESS
|
|
|
|
|
|
/obj/structure/falsewall/welder_act(mob/living/user, obj/item/tool)
|
|
if(tool.use_tool(src, user, 0 SECONDS, volume=50))
|
|
dismantle(user, TRUE)
|
|
return TOOL_ACT_TOOLTYPE_SUCCESS
|
|
return
|
|
|
|
/obj/structure/falsewall/attackby(obj/item/W, mob/user, params)
|
|
if(!opening)
|
|
to_chat(user, span_warning("You must wait until the door has stopped moving!"))
|
|
return
|
|
return ..()
|
|
|
|
/obj/structure/falsewall/proc/dismantle(mob/user, disassembled=TRUE, obj/item/tool = null)
|
|
user.visible_message(span_notice("[user] dismantles the false wall."), span_notice("You dismantle the false wall."))
|
|
if(tool)
|
|
tool.play_tool_sound(src, 100)
|
|
else
|
|
playsound(src, 'sound/items/welder.ogg', 100, TRUE)
|
|
deconstruct(disassembled)
|
|
|
|
/obj/structure/falsewall/deconstruct(disassembled = TRUE)
|
|
if(!(flags_1 & NODECONSTRUCT_1))
|
|
if(disassembled)
|
|
new girder_type(loc)
|
|
if(mineral_amount)
|
|
for(var/i in 1 to mineral_amount)
|
|
new mineral(loc)
|
|
qdel(src)
|
|
|
|
/obj/structure/falsewall/get_dumping_location()
|
|
return null
|
|
|
|
/obj/structure/falsewall/examine_status(mob/user) //So you can't detect falsewalls by examine.
|
|
to_chat(user, span_notice("The outer plating is <b>welded</b> firmly in place."))
|
|
return null
|
|
|
|
/*
|
|
* False R-Walls
|
|
*/
|
|
|
|
/obj/structure/falsewall/reinforced
|
|
name = "reinforced wall"
|
|
desc = "A huge chunk of reinforced metal used to separate rooms."
|
|
//icon = 'icons/turf/walls/reinforced_wall.dmi'
|
|
icon = 'modular_skyrat/modules/aesthetics/walls/icons/reinforced_wall.dmi' //SKYRAT EDIT CHANGE - AESTHETICS
|
|
icon_state = "reinforced_wall-0"
|
|
base_icon_state = "reinforced_wall"
|
|
walltype = /turf/closed/wall/r_wall
|
|
mineral = /obj/item/stack/sheet/plasteel
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
|
|
/obj/structure/falsewall/reinforced/examine_status(mob/user)
|
|
to_chat(user, span_notice("The outer <b>grille</b> is fully intact."))
|
|
return null
|
|
|
|
/obj/structure/falsewall/reinforced/attackby(obj/item/tool, mob/user)
|
|
..()
|
|
if(tool.tool_behaviour == TOOL_WIRECUTTER)
|
|
dismantle(user, TRUE, tool)
|
|
|
|
/*
|
|
* Uranium Falsewalls
|
|
*/
|
|
|
|
/obj/structure/falsewall/uranium
|
|
name = "uranium wall"
|
|
desc = "A wall with uranium plating. This is probably a bad idea."
|
|
icon = 'icons/turf/walls/uranium_wall.dmi'
|
|
icon_state = "uranium_wall-0"
|
|
base_icon_state = "uranium_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/uranium
|
|
walltype = /turf/closed/wall/mineral/uranium
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_URANIUM_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_URANIUM_WALLS
|
|
|
|
/// Mutex to prevent infinite recursion when propagating radiation pulses
|
|
var/active = null
|
|
|
|
/// The last time a radiation pulse was performed
|
|
var/last_event = 0
|
|
|
|
/obj/structure/falsewall/uranium/Initialize(mapload)
|
|
. = ..()
|
|
RegisterSignal(src, COMSIG_ATOM_PROPAGATE_RAD_PULSE, PROC_REF(radiate))
|
|
|
|
/obj/structure/falsewall/uranium/attackby(obj/item/W, mob/user, params)
|
|
radiate()
|
|
return ..()
|
|
|
|
/obj/structure/falsewall/uranium/attack_hand(mob/user, list/modifiers)
|
|
radiate()
|
|
return ..()
|
|
|
|
/obj/structure/falsewall/uranium/proc/radiate()
|
|
SIGNAL_HANDLER
|
|
if(active)
|
|
return
|
|
if(world.time <= last_event + 1.5 SECONDS)
|
|
return
|
|
active = TRUE
|
|
radiation_pulse(
|
|
src,
|
|
max_range = 3,
|
|
threshold = RAD_LIGHT_INSULATION,
|
|
chance = URANIUM_IRRADIATION_CHANCE,
|
|
minimum_exposure_time = URANIUM_RADIATION_MINIMUM_EXPOSURE_TIME,
|
|
)
|
|
propagate_radiation_pulse()
|
|
last_event = world.time
|
|
active = FALSE
|
|
/*
|
|
* Other misc falsewall types
|
|
*/
|
|
|
|
/obj/structure/falsewall/gold
|
|
name = "gold wall"
|
|
desc = "A wall with gold plating. Swag!"
|
|
icon = 'icons/turf/walls/gold_wall.dmi'
|
|
icon_state = "gold_wall-0"
|
|
base_icon_state = "gold_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/gold
|
|
walltype = /turf/closed/wall/mineral/gold
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_GOLD_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_GOLD_WALLS
|
|
|
|
/obj/structure/falsewall/silver
|
|
name = "silver wall"
|
|
desc = "A wall with silver plating. Shiny."
|
|
icon = 'icons/turf/walls/silver_wall.dmi'
|
|
icon_state = "silver_wall-0"
|
|
base_icon_state = "silver_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/silver
|
|
walltype = /turf/closed/wall/mineral/silver
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_SILVER_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_SILVER_WALLS
|
|
|
|
/obj/structure/falsewall/diamond
|
|
name = "diamond wall"
|
|
desc = "A wall with diamond plating. You monster."
|
|
icon = 'icons/turf/walls/diamond_wall.dmi'
|
|
icon_state = "diamond_wall-0"
|
|
base_icon_state = "diamond_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/diamond
|
|
walltype = /turf/closed/wall/mineral/diamond
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_DIAMOND_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_DIAMOND_WALLS
|
|
max_integrity = 800
|
|
|
|
/obj/structure/falsewall/plasma
|
|
name = "plasma wall"
|
|
desc = "A wall with plasma plating. This is definitely a bad idea."
|
|
icon = 'icons/turf/walls/plasma_wall.dmi'
|
|
icon_state = "plasma_wall-0"
|
|
base_icon_state = "plasma_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/plasma
|
|
walltype = /turf/closed/wall/mineral/plasma
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_PLASMA_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_PLASMA_WALLS
|
|
|
|
/obj/structure/falsewall/bananium
|
|
name = "bananium wall"
|
|
desc = "A wall with bananium plating. Honk!"
|
|
icon = 'icons/turf/walls/bananium_wall.dmi'
|
|
icon_state = "bananium_wall-0"
|
|
base_icon_state = "bananium_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/bananium
|
|
walltype = /turf/closed/wall/mineral/bananium
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_BANANIUM_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_BANANIUM_WALLS
|
|
|
|
|
|
/obj/structure/falsewall/sandstone
|
|
name = "sandstone wall"
|
|
desc = "A wall with sandstone plating. Rough."
|
|
icon = 'icons/turf/walls/sandstone_wall.dmi'
|
|
icon_state = "sandstone_wall-0"
|
|
base_icon_state = "sandstone_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/sandstone
|
|
walltype = /turf/closed/wall/mineral/sandstone
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_SANDSTONE_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_SANDSTONE_WALLS
|
|
|
|
/obj/structure/falsewall/wood
|
|
name = "wooden wall"
|
|
desc = "A wall with wooden plating. Stiff."
|
|
icon = 'icons/turf/walls/wood_wall.dmi'
|
|
icon_state = "wood_wall-0"
|
|
base_icon_state = "wood_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/wood
|
|
walltype = /turf/closed/wall/mineral/wood
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_WOOD_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_WOOD_WALLS
|
|
|
|
/obj/structure/falsewall/bamboo
|
|
name = "bamboo wall"
|
|
desc = "A wall with bamboo finish. Zen."
|
|
icon = 'icons/turf/walls/bamboo_wall.dmi'
|
|
mineral = /obj/item/stack/sheet/mineral/bamboo
|
|
walltype = /turf/closed/wall/mineral/bamboo
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_WALLS + SMOOTH_GROUP_BAMBOO_WALLS + SMOOTH_GROUP_CLOSED_TURFS
|
|
canSmoothWith = SMOOTH_GROUP_BAMBOO_WALLS
|
|
|
|
/obj/structure/falsewall/iron
|
|
name = "rough iron wall"
|
|
desc = "A wall with rough metal plating."
|
|
icon = 'icons/turf/walls/iron_wall.dmi'
|
|
icon_state = "iron_wall-0"
|
|
base_icon_state = "iron_wall"
|
|
mineral = /obj/item/stack/rods
|
|
mineral_amount = 5
|
|
walltype = /turf/closed/wall/mineral/iron
|
|
base_icon_state = "iron_wall"
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_IRON_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_IRON_WALLS
|
|
|
|
/obj/structure/falsewall/abductor
|
|
name = "alien wall"
|
|
desc = "A wall with alien alloy plating."
|
|
icon = 'icons/turf/walls/abductor_wall.dmi'
|
|
icon_state = "abductor_wall-0"
|
|
base_icon_state = "abductor_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/abductor
|
|
walltype = /turf/closed/wall/mineral/abductor
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_ABDUCTOR_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_ABDUCTOR_WALLS
|
|
|
|
/obj/structure/falsewall/titanium
|
|
name = "wall"
|
|
desc = "A light-weight titanium wall used in shuttles."
|
|
icon = 'icons/turf/walls/shuttle_wall.dmi'
|
|
icon_state = "shuttle_wall-0"
|
|
base_icon_state = "shuttle_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/titanium
|
|
walltype = /turf/closed/wall/mineral/titanium
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_TITANIUM_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_SHUTTLE_PARTS + SMOOTH_GROUP_AIRLOCK + SMOOTH_GROUP_TITANIUM_WALLS
|
|
|
|
/obj/structure/falsewall/plastitanium
|
|
name = "wall"
|
|
desc = "An evil wall of plasma and titanium."
|
|
icon = 'icons/turf/walls/plastitanium_wall.dmi'
|
|
icon_state = "plastitanium_wall-0"
|
|
base_icon_state = "plastitanium_wall"
|
|
mineral = /obj/item/stack/sheet/mineral/plastitanium
|
|
walltype = /turf/closed/wall/mineral/plastitanium
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_PLASTITANIUM_WALLS + SMOOTH_GROUP_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_SHUTTLE_PARTS + SMOOTH_GROUP_AIRLOCK + SMOOTH_GROUP_PLASTITANIUM_WALLS
|
|
|
|
/obj/structure/falsewall/material
|
|
name = "wall"
|
|
desc = "A huge chunk of material used to separate rooms."
|
|
icon = 'icons/turf/walls/materialwall.dmi'
|
|
icon_state = "materialwall-0"
|
|
base_icon_state = "materialwall"
|
|
walltype = /turf/closed/wall/material
|
|
smoothing_flags = SMOOTH_BITMASK
|
|
smoothing_groups = SMOOTH_GROUP_WALLS + SMOOTH_GROUP_CLOSED_TURFS + SMOOTH_GROUP_MATERIAL_WALLS
|
|
canSmoothWith = SMOOTH_GROUP_MATERIAL_WALLS
|
|
material_flags = MATERIAL_EFFECTS | MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
|
|
|
|
/obj/structure/falsewall/material/deconstruct(disassembled = TRUE)
|
|
if(!(flags_1 & NODECONSTRUCT_1))
|
|
if(disassembled)
|
|
new girder_type(loc)
|
|
for(var/material in custom_materials)
|
|
var/datum/material/material_datum = material
|
|
new material_datum.sheet_type(loc, FLOOR(custom_materials[material_datum] / MINERAL_MATERIAL_AMOUNT, 1))
|
|
qdel(src)
|
|
|
|
/obj/structure/falsewall/material/mat_update_desc(mat)
|
|
desc = "A huge chunk of [mat] used to separate rooms."
|
|
|
|
/obj/structure/falsewall/material/toggle_open()
|
|
if(!QDELETED(src))
|
|
set_density(!density)
|
|
var/mat_opacity = TRUE
|
|
for(var/datum/material/mat in custom_materials)
|
|
if(mat.alpha < 255)
|
|
mat_opacity = FALSE
|
|
break
|
|
set_opacity(density && mat_opacity)
|
|
opening = FALSE
|
|
update_appearance()
|
|
air_update_turf(TRUE, !density)
|
|
|
|
/obj/structure/falsewall/material/ChangeToWall(delete = 1)
|
|
var/turf/current_turf = get_turf(src)
|
|
var/turf/closed/wall/material/new_wall = current_turf.PlaceOnTop(/turf/closed/wall/material)
|
|
new_wall.set_custom_materials(custom_materials)
|
|
if(delete)
|
|
qdel(src)
|
|
return current_turf
|
|
|
|
/obj/structure/falsewall/material/update_icon(updates)
|
|
. = ..()
|
|
for(var/datum/material/mat in custom_materials)
|
|
if(mat.alpha < 255)
|
|
update_transparency_underlays()
|
|
return
|
|
|
|
/obj/structure/falsewall/material/proc/update_transparency_underlays()
|
|
underlays.Cut()
|
|
var/girder_icon_state = "displaced"
|
|
if(opening)
|
|
girder_icon_state += "_[density ? "opening" : "closing"]"
|
|
else if(!density)
|
|
girder_icon_state += "_open"
|
|
var/mutable_appearance/girder_underlay = mutable_appearance('icons/obj/structures.dmi', girder_icon_state, layer = LOW_OBJ_LAYER-0.01)
|
|
girder_underlay.appearance_flags = RESET_ALPHA | RESET_COLOR
|
|
underlays += girder_underlay
|