Files
Paradise/code/game/objects/items/mountable_frames/apc_frame.dm
Sirryan2002 b4539344e4 Minor Mountable Frame Code Refactor (#18738)
* bugfix turned into a refactor

* fixes exploit with producing infinite metal

* Update code/__DEFINES/construction.dm

Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>

Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
2022-08-27 16:04:43 -05:00

35 lines
1.2 KiB
Plaintext

/obj/item/mounted/frame/apc_frame
name = "APC frame"
desc = "Used for repairing or building APCs"
icon = 'icons/obj/apc_repair.dmi'
icon_state = "apc_frame"
mount_requirements = MOUNTED_FRAME_SIMFLOOR | MOUNTED_FRAME_NOSPACE
metal_sheets_refunded = 2
/obj/item/mounted/frame/apc_frame/try_build(turf/on_wall, mob/user)
if(!..())
return
var/turf/T = get_turf(user)
var/area/A = get_area(T)
if(A.get_apc())
to_chat(user, "<span class='warning'>This area already has an APC!</span>")
return //only one APC per area
if(!A.requires_power)
to_chat(user, "<span class='warning'>You cannot place [src] in this area!</span>")
return //can't place apcs in areas with no power requirement
for(var/obj/machinery/power/terminal/E in T)
if(E.master)
to_chat(user, "<span class='warning'>There is another network terminal here!</span>")
return
else
var/obj/item/stack/cable_coil/C = new /obj/item/stack/cable_coil(T)
C.amount = 10
to_chat(user, "<span class='notice'>You cut the cables and disassemble the unused power terminal.</span>")
qdel(E)
return TRUE
/obj/item/mounted/frame/apc_frame/do_build(turf/on_wall, mob/user)
new /obj/machinery/power/apc(get_turf(src), get_dir(user, on_wall), TRUE)
qdel(src)