ID:144608
 
Code:
Delete_Town(var/turf/town/T in world)


Problem description:

This lets players right-click any turf and delete it, but I only want them to be able to right-click only /turf/town :(
I don't think you can specify which turf to delete like THAT.

However, there's two ways I can think of what you can do:

1) Give the verb to the town rather than the mob, eg:
turf/Self_delete()
set src in oview(3)
del src


2) Add an if() statement in your current verb, checking if the turf being deleted belongs to the correct turf before deleting:
mob/verb/Delete_Turf(var/turf/town/T in world) //again, I doubt the /town/ matters here
if(!istype(T,/turf/town))//checks the turf type if it is /turf/town
src<<"You can not delete this turf!"
return//stops the code block
del src


- GhostAnime
In response to GhostAnime
I already set it up like #2 unless there was no way to make it work like I wanted; it just seems wierd that there's no differance between:

Delete_Town(var/turf/town in world)

and

Delete_Town(var/turf in world)

=(


I should also probably set it to oview() instead of world. I'll do that~
In response to Cowdude
Well, there's another method, you can create a list and fill it up with town turfs can ask the person which one he/she wants to delete. Eg:
mob/verb/Delete_Town()
var
turf/town/T
townL[0]//empty list
for(T in world) if(istype(T))//Checks if T is indeed turf/town, you can never be too careful
townL+=T//Adds the turf into the list
T=input("Select which town you want to delete.") as null|anything in townL//remember, null=> cancel button => returns null when clicked.
if(!T)return//if T does not exist (null)
del T


- GhostAnime