mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 13:37:58 +01:00
Merge pull request #1488 from Krausus/ExplosionThrowingTweaks
Tweaks Explosion Throwing
This commit is contained in:
@@ -110,7 +110,7 @@
|
||||
if(A.density && !A.throwpass) // **TODO: Better behaviour for windows which are dense, but shouldn't always stop movement
|
||||
src.throw_impact(A,speed)
|
||||
|
||||
/atom/movable/proc/throw_at(atom/target, range, speed, thrower)
|
||||
/atom/movable/proc/throw_at(atom/target, range, speed, thrower, no_spin)
|
||||
if(!target || !src || (flags & NODROP))
|
||||
return 0
|
||||
//use a modified version of Bresenham's algorithm to get from the atom's current position to that of the target
|
||||
@@ -119,7 +119,7 @@
|
||||
src.thrower = thrower
|
||||
src.throw_source = get_turf(src) //store the origin turf
|
||||
if(target.allow_spin) // turns out 1000+ spinning objects being thrown at the singularity creates lag - Iamgoofball
|
||||
if(!no_spin_thrown)
|
||||
if(!no_spin_thrown && !no_spin)
|
||||
SpinAnimation(5, 1)
|
||||
var/dist_x = abs(target.x - src.x)
|
||||
var/dist_y = abs(target.y - src.y)
|
||||
@@ -140,9 +140,6 @@
|
||||
var/area/a = get_area(src.loc)
|
||||
if(dist_x > dist_y)
|
||||
var/error = dist_x/2 - dist_y
|
||||
|
||||
|
||||
|
||||
while(src && target &&((((src.x < target.x && dx == EAST) || (src.x > target.x && dx == WEST)) && dist_travelled < range) || (a && a.has_gravity == 0) || istype(src.loc, /turf/space)) && src.throwing && istype(src.loc, /turf))
|
||||
// only stop when we've gone the whole distance (or max throw range) and are on a non-space tile, or hit something, or hit the end of the map, or someone picks it up
|
||||
if(error < 0)
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
dist += D.explosion_block
|
||||
|
||||
var/flame_dist = 0
|
||||
var/throw_dist = dist
|
||||
var/throw_dist = max_range - dist
|
||||
|
||||
if(dist < flame_range)
|
||||
flame_dist = 1
|
||||
@@ -126,14 +126,16 @@
|
||||
|
||||
//--- THROW ITEMS AROUND ---
|
||||
|
||||
var/throw_dir = get_dir(epicenter,T)
|
||||
for(var/obj/item/I in T)
|
||||
spawn(0) //Simultaneously not one at a time
|
||||
if(I && !I.anchored)
|
||||
var/throw_range = rand(throw_dist, max_range)
|
||||
var/turf/throw_at = get_ranged_target_turf(I, throw_dir, throw_range)
|
||||
I.throw_speed = 4 //Temporarily change their throw_speed for embedding purposes (Reset when it finishes throwing, regardless of hitting anything)
|
||||
I.throw_at(throw_at, throw_range, 2)//Throw it at 2 speed, this is purely visual anyway.
|
||||
if(throw_dist > 0)
|
||||
var/throw_dir = get_dir(epicenter,T)
|
||||
for(var/obj/item/I in T)
|
||||
spawn(0) //Simultaneously not one at a time
|
||||
if(I && !I.anchored)
|
||||
var/throw_mult = 0.5 + (0.5 * rand()) // Between 0.5 and 1.0
|
||||
var/throw_range = round((throw_dist + 1) * throw_mult) // Roughly 50% to 100% of throw_dist
|
||||
if(throw_range > 0)
|
||||
var/turf/throw_at = get_ranged_target_turf(I, throw_dir, throw_range)
|
||||
I.throw_at(throw_at, throw_range, 2, no_spin = 1)//Throw it at 2 speed, this is purely visual anyway.
|
||||
|
||||
var/took = (world.timeofday-start)/10
|
||||
//You need to press the DebugGame verb to see these now....they were getting annoying and we've collected a fair bit of data. Just -test- changes to explosion code using this please so we can compare
|
||||
|
||||
Reference in New Issue
Block a user