Hey guys sorry for the onslaught of questions tonight, I am writing a code to make random turfs on the map as rougelikes tend to have randomization for replay value. this is my first shot at it and it doesnt give errors it just doesn't make the turfs as I want it to :P I put the random mob on the map and it doesn't change into a floor or water tile then delete the mob as I had hoped it just sits there lol. If you know why it doesn't work or have a easier way to go about this I would appreciate it :)
mob/random_tile
density = 0
text = ""
New()
randomize()
mob/proc/randomize()
while(src)
if(src.random == 0)
if(rand(1,2) == 1)
new/turf/water in src.loc
random += 1
sleep(1)
else
new/turf/floor in src.loc
random += 1
sleep(1)
else
del(src)
Thanks in advance,
Bloodocean7.
Now we'll look at randomize itself, the way you have it setup now there's not even really a need for a loop, because it's just going to fire once and delete the mob (which will terminate the loop).
Notice the syntax of usage of 'new' here, your usage was close to proper but not quite right, in the context you used it in your code you'd want:
new/turf/floor(src.loc)
You can pass custom arguments through the usage of new as well, which will be passed through the New() call of the turf.