-Projectile crosses mob/obj
-mob/obj crosses projectile
-Projectile is placed on the mobs location.
This is my current attempt:
obj/projectile
layer = 5
density = 1
var/tmp
speed = 1
critical = null
duration = 50
breakable = TRUE
mob/owner = null
mob/target = null
stand_still = null
attack_type = null
damage_amount = null
guard_ignorant = FALSE
movement_limit = FALSE
New(loc, dir, mob/owner, mob/target)
src.dir = dir
src.loc = loc
src.owner = owner
src.target = target
src.projectile_fire(target)
if(istype(src, /obj/projectile/mage/unleash))
for(var/mob/m in oview(src, 2))
var/teamate = owner._check_teamate(m)
if(teamate) return
var damage = owner.get_damage(defender = m, damage_amount = src.damage_amount)
m.core_loss(m.health, amt = damage)
owner.show_damage(m, "<b>[damage]","#fff")
//Unleash applies a burn for 3 seconds.
var/ability/a = locate(/ability/mage/active/unleash) in owner.ability_list
if(a && a.rank > 3) owner.apply_condition(defender = m, condition = "burn", duration = 30)
..()
/*onCrossed(atom/movable/a)
//You don't need to check if special is unlocked, because you already did it when you excuted the ability
world << "[a]"
if(isturf(a) && isobj(a)) del src
else if(ismob(a))
if(a == owner) return
else
var/mob/defender = a
var/teamate = src.owner._check_teamate(a)
//if(teamate) return
var/damage = src.owner.get_damage(defender = defender, attack_type = src.attack_type, guard_ignorant = src.guard_ignorant, \
critical = src.critical, damage_amount = src.damage_amount)
if(isnum(damage))
defender.core_loss(defender.health, amt = damage)
owner.show_damage(defender, "<b>[damage]","#fff")
if(src.breakable) del(src)*/
proc
projectile_fire(var/target_lock = FALSE)
if(!stand_still)
//code homing system here
if(target_lock && owner.target)
walk_towards(src,owner.target,world.tick_lag * src.speed)
else
walk(src, src.dir, src.speed)
//else
// new/obj/effect(icon = '_ground_effects.dmi',icon_state = "tiney_crater", loc = src.loc)
duration += round(duration * (owner.apply_vital_boost(owner.duration) / 100))
if(src) spawn(duration) del(src)
Though, I suppose you could take a look at a prototype version of it I shared here:
http://www.byond.com/forum/?post=1901373#comment16036887
Blatant plug, I sell copies of a fully-featured pixel projectile library for $150 a license if you want the milk straight from the source.