mob
var/tmp/Beaming = 0
Move(NewLoc, Dir)
if(!Beaming) return ..()
dir = Dir
/*
Ki Types: Blast, Beam, Blast Charge (Just Charge)
Beam: RP Pause required for attacking players
Blast: Makes use of targeting
Blast Charge: Immobilizes user & Makes them less responsive to attacks
--- Blast ---
Blast: If targeting, a special *semi-homing behavior is used
* Blasts home in if the target is within a range of directions relative to itself
1. Target is North of Blast: Home
2. Target is East of Blast: Home
3. Target is Southeast of Blast: Trail away, Homing breaks
4. Target is South of Blast: Trail away, Homing breaks
Deflection: 50 * ((Attacker.BP * Attacker.Accuracy) / (BP * Agility))
Reflection: 50 * (((Attacker.BP * Attacker.Accuracy) / (BP * Agility)) / 1.25)
Refire: 1 per sec (Mastered)
Damage: max(0, (Attacker.BP * Attacker.Strength) / (BP * Durability) / 5)
*/
Projectile
parent_type = /obj
density = 0
Grabbable = 0
Attackable = 0
proc
position(mob/m, s = 16)
loc = m.loc
dir = m.dir
var x = m.step_x, y = m.step_y
if(m.dir & NORTH) y += s
if(m.dir & SOUTH) y -= s
if(m.dir & WEST) x -= s
if(m.dir & EAST) x += s
step_x = x
step_y = y
collide()
// expand later
Bump(atom/a)
..(a)
collide(a)
Blast
step_size = 32
Standing = 1
bound_x = 11
bound_y = 12
bound_width = 11
bound_height = 7
icon = 'Blast1.dmi'
New(mob/ref)
if(!ismob(ref)) del src
..(ref)
position(ref)
life()
Move()
..()
if(dir & NORTH) if(y == world.maxy) del src
if(dir & SOUTH) if(y == 1) del src
if(dir & WEST) if(x == 1) del src
if(dir & EAST) if(x == world.maxx) del src
collide(atom/a)
// damage stuff
del src
proc
life()
for()
sleep(1)
step(src, src.dir)
Beam
step_size = 32
icon = 'Beam1.dmi'
icon_state = "Body"
var Projectile/Beam/childobject
var obj/Skills/Beam/creator
New(l, obj/Skills/Beam/s)
..(l)
creator = s
collide()
if((creator.head == src) && childobject)
childobject.make_head()
del src
proc
add_link(hcreator)
var Projectile/Beam/tl = src
while(tl.childobject) tl = tl.childobject
var Projectile/Beam/b = new(tl.loc, hcreator)
b.icon_state = "Tail"
tl.childobject = b
b.step_x = tl.step_x
b.step_y = tl.step_y
tl.icon_state = "Body"
make_head()
icon_state = "Head"
spawn() head_life()
head_life()
while(src)
sleep(1)
step(src, dir)
if(creator.beaming) add_link(creator)
Move()
var oloc = loc
. = ..()
if(childobject && .) childobject.Move(oloc)
if(!childobject) icon_state = "Tail"
Charge
obj
Skills
Blast
Mastery = 1
var
Mastery_P = 1
Click()
usr.blast()
Beam
var
beaming = 0
Projectile/Beam/head
Click()
usr.beam(src)
Charge // later defined
Explosion // later
mob
proc
blast()
new /Projectile/Blast(src)
beam(obj/Skills/Beam/b)
if(!b) return
if(b.beaming) b.beaming = 0
else
b.beaming = 1
spawn() beaming(b)
beaming(obj/Skills/Beam/b)
b.head = new /Projectile/Beam(src, b)
b.head.position(src, 32)
spawn() b.head.head_life()
while(b.beaming)
sleep(1)
// do stuff
Problem description:
Well, I coded up a little Projectile setup, and in the end it ultimately ended up having issues. Some issues it has are the head not showing up in the right place (shows at the tail until you release the beam, in which case it turns into a tail).
Sometimes it loses it's alignment, and furthermore it faces the wrong direction in some cases.
I'm less looking for a, "you did this wrong", and more looking for some better logic behind putting this all together, since it's getting increasingly complicated, when it seems like it doesn't need to be.
Also, here's a problem that causes your head object to not be the right icon state:
Specifically, this line:
tl.icon_state = "Body"
Following this code, the head tile will stay as tl (Because it doesn't have a childobject). Just add a check to make sure tl isn't src.