Merge pull request #1240 from SkyMarshal/CoolTweaks

Fixed and cleaned up ZAS.  Added some better sanity to explosion locations.
This commit is contained in:
Erthilo
2012-06-04 15:06:33 -07:00
22 changed files with 538 additions and 332 deletions
@@ -20,7 +20,7 @@
message_admins("[key_name_admin(user)] triggered a fueltank explosion.")
log_game("[key_name(user)] triggered a fueltank explosion.")
user << "\red That was stupid of you."
explosion(src.loc,-1,0,2)
explosion(get_turf(src),-1,0,2)
if(src)
del(src)
return
+7 -8
View File
@@ -105,18 +105,17 @@
shake_camera(M, 3, 1)
if (A)
A.meteorhit(src)
playsound(src.loc, 'meteorimpact.ogg', 40, 1)
playsound(get_turf(src), 'meteorimpact.ogg', 40, 1)
if (--src.hits <= 0)
if(prob(15))// && !istype(A, /obj/structure/grille))
explosion(src.loc, 4, 5, 6, 7, 0)
playsound(src.loc, "explosion", 50, 1)
explosion(get_turf(src), 4, 5, 6, 7, 0)
playsound(get_turf(src), "explosion", 50, 1)
del(src)
return
/obj/effect/meteor/ex_act(severity)
if (severity < 4)
spawn(0)
del(src)
return
@@ -139,11 +138,11 @@
A.meteorhit(src)
src.hits--
return
playsound(src.loc, 'meteorimpact.ogg', 40, 1)
playsound(get_turf(src), 'meteorimpact.ogg', 40, 1)
if (--src.hits <= 0)
if(prob(15) && !istype(A, /obj/structure/grille))
explosion(src.loc, 1, 2, 3, 4, 0)
playsound(src.loc, "explosion", 50, 1)
explosion(get_turf(src), 1, 2, 3, 4, 0)
playsound(get_turf(src), "explosion", 50, 1)
del(src)
return
+219 -22
View File
@@ -8,6 +8,9 @@ connection
turf //The turfs involved in the connection.
A
B
zone
zone_A
zone_B
indirect = 0 //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
@@ -17,9 +20,11 @@ connection
if(A.zone)
if(!A.zone.connections) A.zone.connections = new()
A.zone.connections += src
zone_A = A.zone
if(B.zone)
if(!B.zone.connections) B.zone.connections = new()
B.zone.connections += src
zone_B = B.zone
if(A.zone && B.zone)
if(!A.zone.connected_zones)
A.zone.connected_zones = list()
@@ -41,27 +46,90 @@ connection
world.log << "Attempted to create connection object for non-zone tiles: [T] -> [O]"
Del()
if(A.zone && A.zone.connections)
A.zone.connections -= src
A.zone.connections.Remove(src)
if(!A.zone.connections.len)
del A.zone.connections
if(B.zone && B.zone.connections)
B.zone.connections -= src
B.zone.connections.Remove(src)
if(!A.zone.connections.len)
del B.zone.connections
if(zone_A && zone_A.connections)
zone_A.connections.Remove(src)
if(!zone_A.connections.len)
del zone_A.connections
if(zone_B && zone_B.connections)
zone_B.connections.Remove(src)
if(!zone_B.connections.len)
del zone_B.connections
if(A.zone && B.zone)
if(B.zone in A.zone.connected_zones)
if(A.zone.connected_zones[B.zone] > 1)
A.zone.connected_zones[B.zone]--
else
A.zone.connected_zones -= B.zone
if(A.zone in B.zone.connected_zones)
if(B.zone.connected_zones[A.zone] > 1)
B.zone.connected_zones[A.zone]--
else
B.zone.connected_zones -= A.zone
if(A.zone.connected_zones && !A.zone.connected_zones.len)
A.zone.connected_zones = null
if(B.zone.connected_zones && !B.zone.connected_zones.len)
B.zone.connected_zones = null
if(A.zone)
if(B.zone)
if(B.zone in A.zone.connected_zones)
if(A.zone.connected_zones[B.zone] > 1)
A.zone.connected_zones[B.zone]--
else
A.zone.connected_zones -= B.zone
if(A.zone.connected_zones && !A.zone.connected_zones.len)
A.zone.connected_zones = null
if( zone_B && (!B.zone && zone_B != B.zone) )
if(zone_B in A.zone.connected_zones)
if(A.zone.connected_zones[zone_B] > 1)
A.zone.connected_zones[zone_B]--
else
A.zone.connected_zones -= zone_B
if(A.zone.connected_zones && !A.zone.connected_zones.len)
A.zone.connected_zones = null
if(zone_A && (!A.zone || zone_A != A.zone))
if(B.zone)
if(B.zone in zone_A.connected_zones)
if(zone_A.connected_zones[B.zone] > 1)
zone_A.connected_zones[B.zone]--
else
zone_A.connected_zones -= B.zone
if(zone_A.connected_zones && !zone_A.connected_zones.len)
zone_A.connected_zones = null
if( zone_B && (!B.zone && zone_B != B.zone) )
if(zone_B in zone_A.connected_zones)
if(zone_A.connected_zones[zone_B] > 1)
zone_A.connected_zones[zone_B]--
else
zone_A.connected_zones -= zone_B
if(zone_A.connected_zones && !zone_A.connected_zones.len)
zone_A.connected_zones = null
if(B.zone)
if(A.zone)
if(A.zone in B.zone.connected_zones)
if(B.zone.connected_zones[A.zone] > 1)
B.zone.connected_zones[A.zone]--
else
B.zone.connected_zones -= A.zone
if(B.zone.connected_zones && !B.zone.connected_zones.len)
B.zone.connected_zones = null
if( zone_A && (!A.zone && zone_A != A.zone) )
if(zone_A in B.zone.connected_zones)
if(B.zone.connected_zones[zone_A] > 1)
B.zone.connected_zones[zone_A]--
else
B.zone.connected_zones -= zone_A
if(B.zone.connected_zones && !B.zone.connected_zones.len)
B.zone.connected_zones = null
if(zone_B && (!B.zone || zone_B != B.zone))
if(A.zone)
if(A.zone in zone_B.connected_zones)
if(zone_B.connected_zones[A.zone] > 1)
zone_B.connected_zones[A.zone]--
else
zone_B.connected_zones -= A.zone
if(zone_B.connected_zones && !zone_B.connected_zones.len)
zone_B.connected_zones = null
if( zone_A && (!A.zone && zone_A != A.zone) )
if(zone_A in zone_B.connected_zones)
if(zone_B.connected_zones[zone_A] > 1)
zone_B.connected_zones[zone_A]--
else
zone_B.connected_zones -= zone_A
if(zone_B.connected_zones && !zone_B.connected_zones.len)
zone_B.connected_zones = null
. = ..()
proc/Cleanup()
@@ -71,8 +139,137 @@ connection
if(A.zone == B.zone)
//world.log << "Connection removed: Zones now merged."
del src
if((A.zone && A.zone != zone_A) || (B.zone && B.zone != zone_B))
Sanitize()
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
if(no_zone_count >= 5)
//world.log << "Connection removed: [A] or [B] missing a zone."
del src
return 0
return 1
proc/Sanitize()
//If the zones change on connected turfs, update it.
if(A.zone && A.zone != zone_A && B.zone && B.zone != zone_B)
if(!A.zone || !B.zone)
del src
if(zone_A)
if(zone_A.connections)
zone_A.connections.Remove(src)
if(!zone_A.connections.len)
del zone_A.connections
if(zone_A.connected_zones)
if(zone_A.connected_zones[zone_B] > 1)
zone_A.connected_zones[zone_B]--
else
zone_A.connected_zones.Remove(zone_B)
if(zone_A.connected_zones && !zone_A.connected_zones.len)
zone_A.connected_zones = null
if(zone_B)
if(zone_B.connections)
zone_B.connections.Remove(src)
if(!zone_B.connections.len)
del zone_B.connections
if(zone_B.connected_zones)
if(zone_B.connected_zones[zone_A] > 1)
zone_B.connected_zones[zone_A]--
else
zone_B.connected_zones.Remove(zone_A)
if(zone_B.connected_zones && !zone_B.connected_zones.len)
zone_B.connected_zones = null
if(!A.zone.connections)
A.zone.connections = list()
A.zone.connections |= src
if(!B.zone.connections)
B.zone.connections = list()
B.zone.connections |= src
if(!A.zone.connected_zones)
A.zone.connected_zones = list()
if(!(B.zone in A.zone.connected_zones))
A.zone.connected_zones += B.zone
A.zone.connected_zones[B.zone] = 1
else
A.zone.connected_zones[B.zone]++
if(!B.zone.connected_zones)
B.zone.connected_zones = list()
if(!(A.zone in B.zone.connected_zones))
B.zone.connected_zones += A.zone
B.zone.connected_zones[A.zone] = 1
else
B.zone.connected_zones[A.zone]++
zone_B = B.zone
zone_A = A.zone
else if(A.zone && A.zone != zone_A)
if(zone_A)
if(zone_A.connections)
zone_A.connections.Remove(src)
if(!zone_A.connections.len)
del zone_A.connections
if(!A.zone.connections)
A.zone.connections = list()
A.zone.connections |= src
if(zone_A.connected_zones)
if(zone_A.connected_zones[zone_B] > 1)
zone_A.connected_zones[zone_B]--
else
zone_A.connected_zones.Remove(zone_B)
if(zone_A.connected_zones && !zone_A.connected_zones.len)
zone_A.connected_zones = null
if(!A.zone.connected_zones)
A.zone.connected_zones = list()
if(!(zone_B in A.zone.connected_zones))
A.zone.connected_zones += zone_B
A.zone.connected_zones[zone_B] = 1
else
A.zone.connected_zones[zone_B]++
zone_A = A.zone
else
del src
else if(B.zone && B.zone != zone_B)
if(zone_B)
if(zone_B.connections)
zone_B.connections.Remove(src)
if(!zone_B.connections.len)
del zone_B.connections
if(!B.zone.connections)
B.zone.connections = list()
B.zone.connections |= src
if(zone_B.connected_zones)
if(zone_B.connected_zones[zone_A] > 1)
zone_B.connected_zones[zone_A]--
else
zone_B.connected_zones.Remove(zone_A)
if(zone_B.connected_zones && !zone_B.connected_zones.len)
zone_B.connected_zones = null
if(!B.zone.connected_zones)
B.zone.connected_zones = list()
if(!(zone_A in B.zone.connected_zones))
B.zone.connected_zones += zone_A
B.zone.connected_zones[zone_A] = 1
else
B.zone.connected_zones[zone_A]++
zone_B = B.zone
else
del src
+1 -1
View File
@@ -53,7 +53,7 @@ datum
//FOR THE LOVE OF GOD PLEASE USE THIS PROC
//Call it with negative numbers to remove gases.
proc/adjustGases(o2 = 0, co2 = 0, n2 = 0, tx = 0, list/datum/gas/traces = list())
proc/adjust(o2 = 0, co2 = 0, n2 = 0, tx = 0, list/datum/gas/traces = list())
//Purpose: Adjusting the gases within a airmix
//Called by: Nothing, yet!
//Inputs: The values of the gases to adjust
+11 -10
View File
@@ -178,17 +178,18 @@ turf
if(zone)
for(var/direction in cardinal)
if(air_check_directions&direction)
var/turf/simulated/T = get_step(src,direction)
if(T)
ZConnect(src,T)
else
var/turf/simulated/T = get_step(src,direction)
if(T)
ZDisconnect(src,T)
var/turf/simulated/T = get_step(src,direction)
if(istype(T))
if(CanPass(null, src, 1.5, 0))
if(CanPass(null, src, 0, 0))
ZConnect(src,T)
else
ZDisconnect(src,T)
else
zone.rebuild = 1
if(T.zone)
T.zone.rebuild = 1
else
for(var/direction in cardinal)
if(air_check_directions&direction)
var/turf/simulated/T = get_step(src,direction)
+159 -149
View File
@@ -1,31 +1,32 @@
zone
proc
AddTurf(turf/T)
//Adds the turf to contents, increases the size of the zone, and sets the zone var.
if(T in contents) return
contents += T
air.group_multiplier++
T.zone = src
RemoveTurf(turf/T)
//Same, but in reverse.
if(!(T in contents)) return
contents -= T
air.group_multiplier--
T.zone = null
/zone
proc/AddTurf(turf/T)
//Adds the turf to contents, increases the size of the zone, and sets the zone var.
if(T in contents)
return
contents += T
air.group_multiplier++
T.zone = src
proc/RemoveTurf(turf/T)
//Same, but in reverse.
if(!(T in contents))
return
contents -= T
air.group_multiplier--
T.zone = null
AddSpace(turf/space/S)
//Adds a space tile to the list, and creates the list if null.
if(istype(S,/turf/space))
if(!space_tiles) space_tiles = list()
space_tiles += S
proc/AddSpace(turf/space/S)
//Adds a space tile to the list, and creates the list if null.
if(istype(S,/turf/space))
if(!space_tiles) space_tiles = list()
space_tiles += S
RemoveSpace(turf/space/S)
//Removes a space tile from the list, and deletes the list if length is 0.
if(space_tiles)
space_tiles -= S
if(!space_tiles.len) space_tiles = null
proc/RemoveSpace(turf/space/S)
//Removes a space tile from the list, and deletes the list if length is 0.
if(space_tiles)
space_tiles -= S
if(!space_tiles.len) space_tiles = null
turf/proc/HasDoor(turf/O)
/turf/proc/HasDoor(turf/O)
//Checks for the presence of doors, used for zone spreading and connection.
//A positive numerical argument checks only for closed doors.
//Another turf as an argument checks for windoors between here and there.
@@ -38,158 +39,167 @@ turf/proc/HasDoor(turf/O)
else
return 1
turf/proc/find_zone()
/turf/proc/find_zone()
//Allows newly generated turfs to join up with a nearby zone.
if(world.time < 10) return
for(var/d in cardinal)
var/turf/T = get_step(src,d)
if(!T || !T.zone || !T.ZCanPass(src)) continue
if(!zone)
zone = T.zone
zone.AddTurf(src)
else if(T.zone != zone)
ZConnect(src,T)
if(density)
for(var/d in cardinal)
var/turf/T = get_step(src,d)
if(!T || !T.zone || !T.ZCanPass(src))
continue
T.zone.rebuild = 1
turf/proc/check_connections()
else
for(var/d in cardinal)
var/turf/T = get_step(src,d)
if(!T || !T.zone || !T.ZCanPass(src))
continue
if(!zone)
zone = T.zone
zone.AddTurf(src)
else if(T.zone != zone)
ZConnect(src,T)
/turf/proc/check_connections()
//Checks for new connections that can be made.
for(var/d in cardinal)
var/turf/T = get_step(src,d)
if(!T || !T.zone || !T.CanPass(0,src,0,0)) continue
if(!T || !T.zone || !T.CanPass(0,src,0,0))
continue
if(T.zone != zone)
ZConnect(src,T)
turf/proc/check_for_space()
/turf/proc/check_for_space()
//Checks for space around the turf.
for(var/d in cardinal)
var/turf/T = get_step(src,d)
if(istype(T,/turf/space) && T.CanPass(0,src,0,0))
zone.AddSpace(T)
proc
ZMerge(zone/A,zone/B)
//Merges two zones so that they are one.
var
a_size = A.air.group_multiplier
b_size = B.air.group_multiplier
c_size = a_size + b_size
new_contents = A.contents + B.contents
proc/ZMerge(zone/A,zone/B)
//Merges two zones so that they are one.
var
a_size = A.air.group_multiplier
b_size = B.air.group_multiplier
c_size = a_size + b_size
new_contents = A.contents + B.contents
//Set air multipliers to one so air represents gas per tile.
A.air.group_multiplier = 1
B.air.group_multiplier = 1
//Set air multipliers to one so air represents gas per tile.
A.air.group_multiplier = 1
B.air.group_multiplier = 1
//Remove some air proportional to the size of this zone.
A.air.remove_ratio(a_size/c_size)
B.air.remove_ratio(b_size/c_size)
//Remove some air proportional to the size of this zone.
A.air.remove_ratio(a_size/c_size)
B.air.remove_ratio(b_size/c_size)
//Merge the gases and set the multiplier to the sum of the old ones.
A.air.merge(B.air)
A.air.group_multiplier = c_size
//Merge the gases and set the multiplier to the sum of the old ones.
A.air.merge(B.air)
A.air.group_multiplier = c_size
//Check for connections to merge into the new zone.
for(var/connection/C in B.connections)
if((C.A in new_contents) && (C.B in new_contents))
del C
continue
if(!A.connections) A.connections = list()
A.connections += C
//Check for connections to merge into the new zone.
for(var/connection/C in B.connections)
if((C.A in new_contents) && (C.B in new_contents))
del C
continue
if(!A.connections) A.connections = list()
A.connections += C
//Add space tiles.
A.space_tiles += B.space_tiles
//Add space tiles.
A.space_tiles += B.space_tiles
//Add contents.
A.contents = new_contents
//Add contents.
A.contents = new_contents
//Set all the zone vars.
for(var/turf/T in B.contents)
T.zone = A
//Set all the zone vars.
for(var/turf/T in B.contents)
T.zone = A
del B
del B
ZConnect(turf/A,turf/B)
//Connects two zones by forming a connection object representing turfs A and B.
proc/ZConnect(turf/A,turf/B)
//Connects two zones by forming a connection object representing turfs A and B.
//Make sure that if it's space, it gets added to space_tiles instead.
if(istype(B,/turf/space))
if(A.zone)
A.zone.AddSpace(B)
return
if(istype(A,/turf/space))
if(B.zone)
B.zone.AddSpace(A)
//Make sure that if it's space, it gets added to space_tiles instead.
if(istype(B,/turf/space))
if(A.zone)
A.zone.AddSpace(B)
return
if(istype(A,/turf/space))
if(B.zone)
B.zone.AddSpace(A)
return
//Make some preliminary checks to see if the connection is valid.
if(!A.zone || !B.zone) return
if(A.zone == B.zone) return
if(!A.CanPass(0,B,0,0)) return
//Ensure the connection isn't already made.
for(var/connection/C in A.zone.connections)
if((C.A == A && C.B == B) || (C.A == B && C.B == A))
return
//Make some preliminary checks to see if the connection is valid.
if(!A.zone || !B.zone) return
if(A.zone == B.zone) return
if(!A.CanPass(0,B,0,0)) return
var/connection/C = new(A,B)
//Ensure the connection isn't already made.
for(var/connection/C in A.zone.connections)
if((C.A == A && C.B == B) || (C.A == B && C.B == A))
return
//Ensure zones separated by doors do not merge.
if(A.HasDoor(B) || B.HasDoor(A)) C.indirect = 1
var/connection/C = new(A,B)
proc/ZDisconnect(turf/A,turf/B)
//Removes a zone connection. Can split zones in the case of a permanent barrier.
//Ensure zones separated by doors do not merge.
if(A.HasDoor(B) || B.HasDoor(A)) C.indirect = 1
ZDisconnect(turf/A,turf/B)
//Removes a zone connection. Can split zones in the case of a permanent barrier.
//If one of them doesn't have a zone, it might be space, so check for that.
if(A.zone && B.zone)
//If the two zones are different, just remove a connection.
if(A.zone != B.zone)
for(var/connection/C in A.zone.connections)
if((C.A == A && C.B == B) || (C.A == B && C.B == A))
del C
//If they're the same, split the zone at this line.
else
//Preliminary checks to prevent stupidity.
if(A == B) return
if(A.CanPass(0,B,0,0)) return
if(A.HasDoor(B) || B.HasDoor(A)) return
//Do a test fill. If turf B is still in the floodfill, then the zone isn't really split.
var/zone/oldzone = A.zone
var/list/test = FloodFill(A)
if(B in test) return
else
var/zone/Z = new(test,oldzone.air) //Create a new zone based on the old air and the test fill.
//Add connections from the old zone.
for(var/connection/C in oldzone.connections)
if((A in Z.contents) || (B in Z.contents))
if(!Z.connections) Z.connections = list()
Z.connections += C
//Check for space.
for(var/turf/T in test)
T.check_for_space()
//Make a new, identical air mixture for the other zone.
var/datum/gas_mixture/Y_Air = new
Y_Air.copy_from(oldzone.air)
var/zone/Y = new(B,Y_Air) //Make a new zone starting at B and using Y_Air.
//Add relevant connections from old zone.
for(var/connection/C in oldzone.connections)
if((A in Y.contents) || (B in Y.contents))
if(!Y.connections) Y.connections = list()
Y.connections += C
//Add the remaining space tiles to this zone.
for(var/turf/space/T in oldzone.space_tiles)
if(!(T in Z.space_tiles))
Y.AddSpace(T)
oldzone.air = null
del oldzone
//If one of them doesn't have a zone, it might be space, so check for that.
if(A.zone && B.zone)
//If the two zones are different, just remove a connection.
if(A.zone != B.zone)
for(var/connection/C in A.zone.connections)
if((C.A == A && C.B == B) || (C.A == B && C.B == A))
del C
//If they're the same, split the zone at this line.
else
if(istype(A,/turf/space) && B.zone)
B.zone.RemoveSpace(A)
else if(istype(B,/turf/space) && A.zone)
A.zone.RemoveSpace(B)
//Preliminary checks to prevent stupidity.
if(A == B) return
if(A.CanPass(0,B,0,0)) return
if(A.HasDoor(B) || B.HasDoor(A)) return
//Do a test fill. If turf B is still in the floodfill, then the zone isn't really split.
var/zone/oldzone = A.zone
var/list/test = FloodFill(A)
if(B in test) return
else
var/zone/Z = new(test,oldzone.air) //Create a new zone based on the old air and the test fill.
//Add connections from the old zone.
for(var/connection/C in oldzone.connections)
if((A in Z.contents) || (B in Z.contents))
if(!Z.connections) Z.connections = list()
Z.connections += C
//Check for space.
for(var/turf/T in test)
T.check_for_space()
//Make a new, identical air mixture for the other zone.
var/datum/gas_mixture/Y_Air = new
Y_Air.copy_from(oldzone.air)
var/zone/Y = new(B,Y_Air) //Make a new zone starting at B and using Y_Air.
//Add relevant connections from old zone.
for(var/connection/C in oldzone.connections)
if((A in Y.contents) || (B in Y.contents))
if(!Y.connections) Y.connections = list()
Y.connections += C
//Add the remaining space tiles to this zone.
for(var/turf/space/T in oldzone.space_tiles)
if(!(T in Z.space_tiles))
Y.AddSpace(T)
oldzone.air = null
del oldzone
else
if(istype(A,/turf/space) && B.zone)
B.zone.RemoveSpace(A)
else if(istype(B,/turf/space) && A.zone)
A.zone.RemoveSpace(B)
+110 -110
View File
@@ -1,117 +1,118 @@
#define QUANTIZE(variable) (round(variable,0.0001))
var/explosion_halt = 0
var/zone_share_percent = 1
zone
proc/process()
//Does rebuilding stuff. Not sure if used.
if(rebuild)
//Deletes zone if empty.
if(!contents.len)
del src
return 0
var/zone_share_percent = 4
zone/proc/process()
//Does rebuilding stuff. Not sure if used.
if(rebuild)
//Deletes zone if empty.
if(!contents.len)
del src
return 0
//Choose a random turf and regenerate the zone from it.
var
turf/sample = pick(contents)
list/new_contents = FloodFill(sample)
problem = 0
//Choose a random turf and regenerate the zone from it.
var
turf/sample = pick(contents)
list/new_contents = FloodFill(sample)
problem = 0
//If something isn't carried over, there was a complication.
for(var/turf/T in contents)
if(!(T in new_contents))
problem = 1
//If something isn't carried over, there was a complication.
for(var/turf/T in contents)
if(!(T in new_contents))
problem = 1
if(problem)
//Build some new zones for stuff that wasn't included.
var/list/rebuild_turfs = list()
for(var/turf/T in contents - new_contents)
contents -= T
rebuild_turfs += T
T.zone = null
for(var/turf/T in rebuild_turfs)
if(!T.zone)
var/zone/Z = new/zone(T)
Z.air.copy_from(air)
rebuild = 0
if(problem)
//Build some new zones for stuff that wasn't included.
var/list/rebuild_turfs = list()
for(var/turf/T in contents - new_contents)
contents -= T
rebuild_turfs += T
T.zone = null
for(var/turf/T in rebuild_turfs)
if(!T.zone)
var/zone/Z = new/zone(T)
Z.air.copy_from(air)
//Sometimes explosions will cause the air to be deleted for some reason.
if(!air)
air = new()
air.adjustGases(MOLES_O2STANDARD, 0, MOLES_N2STANDARD, 0, list())
world.log << "Air object lost in zone. Regenerating."
rebuild = 0
//Counting up space.
var/total_space = 0
//Sometimes explosions will cause the air to be deleted for some reason.
if(!air)
air = new()
air.adjust(MOLES_O2STANDARD, 0, MOLES_N2STANDARD, 0, list())
world.log << "Air object lost in zone. Regenerating."
if(space_tiles)
for(var/T in space_tiles)
if(!istype(T,/turf/space)) space_tiles -= T
total_space++
//Counting up space.
var/total_space = 0
//Add checks to ensure that we're not sucking air out of an empty room.
if(total_space && air.total_moles > 0.1 && air.temperature > TCMB+0.5)
//If there is space, air should flow out of the zone.
//if(abs(air.pressure) > vsc.airflow_lightest_pressure)
// AirflowSpace(src)
ShareSpace(air,total_space*(zone_share_percent/100))
if(space_tiles)
for(var/T in space_tiles)
if(!istype(T,/turf/space))
space_tiles -= T
continue
total_space++
//React the air here.
//air.react(null,0)
//Add checks to ensure that we're not sucking air out of an empty room.
if(total_space && air.total_moles > 0.1 && air.temperature > TCMB+0.5)
//If there is space, air should flow out of the zone.
//if(abs(air.pressure) > vsc.airflow_lightest_pressure)
// AirflowSpace(src)
ShareSpace(air,total_space*(zone_share_percent/100))
//Check the graphic.
//React the air here.
//air.react(null,0)
air.graphic = 0
if(air.toxins > MOLES_PLASMA_VISIBLE)
air.graphic = 1
else if(air.trace_gases.len)
var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in air.trace_gases
if(sleeping_agent && (sleeping_agent.moles > 1))
air.graphic = 2
else
air.graphic = 0
//Check the graphic.
//Only run through the individual turfs if there's reason to.
if(air.graphic != air.graphic_archived || air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
air.graphic = 0
if(air.toxins > MOLES_PLASMA_VISIBLE)
air.graphic = 1
else if(air.trace_gases.len)
var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in air.trace_gases
if(sleeping_agent && (sleeping_agent.moles > 1))
air.graphic = 2
for(var/turf/simulated/S in contents)
//Update overlays.
if(air.graphic != air.graphic_archived)
if(S.HasDoor(1))
S.update_visuals()
else
S.update_visuals(air)
//Only run through the individual turfs if there's reason to.
if(air.graphic != air.graphic_archived || air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
//Expose stuff to extreme heat.
if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
for(var/atom/movable/item in S)
item.temperature_expose(air, air.temperature, CELL_VOLUME)
S.temperature_expose(air, air.temperature, CELL_VOLUME)
for(var/turf/simulated/S in contents)
//Update overlays.
if(air.graphic != air.graphic_archived)
if(S.HasDoor(1))
S.update_visuals()
else
S.update_visuals(air)
//Archive graphic so we can know if it's different.
air.graphic_archived = air.graphic
//Expose stuff to extreme heat.
if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
for(var/atom/movable/item in S)
item.temperature_expose(air, air.temperature, CELL_VOLUME)
S.temperature_expose(air, air.temperature, CELL_VOLUME)
//Ensure temperature does not reach absolute zero.
air.temperature = max(TCMB,air.temperature)
//Archive graphic so we can know if it's different.
air.graphic_archived = air.graphic
//Handle connections to other zones.
if(length(connections))
for(var/connection/C in connections)
//Check if the connection is valid first.
C.Cleanup()
//Do merging if conditions are met. Specifically, if there's a non-door connection
//to somewhere with space, the zones are merged regardless of equilibrium, to speed
//up spacing in areas with double-plated windows.
if(C && !C.indirect && C.A.zone && C.B.zone)
if(C.A.zone.air.compare(C.B.zone.air) || total_space)
ZMerge(C.A.zone,C.B.zone)
//Ensure temperature does not reach absolute zero.
air.temperature = max(TCMB,air.temperature)
//Share some
for(var/zone/Z in connected_zones)
//Ensure we're not doing pointless calculations on equilibrium zones.
if(abs(air.total_moles - Z.air.total_moles) > 0.1 || abs(air.temperature - Z.air.temperature) > 0.1)
//if(abs(Z.air.pressure - air.pressure) > vsc.airflow_lightest_pressure)
// Airflow(src,Z)
ShareRatio(air,Z.air,connected_zones[Z]*(zone_share_percent/100))
//Handle connections to other zones.
if(length(connections))
for(var/connection/C in connections)
//Check if the connection is valid first.
if(!C.Cleanup())
continue
//Do merging if conditions are met. Specifically, if there's a non-door connection
//to somewhere with space, the zones are merged regardless of equilibrium, to speed
//up spacing in areas with double-plated windows.
if(C && !C.indirect && C.A.zone && C.B.zone)
if(C.A.zone.air.compare(C.B.zone.air) || total_space)
ZMerge(C.A.zone,C.B.zone)
//Share some
for(var/zone/Z in connected_zones)
//Ensure we're not doing pointless calculations on equilibrium zones.
if(abs(air.total_moles - Z.air.total_moles) > 0.1 || abs(air.temperature - Z.air.temperature) > 0.1)
//if(abs(Z.air.pressure - air.pressure) > vsc.airflow_lightest_pressure)
// Airflow(src,Z)
ShareRatio(air,Z.air,connected_zones[Z]*(zone_share_percent/100))
proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, ratio)
//Shares a specific ratio of gas between mixtures using simple weighted averages.
@@ -215,19 +216,18 @@ proc/ShareSpace(datum/gas_mixture/A, ratio)
return 1
zone/proc
connected_zones()
//A legacy proc for getting connected zones.
. = list()
for(var/connection/C in connections)
var/zone/Z
if(C.A.zone == src)
Z = C.B.zone
else
Z = C.A.zone
zone/proc/connected_zones()
//A legacy proc for getting connected zones.
. = list()
for(var/connection/C in connections)
var/zone/Z
if(C.A.zone == src)
Z = C.B.zone
else
Z = C.A.zone
if(Z in .)
.[Z]++
else
. += Z
.[Z] = 1
if(Z in .)
.[Z]++
else
. += Z
.[Z] = 1
+2 -2
View File
@@ -12,7 +12,7 @@
New()
..()
air_contents.adjustGases((3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
air_contents.adjust((3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
@@ -44,5 +44,5 @@
..()
var/datum/gas/sleeping_agent/trace_gas = new()
trace_gas.moles = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
air_contents.adjustGases((3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD, traces = list(trace_gas))
air_contents.adjust((3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD, traces = list(trace_gas))
return
+3 -3
View File
@@ -76,7 +76,7 @@
New()
..()
air_contents.adjustGases((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
air_contents.adjust((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
/obj/item/weapon/tank/jetpack/oxygen
@@ -87,7 +87,7 @@
New()
..()
air_contents.adjustGases((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
air_contents.adjust((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
/obj/item/weapon/tank/jetpack/carbondioxide
@@ -100,7 +100,7 @@
..()
src.ion_trail = new /datum/effect/effect/system/ion_trail_follow()
src.ion_trail.set_up(src)
air_contents.adjustGases(0,(6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
air_contents.adjust(0,(6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
examine()
+1 -1
View File
@@ -8,7 +8,7 @@
New()
..()
air_contents.adjustGases((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
air_contents.adjust((6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
return
+2 -3
View File
@@ -18,9 +18,8 @@
/turf/New()
..()
for(var/atom/movable/AM as mob|obj in src)
spawn( 0 )
src.Entered(AM)
return
spawn(0)
Entered(AM)
return
/turf/ex_act(severity)
+4 -4
View File
@@ -3221,19 +3221,19 @@
bullet_act(var/obj/item/projectile/Proj)
if(istype(Proj ,/obj/item/projectile/beam)||istype(Proj,/obj/item/projectile/bullet))
explosion(src.loc,-1,0,2)
explosion(get_turf(src),-1,0,2)
if(src)
del(src)
blob_act()
explosion(src.loc,0,1,5,7,10)
explosion(get_turf(src),0,1,5,7,10)
if(src)
del(src)
ex_act()
explosion(src.loc,-1,0,2)
explosion(get_turf(src),-1,0,2)
if(src)
del(src)
@@ -3274,7 +3274,7 @@
reagents.add_reagent("beer",1000)
/obj/structure/reagent_dispensers/beerkeg/blob_act()
explosion(src.loc,0,3,5,7,10)
explosion(get_turf(src),0,3,5,7,10)
del(src)
@@ -65,7 +65,7 @@
//For ninjas exploding when they die./N
if (istype(wear_suit, /obj/item/clothing/suit/space/space_ninja)&&wear_suit:s_initialized)
src << browse(null, "window=spideros")//Just in case.
var/location = loc
var/turf/location = get_turf(src)
explosion(location, 1, 2, 3, 4)
canmove = 0
@@ -11,7 +11,7 @@
if (ghost.client)
ghost.client.eye = ghost
explosion(src.loc, -1,-1,3,12)
explosion(get_turf(src), -1,-1,3,12)
sleep(2)
del(src)
else
+1 -1
View File
@@ -39,7 +39,7 @@
if(explosive)
spawn(10)
explosion(src.loc, 3, 6, 12, 15)
explosion(get_turf(src), 3, 6, 12, 15)
for(var/obj/machinery/ai_status_display/O in world) //change status
spawn( 0 )
@@ -2,7 +2,7 @@
src.stat = 2
src.icon_state = "ai-crash"
spawn(10)
explosion(src.loc, 3, 6, 12, 15)
explosion(get_turf(src), 3, 6, 12, 15)
for(var/obj/machinery/ai_status_display/O in world) //change status
spawn( 0 )
+1 -1
View File
@@ -46,7 +46,7 @@
var/strength = convert2energy(mass)
if (strength < 773.0)
var/turf/T = get_turf(src.loc)
var/turf/T = get_turf(src)
if (strength > (450+T0C))
explosion(T, 0, 1, 2, 4)
+1 -1
View File
@@ -399,7 +399,7 @@
// explode the light
/obj/machinery/light/proc/explode()
var/turf/T = get_turf(src.loc)
var/turf/T = get_turf(src)
spawn(0)
broken() // break it first to give a warning
sleep(2)
+1 -1
View File
@@ -70,7 +70,7 @@
proc
overheat()
explosion(src.loc, 2, 5, 2, -1)
explosion(get_turf(src), 2, 5, 2, -1)
attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/weapon/tank/plasma))
+4 -4
View File
@@ -183,7 +183,7 @@ display round(lastgen) and plasmatank amount
proc
overheat()
explosion(src.loc, 2, 5, 2, -1)
explosion(get_turf(src), 2, 5, 2, -1)
attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, sheet_path))
@@ -302,7 +302,7 @@ display round(lastgen) and plasmatank amount
time_per_sheet = 25
board_path = "/obj/item/weapon/circuitboard/pacman/super"
overheat()
explosion(src.loc, 3, 3, 3, -1)
explosion(get_turf(src), 3, 3, 3, -1)
/obj/machinery/power/port_gen/pacman/mrs
name = "M.R.S.P.A.C.M.A.N.-type Portable Generator"
@@ -312,7 +312,7 @@ display round(lastgen) and plasmatank amount
time_per_sheet = 30
board_path = "/obj/item/weapon/circuitboard/pacman/mrs"
overheat()
explosion(src.loc, 4, 4, 4, -1)
explosion(get_turf(src), 4, 4, 4, -1)
/obj/machinery/power/port_gen/pacman/industrial
name = "Industrial P.A.C.M.A.N.-type Portable Generator"
@@ -322,4 +322,4 @@ display round(lastgen) and plasmatank amount
time_per_sheet = 30
board_path = "/obj/item/weapon/circuitboard/pacman/industrial"
overheat()
explosion(src.loc, 4, 4, 4, -1)
explosion(get_turf(src), 4, 4, 4, -1)
@@ -258,7 +258,7 @@ var/global/list/uneatable = list(
if (istype(A,/obj/item/weapon/storage/backpack/holding))
var/dist = max((current_size - 2),1)
explosion(src.loc,(dist),(dist*2),(dist*4))
explosion(get_turf(src),(dist),(dist*2),(dist*4))
return
if(istype(A, /obj/machinery/singularity))//Welp now you did it
@@ -266,7 +266,7 @@ var/global/list/uneatable = list(
src.energy += (S.energy/2)//Absorb most of it
del(S)
var/dist = max((current_size - 2),1)
explosion(src.loc,(dist),(dist*2),(dist*4))
explosion(get_turf(src),(dist),(dist*2),(dist*4))
return//Quits here, the obj should be gone, hell we might be
if((teleport_del) && (!istype(A, /obj/machinery)))//Going to see if it does not lag less to tele items over to Z 2
+5 -5
View File
@@ -304,9 +304,9 @@
proc/ion_act()
if(src.z == 1)
if(z == 1)
if(prob(1)) //explosion
world << "\red SMES explosion in [src.loc.loc]"
world << "\red SMES explosion in \the [get_turf(src)]"
for(var/mob/M in viewers(src))
M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2)
sleep(10*pick(4,5,6,7,10,14))
@@ -314,11 +314,11 @@
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
explosion(src.loc, -1, 0, 1, 3, 0)
explosion(get_turf(src), -1, 0, 1, 3, 0)
del(src)
return
if(prob(15)) //Power drain
world << "\red SMES power drain in [src.loc.loc]"
world << "\red SMES power drain in \the [get_turf(src)]"
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
@@ -327,7 +327,7 @@
else
emp_act(2)
if(prob(5)) //smoke only
world << "\red SMES smoke in [src.loc.loc]"
world << "\red SMES smoke in \the [get_turf(src)]"
var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)