ID:178001
 
How do you make a turf remove by del(src) return after seven have been deleted? In the EXACT spots that they were created. Or, is it is unavoidable, not all on the player's location or on roads. BTW, the roads are used as road, if that will help anyone who helps me.
turf_holder // used to hold important data about deleted turfs
var
turf_type
x
y
z

var
list/deleted_turfs = list() // stores /turf_holder data
turf_respawn = 0

turf
Del()
if(!turf_respawn) // if respawning turfs, ignore this section
turf_respawn = 1 // let the world know it is respawning turfs

var/turf_holder/T

if(deleted_turfs.len >= 7) // if 7 or more turfs have been deleted before
for(T in deleted_turfs)
var/Type = T.turf_type
new Type(locate(T.x,T.y,T.z)) // respawn the turf in it's old location

deleted_turfs = list() // clear the list

T = new() // create a turf_holder

// place this turf's data in the turf_holder
T.turf_type = src.type
T.x = src.x
T.y = src.y
T.z = src.z

deleted_turfs += T // add this turf_holder to the deleted_turfs

turf_respawn = 0 // finished respawning turfs

..() // do the default Del() stuff


If you only want this to happen for specific turfs, override their Del() procs, but not the default turf/Del()
In response to Shadowdarke
Shadowdarke wrote:
turf_holder // used to hold important data about deleted turfs
var
turf_type
x
y
z

var
list/deleted_turfs = list() // stores /turf_holder data
turf_respawn = 0

turf
Del()
if(!turf_respawn) // if respawning turfs, ignore this section
turf_respawn = 1 // let the world know it is respawning turfs

var/turf_holder/T

if(deleted_turfs.len >= 7) // if 7 or more turfs have been deleted before
for(T in deleted_turfs)
var/Type = T.turf_type
new Type(locate(T.x,T.y,T.z)) // respawn the turf in it's old location

deleted_turfs = list() // clear the list

T = new() // create a turf_holder

// place this turf's data in the turf_holder
T.turf_type = src.type
T.x = src.x
T.y = src.y
T.z = src.z

deleted_turfs += T // add this turf_holder to the deleted_turfs

turf_respawn = 0 // finished respawning turfs

..() // do the default Del() stuff


If you only want this to happen for specific turfs, override their Del() procs, but not the default turf/Del()

Is it possible to just use the spawn() proc? I'm a bit new to respawning. Or does Repop() do the job?
In response to Drafonis
Drafonis wrote:
Is it possible to just use the spawn() proc? I'm a bit new to respawning. Or does Repop() do the job?

Repop() is a bludgeon; it will respawn everything.

spawn() is not for "spawning" objects or turfs; the new() command is for that. spawn() is used to spawn off a new thread of execution, by basically putting off a task until later.

Lummox JR
In response to Drafonis
spawn() has nothing to do with remaking items. It is used to make a particular chunk of code run at a later time.

Repop() does not work for turfs. There is also very litle control with Repop(). It resets all deleted mobs and objs that were in the maps when the world booted.
In response to Lummox JR
Lummox JR wrote:
Drafonis wrote:
Is it possible to just use the spawn() proc? I'm a bit new to respawning. Or does Repop() do the job?

Repop() is a bludgeon; it will respawn everything.

spawn() is not for "spawning" objects or turfs; the new() command is for that. spawn() is used to spawn off a new thread of execution, by basically putting off a task until later.

Lummox JR

So, basically, in the scanning proc that I have, if I execute the new() proc a few times, I'll have that done?