Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into Ghommie-cit685
This commit is contained in:
@@ -434,6 +434,29 @@ Turf and target are separate in case you want to teleport some distance from a t
|
||||
|
||||
return locate(x,y,A.z)
|
||||
|
||||
/**
|
||||
* Get ranged target turf, but with direct targets as opposed to directions
|
||||
*
|
||||
* Starts at atom A and gets the exact angle between A and target
|
||||
* Moves from A with that angle, Range amount of times, until it stops, bound to map size
|
||||
* Arguments:
|
||||
* * A - Initial Firer / Position
|
||||
* * target - Target to aim towards
|
||||
* * range - Distance of returned target turf from A
|
||||
* * offset - Angle offset, 180 input would make the returned target turf be in the opposite direction
|
||||
*/
|
||||
/proc/get_ranged_target_turf_direct(atom/A, atom/target, range, offset)
|
||||
var/angle = arctan(target.x - A.x, target.y - A.y)
|
||||
if(offset)
|
||||
angle += offset
|
||||
var/turf/T = get_turf(A)
|
||||
for(var/i in 1 to range)
|
||||
var/turf/check = locate(A.x + cos(angle) * i, A.y + sin(angle) * i, A.z)
|
||||
if(!check)
|
||||
break
|
||||
T = check
|
||||
|
||||
return T
|
||||
|
||||
// returns turf relative to A offset in dx and dy tiles
|
||||
// bound to map limits
|
||||
|
||||
Reference in New Issue
Block a user