From 3bdeba5ac794fc9822062256c56e6254e950e7d3 Mon Sep 17 00:00:00 2001 From: d3athrow Date: Sat, 27 Jul 2013 13:39:20 -0500 Subject: [PATCH] Typo fix, retractor step bugfix. ZAS fix. It should now be possible to repair breaches without admin intervention. Signed-off-by: Mloc-Argent Several ZAS fixes. Adds insulation to doors, modifiable by admins from the ZAS setting panel. Fixes a logic error with connections. (I am dumb some days) Improves the runtime detection and reporting. Improves "zone info" debug verb. --- code/ZAS/Connection.dm | 725 ++++++++++++------------ code/ZAS/Debug.dm | 112 ++-- code/ZAS/FEA_system.dm | 221 ++++---- code/ZAS/Variable Settings.dm | 7 + code/controllers/master_controller.dm | 6 +- code/modules/flufftext/Hallucination.dm | 4 +- code/modules/surgery/generic.dm | 4 +- 7 files changed, 555 insertions(+), 524 deletions(-) diff --git a/code/ZAS/Connection.dm b/code/ZAS/Connection.dm index f9697207c60..8a919d50435 100644 --- a/code/ZAS/Connection.dm +++ b/code/ZAS/Connection.dm @@ -6,393 +6,396 @@ Indirect connections will not merge the two zones after they reach equilibrium. #define CONNECTION_INDIRECT 1 #define CONNECTION_CLOSED 0 +/connection + var/turf/simulated/A + var/turf/simulated/B -connection - var - turf/simulated //The turfs involved in the connection. - A - B - zone - zone_A - zone_B - ref_A - ref_B - indirect = CONNECTION_DIRECT //If the connection is purely indirect, the zones should not join. - last_updated //The tick at which this was last updated. - no_zone_count = 0 + var/zone/zone_A + var/zone/zone_B + + var/ref_A + var/ref_B + + var/indirect = CONNECTION_DIRECT //If the connection is purely indirect, the zones should not join. + + var/last_updated //The tick at which this was last updated. + + var/no_zone_count = 0 - New(turf/T,turf/O) - A = T - B = O - if(A.zone && B.zone) - if(!A.zone.connections) A.zone.connections = list() - A.zone.connections += src - zone_A = A.zone - ref_A = "\ref[A]" - if(!B.zone.connections) B.zone.connections = list() - B.zone.connections += src - zone_B = B.zone - ref_B = "\ref[B]" +/connection/New(turf/T,turf/O) + A = T + B = O + if(A.zone && B.zone) + if(!A.zone.connections) A.zone.connections = list() + A.zone.connections += src + zone_A = A.zone + ref_A = "\ref[A]" - if(ref_A in air_master.turfs_with_connections) - var/list/connections = air_master.turfs_with_connections[ref_A] - connections.Add(src) - else - air_master.turfs_with_connections[ref_A] = list(src) - - if(ref_B in air_master.turfs_with_connections) - var/list/connections = air_master.turfs_with_connections[ref_B] - connections.Add(src) - else - air_master.turfs_with_connections[ref_B] = list(src) - - if(A.CanPass(null, B, 0, 0)) - - ConnectZones(A.zone, B.zone, 1) - - if(A.HasDoor(B) || B.HasDoor(A)) - indirect = CONNECTION_INDIRECT - - else - ConnectZones(A.zone, B.zone) - indirect = CONNECTION_CLOSED - - - else - world.log << "Attempted to create connection object for non-zone tiles: [T] ([T.x],[T.y],[T.z]) -> [O] ([O.x],[O.y],[O.z])" - del(src) - - - Del() - //remove connections from master lists. - if(ref_B in air_master.turfs_with_connections) - var/list/connections = air_master.turfs_with_connections[ref_B] - connections.Remove(src) + if(!B.zone.connections) B.zone.connections = list() + B.zone.connections += src + zone_B = B.zone + ref_B = "\ref[B]" if(ref_A in air_master.turfs_with_connections) var/list/connections = air_master.turfs_with_connections[ref_A] - connections.Remove(src) + connections.Add(src) + else + air_master.turfs_with_connections[ref_A] = list(src) - //Remove connection from zones. - if(A) - if(A.zone && A.zone.connections) - A.zone.connections.Remove(src) - if(!A.zone.connections.len) - A.zone.connections = null + if(ref_B in air_master.turfs_with_connections) + var/list/connections = air_master.turfs_with_connections[ref_B] + connections.Add(src) + else + air_master.turfs_with_connections[ref_B] = list(src) - if(istype(zone_A) && (!A || A.zone != zone_A)) + if(A.CanPass(null, B, 0, 0)) + + ConnectZones(A.zone, B.zone, 1) + + if(A.HasDoor(B) || B.HasDoor(A)) + indirect = CONNECTION_INDIRECT + + else + ConnectZones(A.zone, B.zone) + indirect = CONNECTION_CLOSED + + + else + world.log << "Attempted to create connection object for non-zone tiles: [T] ([T.x],[T.y],[T.z]) -> [O] ([O.x],[O.y],[O.z])" + del(src) + + +/connection/Del() + //remove connections from master lists. + if(ref_B in air_master.turfs_with_connections) + var/list/connections = air_master.turfs_with_connections[ref_B] + connections.Remove(src) + + if(ref_A in air_master.turfs_with_connections) + var/list/connections = air_master.turfs_with_connections[ref_A] + connections.Remove(src) + + //Remove connection from zones. + if(A) + if(A.zone && A.zone.connections) + A.zone.connections.Remove(src) + if(!A.zone.connections.len) + A.zone.connections = null + + if(istype(zone_A) && (!A || A.zone != zone_A)) + if(zone_A.connections) + zone_A.connections.Remove(src) + if(!zone_A.connections.len) + zone_A.connections = null + + if(B) + if(B.zone && B.zone.connections) + B.zone.connections.Remove(src) + if(!B.zone.connections.len) + B.zone.connections = null + + if(istype(zone_B) && (!B || B.zone != zone_B)) + if(zone_B.connections) + zone_B.connections.Remove(src) + if(!zone_B.connections.len) + zone_B.connections = null + + //Disconnect zones while handling unusual conditions. + // e.g. loss of a zone on a turf + if(A && A.zone && B && B.zone) + DisconnectZones(A.zone, B.zone) + + //Finally, preform actual deletion. + . = ..() + + +/connection/proc/ConnectZones(var/zone/zone_1, var/zone/zone_2, open = 0) + + //Sanity checking + if(!istype(zone_1) || !istype(zone_2)) + return + + //Handle zones connecting indirectly/directly. + if(open) + + //Create the lists if necessary. + if(!zone_1.connected_zones) + zone_1.connected_zones = list() + + if(!zone_2.connected_zones) + zone_2.connected_zones = list() + + //Increase the number of connections between zones. + if(zone_2 in zone_1.connected_zones) + zone_1.connected_zones[zone_2]++ + else + zone_1.connected_zones += zone_2 + zone_1.connected_zones[zone_2] = 1 + + if(zone_1 in zone_2.connected_zones) + zone_2.connected_zones[zone_1]++ + else + zone_2.connected_zones += zone_1 + zone_2.connected_zones[zone_1] = 1 + + //Handle closed connections. + else + + //Create the lists + if(!zone_1.closed_connection_zones) + zone_1.closed_connection_zones = list() + + if(!zone_2.closed_connection_zones) + zone_2.closed_connection_zones = list() + + //Increment the connections. + if(zone_2 in zone_1.closed_connection_zones) + zone_1.closed_connection_zones[zone_2]++ + else + zone_1.closed_connection_zones += zone_2 + zone_1.closed_connection_zones[zone_2] = 1 + + if(zone_1 in zone_2.closed_connection_zones) + zone_2.closed_connection_zones[zone_1]++ + else + zone_2.closed_connection_zones += zone_1 + zone_2.closed_connection_zones[zone_1] = 1 + + +/connection/proc/DisconnectZones(var/zone/zone_1, var/zone/zone_2) + //Sanity checking + if(!istype(zone_1) || !istype(zone_2)) + return + + if(indirect != CONNECTION_CLOSED) + //Handle disconnection of indirectly or directly connected zones. + if( (zone_1 in zone_2.connected_zones) || (zone_2 in zone_1.connected_zones) ) + + //If there are more than one connection, decrement the number of connections + //Otherwise, remove all connections between the zones. + if(zone_2 in zone_1.connected_zones) + if(zone_1.connected_zones[zone_2] > 1) + zone_1.connected_zones[zone_2]-- + else + zone_1.connected_zones -= zone_2 + //remove the list if it is empty + if(!zone_1.connected_zones.len) + zone_1.connected_zones = null + + //Then do the same for the other zone. + if(zone_1 in zone_2.connected_zones) + if(zone_2.connected_zones[zone_1] > 1) + zone_2.connected_zones[zone_1]-- + else + zone_2.connected_zones -= zone_1 + if(!zone_2.connected_zones.len) + zone_2.connected_zones = null + + else + //Handle disconnection of closed zones. + if( (zone_1 in zone_2.closed_connection_zones) || (zone_2 in zone_1.closed_connection_zones) ) + + //If there are more than one connection, decrement the number of connections + //Otherwise, remove all connections between the zones. + if(zone_2 in zone_1.closed_connection_zones) + if(zone_1.closed_connection_zones[zone_2] > 1) + zone_1.closed_connection_zones[zone_2]-- + else + zone_1.closed_connection_zones -= zone_2 + //remove the list if it is empty + if(!zone_1.closed_connection_zones.len) + zone_1.closed_connection_zones = null + + //Then do the same for the other zone. + if(zone_1 in zone_2.closed_connection_zones) + if(zone_2.closed_connection_zones[zone_1] > 1) + zone_2.closed_connection_zones[zone_1]-- + else + zone_2.closed_connection_zones -= zone_1 + if(!zone_2.closed_connection_zones.len) + zone_2.closed_connection_zones = null + + +/connection/proc/Cleanup() + + //Check sanity: existance of turfs + if(!A || !B) + del src + + //Check sanity: zones are different + if(A.zone == B.zone) + del src + + //Check sanity: same turfs as before. + if(ref_A != "\ref[A]" || ref_B != "\ref[B]") + del src + + //Handle zones changing on a turf. + if((A.zone && A.zone != zone_A) || (B.zone && B.zone != zone_B)) + Sanitize() + + //Manage sudden loss of a turfs zone. (e.g. a wall being built) + if(!A.zone || !B.zone) + no_zone_count++ + if(no_zone_count >= 5) + //world.log << "Connection removed: [A] or [B] missing a zone." + del src + return 0 + + return 1 + + +/connection/proc/CheckPassSanity() + //Sanity check, first. + Cleanup() + + if(A.zone && B.zone) + + //If no walls are blocking us... + if(A.ZAirPass(B)) + //...we check to see if there is a door in the way... + var/door_pass = A.CanPass(null,B,1.5,1) + //...and if it is opened. + if(door_pass || A.CanPass(null,B,0,0)) + + //Make and remove connections to let air pass. + if(indirect == CONNECTION_CLOSED) + DisconnectZones(A.zone, B.zone) + ConnectZones(A.zone, B.zone, 1) + + if(door_pass) + indirect = CONNECTION_DIRECT + else if(!door_pass) + indirect = CONNECTION_INDIRECT + + //The door is instead closed. + else if(indirect > CONNECTION_CLOSED) + DisconnectZones(A.zone, B.zone) + indirect = CONNECTION_CLOSED + ConnectZones(A.zone, B.zone) + + //If I can no longer pass air, better delete + else + del src + +/connection/proc/Sanitize() + //If the zones change on connected turfs, update it. + + //Both zones changed (wat) + if(A.zone && A.zone != zone_A && B.zone && B.zone != zone_B) + + //If the zones have gotten swapped + // (do not ask me how, I am just being anal retentive about sanity) + if(A.zone == zone_B && B.zone == zone_A) + var/turf/temp = B + B = A + A = temp + zone_B = B.zone + zone_A = A.zone + var/temp_ref = ref_A + ref_A = ref_B + ref_B = temp_ref + return + + //Handle removal of connections from archived zones. + if(zone_A && zone_A.connections) + zone_A.connections.Remove(src) + if(!zone_A.connections.len) + zone_A.connections = null + + if(zone_B && zone_B.connections) + zone_B.connections.Remove(src) + if(!zone_B.connections.len) + zone_B.connections = null + + if(A.zone) + if(!A.zone.connections) + A.zone.connections = list() + A.zone.connections |= src + + if(B.zone) + if(!B.zone.connections) + B.zone.connections = list() + B.zone.connections |= src + + //If either zone is null, we disconnect the archived ones after cleaning up the connections. + if(!A.zone || !B.zone) + if(zone_A && zone_B) + DisconnectZones(zone_B, zone_A) + + if(!A.zone) + zone_A = A.zone + + if(!B.zone) + zone_B = B.zone + return + + //Handle diconnection and reconnection of zones. + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) + ConnectZones(A.zone, B.zone, indirect) + + //resetting values of archived values. + zone_B = B.zone + zone_A = A.zone + + //The "A" zone changed. + else if(A.zone && A.zone != zone_A) + + //Handle connection cleanup + if(zone_A) if(zone_A.connections) zone_A.connections.Remove(src) if(!zone_A.connections.len) zone_A.connections = null - if(B) - if(B.zone && B.zone.connections) - B.zone.connections.Remove(src) - if(!B.zone.connections.len) - B.zone.connections = null + if(A.zone) + if(!A.zone.connections) + A.zone.connections = list() + A.zone.connections |= src - if(istype(zone_B) && (!B || B.zone != zone_B)) + //If the "A" zone is null, we disconnect the archived ones after cleaning up the connections. + if(!A.zone) + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) + zone_A = A.zone + return + + //Handle diconnection and reconnection of zones. + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) + ConnectZones(A.zone, B.zone, indirect) + zone_A = A.zone + + //The "B" zone changed. + else if(B.zone && B.zone != zone_B) + + //Handle connection cleanup + if(zone_B) if(zone_B.connections) zone_B.connections.Remove(src) if(!zone_B.connections.len) zone_B.connections = null - //Disconnect zones while handling unusual conditions. - // e.g. loss of a zone on a turf - if(A && A.zone && B && B.zone) - DisconnectZones(A.zone, B.zone) + if(B.zone) + if(!B.zone.connections) + B.zone.connections = list() + B.zone.connections |= src - //Finally, preform actual deletion. - . = ..() - - - proc/ConnectZones(var/zone/zone_1, var/zone/zone_2, open = 0) - - //Sanity checking - if(!istype(zone_1) || !istype(zone_2)) - return - - //Handle zones connecting indirectly/directly. - if(open) - - //Create the lists if necessary. - if(!zone_1.connected_zones) - zone_1.connected_zones = list() - - if(!zone_2.connected_zones) - zone_2.connected_zones = list() - - //Increase the number of connections between zones. - if(zone_2 in zone_1.connected_zones) - zone_1.connected_zones[zone_2]++ - else - zone_1.connected_zones += zone_2 - zone_1.connected_zones[zone_2] = 1 - - if(zone_1 in zone_2.connected_zones) - zone_2.connected_zones[zone_1]++ - else - zone_2.connected_zones += zone_1 - zone_2.connected_zones[zone_1] = 1 - - //Handle closed connections. - else - - //Create the lists - if(!zone_1.closed_connection_zones) - zone_1.closed_connection_zones = list() - - if(!zone_2.closed_connection_zones) - zone_2.closed_connection_zones = list() - - //Increment the connections. - if(zone_2 in zone_1.closed_connection_zones) - zone_1.closed_connection_zones[zone_2]++ - else - zone_1.closed_connection_zones += zone_2 - zone_1.closed_connection_zones[zone_2] = 1 - - if(zone_1 in zone_2.closed_connection_zones) - zone_2.closed_connection_zones[zone_1]++ - else - zone_2.closed_connection_zones += zone_1 - zone_2.closed_connection_zones[zone_1] = 1 - - - proc/DisconnectZones(var/zone/zone_1, var/zone/zone_2) - - //Sanity checking - if(!istype(zone_1) || !istype(zone_2)) - return - - if(indirect != CONNECTION_CLOSED) - //Handle disconnection of indirectly or directly connected zones. - if( (zone_1 in zone_2.connected_zones) || (zone_2 in zone_1.connected_zones) ) - - //If there are more than one connection, decrement the number of connections - //Otherwise, remove all connections between the zones. - if(zone_2 in zone_1.connected_zones) - if(zone_1.connected_zones[zone_2] > 1) - zone_1.connected_zones[zone_2]-- - else - zone_1.connected_zones -= zone_2 - //remove the list if it is empty - if(!zone_1.connected_zones.len) - zone_1.connected_zones = null - - //Then do the same for the other zone. - if(zone_1 in zone_2.connected_zones) - if(zone_2.connected_zones[zone_1] > 1) - zone_2.connected_zones[zone_1]-- - else - zone_2.connected_zones -= zone_1 - if(!zone_2.connected_zones.len) - zone_2.connected_zones = null - - else - //Handle disconnection of closed zones. - if( (zone_1 in zone_2.closed_connection_zones) || (zone_2 in zone_1.closed_connection_zones) ) - - //If there are more than one connection, decrement the number of connections - //Otherwise, remove all connections between the zones. - if(zone_2 in zone_1.closed_connection_zones) - if(zone_1.closed_connection_zones[zone_2] > 1) - zone_1.closed_connection_zones[zone_2]-- - else - zone_1.closed_connection_zones -= zone_2 - //remove the list if it is empty - if(!zone_1.closed_connection_zones.len) - zone_1.closed_connection_zones = null - - //Then do the same for the other zone. - if(zone_1 in zone_2.closed_connection_zones) - if(zone_2.closed_connection_zones[zone_1] > 1) - zone_2.closed_connection_zones[zone_1]-- - else - zone_2.closed_connection_zones -= zone_1 - if(!zone_2.closed_connection_zones.len) - zone_2.closed_connection_zones = null - - - proc/Cleanup() - - //Check sanity: existance of turfs - if(!A || !B) - del src - - //Check sanity: zones are different - if(A.zone == B.zone) - del src - - //Check sanity: same turfs as before. - if(ref_A != "\ref[A]" || ref_B != "\ref[B]") - del src - - //Handle zones changing on a turf. - if((A.zone && A.zone != zone_A) || (B.zone && B.zone != zone_B)) - Sanitize() - - //Manage sudden loss of a turfs zone. (e.g. a wall being built) - if(!A.zone || !B.zone) - no_zone_count++ - if(no_zone_count >= 5) - //world.log << "Connection removed: [A] or [B] missing a zone." - del src - return 0 - - return 1 - - - proc/CheckPassSanity() - //Sanity check, first. - Cleanup() - - if(A.zone && B.zone) - - //If no walls are blocking us... - if(A.ZAirPass(B)) - //...we check to see if there is a door in the way... - var/door_pass = A.CanPass(null,B,1.5,1) - //...and if it is opened. - if(door_pass || A.CanPass(null,B,0,0)) - - //Make and remove connections to let air pass. - if(indirect == CONNECTION_CLOSED) - DisconnectZones(A.zone, B.zone) - ConnectZones(A.zone, B.zone, 1) - - if(door_pass) - indirect = CONNECTION_DIRECT - else if(!door_pass) - indirect = CONNECTION_INDIRECT - - //The door is instead closed. - else if(indirect > CONNECTION_CLOSED) - DisconnectZones(A.zone, B.zone) - indirect = CONNECTION_CLOSED - ConnectZones(A.zone, B.zone) - - //If I can no longer pass air, better delete - else - del src - - proc/Sanitize() - //If the zones change on connected turfs, update it. - - //Both zones changed (wat) - if(A.zone && A.zone != zone_A && B.zone && B.zone != zone_B) - - //If the zones have gotten swapped - // (do not ask me how, I am just being anal retentive about sanity) - if(A.zone == zone_B && B.zone == zone_A) - var/turf/temp = B - B = A - A = temp - zone_B = B.zone - zone_A = A.zone - var/temp_ref = ref_A - ref_A = ref_B - ref_B = temp_ref - return - - //Handle removal of connections from archived zones. - if(zone_A && zone_A.connections) - zone_A.connections.Remove(src) - if(!zone_A.connections.len) - zone_A.connections = null - - if(zone_B && zone_B.connections) - zone_B.connections.Remove(src) - if(!zone_B.connections.len) - zone_B.connections = null - - if(A.zone) - if(!A.zone.connections) - A.zone.connections = list() - A.zone.connections |= src - - if(B.zone) - if(!B.zone.connections) - B.zone.connections = list() - B.zone.connections |= src - - //If either zone is null, we disconnect the archived ones after cleaning up the connections. - if(!A.zone || !B.zone) - if(zone_A && zone_B) - DisconnectZones(zone_B, zone_A) - - if(!A.zone) - zone_A = A.zone - - if(!B.zone) - zone_B = B.zone - return - - //Handle diconnection and reconnection of zones. + //If the "B" zone is null, we disconnect the archived ones after cleaning up the connections. + if(!B.zone) if(zone_A && zone_B) DisconnectZones(zone_A, zone_B) - ConnectZones(A.zone, B.zone, indirect) - - //resetting values of archived values. zone_B = B.zone - zone_A = A.zone + return - //The "A" zone changed. - else if(A.zone && A.zone != zone_A) - - //Handle connection cleanup - if(zone_A) - if(zone_A.connections) - zone_A.connections.Remove(src) - if(!zone_A.connections.len) - zone_A.connections = null - - if(A.zone) - if(!A.zone.connections) - A.zone.connections = list() - A.zone.connections |= src - - //If the "A" zone is null, we disconnect the archived ones after cleaning up the connections. - if(!A.zone) - if(zone_A && zone_B) - DisconnectZones(zone_A, zone_B) - zone_A = A.zone - return - - //Handle diconnection and reconnection of zones. - if(zone_A && zone_B) - DisconnectZones(zone_A, zone_B) - ConnectZones(A.zone, B.zone, indirect) - - //The "B" zone changed. - else if(B.zone && B.zone != zone_B) - - //Handle connection cleanup - if(zone_B) - if(zone_B.connections) - zone_B.connections.Remove(src) - if(!zone_B.connections.len) - zone_B.connections = null - - if(B.zone) - if(!B.zone.connections) - B.zone.connections = list() - B.zone.connections |= src - - //If the "B" zone is null, we disconnect the archived ones after cleaning up the connections. - if(!B.zone) - if(zone_A && zone_B) - DisconnectZones(zone_A, zone_B) - zone_B = B.zone - return - - //Handle diconnection and reconnection of zones. - if(zone_A && zone_B) - DisconnectZones(zone_A, zone_B) - ConnectZones(A.zone, B.zone, indirect) + //Handle diconnection and reconnection of zones. + if(zone_A && zone_B) + DisconnectZones(zone_A, zone_B) + ConnectZones(A.zone, B.zone, indirect) + zone_B = B.zone #undef CONNECTION_DIRECT diff --git a/code/ZAS/Debug.dm b/code/ZAS/Debug.dm index a6562858256..807208a5a3e 100644 --- a/code/ZAS/Debug.dm +++ b/code/ZAS/Debug.dm @@ -3,16 +3,16 @@ client/proc/Zone_Info(turf/T as null|turf) set category = "Debug" if(T) if(T.zone) - T.zone.DebugDisplay(mob) + T.zone.DebugDisplay(src) else mob << "No zone here." else - for(T in world) - T.overlays -= 'debug_space.dmi' - T.overlays -= 'debug_group.dmi' - T.overlays -= 'debug_connect.dmi' - + if(zone_debug_images) + for(var/zone in zone_debug_images) + images -= zone_debug_images[zone] + zone_debug_images = null +client/var/list/zone_debug_images client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf) set category = "Debug" @@ -24,12 +24,12 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf) "South" = SOUTH,\ "East" = EAST,\ "West" = WEST,\ - "None" = null) + "N/A" = null) var/direction = input("What direction do you wish to test?","Set direction") as null|anything in direction_list if(!direction) return - if(direction == "None") + if(direction == "N/A") if(T.CanPass(null, T, 0,0)) mob << "The turf can pass air! :D" else @@ -56,51 +56,67 @@ client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf) mob << "Both turfs can connect! :)" -zone/proc - DebugDisplay(mob/M) - if(!dbg_output) - dbg_output = 1 //Don't want to be spammed when someone investigates a zone... - for(var/turf/T in contents) - T.overlays += 'debug_group.dmi' +zone/proc/DebugDisplay(client/client) + if(!istype(client)) + return - for(var/turf/space/S in unsimulated_tiles) - S.overlays += 'debug_space.dmi' + if(!dbg_output) + dbg_output = 1 //Don't want to be spammed when someone investigates a zone... - M << "Zone Air Contents" - M << "Oxygen: [air.oxygen]" - M << "Nitrogen: [air.nitrogen]" - M << "Plasma: [air.toxins]" - M << "Carbon Dioxide: [air.carbon_dioxide]" - M << "Temperature: [air.temperature]" - M << "Heat Energy: [air.temperature * air.heat_capacity()]" - M << "Pressure: [air.return_pressure()]" - M << "" - M << "Space Tiles: [length(unsimulated_tiles)]" - M << "Movable Objects: [length(movables())]" - M << "Connections: [length(connections)]" + if(!client.zone_debug_images) + client.zone_debug_images = list() - for(var/connection/C in connections) - M << "[C.A] --> [C.B] [(C.indirect?"Open":"Closed")]" - C.A.overlays += 'debug_connect.dmi' - C.B.overlays += 'debug_connect.dmi' - for(var/C in connections) - if(!istype(C,/connection)) - M << "[C] (Not Connection!)" + var/list/current_zone_images = list() - else - dbg_output = 0 + for(var/turf/T in contents) + current_zone_images += image('debug_group.dmi', T, null, TURF_LAYER) - for(var/turf/T in contents) - T.overlays -= 'debug_group.dmi' + for(var/turf/space/S in unsimulated_tiles) + current_zone_images += image('debug_space.dmi', S, null, TURF_LAYER) - for(var/turf/space/S in unsimulated_tiles) - S.overlays -= 'debug_space.dmi' + client << "Zone Air Contents" + client << "Oxygen: [air.oxygen]" + client << "Nitrogen: [air.nitrogen]" + client << "Plasma: [air.toxins]" + client << "Carbon Dioxide: [air.carbon_dioxide]" + client << "Temperature: [air.temperature] K" + client << "Heat Energy: [air.temperature * air.heat_capacity()] J" + client << "Pressure: [air.return_pressure()] KPa" + client << "" + client << "Space Tiles: [length(unsimulated_tiles)]" + client << "Movable Objects: [length(movables())]" + client << "Connections: [length(connections)]" - for(var/connection/C in connections) - C.A.overlays -= 'debug_connect.dmi' - C.B.overlays -= 'debug_connect.dmi' - for(var/zone/Z in zones) - if(Z.air == air && Z != src) - var/turf/zloc = pick(Z.contents) - M << "\red Illegal air datum shared by: [zloc.loc.name]" + for(var/connection/C in connections) + client << "\ref[C] [C.A] --> [C.B] [(C.indirect?"Open":"Closed")]" + current_zone_images += image('debug_connect.dmi', C.A, null, TURF_LAYER) + current_zone_images += image('debug_connect.dmi', C.B, null, TURF_LAYER) + + client << "Connected Zones:" + for(var/zone/zone in connected_zones) + client << "\ref[zone] [zone] - [connected_zones[zone]] (Connected)" + + for(var/zone/zone in closed_connection_zones) + client << "\ref[zone] [zone] - [closed_connection_zones[zone]] (Unconnected)" + + for(var/C in connections) + if(!istype(C,/connection)) + client << "[C] (Not Connection!)" + + if(!client.zone_debug_images) + client.zone_debug_images = list() + client.zone_debug_images[src] = current_zone_images + + client.images += client.zone_debug_images[src] + + else + dbg_output = 0 + + client.images -= client.zone_debug_images[src] + client.zone_debug_images.Remove(src) + + for(var/zone/Z in zones) + if(Z.air == air && Z != src) + var/turf/zloc = pick(Z.contents) + client << "\red Illegal air datum shared by: [zloc.loc.name]" diff --git a/code/ZAS/FEA_system.dm b/code/ZAS/FEA_system.dm index 94b7c5cf6d1..c2a33ad99db 100644 --- a/code/ZAS/FEA_system.dm +++ b/code/ZAS/FEA_system.dm @@ -64,49 +64,46 @@ atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) return (!density || !height || air_group) -turf - CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0) - if(!target) return 0 +/turf/CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0) + if(!target) return 0 - if(istype(mover)) // turf/Enter(...) will perform more advanced checks - return !density + if(istype(mover)) // turf/Enter(...) will perform more advanced checks + return !density - else // Now, doing more detailed checks for air movement and air group formation - if(target.blocks_air||blocks_air) + else // Now, doing more detailed checks for air movement and air group formation + if(target.blocks_air||blocks_air) + return 0 + + for(var/obj/obstacle in src) + if(!obstacle.CanPass(mover, target, height, air_group)) return 0 - - for(var/obj/obstacle in src) - if(!obstacle.CanPass(mover, target, height, air_group)) + if(target != src) + for(var/obj/obstacle in target) + if(!obstacle.CanPass(mover, src, height, air_group)) return 0 - if(target != src) - for(var/obj/obstacle in target) - if(!obstacle.CanPass(mover, src, height, air_group)) - return 0 - return 1 + return 1 -var/global/datum/controller/air_system/air_master +var/datum/controller/air_system/air_master -datum - controller - air_system - //Geoemetry lists - var/list/turfs_with_connections = list() - var/list/active_hotspots = list() +/datum/controller/air_system/ + //Geoemetry lists + var/list/turfs_with_connections = list() + var/list/active_hotspots = list() - //Special functions lists - var/list/tiles_to_reconsider_zones = list() + //Special functions lists + var/list/tiles_to_reconsider_zones = list() - //Geometry updates lists - var/list/tiles_to_update = list() - var/list/connections_to_check = list() + //Geometry updates lists + var/list/tiles_to_update = list() + var/list/connections_to_check = list() - var/current_cycle = 0 - var/update_delay = 5 //How long between check should it try to process atmos again. - var/failed_ticks = 0 //How many ticks have runtimed? + var/current_cycle = 0 + var/update_delay = 5 //How long between check should it try to process atmos again. + var/failed_ticks = 0 //How many ticks have runtimed? - var/tick_progress = 0 + var/tick_progress = 0 /* process() @@ -122,97 +119,103 @@ datum */ - proc/setup() - //Purpose: Call this at the start to setup air groups geometry - // (Warning: Very processor intensive but only must be done once per round) - //Called by: Gameticker/Master controller - //Inputs: None. - //Outputs: None. +/datum/controller/air_system/proc/setup() + //Purpose: Call this at the start to setup air groups geometry + // (Warning: Very processor intensive but only must be done once per round) + //Called by: Gameticker/Master controller + //Inputs: None. + //Outputs: None. - set background = 1 - world << "\red \b Processing Geometry..." - sleep(-1) + set background = 1 + world << "\red \b Processing Geometry..." + sleep(-1) - var/start_time = world.timeofday + var/start_time = world.timeofday - var/simulated_turf_count = 0 + var/simulated_turf_count = 0 - for(var/turf/simulated/S in world) - simulated_turf_count++ - if(!S.zone && !S.blocks_air) - if(S.CanPass(null, S, 0, 0)) - new/zone(S) + for(var/turf/simulated/S in world) + simulated_turf_count++ + if(!S.zone && !S.blocks_air) + if(S.CanPass(null, S, 0, 0)) + new/zone(S) - for(var/turf/simulated/S in world) - S.update_air_properties() + for(var/turf/simulated/S in world) + S.update_air_properties() - world << {"Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds. - Total Simulated Turfs: [simulated_turf_count] - Total Zones: [zones.len] - Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]"} - /* - spawn start() + world << {"Geometry initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds. +Total Simulated Turfs: [simulated_turf_count] +Total Zones: [zones.len] +Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_count]"} + /* + spawn start() - proc/start() - //Purpose: This is kicked off by the master controller, and controls the processing of all atmosphere. - //Called by: Master controller - //Inputs: None. - //Outputs: None. +/datum/controller/air_system/proc/start() + //Purpose: This is kicked off by the master controller, and controls the processing of all atmosphere. + //Called by: Master controller + //Inputs: None. + //Outputs: None. - set background = 1 + set background = 1 - while(1) - if(!kill_air) - current_cycle++ - var/success = tick() //Changed so that a runtime does not crash the ticker. - if(!success) //Runtimed. - failed_ticks++ - if(failed_ticks > 20) - world << "ERROR IN ATMOS TICKER. Killing air simulation!" - kill_air = 1 - sleep(max(5,update_delay*tick_multiplier)) - */ + while(1) + if(!kill_air) + current_cycle++ + var/success = tick() //Changed so that a runtime does not crash the ticker. + if(!success) //Runtimed. + failed_ticks++ + if(failed_ticks > 20) + world << "ERROR IN ATMOS TICKER. Killing air simulation!" + kill_air = 1 + sleep(max(5,update_delay*tick_multiplier)) + */ - proc/tick() - . = 1 //Set the default return value, for runtime detection. +/datum/controller/air_system/proc/tick() + . = 1 //Set the default return value, for runtime detection. - tick_progress = "update_air_properties" - if(tiles_to_update.len) //If there are tiles to update, do so. - for(var/turf/simulated/T in tiles_to_update) - if(. && T && !T.update_air_properties()) - . = 0 //If a runtime occured, make sure we can sense it. - //message_admins("ZASALERT: Unable run turf/simualted/update_air_properties()") - tiles_to_update = list() + tick_progress = "update_air_properties" + if(tiles_to_update.len) //If there are tiles to update, do so. + for(var/turf/simulated/T in tiles_to_update) + if(. && T && !T.update_air_properties()) + . = 0 //If a runtime occured, make sure we can sense it. + //message_admins("ZASALERT: Unable run turf/simualted/update_air_properties()") + if(.) + tiles_to_update = list() - //Check sanity on connection objects. - tick_progress = "connections_to_check" - if(connections_to_check.len) - for(var/connection/C in connections_to_check) - C.CheckPassSanity() - connections_to_check = list() + //Check sanity on connection objects. + if(.) + tick_progress = "connections_to_check" + if(connections_to_check.len) + for(var/connection/C in connections_to_check) + C.CheckPassSanity() + connections_to_check = list() - //Ensure tiles still have zones. - tick_progress = "tiles_to_reconsider_zones" - if(tiles_to_reconsider_zones.len) - for(var/turf/simulated/T in tiles_to_reconsider_zones) - if(!T.zone) - new /zone(T) - tiles_to_reconsider_zones = list() + //Ensure tiles still have zones. + if(.) + tick_progress = "tiles_to_reconsider_zones" + if(tiles_to_reconsider_zones.len) + for(var/turf/simulated/T in tiles_to_reconsider_zones) + if(!T.zone) + new /zone(T) + tiles_to_reconsider_zones = list() - //Process zones. - tick_progress = "zone/process()" - for(var/zone/Z in zones) - if(Z.last_update < current_cycle) - var/output = Z.process() - if(Z) - Z.last_update = current_cycle - if(. && Z && !output) - . = 0 - //Process fires. - tick_progress = "active_hotspots (fire)" - for(var/obj/fire/F in active_hotspots) - if(. && F && !F.process()) - . = 0 + //Process zones. + if(.) + tick_progress = "zone/process()" + for(var/zone/Z in zones) + if(Z.last_update < current_cycle) + var/output = Z.process() + if(Z) + Z.last_update = current_cycle + if(. && Z && !output) + . = 0 + //Process fires. + if(.) + tick_progress = "active_hotspots (fire)" + for(var/obj/fire/F in active_hotspots) + if(. && F && !F.process()) + . = 0 - tick_progress = "success" \ No newline at end of file + if(.) + tick_progress = "success" \ No newline at end of file diff --git a/code/ZAS/Variable Settings.dm b/code/ZAS/Variable Settings.dm index e929ede6d59..9937c6703c3 100644 --- a/code/ZAS/Variable Settings.dm +++ b/code/ZAS/Variable Settings.dm @@ -62,6 +62,13 @@ vs_control/var airflow_mob_slowdown_NAME = "Airflow Slowdown" airflow_mob_slowdown_DESC = "Time in tenths of a second to add as a delay to each movement by a mob if they are fighting the pull of the airflow." + var/connection_insulation = 0.4 + var/connection_insulation_NAME = "Connections - Insulation" + var/connection_insulation_DESC = "How insulative a connection is, in terms of heat transfer. 1 is perfectly insulative, and 0 is perfectly conductive." + + var/connection_temperature_delta = 10 + var/connection_temperature_delta_NAME = "Connections - Temperature Difference" + var/connection_temperature_delta_DESC = "The smallest temperature difference which will cause heat to travel through doors." vs_control var diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 280752c763b..b715024abe3 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -153,12 +153,12 @@ datum/controller/game_controller/proc/process() //src.set_debug_state("Air Master") air_master.current_cycle++ - var/success = air_master.tick() //Changed so that a runtime does not crash the ticker. - if(!success) //Runtimed. + if(!air_master.tick()) //Runtimed. air_master.failed_ticks++ if(air_master.failed_ticks > 5) world << "RUNTIMES IN ATMOS TICKER. Killing air simulation!" - message_admins("ZASALERT: unable run [air_master.tick_progress], tell someone about this!") + world.log << "### ZAS SHUTDOWN" + message_admins("ZASALERT: unable to run [air_master.tick_progress], shutting down!") log_admin("ZASALERT: unable run zone/process() -- [air_master.tick_progress]") air_processing_killed = 1 air_master.failed_ticks = 0 diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 0aa2b06a5f5..18e4f2916a5 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -77,7 +77,9 @@ mob/living/carbon/proc/handle_hallucinations() halitem.name = "Flashbang" if(client) client.screen += halitem spawn(rand(100,250)) - del halitem + if(client) + client.screen -= halitem + halitem = null if(26 to 40) //Flashes of danger //src << "Danger Flash" diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm index 15739cee29e..eb924528b58 100644 --- a/code/modules/surgery/generic.dm +++ b/code/modules/surgery/generic.dm @@ -87,7 +87,7 @@ fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) - user.visible_message("\red [user]'s hand slips, tearing blood vessals and causing massive bleeding in [target]'s [affected.display_name] with the \[tool]!", \ + user.visible_message("\red [user]'s hand slips, tearing blood vessals and causing massive bleeding in [target]'s [affected.display_name] with \the [tool]!", \ "\red Your hand slips, tearing blood vessels and causing massive bleeding in [target]'s [affected.display_name] with \the [tool]!",) affected.createwound(CUT, 10) @@ -103,7 +103,7 @@ can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone) - return ..() && affected.open < 2 && !(affected.status & ORGAN_BLEEDING) + return ..() && affected.open == 1 && !(affected.status & ORGAN_BLEEDING) begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool) var/datum/organ/external/affected = target.get_organ(target_zone)