Miscellaneous Tweaks (#1720)

changes:

Refactored footstep sounds to use less operations & only calculate for human-types.
Improved the logging detail of the lighting profiler.
Fixed some shuttle corners that weren't correctly working with parallax space.
Converted get_turf() into a compiler macro.
Solars are now dynamically lit.
Silenced warning from lighting overlays pooling themselves when updated on a space tile.
Fixed a bug where securing a girder was instant when it was supposed to have a delay.
This commit is contained in:
Lohikar
2017-02-07 10:46:39 -06:00
committed by skull132
parent ed6dbee896
commit bc441ab9d6
20 changed files with 122 additions and 77 deletions

View File

@@ -9,7 +9,7 @@
luminosity = FALSE
/area/proc/set_dynamic_lighting(var/new_dynamic_lighting = TRUE)
lprof_write(src, "area_sdl")
L_PROF(src, "area_sdl")
if (new_dynamic_lighting == dynamic_lighting)
return FALSE

View File

@@ -14,7 +14,7 @@
// The proc you should always use to set the light of this atom.
/atom/proc/set_light(var/l_range, var/l_power, var/l_color = NONSENSICAL_VALUE, var/uv = NONSENSICAL_VALUE, var/no_update = FALSE)
lprof_write(src, "atom_setlight")
L_PROF(src, "atom_setlight")
if(l_range > 0 && l_range < MINIMUM_USEFUL_LIGHT_RANGE)
l_range = MINIMUM_USEFUL_LIGHT_RANGE //Brings the range up to 1.4, which is just barely brighter than the soft lighting that surrounds players.
@@ -38,6 +38,7 @@
#undef NONSENSICAL_VALUE
/atom/proc/set_uv(var/intensity, var/no_update)
L_PROF(src, "atom_setuv")
if (intensity < 0 || intensity > 255)
intensity = min(max(intensity, 255), 0)
@@ -55,7 +56,7 @@
if (gcDestroyed)
return
lprof_write(src, "atom_update")
L_PROF(src, "atom_update")
if (!light_power || !light_range) // We won't emit light anyways, destroy the light source.
if(light)
@@ -104,7 +105,7 @@
if (new_opacity == opacity)
return
lprof_write(src, "atom_setopacity")
L_PROF(src, "atom_setopacity")
opacity = new_opacity
var/turf/T = loc

View File

@@ -32,6 +32,7 @@
update_overlay()
/atom/movable/lighting_overlay/Destroy()
L_PROF(loc, "overlay_destroy")
global.all_lighting_overlays -= src
global.lighting_update_overlays -= src
lighting_process.curr_overlays -= src
@@ -55,8 +56,9 @@
returnToPool(src)
return
if (T.is_space())
warning("A lighting overlay realised it was attached to a space tile and got pooled!")
if (istype(T, /turf/space))
// I mean, this happens often and doesn't do any harm. Might as well silence the warning.
//warning("A lighting overlay realised it was attached to a space tile and got pooled!")
returnToPool(src)
return
@@ -103,6 +105,7 @@
// Override here to prevent things accidentally moving around overlays.
/atom/movable/lighting_overlay/forceMove(atom/destination, var/no_tp=FALSE, var/harderforce = FALSE)
if(harderforce)
L_PROF(loc, "overlay_forcemove")
. = ..()
/atom/movable/lighting_overlay/resetVariables(...)

View File

@@ -11,7 +11,7 @@
var/name = null
var/locname = null
if (istype(obj, /obj) || istype(obj, /turf))
if (istype(obj))
name = obj.name
locname = obj.loc.name
x = obj.loc.x
@@ -20,12 +20,13 @@
var/static/DBQuery/lprof_q
if (!lprof_q)
lprof_q = dbcon.NewQuery({"INSERT INTO ss13dbg_lighting (time,type,name,loc_name,x,y,z)
VALUES (:time,:type,:name,:loc_name,:x,:y,:z);"})
lprof_q = dbcon.NewQuery({"INSERT INTO ss13dbg_lighting (time,tick_usage,type,name,loc_name,x,y,z)
VALUES (:time,:tick_usage,:type,:name,:loc_name,:x,:y,:z);"})
lprof_q.Execute(
list(
":time" = world.time,
":tick_usage" = world.tick_usage,
":type" = type,
":name" = name,
":loc_name" = locname,

View File

@@ -59,12 +59,14 @@
update()
lprof_write(src, "source_new")
L_PROF(source_atom, "source_new")
return ..()
// Kill ourselves.
/datum/light_source/proc/destroy(var/no_update = FALSE)
L_PROF(source_atom, "source_destroy")
destroyed = TRUE
if (!no_update)
force_update()
@@ -121,19 +123,20 @@
top_atom.light_sources += src // Add ourselves to the light sources of our new top atom.
lprof_write(src, "source_update")
L_PROF(source_atom, "source_update")
INTELLIGENT_UPDATE
// Will force an update without checking if it's actually needed.
/datum/light_source/proc/force_update()
lprof_write(src, "source_forceupdate")
L_PROF(source_atom, "source_forceupdate")
force_update = 1
INTELLIGENT_UPDATE
// Will cause the light source to recalculate turfs that were removed or added to visibility only.
/datum/light_source/proc/vis_update()
L_PROF(source_atom, "source_visupdate")
vis_update = 1
INTELLIGENT_UPDATE
@@ -285,6 +288,7 @@
APPLY_CORNER(C,now)
/datum/light_source/proc/smart_vis_update(var/now = FALSE)
L_PROF(source_atom, "source_smartvisupdate")
var/list/datum/lighting_corner/corners = list()
var/list/turf/turfs = list()
FOR_DVIEW(var/turf/T, light_range, source_turf, 0)

View File

@@ -17,7 +17,7 @@
// Causes any affecting light sources to be queued for a visibility update, for example a door got opened.
/turf/proc/reconsider_lights()
lprof_write(src, "turf_reconsider")
L_PROF(src, "turf_reconsider")
for (var/datum/light_source/L in affecting_lights)
L.vis_update()
@@ -25,6 +25,8 @@
if (lighting_overlay)
returnToPool(lighting_overlay)
L_PROF(src, "turf_clear_overlay")
for (var/datum/lighting_corner/C in corners)
C.update_active()
@@ -33,6 +35,8 @@
if (lighting_overlay)
return
L_PROF(src, "turf_build_overlay")
var/area/A = loc
if (A.dynamic_lighting && dynamic_lighting)
if (!lighting_corners_initialised)
@@ -70,6 +74,8 @@
if (!lighting_overlay)
return 1
L_PROF(src, "turf_get_uv")
var/totallums = 0
for (var/datum/lighting_corner/L in corners)
totallums += L.lum_u