Files
CHOMPStation2/code/game/objects/items/apc_frame.dm
CHOMPStation2 ab154b48b2 [MIRROR] refactors most spans (#9139)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com>
Co-authored-by: Kashargul <KashL@t-online.de>
2024-10-04 15:00:17 +02:00

39 lines
1.2 KiB
Plaintext

// APC HULL
/obj/item/frame/apc
name = "\improper APC frame"
desc = "Used for repairing or building APCs"
icon = 'icons/obj/apc_repair.dmi'
icon_state = "apc_frame"
refund_amt = 2
build_wall_only = TRUE
matter = list(MAT_STEEL = 100, MAT_GLASS = 30)
/obj/item/frame/apc/try_build(turf/on_wall, mob/user as mob)
if (get_dist(on_wall, user)>1)
return
var/ndir = get_dir(user, on_wall)
if (!(ndir in cardinal))
return
var/turf/loc = get_turf(user)
var/area/A = loc.loc
if (!istype(loc, /turf/simulated/floor))
to_chat(user, span_warning("APC cannot be placed on this spot."))
return
if (A.requires_power == 0 || istype(A, /area/space))
to_chat(user, span_warning("APC cannot be placed in this area."))
return
if (A.get_apc())
to_chat(user, span_warning("This area already has an APC."))
return //only one APC per area
for(var/obj/machinery/power/terminal/T in loc)
if (T.master)
to_chat(user, span_warning("There is another network terminal here."))
return
else
new /obj/item/stack/cable_coil(loc, 10)
to_chat(user, "You cut the cables and disassemble the unused power terminal.")
qdel(T)
new /obj/machinery/power/apc(loc, ndir, 1)
qdel(src)