Fire Sprite Change (#8868)

This commit is contained in:
Geeves
2020-05-16 15:35:00 +02:00
committed by GitHub
parent 753393625f
commit 98389c284c
4 changed files with 33 additions and 24 deletions
+9 -12
View File
@@ -8,8 +8,8 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
//#define FIREDBG
#define FIRE_LIGHT_1 2 //These defines are the power of the light given off by fire at various stages
#define FIRE_LIGHT_2 3
#define FIRE_LIGHT_3 4
#define FIRE_LIGHT_2 4
#define FIRE_LIGHT_3 5
/turf
var/tmp/obj/fire/fire = null
@@ -128,9 +128,9 @@ turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
blend_mode = BLEND_ADD
icon = 'icons/effects/fire.dmi'
icon_state = "1"
light_color = "#ED9200"
layer = ON_TURF_LAYER
icon_state = "wavey_fire"
light_color = LIGHT_COLOR_FIRE
layer = ABOVE_MOB_LAYER
var/firelevel = 1 //Calculated by gas_mixture.calculate_firelevel()
@@ -147,14 +147,11 @@ turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
var/datum/gas_mixture/air_contents = my_tile.return_air()
if(firelevel > 6)
icon_state = "3"
set_light(7, FIRE_LIGHT_3, no_update = TRUE) // We set color later in the proc, that should trigger an update.
set_light(9, FIRE_LIGHT_3, no_update = TRUE) // We set color later in the proc, that should trigger an update.
else if(firelevel > 2.5)
icon_state = "2"
set_light(5, FIRE_LIGHT_2, no_update = TRUE)
set_light(7, FIRE_LIGHT_2, no_update = TRUE)
else
icon_state = "1"
set_light(3, FIRE_LIGHT_1, no_update = TRUE)
set_light(5, FIRE_LIGHT_1, no_update = TRUE)
air_contents.adjust_gas("carbon_dioxide", firelevel * 0.07)
@@ -193,7 +190,7 @@ turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
else
enemy_tile.adjacent_fire_act(loc, air_contents, air_contents.temperature, air_contents.volume)
set_light(l_color = color)
set_light(l_color = fire_color(air_contents.temperature, TRUE))
var/list/animate_targets = get_above_oo() + src
for (var/thing in animate_targets)
var/atom/movable/AM = thing
+16 -12
View File
@@ -192,32 +192,36 @@ proc/tg_list2text(list/list, glue=",")
return .
// heat2color functions. Adapted from: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
/proc/heat2color(temp)
return rgb(heat2color_r(temp), heat2color_g(temp), heat2color_b(temp))
// light_adjustment makes the given colour a bit brighter so that set_light can use it to make the room a bit brighter - geeves
/proc/heat2color(temp, var/for_light = FALSE)
return rgb(heat2color_r(temp, for_light), heat2color_g(temp, for_light), heat2color_b(temp, for_light))
/proc/heat2color_r(temp)
/proc/heat2color_r(temp, var/for_light = FALSE)
temp /= 100
if(temp <= 66)
. = 255
return 255
else
. = max(0, min(255, 329.698727446 * (temp - 60) ** -0.1332047592))
var/light_adjustment = for_light ? 15 : 0
return max(0, min(255, 329.698727446 * (temp - 60) ** -0.1332047592 + light_adjustment))
/proc/heat2color_g(temp)
/proc/heat2color_g(temp, var/for_light = FALSE)
temp /= 100
var/light_adjustment = for_light ? 15 : 0
if(temp <= 66)
. = max(0, min(255, 99.4708025861 * log(temp) - 161.1195681661))
return max(0, min(255, 99.4708025861 * log(temp) - 161.1195681661 + light_adjustment))
else
. = max(0, min(255, 288.1221695283 * ((temp - 60) ** -0.0755148492)))
return max(0, min(255, 288.1221695283 * ((temp - 60) ** -0.0755148492 + light_adjustment)))
/proc/heat2color_b(temp)
/proc/heat2color_b(temp, var/for_light = FALSE)
temp /= 100
if(temp >= 66)
. = 255
return 255
else
if(temp <= 16)
. = 0
return 0
else
. = max(0, min(255, 138.5177312231 * log(temp - 10) - 305.0447927307))
var/light_adjustment = for_light ? 15 : 0
return max(0, min(255, 138.5177312231 * log(temp - 10) - 305.0447927307 + light_adjustment))
// Very ugly, BYOND doesn't support unix time and rounding errors make it really hard to convert it to BYOND time.
// returns "YYYY-MM-DD" by default