diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm index 9f48166e31..a3e2222f2e 100644 --- a/code/__DEFINES/layers.dm +++ b/code/__DEFINES/layers.dm @@ -62,6 +62,7 @@ #define SPACEVINE_LAYER 4.8 #define SPACEVINE_MOB_LAYER 4.9 //#define FLY_LAYER 5 //For easy recordkeeping; this is a byond define +#define GASFIRE_LAYER 5.05 #define RIPPLE_LAYER 5.1 #define GHOST_LAYER 6 diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm index 67e0381571..2a24e5fa28 100644 --- a/code/modules/atmospherics/environmental/LINDA_fire.dm +++ b/code/modules/atmospherics/environmental/LINDA_fire.dm @@ -50,14 +50,16 @@ mouse_opacity = MOUSE_OPACITY_TRANSPARENT icon = 'icons/effects/fire.dmi' icon_state = "1" - layer = ABOVE_OPEN_TURF_LAYER + layer = GASFIRE_LAYER light_range = LIGHT_RANGE_FIRE light_color = LIGHT_COLOR_FIRE + blend_mode = BLEND_ADD var/volume = 125 var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST var/just_spawned = TRUE var/bypassing = FALSE + var/visual_update_tick = 0 /obj/effect/hotspot/Initialize() . = ..() @@ -96,6 +98,64 @@ AT.fire_act(temperature, volume) return +/obj/effect/hotspot/proc/gauss_lerp(x, x1, x2) + var/b = (x1 + x2) * 0.5 + var/c = (x2 - x1) / 6 + return NUM_E ** -((x - b) ** 2 / (2 * c) ** 2) + +/obj/effect/hotspot/proc/update_color() + cut_overlays() + + var/heat_r = heat2colour_r(temperature) + var/heat_g = heat2colour_g(temperature) + var/heat_b = heat2colour_b(temperature) + var/heat_a = 255 + var/greyscale_fire = 1 //This determines how greyscaled the fire is. + + if(temperature < 5000) //This is where fire is very orange, we turn it into the normal fire texture here. + var/normal_amt = gauss_lerp(temperature, 1000, 3000) + heat_r = LERP(heat_r,255,normal_amt) + heat_g = LERP(heat_g,255,normal_amt) + heat_b = LERP(heat_b,255,normal_amt) + heat_a -= gauss_lerp(temperature, -5000, 5000) * 128 + greyscale_fire -= normal_amt + if(temperature > 40000) //Past this temperature the fire will gradually turn a bright purple + var/purple_amt = temperature < LERP(40000,200000,0.5) ? gauss_lerp(temperature, 40000, 200000) : 1 + heat_r = LERP(heat_r,255,purple_amt) + if(temperature > 200000 && temperature < 500000) //Somewhere at this temperature nitryl happens. + var/sparkle_amt = gauss_lerp(temperature, 200000, 500000) + var/mutable_appearance/sparkle_overlay = mutable_appearance('icons/effects/effects.dmi', "shieldsparkles") + sparkle_overlay.blend_mode = BLEND_ADD + sparkle_overlay.alpha = sparkle_amt * 255 + add_overlay(sparkle_overlay) + if(temperature > 400000 && temperature < 1500000) //Lightning because very anime. + var/mutable_appearance/lightning_overlay = mutable_appearance(icon, "overcharged") + lightning_overlay.blend_mode = BLEND_ADD + add_overlay(lightning_overlay) + if(temperature > 4500000) //This is where noblium happens. Some fusion-y effects. + var/fusion_amt = temperature < LERP(4500000,12000000,0.5) ? gauss_lerp(temperature, 4500000, 12000000) : 1 + var/mutable_appearance/fusion_overlay = mutable_appearance('icons/effects/tile_effects.dmi', "chem_gas") + fusion_overlay.blend_mode = BLEND_ADD + fusion_overlay.alpha = fusion_amt * 255 + var/mutable_appearance/rainbow_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "druggy") + rainbow_overlay.blend_mode = BLEND_ADD + rainbow_overlay.alpha = fusion_amt * 255 + rainbow_overlay.appearance_flags = RESET_COLOR + heat_r = LERP(heat_r,150,fusion_amt) + heat_g = LERP(heat_g,150,fusion_amt) + heat_b = LERP(heat_b,150,fusion_amt) + add_overlay(fusion_overlay) + add_overlay(rainbow_overlay) + + set_light(l_color = rgb(LERP(250,heat_r,greyscale_fire),LERP(160,heat_g,greyscale_fire),LERP(25,heat_b,greyscale_fire))) + + heat_r /= 255 + heat_g /= 255 + heat_b /= 255 + + color = list(LERP(0.3, 1, 1-greyscale_fire) * heat_r,0.3 * heat_g * greyscale_fire,0.3 * heat_b * greyscale_fire, 0.59 * heat_r * greyscale_fire,LERP(0.59, 1, 1-greyscale_fire) * heat_g,0.59 * heat_b * greyscale_fire, 0.11 * heat_r * greyscale_fire,0.11 * heat_g * greyscale_fire,LERP(0.11, 1, 1-greyscale_fire) * heat_b, 0,0,0) + alpha = heat_a + #define INSUFFICIENT(path) (!location.air.gases[path] || location.air.gases[path][MOLES] < 0.5) /obj/effect/hotspot/process() if(just_spawned) @@ -142,6 +202,9 @@ else icon_state = "1" + if((visual_update_tick++ % 7) == 0) + update_color() + if(temperature > location.max_fire_temperature_sustained) location.max_fire_temperature_sustained = temperature diff --git a/icons/effects/fire.dmi b/icons/effects/fire.dmi index 79a73189c3..113e16163e 100644 Binary files a/icons/effects/fire.dmi and b/icons/effects/fire.dmi differ