ID:149432
 
This code repopulates monsters but doesn't repopulate objects. How can I do that?

world/New()
..()//!!!
spawn
while(1)
sleep(200)
for(var/obj in world)
for(var/mob/M in world)
sleep(200)
Repop()
world <<"(Repop)"
Likwiddraino000 wrote:
This code repopulates monsters but doesn't repopulate objects. How can I do that?

world/New()
..()//!!!
spawn
while(1)
sleep(200)
for(var/obj in world)
for(var/mob/M in world)
sleep(200)
Repop()
world <<"(Repop)"

The first thing to note is that the reference has this to say about Repop():

"Reload the obj and mob instances defined in the world map. This "repopulates" a world to its initial state. Only objects that were destroyed will be recreated."

If your objects weren't actually deleted, they will not repop.

Now to your code. The line for(var/obj in world) does nothing, since nothing is indented under it. But actually neither of your for loops are necessary. Repop() acts on all mobs and objects, so you don't have to do any looping. This code should accomplish the same:

world/New()
..()
while(1)
sleep(200)
Repop()
world <<"(Repop)"
In response to Skysaw