mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
yahar should fix being sucked or blown away from a zone you're nowhere near anymore.
This commit is contained in:
@@ -117,7 +117,7 @@ obj/item/check_airflow_movable(n)
|
||||
//Zones A and B are air zones. n represents the amount of air moved.
|
||||
|
||||
proc/Airflow(zone/A, zone/B)
|
||||
|
||||
set background = 1
|
||||
var/n = B.air.return_pressure() - A.air.return_pressure()
|
||||
|
||||
//Don't go any further if n is lower than the lowest value needed for airflow.
|
||||
@@ -139,6 +139,7 @@ proc/Airflow(zone/A, zone/B)
|
||||
connected_turfs |= C.B
|
||||
|
||||
//Get lists of things that can be thrown across the room for each zone (assumes air is moving from zone B to zone A)
|
||||
spawn()
|
||||
var/list/air_sucked = B.movables()
|
||||
var/list/air_repelled = A.movables()
|
||||
if(n < 0)
|
||||
@@ -169,7 +170,7 @@ proc/Airflow(zone/A, zone/B)
|
||||
|
||||
M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards.
|
||||
|
||||
spawn M.GotoAirflowDest(abs(n)/5)
|
||||
M.GotoAirflowDest(abs(n)/5)
|
||||
|
||||
//Do it again for the stuff in the other zone, making it fly away.
|
||||
for(var/atom/movable/M in air_repelled)
|
||||
@@ -195,7 +196,7 @@ proc/Airflow(zone/A, zone/B)
|
||||
spawn M.RepelAirflowDest(abs(n)/5)
|
||||
|
||||
proc/AirflowSpace(zone/A)
|
||||
|
||||
spawn()
|
||||
//The space version of the Airflow(A,B,n) proc.
|
||||
|
||||
var/n = A.air.return_pressure()
|
||||
@@ -226,8 +227,7 @@ proc/AirflowSpace(zone/A)
|
||||
if(!M.airflow_speed)
|
||||
|
||||
M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards.
|
||||
spawn
|
||||
if(M) M.GotoAirflowDest(n/10)
|
||||
M.GotoAirflowDest(n/10)
|
||||
//Sometimes shit breaks, and M isn't there after the spawn.
|
||||
*/
|
||||
|
||||
|
||||
@@ -85,7 +85,8 @@ Class Procs:
|
||||
|
||||
/connection_edge/proc/tick()
|
||||
|
||||
/connection_edge/proc/flow(list/movable, differential, repelled)
|
||||
/connection_edge/proc/flow(list/movable, differential, repelled, flipped = 0)
|
||||
//Flipped tells us if we are going from A to B or from B to A.
|
||||
if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push))
|
||||
return
|
||||
for(var/atom/movable/M in movable)
|
||||
@@ -115,8 +116,18 @@ Class Procs:
|
||||
|
||||
if(M)
|
||||
if(repelled)
|
||||
if(flipped)
|
||||
if(!(M.loc in src:A.contents))
|
||||
continue
|
||||
else if(!(M.loc in src:B.contents))
|
||||
continue
|
||||
M.RepelAirflowDest(differential/5)
|
||||
else
|
||||
if(flipped)
|
||||
if(!(M.loc in src:B.contents))
|
||||
continue
|
||||
else if(!(M.loc in src:A.contents))
|
||||
continue
|
||||
M.GotoAirflowDest(differential/10)
|
||||
|
||||
|
||||
@@ -176,15 +187,17 @@ Class Procs:
|
||||
|
||||
var/list/attracted
|
||||
var/list/repelled
|
||||
var/flipped = 0
|
||||
if(differential > 0)
|
||||
attracted = A.movables()
|
||||
repelled = B.movables()
|
||||
else
|
||||
flipped = 1
|
||||
attracted = B.movables()
|
||||
repelled = A.movables()
|
||||
|
||||
flow(attracted, abs(differential), 0)
|
||||
flow(repelled, abs(differential), 1)
|
||||
flow(attracted, abs(differential), 0, flipped)
|
||||
flow(repelled, abs(differential), 1, flipped)
|
||||
|
||||
//Helper proc to get connections for a zone.
|
||||
/connection_edge/zone/proc/get_connected_zone(zone/from)
|
||||
|
||||
Reference in New Issue
Block a user