Merge pull request #15919 from AffectedArc07/rgb-floor-tiles

RGB Light Tiles
This commit is contained in:
Fox McCloud
2021-05-15 10:29:47 -04:00
committed by GitHub
6 changed files with 31 additions and 95 deletions
@@ -106,8 +106,8 @@
name = "light tiles"
gender = PLURAL
singular_name = "light floor tile"
desc = "A floor tile, made out off glass. Use a multitool on it to change its color."
icon_state = "tile_light blue"
desc = "A floor tile made of glass, with an integrated light. Use a multitool on it to change its color."
icon_state = "tile_white"
force = 3
throwforce = 5
attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed")
+3 -6
View File
@@ -1,12 +1,9 @@
//This is so damaged or burnt tiles or platings don't get remembered as the default tile
GLOBAL_LIST_INIT(icons_to_ignore_at_floor_init, list("damaged1","damaged2","damaged3","damaged4",
"damaged5","panelscorched","floorscorched1","floorscorched2","platingdmg1","platingdmg2",
"platingdmg3","plating","light_on","light_on_flicker1","light_on_flicker2",
"warnplate", "warnplatecorner","metalfoam", "ironfoam",
"light_on_clicker3","light_on_clicker4","light_on_clicker5","light_broken",
"light_on_broken","light_off","wall_thermite","grass1","grass2","grass3","grass4",
"asteroid","asteroid_dug",
"asteroid0","asteroid1","asteroid2","asteroid3","asteroid4",
"platingdmg3","plating","light_on","warnplate", "warnplatecorner","metalfoam", "ironfoam",
"light_off","wall_thermite","grass1","grass2","grass3","grass4",
"asteroid","asteroid_dug","asteroid0","asteroid1","asteroid2","asteroid3","asteroid4",
"asteroid5","asteroid6","asteroid7","asteroid8","asteroid9","asteroid10","asteroid11","asteroid12",
"oldburning","light-on-r","light-on-y","light-on-g","light-on-b", "wood", "wood-broken", "carpet",
"carpetcorner", "carpetside", "carpet", "ironsand1", "ironsand2", "ironsand3", "ironsand4", "ironsand5",
+25 -86
View File
@@ -1,23 +1,14 @@
#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
#define LIGHTFLOOR_GENERICCYCLE 8
#define LIGHTFLOOR_CYCLEA 9
#define LIGHTFLOOR_CYCLEB 10
/turf/simulated/floor/light
name = "\improper light floor"
light_range = 5
icon_state = "light_on"
floor_tile = /obj/item/stack/tile/light
broken_states = list("light_broken")
broken_states = list("light_off")
/// Are we on
var/on = TRUE
var/state = LIGHTFLOOR_ON
/// Are we broken
var/light_broken = FALSE
/// Can we modify a colour
var/can_modify_colour = TRUE
/turf/simulated/floor/light/Initialize(mapload)
@@ -27,43 +18,11 @@
/turf/simulated/floor/light/update_icon()
..()
if(on)
switch(state)
if(LIGHTFLOOR_ON)
icon_state = "light_on"
set_light(5, null,LIGHT_COLOR_LIGHTBLUE)
if(LIGHTFLOOR_WHITE)
icon_state = "light_on-w"
set_light(5, null,LIGHT_COLOR_WHITE)
if(LIGHTFLOOR_RED)
icon_state = "light_on-r"
set_light(5, null,LIGHT_COLOR_RED)
if(LIGHTFLOOR_GREEN)
icon_state = "light_on-g"
set_light(5, null,LIGHT_COLOR_PURE_GREEN)
if(LIGHTFLOOR_YELLOW)
icon_state = "light_on-y"
set_light(5, null,"#FFFF00")
if(LIGHTFLOOR_BLUE)
icon_state = "light_on-b"
set_light(5, null,LIGHT_COLOR_DARKBLUE)
if(LIGHTFLOOR_PURPLE)
icon_state = "light_on-p"
set_light(5, null,LIGHT_COLOR_PURPLE)
if(LIGHTFLOOR_GENERICCYCLE)
icon_state = "light_on-cycle_all"
set_light(5, null,LIGHT_COLOR_WHITE)
if(LIGHTFLOOR_CYCLEA)
icon_state = "light_on-dancefloor_A"
set_light(5,null,LIGHT_COLOR_RED)
if(LIGHTFLOOR_CYCLEB)
icon_state = "light_on-dancefloor_B"
set_light(5, null,LIGHT_COLOR_DARKBLUE)
else
icon_state = "light_off"
set_light(0)
icon_state = "light_on"
set_light(5, null, color)
else
set_light(0)
icon_state = "light_off"
set_light(0)
/turf/simulated/floor/light/BeforeChange()
set_light(0)
@@ -76,9 +35,9 @@
/turf/simulated/floor/light/attackby(obj/item/C, mob/user, params)
if(istype(C, /obj/item/light/bulb)) //only for light tiles
if(!state)
if(!light_broken)
qdel(C)
state = LIGHTFLOOR_ON
light_broken = FALSE
update_icon()
to_chat(user, "<span class='notice'>You replace the light bulb.</span>")
else
@@ -92,11 +51,21 @@
return
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
if(state != 0)
if(state < LIGHTFLOOR_PURPLE)
state++
else
state = LIGHTFLOOR_ON
if(!light_broken)
var/new_color = input(user, "Select a bulb color", "Select a bulb color", color) as color|null
if(!new_color)
return
// Cancel if they walked away
if(!Adjacent(user, src))
return
// Now lets make sure it cant go fully black. Yes I know this is more dense than my skull.
var/list/hsl = rgb2hsl(hex2num(copytext(new_color, 2, 4)), hex2num(copytext(new_color, 4, 6)), hex2num(copytext(new_color, 6, 8)))
hsl[3] = max(hsl[3], 0.4)
var/list/rgb = hsl2rgb(arglist(hsl))
color = "#[num2hex(rgb[1], 2)][num2hex(rgb[2], 2)][num2hex(rgb[3], 2)]"
to_chat(user, "<span class='notice'>You change [src]'s light bulb color.</span>")
update_icon()
else
@@ -111,33 +80,3 @@
/turf/simulated/floor/light/extinguish_light()
toggle_light(FALSE)
visible_message("<span class='danger'>[src] flickers and falls dark.</span>")
//Cycles through all of the colours
/turf/simulated/floor/light/colour_cycle
state = LIGHTFLOOR_GENERICCYCLE
can_modify_colour = FALSE
//Two different "dancefloor" types so that you can have a checkered pattern
// (also has a longer delay than colour_cycle between cycling colours)
/turf/simulated/floor/light/colour_cycle/dancefloor_a
name = "dancefloor"
desc = "Funky floor."
state = LIGHTFLOOR_CYCLEA
/turf/simulated/floor/light/colour_cycle/dancefloor_b
name = "dancefloor"
desc = "Funky floor."
state = LIGHTFLOOR_CYCLEB
#undef LIGHTFLOOR_ON
#undef LIGHTFLOOR_WHITE
#undef LIGHTFLOOR_RED
#undef LIGHTFLOOR_GREEN
#undef LIGHTFLOOR_YELLOW
#undef LIGHTFLOOR_BLUE
#undef LIGHTFLOOR_PURPLE
#undef LIGHTFLOOR_GENERICCYCLE
#undef LIGHTFLOOR_CYCLEA
#undef LIGHTFLOOR_CYCLEB