mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-30 03:52:52 +00:00
Filter Helpers and Heat Exchanging Pipes (#12051)
This commit is contained in:
@@ -107,6 +107,7 @@
|
||||
#include "code\_helpers\type2type.dm"
|
||||
#include "code\_helpers\unsorted.dm"
|
||||
#include "code\_helpers\view.dm"
|
||||
#include "code\_helpers\visual_filters.dm"
|
||||
#include "code\_helpers\sorting\__main.dm"
|
||||
#include "code\_helpers\sorting\cmp.dm"
|
||||
#include "code\_helpers\sorting\TimSort.dm"
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
var/initialize_directions_he
|
||||
var/surface = 2 //surface area in m^2
|
||||
var/icon_temperature = T20C //stop small changes in temperature causing an icon refresh
|
||||
appearance_flags = KEEP_TOGETHER
|
||||
|
||||
minimum_temperature_difference = 20
|
||||
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
|
||||
@@ -22,6 +23,7 @@
|
||||
initialize_directions_he = initialize_directions // The auto-detection from /pipe is good enough for a simple HE pipe
|
||||
// BubbleWrap END
|
||||
color = "#404040" //we don't make use of the fancy overlay system for colours, use this to set the default.
|
||||
add_filter("glow", 1, list(type="drop_shadow", x = 0, y = 0, offset = 0, size = 4))
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/atmos_init()
|
||||
normalize_dir()
|
||||
@@ -86,21 +88,25 @@
|
||||
if(pipe_air.temperature && (icon_temperature > 500 || pipe_air.temperature > 500)) //start glowing at 500K
|
||||
if(abs(pipe_air.temperature - icon_temperature) > 10)
|
||||
icon_temperature = pipe_air.temperature
|
||||
var/scale = max((icon_temperature - 500) / 1500, 0)
|
||||
|
||||
var/h_r = heat2color_r(icon_temperature)
|
||||
var/h_g = heat2color_g(icon_temperature)
|
||||
var/h_b = heat2color_b(icon_temperature)
|
||||
|
||||
if(icon_temperature < 2000) //scale up overlay until 2000K
|
||||
var/scale = (icon_temperature - 500) / 1500
|
||||
h_r = 64 + (h_r - 64)*scale
|
||||
h_g = 64 + (h_g - 64)*scale
|
||||
h_b = 64 + (h_b - 64)*scale
|
||||
|
||||
var/scale_color = rgb(h_r, h_g, h_b)
|
||||
var/list/animate_targets = get_above_oo() + src
|
||||
for (var/thing in animate_targets)
|
||||
var/atom/movable/AM = thing
|
||||
animate(AM, color = rgb(h_r, h_g, h_b), time = 20, easing = SINE_EASING)
|
||||
animate(AM, color = scale_color, time = 2 SECONDS, easing = SINE_EASING)
|
||||
animate_filter("glow", list(color = scale_color, time = 2 SECONDS, easing = LINEAR_EASING))
|
||||
set_light(min(3, scale*2.5), min(3, scale*2.5), scale_color)
|
||||
else
|
||||
set_light(0)
|
||||
|
||||
|
||||
/obj/machinery/atmospherics/pipe/simple/heat_exchanging/junction
|
||||
|
||||
58
code/_helpers/visual_filters.dm
Normal file
58
code/_helpers/visual_filters.dm
Normal file
@@ -0,0 +1,58 @@
|
||||
// These involve BYOND's built in filters that do visual effects, and not stuff that distinguishes between things.
|
||||
|
||||
// All of this ported from TG.
|
||||
// And then ported to Nebula from Polaris.
|
||||
// And then ported to Aurora
|
||||
/atom/movable
|
||||
var/list/filter_data // For handling persistent filters
|
||||
|
||||
/proc/cmp_filter_data_priority(list/A, list/B)
|
||||
return A["priority"] - B["priority"]
|
||||
|
||||
/atom/movable/proc/add_filter(filter_name, priority, list/params)
|
||||
LAZYINITLIST(filter_data)
|
||||
var/list/p = params.Copy()
|
||||
p["priority"] = priority
|
||||
filter_data[filter_name] = p
|
||||
update_filters()
|
||||
|
||||
/atom/movable/proc/update_filters()
|
||||
filters = null
|
||||
filter_data = sortTim(filter_data, /proc/cmp_filter_data_priority, TRUE)
|
||||
for(var/f in filter_data)
|
||||
var/list/data = filter_data[f]
|
||||
var/list/arguments = data.Copy()
|
||||
arguments -= "priority"
|
||||
filters += filter(arglist(arguments))
|
||||
UPDATE_OO_IF_PRESENT
|
||||
|
||||
/atom/movable/proc/get_filter(filter_name)
|
||||
if(filter_data && filter_data[filter_name])
|
||||
return filters[filter_data.Find(filter_name)]
|
||||
|
||||
// Polaris Extensions
|
||||
/atom/movable/proc/remove_filter(filter_name)
|
||||
var/thing = get_filter(filter_name)
|
||||
if(thing)
|
||||
LAZYREMOVE(filter_data, filter_name)
|
||||
filters -= thing
|
||||
update_filters()
|
||||
|
||||
/// Animate a given filter on this atom. All params after the first are passed to animate().
|
||||
/atom/movable/proc/animate_filter(filter_name, list/params)
|
||||
if (!filter_data || !filter_data[filter_name])
|
||||
return
|
||||
|
||||
var/list/monkeypatched_params = params.Copy()
|
||||
monkeypatched_params.Insert(1, null)
|
||||
var/index = filter_data.Find(filter_name)
|
||||
|
||||
// First, animate ourselves.
|
||||
monkeypatched_params[1] = filters[index]
|
||||
animate(arglist(monkeypatched_params))
|
||||
|
||||
// If we're being copied by Z-Mimic, update mimics too.
|
||||
if (bound_overlay)
|
||||
for (var/atom/movable/AM as anything in get_above_oo())
|
||||
monkeypatched_params[1] = AM.filters[index]
|
||||
animate(arglist(monkeypatched_params))
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
//mob verbs are faster than object verbs. See above.
|
||||
var/mob/living/next_point_time = 0
|
||||
/mob/living/pointed(atom/A as mob|obj|turf in view())
|
||||
/mob/living/pointed(atom/movable/A as mob|obj|turf in view())
|
||||
if(!isturf(src.loc) || !(A in range(world.view, get_turf(src))))
|
||||
return FALSE
|
||||
if(src.stat || !src.canmove || src.restrained())
|
||||
@@ -29,15 +29,11 @@ var/mob/living/next_point_time = 0
|
||||
pointing_effect.invisibility = invisibility
|
||||
addtimer(CALLBACK(GLOBAL_PROC, /proc/qdel, pointing_effect), 2 SECONDS)
|
||||
else
|
||||
var/pointglow = filter(type = "drop_shadow", x = 0, y = -1, offset = 1, size = 1, color = "#F00")
|
||||
LAZYADD(A.filters, pointglow)
|
||||
addtimer(CALLBACK(src, .proc/remove_filter, A, pointglow), 20)
|
||||
A.add_filter("pointglow", 1, list(type = "drop_shadow", x = 0, y = -1, offset = 1, size = 1, color = "#F00"))
|
||||
addtimer(CALLBACK(A, /atom/movable.proc/remove_filter, "pointglow"), 2 SECONDS)
|
||||
visible_message("<b>\The [src]</b> points to \the [A].")
|
||||
return TRUE
|
||||
|
||||
/mob/living/proc/remove_filter(var/atom/A, var/filter_to_remove)
|
||||
LAZYREMOVE(A.filters, filter_to_remove)
|
||||
|
||||
/*one proc, four uses
|
||||
swapping: if it's 1, the mobs are trying to switch, if 0, non-passive is pushing passive
|
||||
default behaviour is:
|
||||
|
||||
6
html/changelogs/geeves-filter_helpers_and_pipe.yml
Normal file
6
html/changelogs/geeves-filter_helpers_and_pipe.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
author: Geeves
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- rscadd: "Heat Exchanging pipes now start glowing based on temperature."
|
||||
Reference in New Issue
Block a user