Newmap - SMC, Openturf, Arrivals Controller, and Mine Turf Improvements (#1958)

* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.

* this is probably important

* Remove cascade disabling SSgarbage

* Fixed a bug where dust() did not qdel the target mob

* Misc fixes

* Fix decals surviving break-to-plating

* Subsystem flag tweaks

* Apparently subsystems are new'd before config is.

* Fix paper icons

* Speculative fix for insane lag

* Better machinery stat

* Make organs not use SSoverlay

* Misc bugfixes & tweaks

* Nightmode fixes

* Changelog for SMC

* Port /tg/'s improved MC crash handling

* Add some more SS Recover() procs

* supply_controller -> SScargo

* More New() -> Initialize()

* pAI and robot construction overlays

* Fix cargo unit tests

* Merge the DMM Suite's atom/New() into atoms_init

* Lighting pre-baking

* Lighting initialization logging

* Fix some bad SS init orders

* Fix SSlighting logging; rename Processes to MC

* Speculative fix for insane GC lag

* Prebaked openturf/icon_smooth & fix lighting prebake

* SS init status; SSatoms LATEQDEL

* Fix bug with MC init stat panel

* Fix parallax

* Misc

* Ignore SS_NO_DISPLAY during init

* apparently this is important

* REEEEEE

* Image GC fixes; broadcaster radio-new sanity

* RCON Cleanup

* Move pAI recruiter into subsystem

* Move global solars list into sun subsystem

* Make chickens not use a global

* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup

* Speed up space init a little

* Fix bad timer flags on floor drying

* Subsystem panic-restart verb for mins

* Explosion speedup

* Minor subsystem & MC logging tweaks

* SSopenturf improvements

* Make pipenet actually initialize (whoops)

* Minor tweaks

* Implement lighting rounding

* comments are hard okay

* Minor lattice tweaks

* Fix some timer issues & better closet init

* Timer sanity

* Request console tweaks + Storage init sanity

* Minor SSmachiner RCON improvements

* Further reduce world-start timer count

* Standardize subsystem logging

* Garbage hard delete profiling from /tg/

* Timer hang detection & recovery

* Log machines that sleep in process() and fuck up SSmachinery

* Fix an issue with external airlocks sleeping in process()

* Failsafe logging

* Minor tweaks

* Revert "Request console tweaks + Storage init sanity"

This reverts commit 98d3579e35.

* Re-implement RC changes

* Fix SQL FT saving

* Fix SSmachinery sleep in disposals

* Minor SS tweaks

* Paper fixes

* Blood drying fixes

* Merge gameticker and SSticker

* Minor global list init cleanup

* Lagcheck biogenerator & bags

* Tweak SScargo init order; RIG Initialize()

* Caching tweaks

* Remove rogue comma

* Initialize fixes

* Lighting destroy cleanup

* Fix emagging airlocks

* Initial SSicon implementation

* Tweaks & Fixes

* Fire + Air alarm queued icon updates

* Overlays + Queued icon cleanup

* Runtime & background fixes

* Kill some meaningless set statements

* Kill some image qdels

* Bump up lighting rounding val

* Fix adv. scanner destroy runtimes

* Remove unneeded icon update limiting

* Move icon smoothing into helpers

* Show a warning if DM 510 compiles without memory leak hack enabled

* Re-organize subsystems & MC defines a little

* Airlock SFX

* Log of Changes

* Make SSicon_update disable itself when not doing anything

* Fix respawn verb runtime when used early in server-init

* Add more information to MC's stat_entry()

* Replace direct refernces to gcDestroyed with QDEL* macros

* plant_controller -> SSplants

* More plant tweaks

* Add more humor to changelog

* Move parallax globals into SSparallax

* Lighting responsiveness tweaks

* Fix parallax init order & better MC init panel stat

* Make mobs GC

* More overlays + Remove intercom spawn()

* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.

* Update changelog

* Mob GC tweaks

* Del() cleanup

* Fix insomniac ZAS connection edges

* Minor pAI cleanup

* Convert more things to SSoverlay; fix duplicated overlay in field gens

* SM Bluespace turf tweaks

* Update SSgarbage debug globals list

* Human-type qdel tweaks

* Subsystem suspension; stat_entry improvements

* SQL Statistics cleanup

* Fix runtimes with ambrosia

* More disable() -> suspend(); fix nightmode again

* Human qdel fix; minor tweaks

* Update turbolift to work with StonedMC

* Make lifts use timers instead of a subsystem

* Make SSassets start earlier

* Convert the radio controller into a subsystem

* Fix some missing CHECK_TICKs in asteroid generation

* MC stat tweaks; make shouldnt_see a typecache

* Kill some redundant debug-controller entries

* radio_controller -> SSradio

* Better SSgarbage hard-del logging from /tg/ upstream

* Logging tweaks + GELF

* Misc client caching improvements

* Slime SSoverlay

* Oven icon fixes

* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.

* Holder tweaks + Welding tool Initialize()

* Fix some bad subsystem logging

* Fix suit cooling units spawning without cells

* Starlight tweaks

* Gibber infinite gib fix

* More SSoverlay stuff

* Make crates use CUT_OVERLAY_IN

* Make SSarrivals suspend instead of disable

* Make openturf use split/phased tick checks

* Speculative fix for unwet timer runtimes

* Blood overlay tweaks/fixes

* Update crusher to play nice with SMC + SSoverlay

* Openturf improvements and fixes

* Minor turbolift tweaks

* Lighting performance improvements + ChangeTurf tweaks

* this is probably important

* Fix wall weld noises on changeturf

* More ChangeTurf tweaks

* Explosion tweaks

* Pre-game lobby tweaks

* Openturf tweaks

* Prevent admins from starting the game before init finishes

* Fix Travis

* Kill an unused var

* Fix ChangeTurf runtimes on openturfs

* Fixes

* Browser datum fixes, asset caching

* Update changelog

* Changelog

* Lobby tweaks

* Ticker tweaks; kill ticker var

* Further lobby tweaks

* Cascade tweaks

* air_master -> SSair

* Reduce overhead from radio autosay

* alarm_manager -> SSalarm

* bomb_processor -> SSexplosives

* corp_regs -> SSlaw

* ZAS overlay fixes

* Small wall icon optimization

* Fix effects master

* Assembly tweaks

* Megavend fixes

* Shuttle fixes

* Camera alert performance improvements

* Fix some world.log spam from lighting overlays

* Fix some Initialize() procs

* Openspace responsiveness tweaks

* Make HE pipes animate through openturfs

* Kill a spawn
This commit is contained in:
Lohikar
2017-05-02 14:40:40 -04:00
committed by LordFowl
parent 9dbf27a0f4
commit f6dc33a465
872 changed files with 17767 additions and 13417 deletions
+5 -24
View File
@@ -57,15 +57,13 @@
// Creates or destroys it if needed, makes it update values, makes sure it's got the correct source turf...
/atom/proc/update_light()
set waitfor = FALSE
if (gcDestroyed)
if (QDELING(src))
return
L_PROF(src, "atom_update")
if (!light_power || !light_range) // We won't emit light anyways, destroy the light source.
if(light)
light.destroy()
light = null
QDEL_NULL(light)
else
if (!istype(loc, /atom/movable)) // We choose what atom should be the top atom of the light here.
. = src
@@ -77,24 +75,6 @@
else
light = new/datum/light_source(src, .)
// Incase any lighting vars are on in the typepath we turn the light on in New().
/atom/New()
. = ..()
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.
// Destroy our light source so we GC correctly.
/atom/Destroy()
if (light)
light.destroy()
light = null
. = ..()
// If we have opacity, make sure to tell (potentially) affected light sources.
/atom/movable/Destroy()
var/turf/T = loc
@@ -131,14 +111,14 @@
/atom/Entered(var/atom/movable/Obj, var/atom/OldLoc) //Implemented here because forceMove() doesn't call Move()
. = ..()
if (Obj && OldLoc != src)
if (Obj && OldLoc != src && Obj.light_sources && Obj.light_sources.len)
for (var/datum/light_source/L in Obj.light_sources) // Cycle through the light sources on this atom and tell them to update.
L.source_atom.update_light()
/atom/Exited(var/atom/movable/Obj, var/atom/newloc)
. = ..()
if (!newloc && Obj && newloc != src) // Incase the atom is being moved to nullspace, we handle queuing for a lighting update here.
if (!newloc && Obj && newloc != src && Obj.light_sources && Obj.light_sources.len) // Incase the atom is being moved to nullspace, we handle queuing for a lighting update here.
for (var/datum/light_source/L in Obj.light_sources) // Cycle through the light sources on this atom and tell them to update.
L.source_atom.update_light()
@@ -148,3 +128,4 @@
for (var/datum/light_source/L in src.light_sources)
if (L.light_angle)
L.source_atom.update_light()
+19 -4
View File
@@ -1,4 +1,3 @@
/var/list/datum/lighting_corner/all_lighting_corners = list()
/var/datum/lighting_corner/dummy/dummy_lighting_corner = new
// Because we can control each corner of every lighting overlay.
// And corners get shared between multiple turfs (unless you're on the corners of the map, then 1 corner doesn't).
@@ -34,7 +33,7 @@
/datum/lighting_corner/New(var/turf/new_turf, var/diagonal)
. = ..()
all_lighting_corners += src
SSlighting.lighting_corners += src
masters[new_turf] = turn(diagonal, 180)
z = new_turf.z
@@ -102,7 +101,7 @@
if (!now)
needs_update = TRUE
update_overlays(FALSE)
lighting_update_corners += src
SSlighting.corner_queue += src
else
update_overlays(TRUE)
@@ -117,11 +116,19 @@
else if (mx < LIGHTING_SOFT_THRESHOLD)
. = 0 // 0 means soft lighting.
#ifdef LIGHTING_USE_MEMORY_HACK
cache_r = lum_r * . + (rand(1,999)/100000) || LIGHTING_SOFT_THRESHOLD
cache_g = lum_g * . + (rand(1,999)/100000) || LIGHTING_SOFT_THRESHOLD
cache_b = lum_b * . + (rand(1,999)/100000) || LIGHTING_SOFT_THRESHOLD
cache_u = lum_u * . || LIGHTING_SOFT_THRESHOLD
cache_mx = mx
#else
cache_r = round(lum_r * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
cache_g = round(lum_g * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
cache_b = round(lum_b * ., LIGHTING_ROUND_VALUE) || LIGHTING_SOFT_THRESHOLD
cache_u = lum_u * . || LIGHTING_SOFT_THRESHOLD
cache_mx = round(mx, LIGHTING_ROUND_VALUE)
#endif
for (var/TT in masters)
var/turf/T = TT
@@ -130,7 +137,15 @@
T.lighting_overlay.update_overlay()
else if (!T.lighting_overlay.needs_update)
T.lighting_overlay.needs_update = TRUE
lighting_update_overlays += T.lighting_overlay
SSlighting.overlay_queue += T.lighting_overlay
/datum/lighting_corner/Destroy(force = FALSE)
crash_with("Some fuck [force ? "force-" : ""]deleted a lighting corner.")
if (!force)
return QDEL_HINT_LETMELIVE
SSlighting.lighting_corners -= src
return ..()
/datum/lighting_corner/dummy/New()
return
+51 -9
View File
@@ -1,5 +1,3 @@
/var/list/all_lighting_overlays = list() // Global list of lighting overlays.
/atom/movable/lighting_overlay
name = ""
anchored = TRUE
@@ -21,7 +19,7 @@
/atom/movable/lighting_overlay/New(atom/loc, no_update = FALSE)
. = ..()
verbs.Cut()
global.all_lighting_overlays += src
SSlighting.lighting_overlays += src
var/turf/T = loc // If this runtimes atleast we'll know what's creating overlays in things that aren't turfs.
T.lighting_overlay = src
@@ -34,17 +32,20 @@
/atom/movable/lighting_overlay/Destroy()
L_PROF(loc, "overlay_destroy")
global.all_lighting_overlays -= src
global.lighting_update_overlays -= src
SSlighting.lighting_overlays -= src
SSlighting.overlay_queue -= src
var/turf/T = loc
if (istype(T))
T.lighting_overlay = null
T.luminosity = 1
..()
return ..()
/atom/movable/lighting_overlay/proc/update_overlay()
if (QDELING(src)) // This shouldn't happen.
return
var/turf/T = loc
if (!istype(T)) // Erm...
if (loc)
@@ -78,15 +79,53 @@
var/datum/lighting_corner/ca = T.corners[1] || dummy_lighting_corner
var/max = max(cr.cache_mx, cg.cache_mx, cb.cache_mx, ca.cache_mx)
luminosity = max > LIGHTING_SOFT_THRESHOLD
color = list(
// The RNG introduced by LIGHTING_USE_MEMORY_HACK makes this shortcut ineffective.
#ifndef LIGHTING_USE_MEMORY_HACK
var/rr = cr.cache_r
var/rg = cr.cache_g
var/rb = cr.cache_b
var/gr = cg.cache_r
var/gg = cg.cache_g
var/gb = cg.cache_b
var/br = cb.cache_r
var/bg = cb.cache_g
var/bb = cb.cache_b
var/ar = ca.cache_r
var/ag = ca.cache_g
var/ab = ca.cache_b
// Check for a common value first so we can skip expensive color matrixes if possible.
var/all_equal = ((rr == gr && gr == br && br == ar) && (rg == gg && gg == bg && bg == ag) && (rb == gb && gb == bb && bb == ab))
if (!luminosity)
icon_state = LIGHTING_DARKNESS_ICON_STATE
color = null
else if (all_equal && rr == LIGHTING_DEFAULT_TUBE_R && rg == LIGHTING_DEFAULT_TUBE_G && rb == LIGHTING_DEFAULT_TUBE_B)
icon_state = LIGHTING_STATION_ICON_STATE
color = null
else
icon_state = LIGHTING_BASE_ICON_STATE
color = list(
rr, rg, rb, 0,
gr, gg, gb, 0,
br, bg, bb, 0,
ar, ag, ab, 0,
0, 0, 0, 1
)
#else
color = list(
cr.cache_r, cr.cache_g, cr.cache_b, 0,
cg.cache_r, cg.cache_g, cg.cache_b, 0,
cb.cache_r, cb.cache_g, cb.cache_b, 0,
ca.cache_r, ca.cache_g, ca.cache_b, 0,
0, 0, 0, 1
)
luminosity = max > LIGHTING_SOFT_THRESHOLD
#endif
// Variety of overrides so the overlays don't get affected by weird things.
@@ -102,6 +141,9 @@
/atom/movable/lighting_overlay/singuloCanEat()
return FALSE
/atom/movable/lighting_overlay/can_fall()
return FALSE
// Override here to prevent things accidentally moving around overlays.
/atom/movable/lighting_overlay/forceMove(atom/destination, no_tp = FALSE, harderforce = FALSE)
if(harderforce)
-84
View File
@@ -1,84 +0,0 @@
/proc/create_lighting_overlays_zlevel(var/zlevel)
ASSERT(zlevel)
for (var/turf/T in block(locate(1, 1, zlevel), locate(world.maxx, world.maxy, zlevel)))
if (!T.dynamic_lighting)
continue
var/area/A = T.loc
if (!A.dynamic_lighting)
continue
new /atom/movable/lighting_overlay(T, TRUE)
// This repeats a bit of code from the lighting process.
/proc/initialize_lighting()
admin_notice(span("danger", "Generating lighting overlays (1/4)..."), R_DEBUG)
for (var/zlevel = 1 to world.maxz)
create_lighting_overlays_zlevel(zlevel)
CHECK_TICK
admin_notice(span("danger", "Initializing light sources (2/4)..."), R_DEBUG)
var/num_lights = 0
var/list/lights = lighting_update_lights
lighting_update_lights = list()
while (lights.len)
var/datum/light_source/L = lights[lights.len]
lights.len--
if (!L) continue
if (L.destroyed || L.check() || L.force_update)
L.remove_lum()
if(!L.destroyed)
L.apply_lum()
else if(L.vis_update) //We smartly update only tiles that became (in) visible to use.
L.smart_vis_update()
L.vis_update = FALSE
L.force_update = FALSE
L.needs_update = FALSE
num_lights++
CHECK_TICK
admin_notice(span("danger", "Processed [num_lights] light sources."), R_DEBUG)
admin_notice(span("danger", "Initializing lighting corners (3/4)..."), R_DEBUG)
var/num_corners = 0
var/list/corners = lighting_update_corners
lighting_update_corners = list()
while (corners.len)
var/datum/lighting_corner/C = corners[corners.len]
corners.len--
if (!C) continue
C.update_overlays()
C.needs_update = FALSE
num_corners++
CHECK_TICK
admin_notice(span("danger", "Processed [num_corners] light corners."), R_DEBUG)
admin_notice(span("danger", "Initializing lighting overlays (4/4)..."), R_DEBUG)
var/num_overlays = 0
var/list/overlays = lighting_update_overlays
lighting_update_overlays = list()
while (overlays.len)
var/atom/movable/lighting_overlay/O = overlays[overlays.len]
overlays.len--
if (!O) continue
O.update_overlay()
O.needs_update = FALSE
num_overlays++
CHECK_TICK
admin_notice(span("danger", "Processed [num_overlays] light overlays."), R_DEBUG)
+13 -9
View File
@@ -80,23 +80,25 @@
return ..()
// Kill ourselves.
/datum/light_source/proc/destroy(var/no_update = FALSE)
/datum/light_source/Destroy(force)
L_PROF(source_atom, "source_destroy")
destroyed = TRUE
if (!no_update)
force_update()
force_update()
if (source_atom && source_atom.light_sources)
source_atom.light_sources -= src
if (top_atom && top_atom.light_sources)
top_atom.light_sources -= src
. = ..()
if (!force)
return QDEL_HINT_IWILLGC
// Process the light RIGHT NOW.
#define DO_UPDATE \
if (destroyed || check() || force_update) { \
if (QDELETED(src) || check() || force_update) { \
remove_lum(TRUE); \
if (!destroyed) { \
if (!QDELETED(src)) { \
apply_lum(TRUE); \
} \
} \
@@ -111,13 +113,13 @@
#define QUEUE_UPDATE \
if (!needs_update) \
{ \
lighting_update_lights += src; \
SSlighting.light_queue += src; \
needs_update = TRUE; \
}
// Picks either scheduled or instant updates based on current server load.
#define INTELLIGENT_UPDATE \
if (world.tick_usage > TICK_LIMIT || !ticker || ticker.current_state <= GAME_STATE_SETTING_UP) { \
if (world.tick_usage > SSlighting.instant_tick_limit || SSlighting.force_queued) { \
QUEUE_UPDATE; \
} \
else { \
@@ -160,7 +162,7 @@
// Will check if we actually need to update, and update any variables that may need to be updated.
/datum/light_source/proc/check()
if (!source_atom || !light_range || !light_power)
destroy(no_update = TRUE)
qdel(src)
return 1
if (!top_atom)
@@ -433,6 +435,8 @@
L = affecting_turfs - turfs // Now-gone turfs, remove us from the affecting lights.
affecting_turfs -= L
for (var/turf/T in L)
if (QDELETED(T))
continue
T.affecting_lights -= src
for (var/datum/lighting_corner/C in corners - effect_str) // New corners
+29 -7
View File
@@ -9,12 +9,6 @@
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.
/turf/New()
. = ..()
if (opacity)
has_opaque_atom = TRUE
// Causes any affecting light sources to be queued for a visibility update, for example a door got opened.
/turf/proc/reconsider_lights()
L_PROF(src, "turf_reconsider")
@@ -29,7 +23,7 @@
/turf/proc/lighting_clear_overlay()
if (lighting_overlay)
returnToPool(lighting_overlay)
qdel(lighting_overlay)
L_PROF(src, "turf_clear_overlay")
@@ -161,3 +155,31 @@
continue
corners[i] = new/datum/lighting_corner(src, LIGHTING_CORNER_DIAGONAL[i])
/turf/ChangeTurf(turf/N, tell_universe = TRUE, force_lighting_update = FALSE)
if (!SSlighting)
return ..()
var/old_opacity = opacity
var/old_dynamic_lighting = dynamic_lighting
var/list/old_affecting_lights = affecting_lights
var/old_lighting_overlay = lighting_overlay
var/list/old_corners = corners
. = ..()
recalc_atom_opacity()
lighting_overlay = old_lighting_overlay
affecting_lights = old_affecting_lights
corners = old_corners
if ((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting))
reconsider_lights()
if (dynamic_lighting != old_dynamic_lighting)
if (dynamic_lighting)
lighting_build_overlay()
else
lighting_clear_overlay()
for (var/turf/space/S in RANGE_TURFS(1, src))
S.update_starlight()
+3 -3
View File
@@ -38,9 +38,9 @@ var/list/admin_verbs_lighting = list(
return
log_and_message_admins("has flushed the lighting processor queues.")
lighting_update_lights = list()
lighting_update_corners = list()
lighting_update_overlays = list()
SSlighting.light_queue = list()
SSlighting.corner_queue = list()
SSlighting.overlay_queue = list()
/client/proc/lighting_reconsider_target(turf/T in world)
set category = "Lighting"