ID:168589
 
So, I was thinking of making a building game, but was wondering how to prevent stacking. I looked for demos and did a forum search, but it appears I can't find anything, so, just out of the blue, I was thinking something such as(Note, this is completely an example, main focus on the last 4 lines):

mob
verb
Build()
for(var/obj/build/T as typesof(/obj/build) in view(usr,0))
if(istype(T,/obj/build))
del(T)
new buildingtype(usr.loc) //buildingtype is the type of obj being made.


So, what exactly should I do?
Was thinking the new buildingtype(usr.loc) part, seeing as it's in the for() loop, might create a new buildingtype for each instance of /obj/build is found.
Dealing with turfs the way you are looking at t, there are no stacking. You can only have one turf per tile unit. If you create another turf, it immediately replaces the turf below it. If you delete a turf, it is replaced with either black square some call a void, or the wolrd turf, which I believe you have stated as grass.
In response to CaptFalcon33035
CaptFalcon33035 wrote:
Dealing with turfs the way you are looking at t, there are no stacking. You can only have one turf per tile unit. If you create another turf, it immediately replaces the turf below it. If you delete a turf, it is replaced with either black square some call a void, or the wolrd turf, which I believe you have stated as grass.

D'oh! I meant obj. Was very late when I was typing that. -_-
The way you formed your variable, istype( T, /obj/build ) will always return true. Also, you'd be better off doing something like this:

mob/verb/Build( Tiles as num )
if( Tiles > 1 )
// This will take up more than one tile, so let's clear those tiles
for( var/obj/build/T as typesof( /obj/build ) in view( src, Tiles ) // Doesn't matter if you do src or usr in a verb.
del( T ) //Delete the object and put the building there, or in this case right now, a piece of a build would be it.
new build7ngtype( src.loc )
return
else
// We have one tile, and we'll be on it.
// NOTE: You may want to revise this method..
// A building should be dense, so the building
// Should really be one tile away.
var/obj/build/T = locate() in src.loc
if( T )
del( T )
new buildingtype( src.loc )
return