From caf4d7d5a57fc08b7e322f3737fd3ceaf34a517f Mon Sep 17 00:00:00 2001 From: Aranclanos Date: Wed, 16 Sep 2015 21:52:25 -0300 Subject: [PATCH] Removes update_triggers.dm and moves the code inside of it to their respective procs. Most of the procs on this file were duplicated. --- code/LINDA/LINDA_turf_tile.dm | 8 +- code/game/machinery/camera/camera.dm | 12 ++- code/game/machinery/doors/door.dm | 4 + .../effects/effect_system/effect_system.dm | 7 ++ code/game/objects/structures.dm | 4 + code/game/turfs/simulated.dm | 6 +- code/game/turfs/turf.dm | 7 +- .../silicon/ai/freelook/update_triggers.dm | 99 ------------------- .../modules/mob/living/silicon/robot/robot.dm | 14 ++- tgstation.dme | 1 - 10 files changed, 50 insertions(+), 112 deletions(-) delete mode 100644 code/modules/mob/living/silicon/ai/freelook/update_triggers.dm diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm index 0dee6d8186a..50e2645eced 100644 --- a/code/LINDA/LINDA_turf_tile.dm +++ b/code/LINDA/LINDA_turf_tile.dm @@ -55,18 +55,20 @@ /turf/simulated/New() ..() - + levelupdate() + if(smooth) + smooth_icon(src) + visibilityChanged() if(!blocks_air) air = new - air.oxygen = oxygen air.carbon_dioxide = carbon_dioxide air.nitrogen = nitrogen air.toxins = toxins - air.temperature = temperature /turf/simulated/Del() + visibilityChanged() if(active_hotspot) active_hotspot.Kill() ..() diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 4eb6a9df0fa..44170c8a8a2 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -30,16 +30,17 @@ var/emped = 0 //Number of consecutive EMP's on this camera /obj/machinery/camera/New() + ..() assembly = new(src) assembly.state = 4 - + cameranet.cameras += src + cameranet.addCamera(src) /* // Use this to look for cameras that have the same c_tag. for(var/obj/machinery/camera/C in cameranet.cameras) var/list/tempnetwork = C.network&src.network if(C != src && C.c_tag == src.c_tag && tempnetwork.len) world.log << "[src.c_tag] [src.x] [src.y] [src.z] conflicts with [C.c_tag] [C.x] [C.y] [C.z]" */ - ..() /obj/machinery/camera/initialize() if(z == 1 && prob(3) && !start_active) @@ -56,6 +57,8 @@ bug.current = null bug = null cameranet.removeCamera(src) //Will handle removal from the camera network and the chunks, so we don't need to worry about that + cameranet.cameras -= src + cameranet.removeCamera(src) return ..() /obj/machinery/camera/emp_act(severity) @@ -235,6 +238,11 @@ return /obj/machinery/camera/proc/deactivate(mob/user, displaymessage = 1) //this should be called toggle() but doing a find and replace for this would be ass + if(can_use()) + cameranet.addCamera(src) + else + SetLuminosity(0) + cameranet.removeCamera(src) status = !status cameranet.updateChunk(x, y, z) var/change_msg = "deactivates" diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 266da942cd9..f0194cc645d 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -259,6 +259,10 @@ /obj/machinery/door/proc/hasPower() return !(stat & NOPOWER) +/obj/machinery/door/proc/update_freelook_sight() + if(!glass && cameranet) + cameranet.updateVisibility(src, 0) + /obj/machinery/door/BlockSuperconductivity() // All non-glass airlocks block heat, this is intended. if(opacity || heat_proof) return 1 diff --git a/code/game/objects/effects/effect_system/effect_system.dm b/code/game/objects/effects/effect_system/effect_system.dm index ea4ec6d60fd..5ed578fecdb 100644 --- a/code/game/objects/effects/effect_system/effect_system.dm +++ b/code/game/objects/effects/effect_system/effect_system.dm @@ -13,7 +13,14 @@ would spawn and follow the beaker, even if it is carried or thrown. unacidable = 1//So effect are not targeted by alien acid. pass_flags = PASSTABLE | PASSGRILLE +/obj/effect/effect/New() + ..() + if(ticker) + cameranet.updateVisibility(src) + /obj/effect/effect/Destroy() + if(ticker) + cameranet.updateVisibility(src) ..() return QDEL_HINT_PUTINPOOL /* diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index c1c19582ec1..b4288121366 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -8,12 +8,16 @@ smooth_icon(src) smooth_icon_neighbors(src) icon_state = "" + if(ticker) + cameranet.updateVisibility(src) /obj/structure/blob_act() if(prob(50)) qdel(src) /obj/structure/Destroy() + if(ticker) + cameranet.updateVisibility(src) if(opacity) UpdateAffectingLights() if(smooth) diff --git a/code/game/turfs/simulated.dm b/code/game/turfs/simulated.dm index 7ab497abae8..afc9f6d8e84 100644 --- a/code/game/turfs/simulated.dm +++ b/code/game/turfs/simulated.dm @@ -9,11 +9,7 @@ var/to_be_destroyed = 0 //Used for fire, if a melting temperature was reached, it will be destroyed var/max_fire_temperature_sustained = 0 //The max temperature of the fire which it was subjected to -/turf/simulated/New() - ..() - levelupdate() - if(smooth) - smooth_icon(src) + /turf/simulated/proc/burn_tile() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 3db0aa0ae76..35be810254f 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -26,11 +26,13 @@ flags = 0 + var/image/obscured //camerachunks + /turf/New() ..() for(var/atom/movable/AM in src) Entered(AM) - return + /turf/Destroy() return QDEL_HINT_HARDDEL_NOW @@ -281,6 +283,9 @@ /turf/proc/can_lay_cable() return can_have_cabling() & !intact +/turf/proc/visibilityChanged() + if(ticker) + cameranet.updateVisibility(src) /turf/indestructible name = "wall" diff --git a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm b/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm deleted file mode 100644 index 3f9d11301a4..00000000000 --- a/code/modules/mob/living/silicon/ai/freelook/update_triggers.dm +++ /dev/null @@ -1,99 +0,0 @@ -#define BORG_CAMERA_BUFFER 30 - -//UPDATE TRIGGERS, when the chunk (and the surrounding chunks) should update. - -// TURFS - -/turf - var/image/obscured - -/turf/proc/visibilityChanged() - if(ticker) - cameranet.updateVisibility(src) - -/turf/simulated/Del() - visibilityChanged() - ..() - -/turf/simulated/New() - ..() - visibilityChanged() - - - -// STRUCTURES - -/obj/structure/Destroy() - if(ticker) - cameranet.updateVisibility(src) - return ..() - -/obj/structure/New() - ..() - if(ticker) - cameranet.updateVisibility(src) - -// EFFECTS - -/obj/effect/Destroy() - if(ticker) - cameranet.updateVisibility(src) - return ..() - -/obj/effect/New() - ..() - if(ticker) - cameranet.updateVisibility(src) - - -// DOORS - -// Simply updates the visibility of the area when it opens/closes/destroyed. -/obj/machinery/door/proc/update_freelook_sight() - // Glass door glass = 1 - // don't check then? - if(!glass && cameranet) - cameranet.updateVisibility(src, 0) - - -// ROBOT MOVEMENT - -// Update the portable camera everytime the Robot moves. -// This might be laggy, comment it out if there are problems. -/mob/living/silicon/robot/var/updating = 0 - -/mob/living/silicon/robot/Move() - var/oldLoc = src.loc - . = ..() - if(.) - if(src.camera) - if(!updating) - updating = 1 - spawn(BORG_CAMERA_BUFFER) - if(oldLoc != src.loc) - cameranet.updatePortableCamera(src.camera) - updating = 0 - -// CAMERA - -// An addition to deactivate which removes/adds the camera from the chunk list based on if it works or not. - -/obj/machinery/camera/deactivate(mob/user, choice = 1) - ..(user, choice) - if(src.can_use()) - cameranet.addCamera(src) - else - src.SetLuminosity(0) - cameranet.removeCamera(src) - -/obj/machinery/camera/New() - ..() - cameranet.cameras += src - cameranet.addCamera(src) - -/obj/machinery/camera/Destroy() - cameranet.cameras -= src - cameranet.removeCamera(src) - return ..() - -#undef BORG_CAMERA_BUFFER \ No newline at end of file diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index bec3e1f8637..36e099d68ca 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -67,6 +67,8 @@ var/lamp_intensity = 0 //Luminosity of the headlamp. 0 is off. Higher settings than the minimum require power. var/lamp_recharging = 0 //Flag for if the lamp is on cooldown after being forcibly disabled. + var/updating = 0 //portable camera camerachunk update + /mob/living/silicon/robot/New(loc) spark_system = new /datum/effect/effect/system/spark_spread() spark_system.set_up(5, 0, src) @@ -882,9 +884,18 @@ /mob/living/silicon/robot/proc/radio_menu() radio.interact(src)//Just use the radio's Topic() instead of bullshit special-snowflake code - +#define BORG_CAMERA_BUFFER 30 /mob/living/silicon/robot/Move(a, b, flag) + var/oldLoc = src.loc . = ..() + if(.) + if(src.camera) + if(!updating) + updating = 1 + spawn(BORG_CAMERA_BUFFER) + if(oldLoc != src.loc) + cameranet.updatePortableCamera(src.camera) + updating = 0 if(module) if(module.type == /obj/item/weapon/robot_module/janitor) var/turf/tile = loc @@ -924,6 +935,7 @@ loc.attackby(module_state_2,src) else if(istype(module_state_3,/obj/item/weapon/storage/bag/ore)) loc.attackby(module_state_3,src) +#undef BORG_CAMERA_BUFFER /mob/living/silicon/robot/proc/self_destruct() if(emagged) diff --git a/tgstation.dme b/tgstation.dme index 16f91b9670f..c3eaf63b7d4 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1217,7 +1217,6 @@ #include "code\modules\mob\living\silicon\ai\freelook\chunk.dm" #include "code\modules\mob\living\silicon\ai\freelook\eye.dm" #include "code\modules\mob\living\silicon\ai\freelook\read_me.dm" -#include "code\modules\mob\living\silicon\ai\freelook\update_triggers.dm" #include "code\modules\mob\living\silicon\pai\death.dm" #include "code\modules\mob\living\silicon\pai\examine.dm" #include "code\modules\mob\living\silicon\pai\life.dm"