Merge pull request #1208 from tigercat2000/coloredtilelight

Colored Light Tiles
This commit is contained in:
ZomgPonies
2015-05-29 19:36:56 -04:00
3 changed files with 50 additions and 24 deletions
+29 -14
View File
@@ -1,8 +1,16 @@
#define LIGHTFLOOR_ON 1
#define LIGHTFLOOR_WHITE 2
#define LIGHTFLOOR_RED 3
#define LIGHTFLOOR_GREEN 4
#define LIGHTFLOOR_YELLOW 5
#define LIGHTFLOOR_BLUE 6
#define LIGHTFLOOR_PURPLE 7
/obj/item/stack/tile/light
name = "light tiles"
singular_name = "light floor tile"
desc = "A floor tile, made out off glass. It produces light."
icon_state = "tile_e"
desc = "A floor tile, made out off glass. Use a multitool on it to change its color."
icon_state = "tile_light blue"
w_class = 3.0
force = 3.0
throwforce = 5.0
@@ -12,18 +20,18 @@
max_amount = 60
attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed")
var/on = 1
var/state //0 = fine, 1 = flickering, 2 = breaking, 3 = broken
var/state = LIGHTFLOOR_ON
/obj/item/stack/tile/light/New(var/loc, var/amount=null)
..()
if(prob(5))
state = 3 //broken
else if(prob(5))
state = 2 //breaking
else if(prob(10))
state = 1 //flickering occasionally
else
state = 0 //fine
/obj/item/stack/tile/light/proc/color_desc()
switch(state)
if(LIGHTFLOOR_ON) return "light blue"
if(LIGHTFLOOR_WHITE) return "white"
if(LIGHTFLOOR_RED) return "red"
if(LIGHTFLOOR_GREEN) return "green"
if(LIGHTFLOOR_YELLOW) return "yellow"
if(LIGHTFLOOR_BLUE) return "dark blue"
if(LIGHTFLOOR_PURPLE) return "purple"
else return "broken"
/obj/item/stack/tile/light/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
..()
@@ -33,4 +41,11 @@
new/obj/item/stack/light_w(user.loc)
if(amount <= 0)
user.unEquip(src, 1)
del(src)
del(src)
else if(istype(O,/obj/item/device/multitool))
state++
if(state>LIGHTFLOOR_PURPLE) state=LIGHTFLOOR_ON
icon_state="tile_"+color_desc()
user << "[src] is now "+color_desc()
return ..()