diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index 40c12e6e0c7..b12890139ec 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -1002,3 +1002,15 @@ if(i < target_list.len) CHECK_TICK return ret + +/// Runtimes if the passed in list is not sorted +/proc/assert_sorted(list/list, name, cmp = /proc/cmp_numeric_asc) + var/last_value = list[1] + + for (var/index in 2 to list.len) + var/value = list[index] + + if (call(cmp)(value, last_value) < 0) + stack_trace("[name] is not sorted. value at [index] ([value]) is in the wrong place compared to the previous value of [last_value] (when compared to by [cmp])") + + last_value = value diff --git a/code/__HELPERS/level_traits.dm b/code/__HELPERS/level_traits.dm index 7f1c2dd7053..805e9466aec 100644 --- a/code/__HELPERS/level_traits.dm +++ b/code/__HELPERS/level_traits.dm @@ -3,7 +3,22 @@ // Basic levels #define is_centcom_level(z) SSmapping.level_trait(z, ZTRAIT_CENTCOM) -#define is_station_level(z) SSmapping.level_trait(z, ZTRAIT_STATION) +GLOBAL_LIST_EMPTY(station_levels_cache) + +// Used to prevent z from being re-evaluated +GLOBAL_VAR(station_level_z_scratch) + +// Called a lot, somewhat slow, so has its own cache +#define is_station_level(z) \ + ( \ + ( \ + /* The right hand side of this guarantees that we'll have the space to fill later on, while also not failing the condition */ \ + (GLOB.station_levels_cache.len < (GLOB.station_level_z_scratch = z) && (GLOB.station_levels_cache.len = GLOB.station_level_z_scratch)) \ + || isnull(GLOB.station_levels_cache[GLOB.station_level_z_scratch]) \ + ) \ + ? (GLOB.station_levels_cache[GLOB.station_level_z_scratch] = !!SSmapping.level_trait(z, ZTRAIT_STATION)) \ + : GLOB.station_levels_cache[GLOB.station_level_z_scratch] \ + ) #define is_mining_level(z) SSmapping.level_trait(z, ZTRAIT_MINING) diff --git a/code/game/area/areas/misc.dm b/code/game/area/areas/misc.dm index fd6d0452d84..610662ac3f6 100644 --- a/code/game/area/areas/misc.dm +++ b/code/game/area/areas/misc.dm @@ -5,8 +5,8 @@ requires_power = TRUE always_unpowered = TRUE static_lighting = FALSE + area_has_base_lighting = FALSE - base_lighting_alpha = 255 power_light = FALSE power_equip = FALSE power_environ = FALSE @@ -17,6 +17,11 @@ sound_environment = SOUND_AREA_SPACE ambient_buzz = null //Space is deafeningly quiet +/area/space/Initialize(mapload) + . = ..() + + add_overlay(GLOB.fullbright_overlay) + /area/space/nearstation icon_state = "space_near" area_flags = UNIQUE_AREA | NO_ALERTS | AREA_USES_STARLIGHT diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 441a4a7ec6d..bb3db2c57bc 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -139,9 +139,9 @@ var/bottom_left_corner ///Smoothing variable var/bottom_right_corner - ///What smoothing groups does this atom belongs to, to match canSmoothWith. If null, nobody can smooth with it. + ///What smoothing groups does this atom belongs to, to match canSmoothWith. If null, nobody can smooth with it. Must be sorted. var/list/smoothing_groups = null - ///List of smoothing groups this atom can smooth with. If this is null and atom is smooth, it smooths only with itself. + ///List of smoothing groups this atom can smooth with. If this is null and atom is smooth, it smooths only with itself. Must be sorted. var/list/canSmoothWith = null ///Reference to atom being orbited var/atom/orbit_target @@ -231,6 +231,7 @@ /atom/proc/Initialize(mapload, ...) SHOULD_NOT_SLEEP(TRUE) SHOULD_CALL_PARENT(TRUE) + if(flags_1 & INITIALIZED_1) stack_trace("Warning: [src]([type]) initialized multiple times!") flags_1 |= INITIALIZED_1 @@ -249,12 +250,20 @@ update_light() if (length(smoothing_groups)) - sortTim(smoothing_groups) //In case it's not properly ordered, let's avoid duplicate entries with the same values. + #ifdef UNIT_TESTS + assert_sorted(smoothing_groups, "[type].smoothing_groups") + #endif + SET_BITFLAG_LIST(smoothing_groups) + if (length(canSmoothWith)) - sortTim(canSmoothWith) + #ifdef UNIT_TESTS + assert_sorted(canSmoothWith, "[type].canSmoothWith") + #endif + if(canSmoothWith[length(canSmoothWith)] > MAX_S_TURF) //If the last element is higher than the maximum turf-only value, then it must scan turf contents for smoothing targets. smoothing_flags |= SMOOTH_OBJ + SET_BITFLAG_LIST(canSmoothWith) if(uses_integrity) @@ -264,6 +273,7 @@ armor = getArmor() else if (!istype(armor, /datum/armor)) stack_trace("Invalid type [armor.type] found in .armor during /atom Initialize()") + atom_integrity = max_integrity // apply materials properly from the default custom_materials value diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index aef93f5485d..67f1abf7ee6 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -108,7 +108,7 @@ bar_material = SAND smoothing_flags = SMOOTH_BITMASK smoothing_groups = list(SMOOTH_GROUP_SANDBAGS) - canSmoothWith = list(SMOOTH_GROUP_SANDBAGS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_SECURITY_BARRICADE) + canSmoothWith = list(SMOOTH_GROUP_WALLS, SMOOTH_GROUP_SECURITY_BARRICADE, SMOOTH_GROUP_SANDBAGS) /obj/structure/barricade/sandbags/Initialize(mapload) . = ..() diff --git a/code/game/objects/effects/decals/cleanable/misc.dm b/code/game/objects/effects/decals/cleanable/misc.dm index 6d2602b9a2f..27dced05e99 100644 --- a/code/game/objects/effects/decals/cleanable/misc.dm +++ b/code/game/objects/effects/decals/cleanable/misc.dm @@ -62,7 +62,7 @@ base_icon_state = "dirt" smoothing_flags = NONE smoothing_groups = list(SMOOTH_GROUP_CLEANABLE_DIRT) - canSmoothWith = list(SMOOTH_GROUP_CLEANABLE_DIRT, SMOOTH_GROUP_WALLS) + canSmoothWith = list(SMOOTH_GROUP_WALLS, SMOOTH_GROUP_CLEANABLE_DIRT) mouse_opacity = MOUSE_OPACITY_TRANSPARENT beauty = -75 diff --git a/code/game/objects/effects/spawners/structure.dm b/code/game/objects/effects/spawners/structure.dm index e2066c6c5f2..86b4a5868ae 100644 --- a/code/game/objects/effects/spawners/structure.dm +++ b/code/game/objects/effects/spawners/structure.dm @@ -10,9 +10,10 @@ again. /obj/effect/spawner/structure/Initialize(mapload) . = ..() - if(spawn_list?.len) - for(var/I in spawn_list) - new I(get_turf(src)) + + for(var/spawn_type in spawn_list) + new spawn_type(loc) + return INITIALIZE_HINT_QDEL @@ -28,9 +29,8 @@ again. /obj/effect/spawner/structure/window/Initialize(mapload) . = ..() - if (is_station_level(z)) - var/turf/current_turf = get_turf(src) - current_turf.rcd_memory = RCD_MEMORY_WINDOWGRILLE + var/turf/current_turf = loc + current_turf.rcd_memory = RCD_MEMORY_WINDOWGRILLE /obj/effect/spawner/structure/window/hollow name = "hollow window spawner" diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index 154b67ac96f..a28919531ad 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -143,7 +143,7 @@ max_integrity = 15 smoothing_flags = SMOOTH_BITMASK smoothing_groups = list(SMOOTH_GROUP_ALIEN_RESIN, SMOOTH_GROUP_ALIEN_WEEDS) - canSmoothWith = list(SMOOTH_GROUP_ALIEN_WEEDS, SMOOTH_GROUP_WALLS) + canSmoothWith = list(SMOOTH_GROUP_WALLS, SMOOTH_GROUP_ALIEN_WEEDS) ///the range of the weeds going to be affected by the node var/node_range = NODERANGE ///the parent node that will determine if we grow or die diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 3cd80f84400..c4be723c499 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -313,7 +313,7 @@ mineral = /obj/item/stack/sheet/mineral/bamboo walltype = /turf/closed/wall/mineral/bamboo smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_BAMBOO_WALLS) + smoothing_groups = list(SMOOTH_GROUP_BAMBOO_WALLS, SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_BAMBOO_WALLS) /obj/structure/falsewall/iron @@ -374,7 +374,7 @@ base_icon_state = "materialwall" walltype = /turf/closed/wall/material smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_MATERIAL_WALLS) + smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_MATERIAL_WALLS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_MATERIAL_WALLS) material_flags = MATERIAL_EFFECTS | MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index 8c924eac990..b3044a60855 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -13,7 +13,7 @@ obj_flags = CAN_BE_HIT | BLOCK_Z_OUT_DOWN smoothing_flags = SMOOTH_BITMASK smoothing_groups = list(SMOOTH_GROUP_LATTICE) - canSmoothWith = list(SMOOTH_GROUP_LATTICE, SMOOTH_GROUP_OPEN_FLOOR, SMOOTH_GROUP_WALLS) + canSmoothWith = list(SMOOTH_GROUP_OPEN_FLOOR, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_LATTICE) var/number_of_mats = 1 var/build_material = /obj/item/stack/rods @@ -77,7 +77,7 @@ base_icon_state = "catwalk" number_of_mats = 2 smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_LATTICE, SMOOTH_GROUP_CATWALK, SMOOTH_GROUP_OPEN_FLOOR) + smoothing_groups = list(SMOOTH_GROUP_OPEN_FLOOR, SMOOTH_GROUP_LATTICE, SMOOTH_GROUP_CATWALK) canSmoothWith = list(SMOOTH_GROUP_CATWALK) obj_flags = CAN_BE_HIT | BLOCK_Z_OUT_DOWN | BLOCK_Z_IN_UP @@ -113,7 +113,7 @@ number_of_mats = 1 color = "#5286b9ff" smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_LATTICE, SMOOTH_GROUP_OPEN_FLOOR) + smoothing_groups = list(SMOOTH_GROUP_OPEN_FLOOR, SMOOTH_GROUP_LATTICE) canSmoothWith = list(SMOOTH_GROUP_LATTICE) obj_flags = CAN_BE_HIT | BLOCK_Z_OUT_DOWN | BLOCK_Z_IN_UP resistance_flags = FIRE_PROOF | LAVA_PROOF diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index fd48a086076..d9000afa596 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -715,7 +715,7 @@ heat_resistance = 1600 armor = list(MELEE = 90, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 50, BIO = 0, FIRE = 80, ACID = 100) smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS, SMOOTH_GROUP_WINDOW_FULLTILE_SHUTTLE) + smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE_SHUTTLE, SMOOTH_GROUP_SHUTTLE_PARTS) canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE_SHUTTLE) explosion_block = 3 glass_type = /obj/item/stack/sheet/titaniumglass @@ -754,7 +754,7 @@ heat_resistance = 1600 armor = list(MELEE = 95, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 50, BIO = 0, FIRE = 80, ACID = 100) smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS, SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM) + smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM, SMOOTH_GROUP_SHUTTLE_PARTS) canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM) explosion_block = 3 damage_deflection = 21 //The same as reinforced plasma windows.3 diff --git a/code/game/turfs/closed/_closed.dm b/code/game/turfs/closed/_closed.dm index 84e4032f747..66a9568c497 100644 --- a/code/game/turfs/closed/_closed.dm +++ b/code/game/turfs/closed/_closed.dm @@ -136,7 +136,7 @@ INITIALIZE_IMMEDIATE(/turf/closed/indestructible/splashscreen) icon_state = "plastitanium_wall-0" base_icon_state = "plastitanium_wall" smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_SYNDICATE_WALLS) + smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_SYNDICATE_WALLS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_SYNDICATE_WALLS, SMOOTH_GROUP_PLASTITANIUM_WALLS, SMOOTH_GROUP_AIRLOCK, SMOOTH_GROUP_SHUTTLE_PARTS) /turf/closed/indestructible/riveted/uranium @@ -152,7 +152,7 @@ INITIALIZE_IMMEDIATE(/turf/closed/indestructible/splashscreen) icon_state = "plastinum_wall-0" base_icon_state = "plastinum_wall" smoothing_flags = SMOOTH_BITMASK | SMOOTH_DIAGONAL_CORNERS - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_PLASTINUM_WALLS) + smoothing_groups = list(SMOOTH_GROUP_PLASTINUM_WALLS, SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_PLASTINUM_WALLS) /turf/closed/indestructible/riveted/plastinum/nodiagonal @@ -219,7 +219,7 @@ INITIALIZE_IMMEDIATE(/turf/closed/indestructible/splashscreen) base_icon_state = "plastitanium_window" opacity = FALSE smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS, SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM) + smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM, SMOOTH_GROUP_SHUTTLE_PARTS) canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM) /turf/closed/indestructible/opsglass/Initialize(mapload) diff --git a/code/game/turfs/closed/wall/material_walls.dm b/code/game/turfs/closed/wall/material_walls.dm index e1de7f8a98d..b96adfdb2c1 100644 --- a/code/game/turfs/closed/wall/material_walls.dm +++ b/code/game/turfs/closed/wall/material_walls.dm @@ -5,7 +5,7 @@ icon_state = "materialwall-0" base_icon_state = "materialwall" smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_MATERIAL_WALLS) + smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_MATERIAL_WALLS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_MATERIAL_WALLS) rcd_memory = null material_flags = MATERIAL_EFFECTS | MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS diff --git a/code/game/turfs/closed/wall/mineral_walls.dm b/code/game/turfs/closed/wall/mineral_walls.dm index 1d576b1a931..6851085acd3 100644 --- a/code/game/turfs/closed/wall/mineral_walls.dm +++ b/code/game/turfs/closed/wall/mineral_walls.dm @@ -188,7 +188,7 @@ icon = 'icons/turf/walls/bamboo_wall.dmi' icon_state = "bamboo" smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_BAMBOO_WALLS) + smoothing_groups = list(SMOOTH_GROUP_BAMBOO_WALLS, SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_BAMBOO_WALLS) sheet_type = /obj/item/stack/sheet/mineral/bamboo hardness = 80 //it's not a mineral... @@ -294,7 +294,7 @@ icon_state = "survival_pod_walls-0" base_icon_state = "survival_pod_walls" smoothing_flags = SMOOTH_BITMASK | SMOOTH_DIAGONAL_CORNERS - canSmoothWith = list(SMOOTH_GROUP_TITANIUM_WALLS, SMOOTH_GROUP_AIRLOCK, SMOOTH_GROUP_WINDOW_FULLTILE, SMOOTH_GROUP_SHUTTLE_PARTS) + canSmoothWith = list(SMOOTH_GROUP_TITANIUM_WALLS, SMOOTH_GROUP_WINDOW_FULLTILE, SMOOTH_GROUP_AIRLOCK, SMOOTH_GROUP_SHUTTLE_PARTS) /turf/closed/wall/mineral/titanium/survival/nodiagonal icon = 'icons/turf/walls/survival_pod_walls.dmi' @@ -319,7 +319,7 @@ hardness = 25 //upgrade on titanium smoothing_flags = SMOOTH_BITMASK | SMOOTH_DIAGONAL_CORNERS smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_PLASTITANIUM_WALLS) - canSmoothWith = list(SMOOTH_GROUP_PLASTITANIUM_WALLS, SMOOTH_GROUP_SYNDICATE_WALLS, SMOOTH_GROUP_AIRLOCK, SMOOTH_GROUP_SHUTTLE_PARTS) + canSmoothWith = list(SMOOTH_GROUP_SYNDICATE_WALLS, SMOOTH_GROUP_PLASTITANIUM_WALLS, SMOOTH_GROUP_AIRLOCK, SMOOTH_GROUP_SHUTTLE_PARTS) custom_materials = list(/datum/material/alloy/plastitanium = 4000) /turf/closed/wall/mineral/plastitanium/rust_heretic_act() diff --git a/code/game/turfs/closed/wall/reinf_walls.dm b/code/game/turfs/closed/wall/reinf_walls.dm index 7dccea7aa95..a85519915cc 100644 --- a/code/game/turfs/closed/wall/reinf_walls.dm +++ b/code/game/turfs/closed/wall/reinf_walls.dm @@ -249,7 +249,7 @@ hardness = 25 //plastitanium turf_flags = IS_SOLID smoothing_flags = SMOOTH_BITMASK | SMOOTH_DIAGONAL_CORNERS - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_SYNDICATE_WALLS) + smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_SYNDICATE_WALLS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_SYNDICATE_WALLS, SMOOTH_GROUP_PLASTITANIUM_WALLS, SMOOTH_GROUP_AIRLOCK, SMOOTH_GROUP_SHUTTLE_PARTS) /turf/closed/wall/r_wall/syndicate/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm index 49d7283db25..99d3f7dd993 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -12,7 +12,7 @@ flags_1 = NO_SCREENTIPS_1 turf_flags = CAN_BE_DIRTY_1 | IS_SOLID smoothing_groups = list(SMOOTH_GROUP_TURF_OPEN, SMOOTH_GROUP_OPEN_FLOOR) - canSmoothWith = list(SMOOTH_GROUP_OPEN_FLOOR, SMOOTH_GROUP_TURF_OPEN) + canSmoothWith = list(SMOOTH_GROUP_TURF_OPEN, SMOOTH_GROUP_OPEN_FLOOR) thermal_conductivity = 0.04 heat_capacity = 10000 diff --git a/code/game/turfs/open/grass.dm b/code/game/turfs/open/grass.dm index 5321841111f..f10c71829cd 100644 --- a/code/game/turfs/open/grass.dm +++ b/code/game/turfs/open/grass.dm @@ -12,7 +12,7 @@ heavyfootstep = FOOTSTEP_GENERIC_HEAVY smoothing_flags = SMOOTH_BITMASK smoothing_groups = list(SMOOTH_GROUP_TURF_OPEN, SMOOTH_GROUP_FLOOR_GRASS) - canSmoothWith = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_FLOOR_GRASS) + canSmoothWith = list(SMOOTH_GROUP_FLOOR_GRASS, SMOOTH_GROUP_CLOSED_TURFS) layer = HIGH_TURF_LAYER var/damaged_dmi = 'icons/turf/floors/grass.dmi' var/smooth_icon = 'icons/turf/floors/grass.dmi' diff --git a/code/game/turfs/open/misc.dm b/code/game/turfs/open/misc.dm index e706198136e..18e146ad64e 100644 --- a/code/game/turfs/open/misc.dm +++ b/code/game/turfs/open/misc.dm @@ -16,7 +16,7 @@ underfloor_accessibility = UNDERFLOOR_INTERACTABLE smoothing_groups = list(SMOOTH_GROUP_TURF_OPEN) - canSmoothWith = list(SMOOTH_GROUP_OPEN_FLOOR, SMOOTH_GROUP_TURF_OPEN) + canSmoothWith = list(SMOOTH_GROUP_TURF_OPEN, SMOOTH_GROUP_OPEN_FLOOR) thermal_conductivity = 0.04 heat_capacity = 10000 diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 55c9700521b..b7ebe82b58a 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -110,17 +110,25 @@ GLOBAL_LIST_EMPTY(station_turfs) levelupdate() if (length(smoothing_groups)) - sortTim(smoothing_groups) //In case it's not properly ordered, let's avoid duplicate entries with the same values. + #ifdef UNIT_TESTS + assert_sorted(smoothing_groups, "[type].smoothing_groups") + #endif + SET_BITFLAG_LIST(smoothing_groups) if (length(canSmoothWith)) - sortTim(canSmoothWith) + #ifdef UNIT_TESTS + assert_sorted(canSmoothWith, "[type].canSmoothWith") + #endif + if(canSmoothWith[length(canSmoothWith)] > MAX_S_TURF) //If the last element is higher than the maximum turf-only value, then it must scan turf contents for smoothing targets. smoothing_flags |= SMOOTH_OBJ SET_BITFLAG_LIST(canSmoothWith) if (smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) QUEUE_SMOOTH(src) - visibilityChanged() + // visibilityChanged() will never hit any path with side effects during mapload + if (!mapload) + visibilityChanged() for(var/atom/movable/content as anything in src) Entered(content, null) @@ -146,7 +154,8 @@ GLOBAL_LIST_EMPTY(station_turfs) directional_opacity = ALL_CARDINALS // apply materials properly from the default custom_materials value - set_custom_materials(custom_materials) + if (!length(custom_materials)) + set_custom_materials(custom_materials) if(uses_integrity) atom_integrity = max_integrity diff --git a/code/modules/industrial_lift/tram_walls.dm b/code/modules/industrial_lift/tram_walls.dm index 17844dbfa5d..9b8aa1629b7 100644 --- a/code/modules/industrial_lift/tram_walls.dm +++ b/code/modules/industrial_lift/tram_walls.dm @@ -255,7 +255,7 @@ icon = 'icons/turf/walls/bamboo_wall.dmi' icon_state = "bamboo" smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_BAMBOO_WALLS) + smoothing_groups = list(SMOOTH_GROUP_BAMBOO_WALLS, SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_BAMBOO_WALLS) mineral = /obj/item/stack/sheet/mineral/bamboo tram_wall_type = /obj/structure/tramwall/bamboo @@ -296,7 +296,7 @@ icon_state = "materialwall-0" base_icon_state = "materialwall" smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_WALLS, SMOOTH_GROUP_MATERIAL_WALLS) + smoothing_groups = list(SMOOTH_GROUP_CLOSED_TURFS, SMOOTH_GROUP_MATERIAL_WALLS, SMOOTH_GROUP_WALLS) canSmoothWith = list(SMOOTH_GROUP_MATERIAL_WALLS) material_flags = MATERIAL_EFFECTS | MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm index 5b3f319b506..1ab338d8b1c 100644 --- a/code/modules/mining/equipment/survival_pod.dm +++ b/code/modules/mining/equipment/survival_pod.dm @@ -88,7 +88,7 @@ icon_state = "pod_window-0" base_icon_state = "pod_window" smoothing_flags = SMOOTH_BITMASK - smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS, SMOOTH_GROUP_SURVIVAL_TITANIUM_POD) + smoothing_groups = list(SMOOTH_GROUP_SURVIVAL_TITANIUM_POD, SMOOTH_GROUP_SHUTTLE_PARTS) canSmoothWith = list(SMOOTH_GROUP_SURVIVAL_TITANIUM_POD) /obj/structure/window/reinforced/shuttle/survival_pod/spawner/north @@ -111,7 +111,7 @@ icon = 'icons/obj/doors/airlocks/survival/survival.dmi' overlays_file = 'icons/obj/doors/airlocks/survival/survival_overlays.dmi' assemblytype = /obj/structure/door_assembly/door_assembly_pod - smoothing_groups = list(SMOOTH_GROUP_AIRLOCK, SMOOTH_GROUP_SURVIVAL_TITANIUM_POD) + smoothing_groups = list(SMOOTH_GROUP_SURVIVAL_TITANIUM_POD, SMOOTH_GROUP_AIRLOCK) /obj/machinery/door/airlock/survival_pod/glass opacity = FALSE diff --git a/tools/read_init_times.py b/tools/read_init_times.py index 4dca61c40f7..c95af704a0a 100644 --- a/tools/read_init_times.py +++ b/tools/read_init_times.py @@ -1,5 +1,6 @@ # When passed an `init_times.json` file (received from enabling `PROFILE_MAPLOAD_INIT_ATOM`), # and an optional max-depth level, this will output init times from worst to best. +import errno import json import sys @@ -19,4 +20,10 @@ for (type, time) in init_times.items(): init_times_per_type[type] = init_times_per_type.get(type, 0) + time for (type, time) in sorted(init_times_per_type.items(), key = lambda x: x[1], reverse = True): - print(type, time) + try: + print(type, time) + except IOError as error: + # Prevents broken pipe error if you do something like `read_init_times.py init_times.json | head` + if error.errno == errno.EPIPE: + sys.stderr.close() + sys.exit(0)