Port SSoverlays & Convert turfs to use it (#5004)

* Added "Display Initialize() Log" admin debug command so you can see it mid-round.

* Ported the core of the overlays management subsystem from /tg

- Added SSoverlays subsystem for compiling overlay lists and applying them to atoms in a controlled anti-lag subsystem.
- Added vars and procs to atom which should eventually replace all direct interaction with BYOND's /atom/overlays var outside the subsystem.
- Added OVERLAY_QUEUED flag to var/atom/flags bitfield.
- Added small framework for subsystem performance tracking. So far used only by SSoverlays
- Added admin debug command "Display overlay Log" to see performance stats mid-round.

* Fix runtime on universal pipe adaptor update_icons

* Workaround for appearance_bro not initialized

Unfortuantely BYOND's initialization order is strange, and the appearance_bro var is only half initialized when map starts to load, causing errors.  We temporarily fix by moving it to be a global-scoped global.

* Convert fire alarms to use add_overlay() A good first test.

* Convert turfs to use add_overlays(), eliminating the turf_overlay_holder!

- Converted as much as I could find about turf overlays to use add_overlay().
- This should be enough to stop BYOND from crashing, so we can eliminate the turf_overlay_holder hack.
- This also lets us remove the anti-corruption hacks from walls and open space.
- ZAS gas overlays can use priority overlays, so this also fixes the gas-goes-away-when-crowbarring-plating issue.
- Stuff like that

* Convert turf overlay interactions to use add_overlay.

Note: This is a plain and simple conversion of existing code to use SSoverlays. However I look at the line changed, and note that that line likely never fully worked as intended, as it has no way of re-applying itself.
I would make it use a priority overlay, but there is no code present for *removing* said overlay from neighbors when it is no longer required.  That code should be implemented by original author.
This commit is contained in:
Leshana
2018-03-05 19:43:23 -06:00
committed by Anewbe
parent 9acf3f8297
commit 741e02407a
33 changed files with 454 additions and 248 deletions
+2
View File
@@ -193,6 +193,8 @@ var/list/admin_verbs_debug = list(
/client/proc/cmd_debug_del_all,
/client/proc/cmd_debug_tog_aliens,
/client/proc/cmd_display_del_log,
/client/proc/cmd_display_init_log,
/client/proc/cmd_display_overlay_log,
/client/proc/air_report,
/client/proc/reload_admins,
/client/proc/reload_eventMs,
+30
View File
@@ -327,6 +327,36 @@
usr << browse(dellog.Join(), "window=dellog")
/client/proc/cmd_display_init_log()
set category = "Debug"
set name = "Display Initialize() Log"
set desc = "Displays a list of things that didn't handle Initialize() properly"
if(!check_rights(R_DEBUG)) return
src << browse(replacetext(SSatoms.InitLog(), "\n", "<br>"), "window=initlog")
/client/proc/cmd_display_overlay_log()
set category = "Debug"
set name = "Display overlay Log"
set desc = "Display SSoverlays log of everything that's passed through it."
if(!check_rights(R_DEBUG)) return
render_stats(SSoverlays.stats, src)
// Render stats list for round-end statistics.
/proc/render_stats(list/stats, user, sort = /proc/cmp_generic_stat_item_time)
sortTim(stats, sort, TRUE)
var/list/lines = list()
for (var/entry in stats)
var/list/data = stats[entry]
lines += "[entry] => [num2text(data[STAT_ENTRY_TIME], 10)]ms ([data[STAT_ENTRY_COUNT]]) (avg:[num2text(data[STAT_ENTRY_TIME]/(data[STAT_ENTRY_COUNT] || 1), 99)])"
if (user)
user << browse("<ol><li>[lines.Join("</li><li>")]</li></ol>", "window=[url_encode("stats:\ref[stats]")]")
else
. = lines.Join("\n")
/client/proc/cmd_admin_grantfullaccess(var/mob/M in mob_list)
set category = "Admin"
set name = "Grant Full Access"
+1 -1
View File
@@ -107,7 +107,7 @@
/turf/simulated/floor/holofloor/desert/New()
..()
if(prob(10))
overlays += "asteroid[rand(0,9)]"
add_overlay("asteroid[rand(0,9)]")
/obj/structure/holostool
name = "stool"
+4 -15
View File
@@ -73,7 +73,7 @@
* Update icon and overlays of open space to be that of the turf below, plus any visible objects on that turf.
*/
/turf/simulated/open/update_icon()
overlays = list() // Edit - Overlays are being crashy when modified.
cut_overlays() // Edit - Overlays are being crashy when modified.
update_icon_edge()// Add - Get grass into open spaces and whatnot.
var/turf/below = GetBelow(src)
if(below)
@@ -86,12 +86,7 @@
bottom_turf.plane = src.plane
bottom_turf.color = below.color
underlays = list(bottom_turf)
// Hack workaround to byond crash bug - Include the magic overlay holder object.
overlays += below.overlays
// if(below.overlay_holder)
// overlays += (below.overlays + below.overlay_holder.overlays)
// else
// overlays += below.overlays
copy_overlays(below)
// get objects (not mobs, they are handled by /obj/zshadow)
var/list/o_img = list()
@@ -104,16 +99,10 @@
temp2.overlays += O.overlays
// TODO Is pixelx/y needed?
o_img += temp2
var/overlays_pre = overlays.len
overlays += o_img
var/overlays_post = overlays.len
if(overlays_post != (overlays_pre + o_img.len)) //Here we go!
world.log << "Corrupted openspace turf at [x],[y],[z] being replaced. Pre: [overlays_pre], Post: [overlays_post]"
new /turf/simulated/open(src)
return //Let's get out of here.
add_overlay(o_img)
if(!below_is_open)
overlays += over_OS_darkness
add_overlay(over_OS_darkness)
return 0
return PROCESS_KILL