constructable/destroyable lights!

This commit is contained in:
Tastyfish
2011-12-27 22:13:18 -05:00
parent 5cce8c0a89
commit f378644bb0
2 changed files with 93 additions and 0 deletions

View File

@@ -76,6 +76,9 @@ var/global/list/datum/stack_recipe/metal_recipes = list ( \
new/datum/stack_recipe("turret frame", /obj/machinery/porta_turret_construct, 5, one_per_turf = 1), \
null, \
new/datum/stack_recipe("apc frame", /obj/item/apc_frame, 2), \
new/datum/stack_recipe("tube light frame", /obj/structure/light_frame), \
new/datum/stack_recipe("small light frame", /obj/structure/light_frame/small), \
new/datum/stack_recipe("table lamp frame", /obj/structure/light_frame/lamp), \
new/datum/stack_recipe("grenade casing", /obj/item/weapon/chem_grenade), \
null, \
new/datum/stack_recipe("iron door", /obj/structure/mineral_door/iron, 20), \

View File

@@ -196,6 +196,25 @@
user << "This type of light requires a [fitting]."
return
// attempt to take light apart
else if(istype(W, /obj/item/weapon/wirecutters))
if(status == LIGHT_EMPTY)
playsound(src.loc, 'Wirecutter.ogg', 100, 1)
var/turf/T = get_turf(user)
user.visible_message("[user] cuts the light's wiring.", "You start to cut the light's wiring.")
sleep(40)
if(get_turf(user) == T)
usr << "\blue You cut the light's wiring."
var/obj/structure/light_frame/F = new(loc)
F.anchored = 1
F.name = "Secured Light Fixture Frame"
F.dir = dir
F.light_type = type
F.icon_state = icon_state
del(src)
else
user << "\blue You need to remove the [fitting] first!"
// attempt to break the light
//If xenos decide they want to smash a light bulb with a toolbox, who am I to stop them? /N
@@ -561,3 +580,74 @@
new /obj/item/weapon/light/tube(src)
new /obj/item/weapon/light/tube(src)
new /obj/item/weapon/light/tube(src)
/obj/structure/light_frame
name = "Light Fixture Frame"
icon = 'lighting.dmi'
icon_state = "tube-empty"
desc = "A lighting fixture frame."
anchored = 0
layer = 5
var/light_type = /obj/machinery/light
var/wired = 0
m_amt = 1000
/obj/structure/light_frame/small
light_type = /obj/machinery/light/small
icon_state = "bulb-empty"
/obj/structure/light_frame/lamp
light_type = /obj/machinery/light/lamp
icon_state = "lamp-empty"
/obj/structure/light_frame/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/wrench) && !anchored)
playsound(src.loc, 'Ratchet.ogg', 100, 1)
var/turf/T = get_turf(user)
user.visible_message("[user] secures the light fixture.", "You start to secure the light fixture.")
sleep(40)
if(get_turf(user) == T)
usr << "\blue You secure the light fixture."
anchored = 1
name = "Secured Light Fixture Frame"
else if(istype(W, /obj/item/weapon/wrench) && anchored)
playsound(src.loc, 'Ratchet.ogg', 100, 1)
var/turf/T = get_turf(user)
user.visible_message("[user] unsecures the light fixture.", "You start to unsecure the light fixture.")
sleep(40)
if(get_turf(user) == T)
usr << "\blue You unsecure the light fixture."
anchored = 0
name = "Light Fixture Frame"
else if(istype(W, /obj/item/weapon/cable_coil) && anchored)
var/turf/T = get_turf(user)
user.visible_message("[user] wires the light fixture.", "You start to wire the light fixture.")
sleep(40)
if(get_turf(user) == T)
var/obj/item/weapon/cable_coil/C = W
C.use(1)
usr << "\blue You wire the light fixture."
var/obj/machinery/light/L = new light_type(loc)
L.dir = dir
L.status = LIGHT_EMPTY
L.update()
del(src)
else if(istype(W, /obj/item/weapon/screwdriver) && !anchored)
playsound(src.loc, 'Screwdriver.ogg', 100, 1)
usr << "\blue You take apart the light fixture."
new /obj/item/stack/sheet/metal(loc)
del(src)
else
..()
/obj/structure/light_frame/verb/rotate()
set name = "Rotate Light"
set category = "Object"
set src in oview(1)
if (src.anchored)
usr << "It is fastened to the wall; therefore, you can't rotate it!"
return 0
src.dir = turn(src.dir, 90)
return