-
-
Notifications
You must be signed in to change notification settings - Fork 28
Lights, lamps and light states
Note: a TARDIS can not have more than 3 lights; it can have as many lamps as you like, as long as it doesn't become laggy
The lights are specified in two tables of interior metadata: Light
(for the main light) and Lights
(for the additional ones).
T.Interior = {
...
Light = { <main light data> },
Lights = {
{ <1st additional light data> },
{ <2nd additional light data> },
},
...
}
The defining parameters for each light are: color
, pos
, brightness
, falloff
You can specify the similar options for the warning state: warn_color
, warn_pos
, warn_brightness
, warn_falloff
The unspecified options are defaulted to normal state values
To make the light work when power is disabled, you can add the nopower
parameter
It allows extra parameters for the power-off state:
off_color
, off_pos
, off_brightness
, off_falloff
and similarly, to the warning state with no power:
off_warn_color
, off_warn_pos
, off_warn_brightness
, off_warn_falloff
Example:
Light = {
color = Color(255, 50, 0),
pos = Vector(0, 0, 120),
brightness = 5,
falloff = 10,
warn_color = Color(255, 0, 0),
warn_pos = Vector(0, 0, 130),
warn_brightness = 3,
-- warn_falloff is defaulted to 10
nopower = false,
},
Lights = {
{
color = Color(255, 50, 255),
pos = Vector(100, 0, 30),
brightness = 5,
falloff = 10,
warn_color = Color(255, 0, 0),
warn_pos = Vector(100, 0, 40),
warn_brightness = 3,
warn_falloff = 10,
nopower = true,
off_color = Color(0, 0, 160),
off_pos = Vector(0, 0, 80),
off_brightness = 2,
off_falloff = 10,
off_warn_color = Color(0, 0, 160),
off_warn_pos = Vector(0, 0, 80),
off_warn_brightness = 0.5,
off_warn_falloff = 30,
},
{
color = Color(255, 50, 255),
pos = Vector(-100, 0, 30),
brightness = 5,
warn_color = Color(0,255,10),
warn_brightness = 1,
},
}
Lamps are defined in the Lamps
table of the interior metadata:
T.Interior = {
...
Lamps = {
some_lamp_id1 = { <1st lamp data> },
some_lamp_id2 = { <2nd lamp data> },
some_lamp_id3 = { <3rd lamp data> },
...
},
...
}
Check out the lamps debugger tool that can help you set up lamps easier
Lamps are more customizable than lights. Here's an example of options for a lamp:
example_lamp = {
color = Color(0, 255, 230),
texture = "effects/flashlight/soft",
fov = 169.09091186523,
distance = 165.45454406738,
brightness = 0.3,
pos = Vector(329.08, -88.87, 74.012),
ang = Angle(87.64, 20.88, 169.94),
shadows = true,
},
You can specify all of those values for different states using warn
, off
, off_warn
sub-tables:
example_lamp_2 = {
color = Color(0, 255, 230),
texture = "effects/flashlight/soft",
fov = 169.09091186523,
distance = 165.45454406738,
brightness = 0.3,
pos = Vector(329.08, -88.87, 74.012),
ang = Angle(87.64, 20.88, 169.94),
nopower = true,
warn = {
-- same list of options available
color = Color(200, 255, 230),
brightness = 2.3,
texture = "effects/flashlight/soft",
fov = 169.09091186523,
distance = 165.45454,
pos = Vector(329.08, -88.87, 74.012),
ang = Angle(87.64, 20.88, 169.94),
},
off = {
-- same list of options available
color = ...
brightness = ...
pos = ...
ang = ...
texture = ...
fov = ...
distance = ...
},
off_warn = {
-- same list of options available
color = ...
brightness = ...
pos = ...
ang = ...
},
},
A recently added feature allows you to change the light states in your TARDIS.
function interior:ApplyLightState(state_name)
checks all the lamps / lights, and if they have the state called state_name
specified, changes the parameters to match that state
Both light metadata and lamp metadata support the states
sub-table in the following format:
states = {
state_name = {
-- light or lamp metadata in the certain state
},
},
The values that aren't specified by the state are inherited from the default state (e.g. you don't have to specify the brightness for all states if you only want to change the colour).
Light states can also include enabled
parameter that can disable the light / lamp in certain situations
Light example with states:
{
color = Color(255, 50, 0),
pos = Vector(0, 0, 120),
brightness = 5,
falloff = 10,
warn_color = Color(255, 0, 0),
warn_pos = Vector(0, 0, 120),
warn_brightness = 3,
warn_falloff = 10,
nopower = true,
off_color = Color(0, 0, 160),
off_pos = Vector(0, 0, 80),
off_brightness = 1,
off_falloff = 10,
off_warn_color = Color(0, 0, 160),
off_warn_pos = Vector(0, 0, 80),
off_warn_brightness = 1,
off_warn_falloff = 10,
states = {
lstate_one_name = {
-- each state can have the same set of parameters as the default one
color = Color(234, 255, 0),
brightness = 3,
falloff = 20,
warn_color = Color(255, 10, 0),
warn_pos = Vector(0, 0, 130),
warn_brightness = 2,
warn_falloff = 20,
off_pos = Vector(0, 0, 80),
off_warn_color = Color(0, 0, 160),
off_warn_pos = Vector(0, 0, 80),
off_warn_brightness = 1,
},
disabled = {
-- applying this state would stop this light from rendering
enabled = false,
},
nopower_full_darkness = {
nopower = false,
-- applying this light state would stop lights from appearing with no power
}
},
},
Lamp example with states:
lamp_id = {
color = Color(0, 255, 230),
texture = "effects/flashlight/soft",
fov = 169.09091186523,
distance = 165.45454406738,
brightness = 0.3,
pos = Vector(329.08, -88.87, 74.012),
ang = Angle(87.64, 20.88, 169.94),
nopower = true,
warn = {
-- same list of options available
color = Color(200, 255, 230),
brightness = 2.3,
texture = "effects/flashlight/soft",
fov = 169.09091186523,
distance = 165.45454,
pos = Vector(329.08, -88.87, 74.012),
ang = Angle(87.64, 20.88, 169.94),
},
off = {
-- same list of options available
color = ...
brightness = ...
pos = ...
ang = ...
texture = ...
fov = ...
distance = ...
},
off_warn = {
-- same list of options available
color = ...
brightness = ...
pos = ...
ang = ...
},
states = {
state_id_1 = {
color = ...
brightness = ...
pos = ...
ang = ...
...
warn = {...},
off = {...},
off_warn = {...},
},
state_id_2 = {...},
...
},
},