ID:146176
 
Code:
            for(var/turf/planetfloor/P in world)
if(rand(1,5000)==1)
new/obj/meteor(P)
for(var/obj/building/B in P.loc)
del(B)
P.ob=1


Problem description:

Somehow this code destroys ALL buildings in the world(I cut this part of the code, and it works fine again, but if I include this all buildings are destroyed) but doesn't drop meteors everywhere... has this something to do with the for(var/obj/building/B in P.loc)?
for(var/turf/planetfloor/P in world)
var/randome = rand(1,5000)
if(randome==1)
new/obj/meteor(P)
for(var/obj/building/B in P.loc)
del(B)
P.ob=1

give that a try ^_^ not sure if it will work but it just might.
In response to Zmadpeter
Didn't work :(
In response to CIB
CIB, it's a one out of 5000 chance that this is actually going to execute? It's going to take hundreds of executions before it actually works. If you're debugging it, you should make it happen a lot more of the time.

I think it might have something to do with this:
        new/obj/meteor(P)


Are you trying to make the new obj in P's location? Or what?

And for this:
        for(var/obj/building/B in P.loc)


Wouldn't if be better than for here?
Change P.loc to P or P.contents.

The loc of something is the object that contains it. P is a turf in this case, so P.loc is the /area that contains it. You have it deleting all objects in the area instead of just objects in the single turf.
In response to Justin Knight
It's not supposed to happen often...
In response to CIB
He is just make it happen so YOU can test it, then after you get it working just set it back to what ever you had it to....get it?