-
-
Notifications
You must be signed in to change notification settings - Fork 452
/
_basic_projectile.dm
29 lines (26 loc) · 1.03 KB
/
_basic_projectile.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* ## Basic Projectile spell
*
* Simply fires specified projectile type the direction the caster is facing.
*
* Behavior could / should probably be unified with pointed projectile spells
* and aoe projectile spells in the future.
*/
/datum/action/cooldown/spell/basic_projectile
/// How far we try to fire the basic projectile. Blocked by dense objects.
var/projectile_range = 7
/// The projectile type fired at all people around us
var/obj/projectile/projectile_type = /obj/projectile/magic/aoe/magic_missile
/datum/action/cooldown/spell/basic_projectile/cast(atom/cast_on)
. = ..()
var/turf/target_turf = get_turf(cast_on)
for(var/i in 1 to projectile_range - 1)
var/turf/next_turf = get_step(target_turf, cast_on.dir)
if(next_turf.density)
break
target_turf = next_turf
fire_projectile(target_turf, cast_on)
/datum/action/cooldown/spell/basic_projectile/proc/fire_projectile(atom/target, atom/caster)
var/obj/projectile/to_fire = new projectile_type()
to_fire.preparePixelProjectile(target, caster)
to_fire.fire()