Files
Paradise/code/game/objects/items/mountable_frames/lights.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

43 lines
1.4 KiB
Plaintext

/obj/item/mounted/frame/light_fixture
name = "light fixture frame"
desc = "Used for building lights."
icon = 'icons/obj/lighting.dmi'
icon_state = "tube-construct-item"
mount_requirements = MOUNTED_FRAME_SIMFLOOR
metal_sheets_refunded = 2
///specifies which type of light fixture this frame will build
var/fixture_type = "tube"
/obj/item/mounted/frame/light_fixture/do_build(turf/on_wall, mob/user)
to_chat(user, "You begin attaching [src] to \the [on_wall].")
playsound(get_turf(src), 'sound/machines/click.ogg', 75, 1)
var/constrdir = user.dir
var/constrloc = get_turf(user)
if(!do_after(user, 30, target = on_wall))
return
var/obj/machinery/light_construct/newlight
switch(fixture_type)
if("bulb")
newlight = new /obj/machinery/light_construct/small(constrloc)
if("tube")
newlight = new /obj/machinery/light_construct(constrloc)
else
newlight = new /obj/machinery/light_construct/small(constrloc)
newlight.dir = constrdir
newlight.fingerprints = src.fingerprints
newlight.fingerprintshidden = src.fingerprintshidden
newlight.fingerprintslast = src.fingerprintslast
user.visible_message("[user] attaches \the [src] to \the [on_wall].", \
"You attach \the [src] to \the [on_wall].")
qdel(src)
/obj/item/mounted/frame/light_fixture/small
name = "small light fixture frame"
desc = "Used for building small lights."
icon = 'icons/obj/lighting.dmi'
icon_state = "bulb-construct-item"
fixture_type = "bulb"
metal_sheets_refunded = 1