mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-27 06:38:03 +01:00
fast optimization pass (#4002)
* WHY * wack * okay * HOW * k Co-authored-by: fake_vm_user <fake_vm_user>
This commit is contained in:
co-authored by
fake_vm_user <fake_vm_user>
parent
93fc8831c0
commit
4e418ff72d
@@ -21,7 +21,7 @@ SUBSYSTEM_DEF(planets)
|
||||
admin_notice("<span class='danger'>Initializing planetary weather.</span>", R_DEBUG)
|
||||
createPlanets()
|
||||
allocateTurfs(TRUE)
|
||||
..()
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/planets/proc/createPlanets()
|
||||
var/list/planet_datums = GLOB.using_map.planet_datums_to_make
|
||||
@@ -36,59 +36,82 @@ SUBSYSTEM_DEF(planets)
|
||||
continue
|
||||
z_to_planet[Z] = NP
|
||||
|
||||
/datum/controller/subsystem/planets/proc/addTurf(var/turf/T,var/is_edge)
|
||||
if(is_edge)
|
||||
new_outdoor_walls |= T
|
||||
else
|
||||
new_outdoor_turfs |= T
|
||||
/datum/controller/subsystem/planets/proc/addTurf(turf/T)
|
||||
new_outdoor_turfs += T
|
||||
|
||||
/datum/controller/subsystem/planets/proc/removeTurf(var/turf/T,var/is_edge)
|
||||
if(is_edge)
|
||||
new_outdoor_walls -= T
|
||||
else
|
||||
new_outdoor_turfs -= T
|
||||
/datum/controller/subsystem/planets/proc/addWall(turf/T)
|
||||
new_outdoor_walls += T
|
||||
|
||||
/datum/controller/subsystem/planets/proc/removeTurf(turf/T)
|
||||
new_outdoor_turfs -= T
|
||||
if(z_to_planet.len >= T.z)
|
||||
var/datum/planet/P = z_to_planet[T.z]
|
||||
if(!P)
|
||||
return
|
||||
if(is_edge)
|
||||
P.planet_floors -= T
|
||||
else
|
||||
P.planet_walls -= T
|
||||
T.vis_contents -= P.weather_holder.visuals
|
||||
T.vis_contents -= P.weather_holder.special_visuals
|
||||
|
||||
/datum/controller/subsystem/planets/proc/allocateTurfs(var/initial = FALSE)
|
||||
var/list/currentlist = new_outdoor_turfs
|
||||
while(currentlist.len)
|
||||
var/turf/simulated/OT = currentlist[currentlist.len]
|
||||
currentlist.len--
|
||||
if(istype(OT) && OT.outdoors && z_to_planet.len >= OT.z && z_to_planet[OT.z])
|
||||
var/datum/planet/P = z_to_planet[OT.z]
|
||||
P.planet_floors |= OT
|
||||
OT.vis_contents |= P.weather_holder.visuals
|
||||
OT.vis_contents |= P.weather_holder.special_visuals
|
||||
if(!initial && MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
currentlist = new_outdoor_walls
|
||||
while(currentlist.len)
|
||||
var/turf/unsimulated/wall/planetary/PW = currentlist[currentlist.len]
|
||||
currentlist.len--
|
||||
if(istype(PW) && z_to_planet.len >= PW.z && z_to_planet[PW.z])
|
||||
var/datum/planet/P = z_to_planet[PW.z]
|
||||
P.planet_walls |= PW
|
||||
if(!initial && MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/planets/proc/unallocateTurf(var/turf/simulated/T)
|
||||
if(istype(T) && z_to_planet[T.z])
|
||||
var/datum/planet/P = z_to_planet[T.z]
|
||||
P.planet_floors -= T
|
||||
T.vis_contents -= P.weather_holder.visuals
|
||||
T.vis_contents -= P.weather_holder.special_visuals
|
||||
|
||||
/datum/controller/subsystem/planets/proc/removeWall(turf/T)
|
||||
new_outdoor_walls -= T
|
||||
if(z_to_planet.len >= T.z)
|
||||
var/datum/planet/P = z_to_planet[T.z]
|
||||
if(!P)
|
||||
return
|
||||
P.planet_walls -= T
|
||||
T.vis_contents -= P.weather_holder.visuals
|
||||
T.vis_contents -= P.weather_holder.special_visuals
|
||||
|
||||
/datum/controller/subsystem/planets/proc/allocateTurfs(initial)
|
||||
// if initial we're going to do optimizations
|
||||
var/planet_z_count = z_to_planet.len
|
||||
if(initial)
|
||||
// make sure no duplicates are there
|
||||
for(var/turf/simulated/S in new_outdoor_turfs)
|
||||
if(planet_z_count < S.z)
|
||||
continue
|
||||
var/datum/planet/P = z_to_planet[S.z]
|
||||
if(!P)
|
||||
continue
|
||||
P.planet_floors |= S
|
||||
S.vis_contents |= P.weather_holder.visuals
|
||||
S.vis_contents |= P.weather_holder.special_visuals
|
||||
for(var/turf/unsimulated/wall/planetary/S in new_outdoor_walls)
|
||||
if(planet_z_count < S.z)
|
||||
continue
|
||||
var/datum/planet/P = z_to_planet[S.z]
|
||||
if(!P)
|
||||
continue
|
||||
P.planet_walls |= S
|
||||
new_outdoor_turfs = list()
|
||||
new_outdoor_walls = list()
|
||||
return
|
||||
var/list/curr = new_outdoor_turfs
|
||||
while(curr)
|
||||
var/turf/simulated/S = curr[curr.len]
|
||||
curr.len--
|
||||
if(!istype(S))
|
||||
continue
|
||||
if(planet_z_count < S.z)
|
||||
continue
|
||||
var/datum/planet/P = z_to_planet[S.z]
|
||||
P.planet_floors |= S
|
||||
S.vis_contents |= P.weather_holder.visuals
|
||||
S.vis_contents |= P.weather_holder.special_visuals
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
curr = new_outdoor_walls
|
||||
while(curr)
|
||||
var/turf/unsimulated/wall/planetary/S = curr[curr.len]
|
||||
curr.len--
|
||||
if(!istype(S))
|
||||
continue
|
||||
if(planet_z_count < S.z)
|
||||
continue
|
||||
var/datum/planet/P = z_to_planet[S.z]
|
||||
P.planet_walls |= S
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
/datum/controller/subsystem/planets/fire(resumed = 0)
|
||||
if(new_outdoor_turfs.len || new_outdoor_walls.len)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// TODO: allow different tile types in storage??
|
||||
/obj/machinery/floorlayer
|
||||
name = "automatic floor layer"
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
@@ -85,11 +86,6 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/floorlayer/proc/SortStacks()
|
||||
for(var/obj/item/stack/tile/tile1 in contents)
|
||||
for(var/obj/item/stack/tile/tile2 in contents)
|
||||
tile2.transfer_to(tile1)
|
||||
|
||||
/obj/machinery/floorlayer/proc/layFloor(var/turf/w_turf)
|
||||
if(!T)
|
||||
if(!TakeNewStack())
|
||||
@@ -98,10 +94,11 @@
|
||||
return 1
|
||||
|
||||
/obj/machinery/floorlayer/proc/TakeTile(var/obj/item/stack/tile/tile)
|
||||
if(!T) T = tile
|
||||
tile.loc = src
|
||||
|
||||
SortStacks()
|
||||
if(!T)
|
||||
T = tile
|
||||
tile.forceMove(src)
|
||||
else
|
||||
tile.merge(T)
|
||||
|
||||
/obj/machinery/floorlayer/proc/CollectTiles(var/turf/w_turf)
|
||||
for(var/obj/item/stack/tile/tile in w_turf)
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
thermal_conductivity = 0.040
|
||||
heat_capacity = 10000
|
||||
var/lava = 0
|
||||
|
||||
/turf/simulated/floor/is_plating()
|
||||
return !flooring
|
||||
@@ -43,7 +42,7 @@
|
||||
set_flooring(get_flooring_data(floortype))
|
||||
else
|
||||
footstep_sounds = base_footstep_sounds
|
||||
if(can_dirty && can_start_dirty)
|
||||
if(mapload && can_dirty && can_start_dirty)
|
||||
if(prob(dirty_prob))
|
||||
dirt += rand(50,100)
|
||||
update_dirt() //5% chance to start with dirt on a floor tile- give the janitor something to do
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
return
|
||||
|
||||
// Create a ceiling to shield from the weather
|
||||
if(src.outdoors)
|
||||
if(outdoors)
|
||||
for(var/dir in GLOB.cardinal)
|
||||
var/turf/A = get_step(src, dir)
|
||||
if(A && !A.outdoors)
|
||||
|
||||
@@ -11,10 +11,6 @@ var/image/no_ceiling_image = null
|
||||
no_ceiling_image.plane = PLANE_MESONS
|
||||
|
||||
/turf/simulated/floor/update_icon(var/update_neighbors)
|
||||
|
||||
if(lava)
|
||||
return
|
||||
|
||||
cut_overlays()
|
||||
|
||||
if(flooring)
|
||||
|
||||
@@ -32,11 +32,6 @@
|
||||
..()
|
||||
name = "magma"
|
||||
|
||||
/turf/simulated/floor/outdoors/lava/update_icon()
|
||||
cut_overlays()
|
||||
..()
|
||||
update_icon_edge()
|
||||
|
||||
/turf/simulated/floor/outdoors/lava/Entered(atom/movable/AM)
|
||||
..()
|
||||
if(burn_stuff(AM))
|
||||
|
||||
@@ -43,14 +43,12 @@ var/list/turf_edge_cache = list()
|
||||
/turf/simulated/AfterChange(flags, oldType)
|
||||
. = ..()
|
||||
// If it was outdoors and still is, it will not get added twice when the planet controller gets around to putting it in.
|
||||
if(outdoors)
|
||||
make_outdoors()
|
||||
else
|
||||
make_indoors()
|
||||
|
||||
/turf/simulated/floor/outdoors/update_icon()
|
||||
..()
|
||||
update_icon_edge()
|
||||
if(flags & CHANGETURF_PRESERVE_OUTDOORS)
|
||||
// if it didn't preserve then we don't need to recheck now do we
|
||||
if(outdoors)
|
||||
make_outdoors()
|
||||
else
|
||||
make_indoors()
|
||||
|
||||
/turf/simulated/floor/outdoors/mud
|
||||
name = "mud"
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
/turf/simulated/sky/Initialize(mapload)
|
||||
. = ..()
|
||||
SSplanets.addTurf(src)
|
||||
set_light(2, 2, "#FFFFFF")
|
||||
|
||||
/turf/simulated/sky/north
|
||||
|
||||
@@ -219,10 +219,6 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
|
||||
depth = 4
|
||||
layer = WATER_FLOOR_LAYER
|
||||
|
||||
/turf/simulated/floor/water/acid/Initialize(mapload)
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/turf/simulated/floor/water/acid/update_icon()
|
||||
..() // To get the edges.
|
||||
|
||||
@@ -230,8 +226,6 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
|
||||
var/image/acid_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = acid_state, layer = WATER_LAYER)
|
||||
add_overlay(acid_sprite)
|
||||
|
||||
update_icon_edge()
|
||||
|
||||
/turf/simulated/floor/water/acid/get_edge_icon_state()
|
||||
return "acid_shallow"
|
||||
|
||||
@@ -340,18 +334,12 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
|
||||
layer = WATER_FLOOR_LAYER
|
||||
depth = 6
|
||||
|
||||
/turf/simulated/floor/water/blood/Initialize(mapload)
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/turf/simulated/floor/water/blood/update_icon()
|
||||
..()
|
||||
icon_state = under_state // This isn't set at compile time in order for it to show as water in the map editor.
|
||||
var/image/blood_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = blood_state, layer = WATER_LAYER)
|
||||
add_overlay(blood_sprite)
|
||||
|
||||
update_icon_edge()
|
||||
|
||||
/turf/simulated/floor/water/blood/get_edge_icon_state()
|
||||
return "acidb_shallow"
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
qdel(L)
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
S.use(1)
|
||||
ChangeTurf(/turf/simulated/floor/airless)
|
||||
ChangeTurf(/turf/simulated/floor/plating, flags = CHANGETURF_INHERIT_AIR)
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The plating is going to need some support.</span>")
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating
|
||||
T.ReplaceWithLattice()
|
||||
T.ChangeTurf(/turf/simulated/floor)
|
||||
T.ChangeTurf(/turf/simulated/floor, flags = CHANGETURF_INHERIT_AIR)
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
user.visible_message("<span class='notice'>[user] expands the ceiling.</span>", "<span class='notice'>You expand the ceiling.</span>")
|
||||
else
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
/turf/unsimulated/wall/planetary/Initialize(mapload)
|
||||
. = ..()
|
||||
SSplanets.addTurf(src)
|
||||
SSplanets.addWall(src)
|
||||
|
||||
/turf/unsimulated/wall/planetary/Destroy()
|
||||
SSplanets.removeTurf(src)
|
||||
SSplanets.removeWall(src)
|
||||
return ..()
|
||||
|
||||
/turf/unsimulated/wall/planetary/proc/set_temperature(var/new_temperature)
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
VIRGO3B_TURF_CREATE(/turf/simulated/open)
|
||||
/turf/simulated/open/virgo3b
|
||||
edge_blending_priority = 0.5 //Turfs which also have e_b_p and higher than this will plop decorative edges onto this turf
|
||||
/turf/simulated/open/virgo3b/Initialize(mapload)
|
||||
. = ..()
|
||||
if(outdoors)
|
||||
SSplanets.addTurf(src)
|
||||
|
||||
VIRGO3B_TURF_CREATE(/turf/simulated/floor)
|
||||
|
||||
@@ -230,7 +226,6 @@ turf/simulated/mineral/rich/make_ore(var/rare_ore)
|
||||
|
||||
/turf/simulated/sky/virgo3b/Initialize()
|
||||
. = ..()
|
||||
SSplanets.addTurf(src)
|
||||
set_light(2, 2, "#FFBBBB")
|
||||
|
||||
/turf/simulated/sky/virgo3b/north
|
||||
|
||||
@@ -102,6 +102,7 @@ turf/simulated/mineral/floor/light_corner
|
||||
reconsider_lights()
|
||||
blocks_air = 1
|
||||
can_build_into_floor = FALSE
|
||||
SSplanets.removeTurf(src)
|
||||
update_general()
|
||||
|
||||
/turf/simulated/mineral/proc/update_general()
|
||||
@@ -367,7 +368,7 @@ turf/simulated/mineral/floor/light_corner
|
||||
return
|
||||
qdel(L)
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
ChangeTurf(/turf/simulated/floor)
|
||||
PlaceOnTop(/turf/simulated/floor/plating, flags = CHANGETURF_INHERIT_AIR)
|
||||
S.use(1)
|
||||
return
|
||||
else
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
if (R.use(1))
|
||||
to_chat(user, "<span class='notice'>Constructing support lattice ...</span>")
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
ReplaceWithLattice()
|
||||
new /obj/structure/lattice(src)
|
||||
return
|
||||
|
||||
if (istype(C, /obj/item/stack/tile/floor))
|
||||
@@ -152,7 +152,7 @@
|
||||
qdel(L)
|
||||
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
||||
S.use(1)
|
||||
ChangeTurf(/turf/simulated/floor/airless)
|
||||
ChangeTurf(/turf/simulated/floor, flags = CHANGETURF_INHERIT_AIR)
|
||||
return
|
||||
else
|
||||
to_chat(user, "<span class='warning'>The plating is going to need some support.</span>")
|
||||
@@ -161,8 +161,6 @@
|
||||
if(istype(C, /obj/item/stack/cable_coil))
|
||||
var/obj/item/stack/cable_coil/coil = C
|
||||
coil.turf_place(src, user)
|
||||
return
|
||||
return
|
||||
|
||||
// Most things use is_plating to test if there is a cover tile on top (like regular floors)
|
||||
/turf/simulated/open/is_plating()
|
||||
|
||||
Reference in New Issue
Block a user