ID:263512
 
Code:
//The Player
mob
var/projectile=/mob //This will be used to determine what they will shoot
icon='player.dmi'
Player
//Test to see if the Fire() proc works
verb
Test()
src.Fire()


//The Shooting
mob
proc
Fire()
world<<"Rawr!"
var/mob/P=src.projectile
new P(src.loc)
P.dir=src.dir
while(src.projectile)
step(P,P.dir)
var/turf/T=P.loc
if(T.density==1)
//Place Damage To Turfs Code here later
del P
world<<"[P] hit [T]!"
break
//If there is a mob in T
for(var/mob/M as mob in T)
if(M==src)
continue
//Place damage to players here
del P
sleep(5)


Problem description:

Whenever I fire, it spawns the projectile P just fine, but it won't let P step. Heres the error it gives:

runtime error: Cannot modify /mob.dir.
proc name: Fire (/mob/proc/Fire)
usr: Dead_Demon (/mob/Player)
src: Dead_Demon (/mob/Player)
call stack:
Dead_Demon (/mob/Player): Fire()
Dead_Demon (/mob/Player): Test()
In short, the problem is as the error tells you, P contains a type path, '/mob', and and not an object, therefore you can't access it's variables.
To expand on what Kaioken said, you're making a new 'p', sure enough, but you're not setting the 'p' variable /to/ it, so it's still a typepath.

var/mob/P=src.projectile
new P(src.loc)


should be:

var/mob/p=new projectile(loc)


(You can leave out src)