mob
var
Beam/myBeam
techs[0]
target
Beam
parent_type=/obj/
layer = 300
icon='Beams.dmi'
var
mob/owner
beam_image
speed
dist
ki_damage
bType
objName
bumping
parts[0]
Techs
Kamehameha
icon_state="kame_head"
beam_image="kame"
objName = "Kamehameha Wave"
bType = "Big"
ki_damage = 10
speed=0.75
dist=35
New()
..()
newBeam(usr, src.objName, src.bType, src.beam_image, src.ki_damage, src.speed, src.dist)
Bump(atom/a)
if(istype(a,/mob/))
var/mob/m=a
restart
if(src.bumping != 5)
owner.target = m.charName
m.collidingBeam = 1
m.damage(src.ki_damage)
m.stunned = 1
m.running = 0
m.vel_x = 0
m.objName = src.objName
if(bType == "Big")
if(owner.dir == EAST)
m.dir = WEST
m:vel_x = 18
else
if(owner.dir == WEST)
m.dir = EAST
m:vel_x = -18
src.bumping ++
spawn(10)
goto restart
return
else
if(src.bumping == 5)
owner.target = null
m.collidingBeam = 0
src.clearBeam()
if(istype(a,/turf/))
src.clearBeam()
Move(NewLoc)
if(locate(/Beam/tail/) in src.loc)
..()
else
var/Beam/middle/_middle=new(src.loc)
_middle.dir=src.dir
_middle.owner=src.owner
_middle.icon_state="[src.beam_image]_[_middle.icon_state]"
src.parts+=_middle
if(dir == EAST)
_middle.pixel_x = 70
else
if(dir == WEST)
_middle.pixel_x = -100
..()
proc/clearBeam()
for(var/mob/m in world)
if(owner.target == m.charName)
m.collidingBeam = 0
owner.target = null
src.owner.myBeam=null
for(var/Beam/b in src.parts)
del(b)
del(src)
head
density=1
icon_state="head"
proc/shoot()
var/dense[0]
for(var/atom/a in src.loc)
if(a.density && a != src) dense+=a
if(dense.len)
for(var/atom/a in dense) src.Bump(a)
while(src.dist--)
step(src, src.dir)
sleep(src.speed)
src.clearBeam()
New()
..()
if(usr.dir == EAST)
pixel_x = 50
pixel_y = -40
else
if(usr.dir == WEST)
pixel_x = -100
pixel_y = -40
tail
icon_state="tail"
New()
..()
if(usr.dir == EAST)
pixel_x = 7
pixel_y = -40
else
if(usr.dir == WEST)
pixel_x = -100
pixel_y = -40
middle
icon_state="middle"
density = 1
proc
newBeam(mob/m, beamName as text, beamType as text, beamState as text, beamDam as num, beamSpeed as num, beamDist as num)
var/Beam/tail/_tail=new(get_step(m,m.dir))
_tail.owner=m
_tail.dir=m.dir
_tail.icon_state="[beamState]_[_tail.icon_state]"
var/Beam/head/_head=new(get_step(m,m.dir))
m.myBeam=_head
_head.owner=m
_head.icon_state="[beamState]_[_head.icon_state]"
_head.beam_image=beamState
_head.parts+=_tail
_head.objName=beamName
_head.dir=m.dir
_head.bType=beamType
_head.ki_damage=beamDam
_head.speed=beamSpeed
_head.dist=beamDist
sleep(beamSpeed)
_head.shoot()
Problem description:
What It Does: So in my game (Dragon Ball Z inspired) beams start off with the tail or part where the beam fires off, then the head fires from the tail's location. The head is what deals damage if you bump into it. While the head is moving, it creates a trail between the tail and itself (this does nothing).
Actual Issue: So I'm trying to figure out two things. The first is, when a player intersects/jumps into the trail, I want the head to move in front of the player and delete all trails that aren't connected to the head anymore. The second issue is the beam not hitting the player from point-blank range.
When you create the movable at a specific location, Move() is not called:
new(get_step(m,m.dir))
You either need to use Move() to put the beam at the starting loc, or you need to search for anything the beam would collide with after you set the location manually.