mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Directional lighting tweaks (#1833)
changes: Flashlights now default to LIGHT_WIDE directional lighting. Glowsticks, Lamps, Flares, and Slime Cores use LIGHT_OMNI. Maglights use LIGHT_NARROW. Heavy-duty flashlights use LIGHT_SEMI. EVA suits default to LIGHT_WIDE. Lanterns use LIGHT_OMNI, as well as now having a more appropriate light color. Floodlights use LIGHT_WIDE, as well as having a more appropriate light color. Synthetics default to LIGHT_WIDE. (including drones) Added some predefined light_wedge values to the lighting defines file. Fixed some bad angles that screwed up north/south lights in some cases.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
heat_protection = HEAD|FACE|EYES
|
||||
cold_protection = HEAD|FACE|EYES
|
||||
brightness_on = 4
|
||||
light_wedge = LIGHT_WIDE
|
||||
sprite_sheets = list(
|
||||
"Tajara" = 'icons/mob/species/tajaran/helmet.dmi',
|
||||
"Skrell" = 'icons/mob/species/skrell/helmet.dmi',
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
action_button_name = "Toggle Helmet Light"
|
||||
light_overlay = "helmet_light"
|
||||
brightness_on = 4
|
||||
light_wedge = LIGHT_WIDE
|
||||
on = 0
|
||||
|
||||
/obj/item/clothing/head/helmet/space/initialize()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
|
||||
/proc/spark(var/turf/loc, var/amount = 1, var/spread_dirs = cardinal)
|
||||
/proc/spark(var/atom/movable/loc, var/amount = 1, var/spread_dirs = cardinal)
|
||||
Creates a spark system that is destroyed once the animation completes.
|
||||
loc: The location this effect should be created at.
|
||||
loc: The location this effect should be created at. Does not need to be a turf.
|
||||
amount: How many spark-tiles should be created.
|
||||
spread_dirs: The directions the sparks should spread in. 'cardinal' if not specified.
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
var/light_color // Hexadecimal RGB string representing the colour of the light.
|
||||
var/uv_intensity = 255 // How much UV light is being emitted by this object. Valid range: 0-255.
|
||||
var/light_wedge // The angle that the light's emission should be restricted to. null for omnidirectional.
|
||||
var/light_self = TRUE // If the light should also affect our tile. Requires light_wedge to be set.
|
||||
|
||||
var/tmp/datum/light_source/light // Our light source. Don't fuck with this directly unless you have a good reason!
|
||||
var/tmp/list/light_sources // Any light sources that are "inside" of us, for example, if src here was a mob that's carrying a flashlight, that flashlight's light source would be part of this list.
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
var/light_color // The colour of the light, string, decomposed by parse_light_color()
|
||||
var/light_uv // The intensity of UV light, between 0 and 255.
|
||||
var/light_angle // The light's emission angle, in degrees.
|
||||
var/light_self = TRUE // If FALSE, the light won't emit onto its own tile. Good with light_angle.
|
||||
|
||||
// Variables for keeping track of the colour.
|
||||
var/lum_r
|
||||
@@ -35,7 +34,6 @@
|
||||
var/tmp/cached_origin_x // The last known X coord of the origin.
|
||||
var/tmp/cached_origin_y // The last known Y coord of the origin.
|
||||
var/tmp/old_direction // The last known direction of the origin.
|
||||
var/tmp/cached_ab // We don't actually need to save this, just nice for debugging.
|
||||
var/tmp/targ_sign
|
||||
var/tmp/test_x_offset
|
||||
var/tmp/test_y_offset
|
||||
@@ -69,7 +67,6 @@
|
||||
light_color = source_atom.light_color
|
||||
light_uv = source_atom.uv_intensity
|
||||
light_angle = source_atom.light_wedge
|
||||
light_self = source_atom.light_self
|
||||
|
||||
parse_light_color()
|
||||
|
||||
@@ -201,10 +198,6 @@
|
||||
light_angle = source_atom.light_wedge
|
||||
. = 1
|
||||
|
||||
if (source_atom.light_self != light_self)
|
||||
light_self = source_atom.light_self
|
||||
. = 1
|
||||
|
||||
// Decompile the hexadecimal colour into lumcounts of each perspective.
|
||||
/datum/light_source/proc/parse_light_color()
|
||||
if (light_color)
|
||||
@@ -266,35 +259,42 @@
|
||||
if (T.x == cached_origin_x && T.y == cached_origin_y && old_direction == top_atom.dir)
|
||||
return
|
||||
|
||||
var/do_offset = TRUE
|
||||
var/turf/front = get_step(T, top_atom.dir)
|
||||
if (front.has_opaque_atom)
|
||||
do_offset = FALSE
|
||||
|
||||
cached_origin_x = T.x
|
||||
test_x_offset = cached_origin_x
|
||||
cached_origin_y = T.y
|
||||
test_y_offset = cached_origin_y
|
||||
old_direction = top_atom.dir
|
||||
|
||||
var/angle = light_angle / 2
|
||||
switch (top_atom.dir)
|
||||
if (NORTH)
|
||||
limit_a_t = angle + 90
|
||||
limit_b_t = angle
|
||||
test_x_offset = cached_origin_x
|
||||
test_y_offset = cached_origin_y + 1
|
||||
limit_b_t = -(angle) + 90
|
||||
if (do_offset)
|
||||
test_y_offset += 1
|
||||
|
||||
if (SOUTH)
|
||||
limit_a_t = -(angle)
|
||||
limit_a_t = (angle) - 90
|
||||
limit_b_t = -(angle) - 90
|
||||
test_x_offset = cached_origin_x
|
||||
test_y_offset = cached_origin_y - 1
|
||||
if (do_offset)
|
||||
test_y_offset -= 1
|
||||
|
||||
if (EAST)
|
||||
limit_a_t = angle
|
||||
limit_b_t = -(angle)
|
||||
test_x_offset = cached_origin_x + 1
|
||||
test_y_offset = cached_origin_y
|
||||
if (do_offset)
|
||||
test_x_offset += 1
|
||||
|
||||
if (WEST)
|
||||
limit_a_t = angle + 180
|
||||
limit_b_t = -(angle) - 180
|
||||
test_x_offset = cached_origin_x - 1
|
||||
test_y_offset = cached_origin_y
|
||||
if (do_offset)
|
||||
test_x_offset -= 1
|
||||
|
||||
// Convert our angle + range into a vector.
|
||||
limit_a_x = POLAR_TO_CART_X(light_range + 10, limit_a_t)
|
||||
@@ -302,8 +302,7 @@
|
||||
limit_b_x = POLAR_TO_CART_X(light_range + 10, limit_b_t)
|
||||
limit_b_y = POLAR_TO_CART_Y(light_range + 10, limit_b_t)
|
||||
// This won't change unless the origin or dir changes, might as well do it here.
|
||||
cached_ab = PSEUDO_WEDGE(limit_a_x, limit_a_y, limit_b_x, limit_b_y)
|
||||
targ_sign = cached_ab > 0
|
||||
targ_sign = PSEUDO_WEDGE(limit_a_x, limit_a_y, limit_b_x, limit_b_y) > 0
|
||||
|
||||
// I know this is 2D, calling it a cone anyways. Fuck the system.
|
||||
// Returns true if the test point is NOT inside the cone.
|
||||
@@ -353,9 +352,6 @@
|
||||
if (light_angle && check_light_cone(Tx, Ty))
|
||||
continue
|
||||
|
||||
if (!light_self && Tx == cached_origin_x && Ty == cached_origin_y) // Shouldn't need to check Z.
|
||||
continue
|
||||
|
||||
if (!T.lighting_corners_initialised)
|
||||
T.generate_missing_corners()
|
||||
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
name = "lantern"
|
||||
icon_state = "lantern"
|
||||
desc = "A mining lantern."
|
||||
brightness_on = 6 // luminosity when on
|
||||
brightness_on = 4 // luminosity when on
|
||||
light_power = 0.75
|
||||
light_wedge = LIGHT_OMNI
|
||||
light_color = LIGHT_COLOR_FIRE
|
||||
|
||||
/*****************************Pickaxe********************************/
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
mob_swap_flags = ROBOT|MONKEY|SLIME|SIMPLE_ANIMAL
|
||||
mob_push_flags = ~HEAVY //trundle trundle
|
||||
|
||||
light_wedge = LIGHT_WIDE
|
||||
|
||||
var/lights_on = 0 // Is our integrated light on?
|
||||
var/used_power_this_tick = 0
|
||||
var/sight_mode = 0
|
||||
|
||||
Reference in New Issue
Block a user