ID:969200
 
(See the best response by Albro1.)
Code:
    Wooden_Wall
icon = 'turfs.dmi'
icon_state = "weakwall"
opacity = 1
density = 1
var
health = 5
Click()
if(usr.hand1 == "")
if(src.health > 0)
src.health -= 1
usr << "The [src]'s health is now [health]"
if(src.health == 0)
del(src)
usr << "Your broke [src]!"
view() << "[usr] has broken [src]!"
Wooden_Floor
icon = 'turfs.dmi'
icon_state = "weakfloor"
var
health = 5
Click()
if(usr.hand1 == "")
if(src.health > 0)
src.health -= 1
usr << "The [src]'s health is now [health]"
view() << "Bang!"
if(src.health == 0)
del(src)
new /turf/Dirt(loc)
usr << "Your broke [src]!"
view() << "[usr] has broken [src]!"


Problem description: When I place a wooden wall on top of the wooden floor and break the wall, the floor goes with it. Any fix to removing a certain turf?

Only one turf can be placed on one space on the map at a time. You'll need to use /objs.
Alright, simple fix. Thanks, but now what if I want it to place grass when I break the wooden floor? Ideas?
Best response
Create a new grass turf there.

var/turf/wood/w = locate(wood_x, wood_y, wood_z)
new /turf/grass(w.loc)


Creating a new turf over it will delete the one under it.
Thanks, one more question, I promise :P


Lets say if I want to only be able to Click it from 1 block away, to simulate a punch, how would I do that?
In response to Jacob843
Completely different issue, but okay. You just need to use get_dist().
Thanks, sorry for all the questions again, but now I know what I needed. Thanks again!