Files
Paradise/code/game/objects/items/mountable_frames/frames.dm
ComicIronic 44aa2ba225 Code rework of placing things on walls.
Stuff goes under types.
Types have procs.
Never have 500 lines of repeated code again.

I came very close to crying while editing this. You should appreciate
that.

----

This commit entirely reworks how placing things on walls work- Posters
have intentionally been left alone to reduce the amount of lines
changed. With this commit, wall-mounted objects are no longer snowflaked
into the wall file.
2015-04-19 14:29:42 -07:00

25 lines
1.0 KiB
Plaintext

/obj/item/mounted/frame
name = "mountable frame"
desc = "Place it on a wall."
var/sheets_refunded = 2
var/list/mount_reqs = list() //can contain simfloor, nospace. Used in try_build to see if conditions are needed, then met
/obj/item/mounted/frame/attackby(obj/item/weapon/W, mob/user)
..()
if (istype(W, /obj/item/weapon/wrench) && sheets_refunded)
//new /obj/item/stack/sheet/metal( get_turf(src.loc), sheets_refunded )
var/obj/item/stack/sheet/metal/M = getFromPool(/obj/item/stack/sheet/metal, get_turf(src))
M.amount = sheets_refunded
qdel(src)
/obj/item/mounted/frame/try_build(turf/on_wall, mob/user)
if(..()) //if we pass the parent tests
var/turf/turf_loc = get_turf(user)
if (src.mount_reqs.Find("simfloor") && !istype(turf_loc, /turf/simulated/floor))
user << "<span class='rose'>[src] cannot be placed on this spot.</span>"
return
if (src.mount_reqs.Find("nospace") && (areaMaster.requires_power == 0 || areaMaster.name == "Space"))
user << "<span class='rose'>[src] cannot be placed in this area.</span>"
return
return 1