Projectiles will no longer lag the server to death (#7960)

About 1.1 million instances of this runtime. This fixes all of them. In a somewhat sane manner. There was currently no mechanic which made projectiles stop if they reached the end of the map. This makes them qdel themselves.
This commit is contained in:
Erki
2020-01-08 21:26:40 +02:00
committed by GitHub
parent 83a65887fc
commit 4e913b613b
2 changed files with 16 additions and 1 deletions

View File

@@ -362,6 +362,10 @@
on_impact(loc)
qdel(src)
return
if (QDELETED(src))
return
last_projectile_move = world.time
if(!nondirectional_sprite && !hitscanning)
var/matrix/M = new
@@ -369,6 +373,11 @@
transform = M
trajectory.increment(trajectory_multiplier)
var/turf/T = trajectory.return_turf()
if (!T) // Nowhere to go. Just die.
qdel(src)
return
if(T.z != loc.z)
before_move()
before_z_change(loc, T)
@@ -513,7 +522,8 @@
required_moves = SSprojectiles.global_max_tick_moves
if(!required_moves)
return
for(var/i in 1 to required_moves)
for(var/i = 1; i <= required_moves && !QDELETED(src); i++)
pixel_move(required_moves)
/obj/item/projectile/proc/setAngle(new_angle) //wrapper for overrides.