I'm making an object, which, when created, spawns 4 other objects in 4 directions and passes them value, which is random between 5 and 10, minus one, or sometimes two. Then that new object creates another 4 objects and passes it's value minus one or two again. New object doesn't make another object if it's value is one. That way I'm trying to make mountains with random forms.
The problem is, the value is passed wrong, so it only shows up good when it sends it as message, but it's true value is 0. For example, after 3 generations of objects are made, initial one returns 7, another one 6 and third on -1.
Another thing is, I was forced into using different objects for different generations. When 2nd generation object tries to make another 2nd, i get loads of spam. If it tries to make 3rd, which is identical to 2nd, everything works fine
And last, I have a question. What would be best way to check if, for example, neighbor turf is /turf/cliff
My lame code:
atom
high
icon='turf.dmi'
var/H
New()
var/H=rand(5,10)
if(H!=0)
var/atom/high2/N= new/atom/high2(locate(src.x+1,src.y,1))
var/atom/high2/S= new/atom/high2(locate(src.x-1,src.y,1))
var/atom/high2/E= new/atom/high2(locate(src.x,src.y+1,1))
var/atom/high2/W= new/atom/high2(locate(src.x,src.y-1,1))
N.H=H-prob(10)-1
S.H=H-prob(10)-1
E.H=H-prob(10)-1
W.H=H-prob(10)-1
high2
icon='turf.dmi'
var/H
New()
world<<"Made a spawn"
if(H!=0)
world<<"continue"
var/atom/high3/N= new/atom/high3(locate(src.x+1,src.y,1))
var/atom/high3/S= new/atom/high3(locate(src.x-1,src.y,1))
var/atom/high3/E= new/atom/high3(locate(src.x,src.y+1,1))
var/atom/high3/W= new/atom/high3(locate(src.x,src.y-1,1))
N.H=H-prob(10)-1
S.H=H-prob(10)-1
E.H=H-prob(10)-1
W.H=H-prob(10)-1
Click()
usr<<"[H]"
high3//for testing
icon='turf.dmi'
var/H
Click()
usr<<"[H]"
New()
if(H!=0)
var/atom/high4/S= new/atom/high4(locate(src.x-1,src.y,1))
high4//for testing
var/H