mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Airflow pushing should work now, and also be a bit less laggy
This commit is contained in:
@@ -57,13 +57,10 @@ mob/proc/airflow_stun()
|
||||
src << "\blue You stay upright as the air rushes past you."
|
||||
return 0
|
||||
|
||||
if(zas_settings.Get(/datum/ZAS_Setting/airflow_push) || AirflowCanPush())
|
||||
if(weakened <= 0) src << "\red The sudden rush of air knocks you over!"
|
||||
weakened = max(weakened,5)
|
||||
last_airflow_stun = world.time
|
||||
return
|
||||
src << "\blue You stay upright as the air rushes past you."
|
||||
if(weakened <= 0) src << "\red The sudden rush of air knocks you over!"
|
||||
weakened = max(weakened,5)
|
||||
last_airflow_stun = world.time
|
||||
return
|
||||
|
||||
mob/living/silicon/airflow_stun()
|
||||
return
|
||||
@@ -80,20 +77,12 @@ mob/living/carbon/human/airflow_stun()
|
||||
src << "\blue You stay upright as the air rushes past you."
|
||||
return 0
|
||||
|
||||
if(zas_settings.Get(/datum/ZAS_Setting/airflow_push) || AirflowCanPush())
|
||||
if(weakened <= 0) src << "\red The sudden rush of air knocks you over!"
|
||||
weakened = max(weakened,rand(1,5))
|
||||
last_airflow_stun = world.time
|
||||
return
|
||||
src << "\blue You stay upright as the air rushes past you."
|
||||
if(weakened <= 0) src << "\red The sudden rush of air knocks you over!"
|
||||
weakened = max(weakened,rand(1,5))
|
||||
last_airflow_stun = world.time
|
||||
return
|
||||
|
||||
atom/movable/proc/check_airflow_movable(n)
|
||||
if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push))
|
||||
if(ismob(src))
|
||||
if(AirflowCanPush())
|
||||
return 1
|
||||
return 0
|
||||
if(anchored && !ismob(src))
|
||||
return 0
|
||||
if(!istype(src,/obj/item) && n < zas_settings.Get(/datum/ZAS_Setting/airflow_dense_pressure))
|
||||
@@ -252,16 +241,11 @@ proc/AirflowSpace(zone/A)
|
||||
return 1
|
||||
|
||||
/mob/AirflowCanPush()
|
||||
return M_HARDCORE in mutations
|
||||
if (M_HARDCORE in mutations)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/atom/movable/proc/GotoAirflowDest(n)
|
||||
if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push) && !AirflowCanPush()) return // If not enabled, fuck it.
|
||||
if(!airflow_dest) return
|
||||
if(airflow_speed < 0) return
|
||||
if(last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay)) return
|
||||
if(airflow_speed)
|
||||
airflow_speed = n/max(get_dist(src,airflow_dest),1)
|
||||
return
|
||||
last_airflow = world.time
|
||||
if(airflow_dest == loc)
|
||||
step_away(src,loc)
|
||||
@@ -289,45 +273,38 @@ proc/AirflowSpace(zone/A)
|
||||
if(!density)
|
||||
density = 1
|
||||
od = 1
|
||||
while(airflow_speed > 0)
|
||||
if(airflow_speed <= 0) return
|
||||
airflow_speed = min(airflow_speed,15)
|
||||
airflow_speed -= zas_settings.Get(/datum/ZAS_Setting/airflow_speed_decay)
|
||||
if(airflow_speed > 7)
|
||||
if(airflow_time++ >= airflow_speed - 7)
|
||||
spawn(0)
|
||||
while(airflow_speed > 0)
|
||||
airflow_speed = min(airflow_speed,15)
|
||||
airflow_speed -= zas_settings.Get(/datum/ZAS_Setting/airflow_speed_decay)
|
||||
if(airflow_speed > 7)
|
||||
if(airflow_time++ >= airflow_speed - 7)
|
||||
if(od)
|
||||
density = 0
|
||||
sleep(tick_multiplier)
|
||||
else
|
||||
if(od)
|
||||
density = 0
|
||||
sleep(1 * tick_multiplier)
|
||||
else
|
||||
sleep(max(1,10-(airflow_speed+3)) * tick_multiplier)
|
||||
if(od)
|
||||
density = 0
|
||||
sleep(max(1,10-(airflow_speed+3)) * tick_multiplier)
|
||||
density = 1
|
||||
if ((!( src.airflow_dest ) || src.loc == src.airflow_dest))
|
||||
src.airflow_dest = locate(min(max(src.x + xo, 1), world.maxx), min(max(src.y + yo, 1), world.maxy), src.z)
|
||||
if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy))
|
||||
return
|
||||
if(!istype(loc, /turf))
|
||||
return
|
||||
step_towards(src, src.airflow_dest)
|
||||
if(ismob(src) && src:client)
|
||||
src:client:move_delay = world.time + zas_settings.Get(/datum/ZAS_Setting/airflow_mob_slowdown)
|
||||
airflow_dest = null
|
||||
airflow_speed = 0
|
||||
airflow_time = 0
|
||||
if(od)
|
||||
density = 1
|
||||
if ((!( src.airflow_dest ) || src.loc == src.airflow_dest))
|
||||
src.airflow_dest = locate(min(max(src.x + xo, 1), world.maxx), min(max(src.y + yo, 1), world.maxy), src.z)
|
||||
if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy))
|
||||
return
|
||||
if(!istype(loc, /turf))
|
||||
return
|
||||
step_towards(src, src.airflow_dest)
|
||||
if(ismob(src) && src:client)
|
||||
src:client:move_delay = world.time + zas_settings.Get(/datum/ZAS_Setting/airflow_mob_slowdown)
|
||||
airflow_dest = null
|
||||
airflow_speed = 0
|
||||
airflow_time = 0
|
||||
if(od)
|
||||
density = 0
|
||||
density = 0
|
||||
|
||||
|
||||
/atom/movable/proc/RepelAirflowDest(n)
|
||||
if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push) && !AirflowCanPush()) return // If not enabled, fuck it.
|
||||
if(!airflow_dest) return
|
||||
if(airflow_speed < 0) return
|
||||
if(last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay)) return
|
||||
if(airflow_speed)
|
||||
airflow_speed = n/max(get_dist(src,airflow_dest),1)
|
||||
return
|
||||
if(airflow_dest == loc)
|
||||
step_away(src,loc)
|
||||
if(ismob(src))
|
||||
@@ -355,29 +332,29 @@ proc/AirflowSpace(zone/A)
|
||||
if(!density)
|
||||
density = 1
|
||||
od = 1
|
||||
while(airflow_speed > 0)
|
||||
if(airflow_speed <= 0) return
|
||||
airflow_speed = min(airflow_speed,15)
|
||||
airflow_speed -= zas_settings.Get(/datum/ZAS_Setting/airflow_speed_decay)
|
||||
if(airflow_speed > 7)
|
||||
if(airflow_time++ >= airflow_speed - 7)
|
||||
sleep(1 * tick_multiplier)
|
||||
else
|
||||
sleep(max(1,10-(airflow_speed+3)) * tick_multiplier)
|
||||
if ((!( src.airflow_dest ) || src.loc == src.airflow_dest))
|
||||
src.airflow_dest = locate(min(max(src.x + xo, 1), world.maxx), min(max(src.y + yo, 1), world.maxy), src.z)
|
||||
if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy))
|
||||
return
|
||||
if(!istype(loc, /turf))
|
||||
return
|
||||
step_towards(src, src.airflow_dest)
|
||||
if(ismob(src) && src:client)
|
||||
src:client:move_delay = world.time + zas_settings.Get(/datum/ZAS_Setting/airflow_mob_slowdown)
|
||||
airflow_dest = null
|
||||
airflow_speed = 0
|
||||
airflow_time = 0
|
||||
if(od)
|
||||
density = 0
|
||||
spawn(0)
|
||||
while(airflow_speed > 0)
|
||||
airflow_speed = min(airflow_speed,15)
|
||||
airflow_speed -= zas_settings.Get(/datum/ZAS_Setting/airflow_speed_decay)
|
||||
if(airflow_speed > 7)
|
||||
if(airflow_time++ >= airflow_speed - 7)
|
||||
sleep(tick_multiplier)
|
||||
else
|
||||
sleep(max(1,10-(airflow_speed+3)) * tick_multiplier)
|
||||
if ((!( src.airflow_dest ) || src.loc == src.airflow_dest))
|
||||
src.airflow_dest = locate(min(max(src.x + xo, 1), world.maxx), min(max(src.y + yo, 1), world.maxy), src.z)
|
||||
if ((src.x == 1 || src.x == world.maxx || src.y == 1 || src.y == world.maxy))
|
||||
return
|
||||
if(!istype(loc, /turf))
|
||||
return
|
||||
step_towards(src, src.airflow_dest)
|
||||
if(ismob(src) && src:client)
|
||||
src:client:move_delay = world.time + zas_settings.Get(/datum/ZAS_Setting/airflow_mob_slowdown)
|
||||
airflow_dest = null
|
||||
airflow_speed = 0
|
||||
airflow_time = 0
|
||||
if(od)
|
||||
density = 0
|
||||
|
||||
/atom/movable/Bump(atom/A)
|
||||
if(airflow_speed > 0 && airflow_dest)
|
||||
|
||||
@@ -86,7 +86,11 @@ Class Procs:
|
||||
/connection_edge/proc/tick()
|
||||
|
||||
/connection_edge/proc/flow(list/movable, differential, repelled)
|
||||
if(!zas_settings.Get(/datum/ZAS_Setting/airflow_push))
|
||||
return
|
||||
for(var/atom/movable/M in movable)
|
||||
if(!M.AirflowCanPush())
|
||||
continue
|
||||
//If they're already being tossed, don't do it again.
|
||||
if(M.last_airflow > world.time - zas_settings.Get(/datum/ZAS_Setting/airflow_delay))
|
||||
continue
|
||||
@@ -110,7 +114,6 @@ Class Procs:
|
||||
M.airflow_dest = pick(close_turfs) //Pick a random midpoint to fly towards.
|
||||
|
||||
if(M)
|
||||
// THERE WAS A SPAWN HERE. STOP DOING THIS SHIT. - N3X
|
||||
if(repelled)
|
||||
M.RepelAirflowDest(differential/5)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user