ID:141256
 
Code:
turf
D
Enter(mob/M)
if(M.Pushed)
new/obj/Crater(M.loc)
del(src)
else
if(istype(M)&&M.Flying)
return 1
else
return 0


Problem description: The crater is forming too early, I think it's forming too early because the crater is formed earlier then the obj is deleted. The problem is that I can't put it after "del(src)" because it won't do anything. I tried changing:

                new/obj/Crater(M.loc)


to

                new/obj/Crater(src.loc)


but it just deletes a different turf and creates the crater over it. It doesn't do it on the wall that is hit. Any suggestions/fixes? Maybe a way to make the code more efficient?
Change Enter to Entered.
I'm guessing you'll want to use Bump() instead, but you didn't actually word what you're trying to do.
I assume the mob's Pushed is set temporarily when he's being moved, doing it properly would probably be something like:
mob/person
var/Pushed
verb/Attack(mob/M in oview(1))
if(!M) return
...
if(dmg > M.maxHP / 3)
M.Push(src.dir,src)
proc/Push(Dir,mob/person/pusher) //;d
src << "You're pushed by [pusher]!"
src.Pushed = 1
step(src,Dir)
src.Pushed = 0

And apparently, you want a certain turf to be destroyed when someone gets pushed into it. You can use Bump() to do it (of course, the wall and mob have to be dense):
mob/person/Bump(atom/A)
if(istype(A,/turf/destructible_wall))
//assuming you want a crater where the wall used to be
new /obj/crater(A)
del A //this doesn't actually delete the above obj

Note you should really just make the crater a turf, not an obj. It doesn't need to move or anything, or be independent of the turf it's on (which is recreated fresh with a default type anyway), so making it an obj seems simple obj-overuse. With making it a turf, you could actually use one line to get rid of the old turf and put a crater there: new /turf/crater(oldturf).