Coloured lighting & related stuff (#3555)

Makes all light tubes & bulbs have colour according to the light they emit. There are 6 preset colours: RGB CMY. Any other color is possible by simply changing the already present brightness_color variable. This PR makes it so it actually changes the color of the item and wall object too.
    Added two new colour defines used only along with preset coloured lights.
    Coloured lights are only obtainable by random maintenace loot, cargo spawn or trader.
    Added box of randomly mixed light colours and box for every preset light colour.
    Removed two sets of redundant defines.
    Converted light item New() to Initialize() (hopefully correctly).
    Made couple tiny tweaks to the lights code.

EDIT, 7. Oct 2017:

    When you hit light machinery or item with paint, it will change it's brightness_color var, instead of the color var.
    Paint buckets can now paint items and people again.
    You can now wash paint off by spraying yourself with fire extinguisher or otherwise covering yourself in water.

EDIT, 8. Oct 2017:

    Removed one apparently unused global list.
    Converted pain bucket New to Initialize and changed it's pathing style.
    Shower can now wash paint too.
    Fixed paint bucket sprites to be bit more dynamic and fixed the in hand sprite. Also added bucket lid.
This commit is contained in:
TheGreatJorge
2017-10-10 18:46:24 +02:00
committed by Werner
parent a3b0a30890
commit 0aff2d8785
17 changed files with 343 additions and 122 deletions
@@ -32,11 +32,6 @@
//
// The explosion cannot insta-kill anyone with 30% or more health.
#define LIGHT_OK 0
#define LIGHT_EMPTY 1
#define LIGHT_BROKEN 2
#define LIGHT_BURNED 3
/obj/item/device/lightreplacer
@@ -257,9 +252,4 @@
if(uses > 0)
return 1
else
return 0
#undef LIGHT_OK
#undef LIGHT_EMPTY
#undef LIGHT_BROKEN
#undef LIGHT_BURNED
return 0
+55 -50
View File
@@ -1,13 +1,11 @@
//NEVER USE THIS IT SUX -PETETHEGOAT
//THE GOAT WAS RIGHT - RKF
var/global/list/cached_icons = list()
/obj/item/weapon/reagent_containers/glass/paint
desc = "It's a paint bucket."
name = "paint bucket"
icon = 'icons/obj/items.dmi'
icon_state = "paint_neutral"
icon_state = "paint_empty"
item_state = "paintcan"
matter = list(DEFAULT_WALL_MATERIAL = 200)
w_class = 3.0
@@ -16,61 +14,68 @@ var/global/list/cached_icons = list()
volume = 60
unacidable = 0
flags = OPENCONTAINER
var/paint_type = "red"
var/paint_reagent = null //name of the reagent responsible for colouring the paint
var/paint_type = null //used for colouring detective technicolor coat and hat
attack(mob/M as mob, mob/user as mob, def_zone)
if(istype(M, /mob/living/))
user.visible_message("<span class='warning'>\The [M] has been splashed with something by [user] to no effect!</span>")
reagents.trans_to_turf(M.loc, 5)
return
/obj/item/weapon/reagent_containers/glass/paint/Initialize()
. = ..()
if(paint_type && lentext(paint_type) > 0)
name = paint_type + " " + name
reagents.add_reagent("water", volume*3/5)
reagents.add_reagent("plasticide", volume/5)
if(paint_reagent)
reagents.add_reagent(paint_reagent, volume/5)
reagents.handle_reactions()
update_icon()
afterattack(turf/simulated/target, mob/user, proximity)
if(!proximity)
return
if(istype(target) && reagents.total_volume > 5)
user.visible_message("<span class='warning'>\The [target] has been splashed with something by [user]!</span>")
reagents.trans_to_turf(target, 5)
return
/obj/item/weapon/reagent_containers/glass/paint/update_icon()
cut_overlays()
if(!is_open_container())
add_overlay("paint_lid")
else if(reagents.total_volume)
var/image/I = image(icon, "paint_full")
I.color = reagents.get_color()
add_overlay(I)
New()
if(paint_type && lentext(paint_type) > 0)
name = paint_type + " " + name
..()
reagents.add_reagent("water", volume*3/5)
reagents.add_reagent("plasticide", volume/5)
if(paint_type == "white") //why don't white crayons exist
reagents.add_reagent("aluminum", volume/5)
else if (paint_type == "black")
reagents.add_reagent("carbon", volume/5)
else
reagents.add_reagent("crayon_dust_[paint_type]", volume/5)
reagents.handle_reactions()
/obj/item/weapon/reagent_containers/glass/paint/on_reagent_change()
update_icon()
red
icon_state = "paint_red"
paint_type = "red"
/obj/item/weapon/reagent_containers/glass/paint/pickup(mob/user)
..()
update_icon()
yellow
icon_state = "paint_yellow"
paint_type = "yellow"
/obj/item/weapon/reagent_containers/glass/paint/dropped(mob/user)
..()
update_icon()
green
icon_state = "paint_green"
paint_type = "green"
/obj/item/weapon/reagent_containers/glass/paint/attack_hand()
..()
update_icon()
blue
icon_state = "paint_blue"
paint_type = "blue"
/obj/item/weapon/reagent_containers/glass/paint/red
paint_reagent = "crayon_dust_red"
paint_type = "red"
purple
icon_state = "paint_violet"
paint_type = "purple"
/obj/item/weapon/reagent_containers/glass/paint/yellow
paint_reagent = "crayon_dust_yellow"
paint_type = "yellow"
black
icon_state = "paint_black"
paint_type = "black"
/obj/item/weapon/reagent_containers/glass/paint/green
paint_reagent = "crayon_dust_green"
paint_type = "green"
white
icon_state = "paint_white"
paint_type = "white"
/obj/item/weapon/reagent_containers/glass/paint/blue
paint_reagent = "crayon_dust_blue"
paint_type = "blue"
/obj/item/weapon/reagent_containers/glass/paint/purple
paint_reagent = "crayon_dust_purple"
paint_type = "purple"
/obj/item/weapon/reagent_containers/glass/paint/black
paint_reagent = "carbon"
paint_type = "black"
/obj/item/weapon/reagent_containers/glass/paint/white
paint_reagent = "aluminum"
paint_type = "white"
@@ -773,6 +773,101 @@
for(var/i = 0; i < 7; i++)
new /obj/item/weapon/light/bulb(src)
/obj/item/weapon/storage/box/lights/coloredmixed
name = "box of colored lights"
icon_state = "lightmixed"
/obj/item/weapon/storage/box/lights/coloredmixed/fill()
..()
var/static/list/tube_colors = list(
/obj/item/weapon/light/tube/colored/red,
/obj/item/weapon/light/tube/colored/green,
/obj/item/weapon/light/tube/colored/blue,
/obj/item/weapon/light/tube/colored/magenta,
/obj/item/weapon/light/tube/colored/yellow,
/obj/item/weapon/light/tube/colored/cyan
)
var/static/list/bulbs_colors = list(
/obj/item/weapon/light/bulb/colored/red,
/obj/item/weapon/light/bulb/colored/green,
/obj/item/weapon/light/bulb/colored/blue,
/obj/item/weapon/light/bulb/colored/magenta,
/obj/item/weapon/light/bulb/colored/yellow,
/obj/item/weapon/light/bulb/colored/cyan
)
for(var/i = 0, i < 14, i++)
var/type = pick(tube_colors)
new type(src)
for(var/i = 0, i < 7, i++)
var/type = pick(bulbs_colors)
new type(src)
/obj/item/weapon/storage/box/lights/colored/red
name = "box of red lights"
icon_state = "lightmixed"
/obj/item/weapon/storage/box/lights/colored/red/fill()
..()
for(var/i = 0, i < 14, i++)
new /obj/item/weapon/light/tube/colored/red(src)
for(var/i = 0, i < 7, i++)
new /obj/item/weapon/light/bulb/colored/red(src)
/obj/item/weapon/storage/box/lights/colored/green
name = "box of green lights"
icon_state = "lightmixed"
/obj/item/weapon/storage/box/lights/colored/green/fill()
..()
for(var/i = 0, i < 14, i++)
new /obj/item/weapon/light/tube/colored/green(src)
for(var/i = 0, i < 7, i++)
new /obj/item/weapon/light/bulb/colored/green(src)
/obj/item/weapon/storage/box/lights/colored/blue
name = "box of blue lights"
icon_state = "lightmixed"
/obj/item/weapon/storage/box/lights/colored/blue/fill()
..()
for(var/i = 0, i < 14, i++)
new /obj/item/weapon/light/tube/colored/blue(src)
for(var/i = 0, i < 7, i++)
new /obj/item/weapon/light/bulb/colored/blue(src)
/obj/item/weapon/storage/box/lights/colored/cyan
name = "box of cyan lights"
icon_state = "lightmixed"
/obj/item/weapon/storage/box/lights/colored/cyan/fill()
..()
for(var/i = 0, i < 14, i++)
new /obj/item/weapon/light/tube/colored/cyan(src)
for(var/i = 0, i < 7, i++)
new /obj/item/weapon/light/bulb/colored/cyan(src)
/obj/item/weapon/storage/box/lights/colored/yellow
name = "box of yellow lights"
icon_state = "lightmixed"
/obj/item/weapon/storage/box/lights/colored/yellow/fill()
..()
for(var/i = 0, i < 14, i++)
new /obj/item/weapon/light/tube/colored/yellow(src)
for(var/i = 0, i < 7, i++)
new /obj/item/weapon/light/bulb/colored/yellow(src)
/obj/item/weapon/storage/box/lights/colored/magenta
name = "box of magenta lights"
icon_state = "lightmixed"
/obj/item/weapon/storage/box/lights/colored/magenta/fill()
..()
for(var/i = 0, i < 14, i++)
new /obj/item/weapon/light/tube/colored/magenta(src)
for(var/i = 0, i < 7, i++)
new /obj/item/weapon/light/bulb/colored/magenta(src)
/obj/item/weapon/storage/box/freezer
name = "portable freezer"
desc = "This nifty shock-resistant device will keep your 'groceries' nice and non-spoiled."
+7
View File
@@ -795,6 +795,13 @@
/obj/item/weapon/storage/box/condimentbottles = 0.2,
/obj/item/weapon/storage/box/mousetraps = 0.3,
/obj/item/weapon/storage/box/lights = 0.5,
/obj/item/weapon/storage/box/lights/coloredmixed = 0.2,
/obj/item/weapon/storage/box/lights/colored/red = 0.1,
/obj/item/weapon/storage/box/lights/colored/green = 0.1,
/obj/item/weapon/storage/box/lights/colored/blue = 0.1,
/obj/item/weapon/storage/box/lights/colored/cyan = 0.1,
/obj/item/weapon/storage/box/lights/colored/yellow = 0.1,
/obj/item/weapon/storage/box/lights/colored/magenta = 0.1,
/obj/item/weapon/contraband/poster = 1.3,
/obj/item/device/magnetic_lock/security = 0.3,
/obj/item/device/magnetic_lock/engineering = 0.3,
@@ -303,6 +303,17 @@
else
O.clean_blood()
if(istype(O, /obj/item/weapon/light))
var/obj/item/weapon/light/L = O
L.brightness_color = initial(L.brightness_color)
L.update()
else if(istype(O, /obj/machinery/light))
var/obj/machinery/light/L = O
L.brightness_color = initial(L.brightness_color)
L.update()
O.color = initial(O.color)
if(isturf(loc))
var/turf/tile = loc
loc.clean_blood()