Colored Fire

This commit adds a colored fire system based on baystation12's system.
This commit is contained in:
Tigercat2000
2015-05-10 13:12:22 -07:00
parent e1249fc640
commit 4642f76d33
4 changed files with 40 additions and 3 deletions
+10 -2
View File
@@ -48,7 +48,7 @@
icon_state = "1"
layer = TURF_LAYER
light_color = "#ED9200"
blend_mode = BLEND_ADD
var/volume = 125
var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
@@ -57,7 +57,8 @@
/obj/effect/hotspot/New()
..()
set_light(7)
color = heat2color(temperature)
set_light(3, 1, color)
air_master.hotspots += src
/obj/effect/hotspot/proc/perform_exposure()
@@ -83,6 +84,9 @@
if(item) // It's possible that the item is deleted in temperature_expose
item.fire_act(null, temperature, volume)
animate(src, color = heat2color(temperature), 5)
set_light(l_color = color)
return 0
@@ -113,6 +117,7 @@
if(bypassing)
icon_state = "3"
set_light(7,3)
location.burn_tile()
//Possible spread due to radiated heat
@@ -128,8 +133,10 @@
else
if(volume > CELL_VOLUME*0.4)
icon_state = "2"
set_light(5, 2)
else
icon_state = "1"
set_light(3, 1)
if(temperature > location.max_fire_temperature_sustained)
location.max_fire_temperature_sustained = temperature
@@ -149,6 +156,7 @@
qdel(src)
/obj/effect/hotspot/Destroy()
set_light(0)
if(istype(loc, /turf/simulated))
var/turf/simulated/T = loc
if(T.active_hotspot == src)
+29
View File
@@ -366,3 +366,32 @@ proc/tg_text2list(text, glue=",", assocglue=";")
finalNum = copytext(finalNum, 1, pos) + sep + copytext(finalNum, pos)
return finalNum
// 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))
/proc/heat2color_r(temp)
temp /= 100
if(temp <= 66)
. = 255
else
. = max(0, min(255, 329.698727446 * (temp - 60) ** -0.1332047592))
/proc/heat2color_g(temp)
temp /= 100
if(temp <= 66)
. = max(0, min(255, 99.4708025861 * log(temp) - 161.1195681661))
else
. = max(0, min(255, 288.1221695283 * ((temp - 60) ** -0.0755148492)))
/proc/heat2color_b(temp)
temp /= 100
if(temp >= 66)
. = 255
else
if(temp <= 16)
. = 0
else
. = max(0, min(255, 138.5177312231 * log(temp - 10) - 305.0447927307))
+1 -1
View File
@@ -1,5 +1,5 @@
/atom/movable/lighting_overlay
name = "loverlay"
name = ""
mouse_opacity = 0
simulated = 0
anchored = 1