how do I make a mob fire in a certain direction?
the shot should then travel in that dir until it hits something
ID:180630
Apr 24 2001, 10:06 am
|
|
In response to Gughunter
|
|
You probably want to use the get_step command. That will return the next turf in the direction something is facing. You could loop through it, and pause a tick or two between iterations, until tries to move to a turf containing an obstacle. could you be a very very kind person and give me a code example? please :) |
In response to Kaidorin
|
|
Not tested, but worth a try...
obj/bullet //Create this in the shooter's loc (not shooter's contents) //and set its dir to shooter's dir. density = 0 fired = 0 proc/Fire() if(!fired) fired = 1 else return var/moved do var/turf/T = get_step(loc, dir) density = 1 //Allow it to Bump() stuff moved = Move(T) density = 0 //Don't let other stuff Bump() it sleep(1) while(moved) |
You probably want to use the get_step command. That will return the next turf in the direction something is facing. You could loop through it, and pause a tick or two between iterations, until tries to move to a turf containing an obstacle.