mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
[MIRROR] Primitive Colorgrading (#11062)
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4e57ac73d4
commit
c97ec96e61
14
code/__defines/colorgrading.dm
Normal file
14
code/__defines/colorgrading.dm
Normal file
@@ -0,0 +1,14 @@
|
||||
#define COLORTINT_NONE "#ffffff"
|
||||
#define COLORTINT_WARM "#fdfdfa"
|
||||
#define COLORTINT_COZY "#f7f5ed"
|
||||
#define COLORTINT_CHILL "#f5fbfa"
|
||||
#define COLORTINT_COLD "#ebf2ff"
|
||||
#define COLORTINT_DIM "#f0f3f9"
|
||||
#define COLORTINT_DARK "#dfe2e7"
|
||||
#define COLORTINT_SICK "#f1f8f0"
|
||||
#define COLORTINT_HIVE "#e5efe3"
|
||||
#define COLORTINT_ARID "#fbf2ec"
|
||||
#define COLORTINT_MEAT "#fee8e8"
|
||||
#define COLORTINT_OMEN "#f0eaf0"
|
||||
#define COLORTINT_DUST "#f7f7f1"
|
||||
#define COLORTINT_BADBROKE "#fbebbb"
|
||||
@@ -51,6 +51,7 @@ GLOBAL_LIST_EMPTY(areas_by_type)
|
||||
var/list/forced_ambience = null
|
||||
var/sound_env = STANDARD_STATION
|
||||
var/turf/base_turf //The base turf type of the area, which can be used to override the z-level's base turf
|
||||
VAR_PRIVATE/color_grading = null // Color blending for clients that enter this area
|
||||
|
||||
/area/New()
|
||||
// Used by the maploader, this must be done in New, not init
|
||||
@@ -397,6 +398,11 @@ var/list/mob/living/forced_ambiance_list = new
|
||||
L.disable_spoiler_vision()
|
||||
check_phase_shift(M) //RS Port #658
|
||||
|
||||
// Update the area's color grading
|
||||
var/area/A = get_area(L)
|
||||
if(L.client && L.client.color != A?.get_color_tint()) // Try to check if we should bother changing before doing blending
|
||||
L.update_client_color()
|
||||
|
||||
/area/proc/play_ambience(var/mob/living/L, initial = TRUE)
|
||||
// Ambience goes down here -- make sure to list each area seperately for ease of adding things in later, thanks! Note: areas adjacent to each other should have the same sounds to prevent cutoff when possible.- LastyScratch
|
||||
if(!L?.read_preference(/datum/preference/toggle/play_ambience))
|
||||
@@ -584,3 +590,8 @@ GLOBAL_DATUM(spoiler_obfuscation_image, /image)
|
||||
|
||||
/area/turbolift/isAlwaysIndoors()
|
||||
return TRUE
|
||||
|
||||
/// Gets a hex color value for blending with a player's client.color. Allows for primitive color grading per area.
|
||||
/area/proc/get_color_tint()
|
||||
SHOULD_CALL_PARENT(TRUE)
|
||||
return color_grading
|
||||
|
||||
@@ -1193,6 +1193,11 @@
|
||||
return
|
||||
colors_to_blend += M.client_color
|
||||
|
||||
if(!colors_to_blend.len) // Modifiers take priority over passive area blending, to prevent changes on every area entered
|
||||
var/location_grade = get_location_color_tint() // Area or weather!
|
||||
if(location_grade)
|
||||
colors_to_blend += location_grade
|
||||
|
||||
if(colors_to_blend.len)
|
||||
var/final_color
|
||||
if(colors_to_blend.len == 1) // If it's just one color we can skip all of this work.
|
||||
|
||||
@@ -283,14 +283,12 @@ default behaviour is:
|
||||
handle_footstep(loc)
|
||||
if(!forced && movetime)
|
||||
SSmotiontracker?.ping(src) // Incase of before init "turf enter gravity" this is ?, unfortunately.
|
||||
// Begin VOREstation edit
|
||||
if(is_shifted)
|
||||
is_shifted = FALSE
|
||||
pixel_x = default_pixel_x
|
||||
pixel_y = default_pixel_y
|
||||
layer = initial(layer)
|
||||
plane = initial(plane)
|
||||
// End VOREstation edit
|
||||
|
||||
if(pulling) // we were pulling a thing and didn't lose it during our move.
|
||||
var/pull_dir = get_dir(src, pulling)
|
||||
@@ -317,11 +315,9 @@ default behaviour is:
|
||||
return
|
||||
else if(lastarea?.get_gravity() == 0)
|
||||
inertial_drift()
|
||||
//VOREStation Edit Start
|
||||
else if(flying)
|
||||
inertial_drift()
|
||||
make_floating(1)
|
||||
//VOREStation Edit End
|
||||
else if(!isspace(loc))
|
||||
inertia_dir = 0
|
||||
make_floating(0)
|
||||
@@ -329,6 +325,12 @@ default behaviour is:
|
||||
layer = HIDING_LAYER
|
||||
plane = OBJ_PLANE
|
||||
|
||||
// Update client color if we're moving from an indoor turf to an outdoor one or vice versa. Needed to make weather blending update in mixed indoor/outdoor turfed areas
|
||||
var/turf/old_turf = oldloc
|
||||
var/turf/new_turf = loc
|
||||
if(istype(old_turf) && old_turf.is_outdoors() != new_turf.is_outdoors())
|
||||
update_client_color()
|
||||
|
||||
/mob/living/proc/inertial_drift()
|
||||
if(x > 1 && x < (world.maxx) && y > 1 && y < (world.maxy))
|
||||
if(Process_Spacemove(1))
|
||||
|
||||
@@ -1236,9 +1236,24 @@
|
||||
// This is for inheritence since /mob/living will serve most cases. If you need ghosts to use this you'll have to implement that yourself.
|
||||
/mob/proc/update_client_color()
|
||||
if(client && client.color)
|
||||
animate(client, color = null, time = 10)
|
||||
animate(client, color = get_location_color_tint(), time = 10)
|
||||
return
|
||||
|
||||
/mob/proc/get_location_color_tint()
|
||||
PROTECTED_PROC(TRUE)
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
var/turf/T = get_turf(src)
|
||||
var/area/A = get_area(src)
|
||||
if(!T || !A)
|
||||
return null
|
||||
if(T.is_outdoors()) // check weather
|
||||
var/datum/planet/P = LAZYACCESS(SSplanets.z_to_planet, T.z)
|
||||
var/weather_tint = P?.weather_holder.current_weather.get_color_tint()
|
||||
if(weather_tint) // But not if the weather has no blending!
|
||||
return weather_tint
|
||||
// If not weather based then just area's
|
||||
return A.get_color_tint()
|
||||
|
||||
/mob/proc/swap_hand()
|
||||
return
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
if(!T.is_outdoors())
|
||||
continue
|
||||
to_chat(M, message)
|
||||
M.update_client_color() // Passively done here instead of its own loop, the only issue is that if you enter an outdoor area to an indoor turf you won't get a blend update till your first message.
|
||||
|
||||
/datum/weather_holder/proc/get_weather_datum(desired_type)
|
||||
return allowed_weather_types[desired_type]
|
||||
@@ -204,6 +205,8 @@
|
||||
var/indoor_sounds_type = null
|
||||
var/effect_flags = NONE
|
||||
|
||||
VAR_PRIVATE/color_grading = null // Color blending for weather to feel hotter, colder, or stranger
|
||||
|
||||
/datum/weather/New()
|
||||
if(outdoor_sounds_type)
|
||||
outdoor_sounds = new outdoor_sounds_type(list(), FALSE, TRUE)
|
||||
@@ -305,6 +308,10 @@
|
||||
return
|
||||
indoor_sounds.output_atoms -= M
|
||||
|
||||
/// Gets a hex color value for blending with a player's client.color.
|
||||
/datum/weather/proc/get_color_tint()
|
||||
return color_grading
|
||||
|
||||
// All this does is hold the weather icon.
|
||||
/atom/movable/weather_visuals
|
||||
icon = 'icons/effects/weather.dmi'
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "code\__defines\clothing.dm"
|
||||
#include "code\__defines\color.dm"
|
||||
#include "code\__defines\color_priority.dm"
|
||||
#include "code\__defines\colorgrading.dm"
|
||||
#include "code\__defines\configuration.dm"
|
||||
#include "code\__defines\construction.dm"
|
||||
#include "code\__defines\construction_datum.dm"
|
||||
|
||||
Reference in New Issue
Block a user