ID:147439
 
Alright, here's the code.

if(src.bspower < O.power)
var/odir = src.dir
var/ndir
if(src.dir == NORTH)
ndir = SOUTH
else if(src.dir == SOUTH)
ndir = NORTH
else if(src.dir == EAST)
ndir = WEST
else if(src.dir == WEST)
ndir = EAST
var/turf/T = locate() in get_step(src,O.dir)
if(T)
if(T.density)
var/beamdmg = O.power * 0.05
beamdmg = round(beamdmg)
var/obj/battlenumbers/numbers = new /obj/battlenumbers(src.loc)
numbers.loc = locate(src.x,src.y+1,src.z)
numbers.BattleNumbers("[beamdmg]",numbers)
src.hp -= beamdmg
src.movable = 1
src.dir = ndir
step(src, ndir)
step(O, O.dir)
src.dir = odir
src.movable = 0

Alright, basically that's the power struggle. When the person that has the beam that is wining the one with the O.power which is the beam. It's suppose to check if the turf behind the person being moved by the beam and if the turf is dense it does damage as you can see and puts a little number proc I created. Now, it's not detecting the turf or something because it isn't working correctly. The damage isn't being delt but the person is moving.

What can I do to fix this, Thanks.
var/turf/T = locate() in get_step(src,O.dir)

Isn't that checking the turf in front of them instead of behind them?
In response to DarkCampainger
Look at the movement. If hte beam is looking north, the character would be looking south, so the direction of the turf should be north of hte character.
First, use the turn() proc. Second, get_step returns a turf.
In response to Garthor
Doesn't work. Same problem.
In response to Vakir
Obviously you misunderstood me.
In response to Garthor
In response to Vakir
I really doubt it's me though.... I tried this through just a random detection to see if it works, and here's the code.

mob
verb
TurfDetectionTest()
set name = "Turf Detection"
set category = "Other"
var/turf/T = locate() in get_step(src,src.dir)
if(T)
world << "Turf detected."
if(T.density)
world << "Turf density detected."

I didn't recieve the world messages so therefore it may be a bug of BYOND?
In response to Vakir
var/turf/T = locate() in get_step(src,src.dir)

Uh why do you have the locate() in part? in with a few exceptions just checks if an item is in a list. I'm not sure what locate() returns with no parameters but I bet it's not in get_step(src,src.dir) so T would be set to zero. The if statement would fail and all is well. Try just getting rid of the locate() in part and leave it as

var/turf/T = get_step(src,src.dir)