From 8b762a5317081e39a3085f8a043ad954954475bd Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Fri, 16 Dec 2016 19:18:09 +0100 Subject: [PATCH] Various lighting fixes. (#94) * Various lighting fixes. * Removes debug things. * I forgot to hit crtl+s --- code/modules/lighting/lighting_area.dm | 4 ++-- code/modules/lighting/lighting_atom.dm | 2 -- code/modules/lighting/lighting_overlay.dm | 23 ++++++++++++++--------- code/modules/lighting/lighting_source.dm | 6 ++++-- code/modules/mob/inventory.dm | 11 +++++++++-- code/modules/shuttle/shuttle.dm | 7 ++++--- 6 files changed, 33 insertions(+), 20 deletions(-) diff --git a/code/modules/lighting/lighting_area.dm b/code/modules/lighting/lighting_area.dm index 702a6ded15..5c56b4d35c 100644 --- a/code/modules/lighting/lighting_area.dm +++ b/code/modules/lighting/lighting_area.dm @@ -18,12 +18,12 @@ dynamic_lighting = new_dynamic_lighting if (IS_DYNAMIC_LIGHTING(src)) - for (var/turf/T in (area_contents())) + for (var/turf/T in area_contents(src)) if (IS_DYNAMIC_LIGHTING(T)) T.lighting_build_overlay() else - for (var/turf/T in (area_contents())) + for (var/turf/T in area_contents(src)) if (T.lighting_overlay) T.lighting_clear_overlay() diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index aeef051734..9c07ef63d8 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -97,8 +97,6 @@ T.reconsider_lights() -// This code makes the light be queued for update when it is moved. -// Entered() should handle it, however Exited() can do it if it is being moved to nullspace (as there would be no Entered() call in that situation). /atom/movable/Moved(atom/OldLoc, Dir) //Implemented here because forceMove() doesn't call Move() . = ..() for (var/datum/light_source/L in src.light_sources) // Cycle through the light sources on this atom and tell them to update. diff --git a/code/modules/lighting/lighting_overlay.dm b/code/modules/lighting/lighting_overlay.dm index 6dbc61047f..d073617f5e 100644 --- a/code/modules/lighting/lighting_overlay.dm +++ b/code/modules/lighting/lighting_overlay.dm @@ -33,20 +33,21 @@ update_overlay() /atom/movable/lighting_overlay/Destroy(var/force) - global.all_lighting_overlays -= src - global.lighting_update_overlays -= src - global.lighting_update_overlays_old -= src - - var/turf/T = loc - if (istype(T)) - T.lighting_overlay = null - T.luminosity = 1 - if (force) + global.all_lighting_overlays -= src + global.lighting_update_overlays -= src + global.lighting_update_overlays_old -= src + + var/turf/T = loc + if (istype(T)) + T.lighting_overlay = null + T.luminosity = 1 + ..() return QDEL_HINT_PUTINPOOL else + // Fuck you! return QDEL_HINT_LETMELIVE /atom/movable/lighting_overlay/proc/update_overlay() @@ -110,3 +111,7 @@ color = LIGHTING_BASE_MATRIX ..("color") + +// Nope nope nope! +/atom/movable/lighting_overlay/onShuttleMove(turf/T1, rotation) + return FALSE diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index 17746d6305..e159209641 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -64,9 +64,11 @@ if (source_atom) if (source_atom.light == src) source_atom.light = null - source_atom.light_sources -= src - if (top_atom) + if (source_atom.light_sources) + source_atom.light_sources -= src + + if (top_atom && top_atom.light_sources) top_atom.light_sources -= src // Fuck supporting force. diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 66b42078ed..75ead02f66 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -29,7 +29,9 @@ if(!has_left_hand()) return 0 if(!l_hand) - W.loc = src //TODO: move to equipped? + var/atom/old_loc = W.loc + W.loc = src //TODO: move to equipped? + W.Moved(old_loc, 0) // MSO told me to do this! l_hand = W W.layer = ABOVE_HUD_LAYER //TODO: move to equipped? W.equipped(src,slot_l_hand) @@ -49,7 +51,9 @@ if(!has_right_hand()) return 0 if(!r_hand) + var/atom/old_loc = W.loc W.loc = src + W.Moved(old_loc, 0) // MSO told me to do this! r_hand = W W.layer = ABOVE_HUD_LAYER W.equipped(src,slot_r_hand) @@ -95,7 +99,9 @@ else if(put_in_inactive_hand(W)) return 1 else + var/atom/old_loc = W.loc W.loc = get_turf(src) + W.Moved(old_loc, 0) // MSO told me to do this! W.layer = initial(W.layer) W.dropped(src) return 0 @@ -157,6 +163,7 @@ if(client) client.screen -= I I.loc = loc + I.Moved(src, 0) // MSO told me to do this! I.dropped(src) if(I) I.layer = initial(I.layer) @@ -274,4 +281,4 @@ return slot_back /mob/proc/getBeltSlot() - return slot_belt \ No newline at end of file + return slot_belt diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 6ef0893120..fbf0d09f23 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -442,7 +442,9 @@ if(!A0) A0 = new area_type(null) for(var/turf/T0 in L0) + var/area/old = T0.loc A0.contents += T0 + T0.change_area(old, A0) remove_ripples() @@ -459,7 +461,9 @@ continue if(T0.type != T0.baseturf) //So if there is a hole in the shuttle we don't drag along the space/asteroid/etc to wherever we are going next T0.copyTurf(T1) + var/area/old = T1.loc areaInstance.contents += T1 + T1.change_area(old, areaInstance) //copy over air if(istype(T1, /turf/open)) @@ -473,15 +477,12 @@ if(rotation) T1.shuttleRotate(rotation) - //lighting stuff - T1.reconsider_lights() SSair.remove_from_active(T1) T1.CalculateAdjacentTurfs() SSair.add_to_active(T1,1) T0.ChangeTurf(turf_type) - T0.reconsider_lights() SSair.remove_from_active(T0) T0.CalculateAdjacentTurfs() SSair.add_to_active(T0,1)