Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws out color priority system #6897

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@
#include "code\__DEFINES\client\player_flags.dm"
#include "code\__DEFINES\client\playtime.dm"
#include "code\__DEFINES\color\color.dm"
#include "code\__DEFINES\color\colour_priority.dm"
#include "code\__DEFINES\color\lights.dm"
#include "code\__DEFINES\color\lum.dm"
#include "code\__DEFINES\combat\armor.dm"
Expand Down
11 changes: 0 additions & 11 deletions code/__DEFINES/color/colour_priority.dm

This file was deleted.

21 changes: 0 additions & 21 deletions code/__HELPERS/icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -781,27 +781,6 @@ GLOBAL_LIST_EMPTY(friendly_animal_types)
//Lame.
/image/proc/setDir(newdir)
dir = newdir
/*
GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0,0,0)))

/obj/proc/make_frozen_visual()
// Used to make the frozen item visuals for Freon.
if(resistance_flags & FREEZE_PROOF)
return
if(!(obj_flags & FROZEN))
name = "frozen [name]"
add_atom_colour(GLOB.freon_color_matrix, TEMPORARY_COLOUR_PRIORITY)
alpha -= 25
obj_flags |= FROZEN

//Assumes already frozed
/obj/proc/make_unfrozen()
if(obj_flags & FROZEN)
name = replacetext(name, "frozen ", "")
remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, GLOB.freon_color_matrix)
alpha += 25
obj_flags &= ~FROZEN
*/

/**
* Converts an icon to base64. Operates by putting the icon in the iconCache savefile,
Expand Down
22 changes: 11 additions & 11 deletions code/game/atoms/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -721,35 +721,35 @@
var/datum/component/radioactive/RA = GetComponent(/datum/component/radioactive)
RA?.clean(str, mul)

//? Atom Colour Priority System
//* Color *//

/**
* A System that gives finer control over which atom colour to colour the atom with.
* The "highest priority" one is always displayed as opposed to the default of
* "whichever was set last is displayed"
* Managed color set procs for the atom's raw `color` variable. This used to be a full priority system,
* but it was determined to be unnecessary.
*/

/**
* getter for current color
*/
/atom/proc/get_atom_colour()
/atom/proc/get_atom_color()
CRASH("base proc hit")

/**
* copies from other
*/
/atom/proc/copy_atom_colour(atom/other, colour_priority)
/atom/proc/copy_atom_color(atom/other)
CRASH("base proc hit")

/// Adds an instance of colour_type to the atom's atom_colours list
/atom/proc/add_atom_colour(coloration, colour_priority)
/// Adds an instance of colour_type to the atom's atom_colors list
/atom/proc/add_atom_color(new_color)
CRASH("base proc hit")

/// Removes an instance of colour_type from the atom's atom_colours list
/atom/proc/remove_atom_colour(colour_priority, coloration)
/// Removes an instance of colour_type from the atom's atom_colors list
/atom/proc/remove_atom_color(require_color)
CRASH("base proc hit")

/// Resets the atom's color to null, and then sets it to the highest priority colour available
/atom/proc/update_atom_colour()
/atom/proc/update_atom_color()
CRASH("base proc hit")

//* Deletions *//
Expand Down
2 changes: 0 additions & 2 deletions code/game/atoms/atom_vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@
return

switch(var_name)
if(NAMEOF(src, color))
add_atom_colour(color, ADMIN_COLOUR_PRIORITY)
if(NAMEOF(src, base_layer), NAMEOF(src, layer))
set_base_layer(var_value)
if(NAMEOF(src, relative_layer))
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms/atoms_initializing_EXPENSIVE.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@

//atom color stuff
if(color)
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
add_atom_color(color)

if(light_power && light_range)
update_light()
Expand Down
95 changes: 10 additions & 85 deletions code/game/atoms/movable/movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,6 @@
*/
var/throw_speed_scaling_exponential = THROW_SPEED_SCALING_CONSTANT_DEFAULT

//? Colors
/**
* used to store the different colors on an atom
*
* its inherent color, the colored paint applied on it, special color effect etc...
*/
var/list/atom_colours
/// use expensive color priority system
var/atom_colouration_system = FALSE

//? Emissives
/// Either FALSE, [EMISSIVE_BLOCK_GENERIC], or [EMISSIVE_BLOCK_UNIQUE]
var/blocks_emissive = FALSE
Expand All @@ -189,9 +179,6 @@

/atom/movable/Initialize(mapload)
. = ..()
//atom color stuff
if(!isnull(color) && atom_colouration_system)
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
// WARNING WARNING SHITCODE THIS MEANS THAT ONLY TURFS RECEIVE MAPLOAD ENTERED
// DO NOT RELY ON ENTERED
// TODO: what would tg do (but maybe not that much component signal abuse?)
Expand Down Expand Up @@ -552,84 +539,22 @@

//? atom colors

/**
* getter for current color
*/
/atom/movable/get_atom_colour()
/atom/movable/get_atom_color()
return color

/**
* copies from other
*/
/atom/movable/copy_atom_colour(atom/other, colour_priority)
if(!atom_colouration_system)
var/others = other.get_atom_colour()
if(isnull(others))
return
color = others
return
add_atom_colour(other.get_atom_colour(), colour_priority || FIXED_COLOUR_PRIORITY)
/atom/movable/copy_atom_color(atom/other)
color = other.get_atom_color()

/**
* copies all from another movable
*/
/atom/movable/proc/copy_atom_colours(atom/movable/other)
if(!atom_colouration_system)
return copy_atom_colour(other)
if(isnull(other.atom_colours))
return
atom_colours = other.atom_colours.Copy()
update_atom_colour()
/atom/movable/add_atom_color(new_color)
color = new_color

/// Adds an instance of colour_type to the atom's atom_colours list
/atom/movable/add_atom_colour(coloration, colour_priority)
if(!coloration)
return
if(!atom_colouration_system)
color = coloration
return
if(colour_priority > COLOUR_PRIORITY_AMOUNT)
return
if(!atom_colours || !atom_colours.len)
atom_colours = list()
atom_colours.len = COLOUR_PRIORITY_AMOUNT //four priority levels currently.
atom_colours[colour_priority] = coloration
update_atom_colour()

/// Removes an instance of colour_type from the atom's atom_colours list
/atom/movable/remove_atom_colour(colour_priority, coloration)
if(!atom_colouration_system)
if(coloration && color != coloration)
return
if(isnull(color))
return
color = null
return
if(!islist(atom_colours))
return
if(colour_priority > COLOUR_PRIORITY_AMOUNT)
return
if(coloration && atom_colours[colour_priority] != coloration)
return //if we don't have the expected color (for a specific priority) to remove, do nothing
atom_colours[colour_priority] = null
update_atom_colour()

/// Resets the atom's color to null, and then sets it to the highest priority colour available
/atom/movable/update_atom_colour()
if(!atom_colouration_system)
return
if(!islist(atom_colours))
/atom/movable/remove_atom_color(require_color)
if(require_color && color != require_color)
return
color = null
for(var/C in atom_colours)
if(islist(C))
var/list/L = C
if(L.len)
color = L
return
else if(C)
color = C
return

/atom/movable/update_atom_color()
return

//* Rendering *//

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/gear_painter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
drop_item()
return TRUE
if("clear")
inserted.remove_atom_colour(FIXED_COLOUR_PRIORITY)
inserted.remove_atom_color()
playsound(src, 'sound/effects/spray3.ogg', 50, 1)
temp = "Cleared Successfully!"
return TRUE
Expand Down Expand Up @@ -236,7 +236,7 @@
if(!color_to_use || !check_valid_color(color_to_use, user))
to_chat(user, SPAN_NOTICE("Invalid color."))
return FALSE
inserted.add_atom_colour(color_to_use, FIXED_COLOUR_PRIORITY)
inserted.add_atom_color(color_to_use)
playsound(src, 'sound/effects/spray3.ogg', 50, 1)
return TRUE

Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/effects/debris/cleanable/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var/global/list/image/splatter_cache=list()
/obj/effect/debris/cleanable/blood/update_icon()
if(basecolor == "rainbow")
basecolor = "#[get_random_colour(1)]"
add_atom_colour(basecolor, FIXED_COLOUR_PRIORITY)
add_atom_color(basecolor)

if(basecolor == SYNTH_BLOOD_COLOUR)
name = "oil"
Expand Down Expand Up @@ -129,7 +129,7 @@ var/global/list/image/splatter_cache=list()
name = dryname
desc = drydesc
var/newcolor = adjust_brightness(color, -50)
add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY)
add_atom_color(newcolor)
amount = 0

/obj/effect/debris/cleanable/blood/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
Expand Down
10 changes: 5 additions & 5 deletions code/game/objects/effects/debris/debris.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@

//* Atom Color - we don't use the expensive system. *//

/obj/effect/debris/get_atom_colour()
/obj/effect/debris/get_atom_color()
return color

/obj/effect/debris/add_atom_colour(coloration, colour_priority)
/obj/effect/debris/add_atom_color(coloration, colour_priority)
color = coloration

/obj/effect/debris/remove_atom_colour(colour_priority, coloration)
/obj/effect/debris/remove_atom_color(colour_priority, coloration)
color = null

/obj/effect/debris/update_atom_colour()
/obj/effect/debris/update_atom_color()
return

/obj/effect/debris/copy_atom_colour(atom/other, colour_priority)
/obj/effect/debris/copy_atom_color(atom/other, colour_priority)
if(isnull(other.color))
return
color = other.color
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/melee/types/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

// Randomizes color
/obj/item/melee/umbrella/random/Initialize(mapload)
add_atom_colour("#"+get_random_colour(), FIXED_COLOUR_PRIORITY)
add_atom_color("#"+get_random_colour())
return ..()

/obj/item/melee/cursedblade
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/storage/wallets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@

/obj/item/storage/wallet/poly/Initialize(mapload)
. = ..()
add_atom_colour("#"+get_random_colour(), FIXED_COLOUR_PRIORITY)
add_atom_color("#"+get_random_colour())
update_icon()

/obj/item/storage/wallet/poly/verb/change_color()
Expand All @@ -125,7 +125,7 @@
var/new_color = input(usr, "Pick a new color", "Wallet Color", color) as color|null

if(new_color)
add_atom_colour(new_color, FIXED_COLOUR_PRIORITY)
add_atom_color(new_color)

/obj/item/storage/wallet/poly/emp_act()
var/original_state = icon_state
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tools/switchtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@

/obj/item/switchtool/holo/Initialize(mapload)
. = ..()
add_atom_colour(light_color, FIXED_COLOUR_PRIORITY)
add_atom_color(light_color)

/obj/item/switchtool/holo/deploy(var/obj/item/module) //We lightin' it up in here
..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/towels.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@

/obj/item/towel/random/Initialize(mapload)
. = ..()
add_atom_colour("#"+get_random_colour(), FIXED_COLOUR_PRIORITY)
add_atom_color("#"+get_random_colour())
1 change: 0 additions & 1 deletion code/game/objects/obj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pass_flags_self = ATOM_PASS_OVERHEAD_THROW
animate_movement = SLIDE_STEPS
rad_flags = NONE
atom_colouration_system = TRUE
integrity_enabled = TRUE
armor_type = /datum/armor/object/default

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/gravemarker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if(!material)
qdel(src)
return
add_atom_colour(material.icon_colour, FIXED_COLOUR_PRIORITY)
add_atom_color(material.icon_colour)

/obj/structure/gravemarker/examine(mob/user, dist)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/stool_bed_chair_nest/bed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/obj/structure/bed/Initialize(mapload, new_material, new_padding_material)
. = ..(mapload)
remove_atom_colour(FIXED_COLOUR_PRIORITY)
remove_atom_color()
if(!new_material)
new_material = MAT_STEEL
material = get_material_by_name(new_material)
Expand Down
1 change: 0 additions & 1 deletion code/game/rendering/screen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

/atom/movable/screen
appearance_flags = PIXEL_SCALE | NO_CLIENT_COLOR
atom_colouration_system = FALSE
plane = HUD_PLANE
layer = HUD_LAYER_BASE
var/obj/master = null //A reference to the object in the slot. Grabs or items, generally.
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/change_turf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ GLOBAL_LIST_INIT(multiz_hole_baseturfs, typecacheof(list(
T.icon_state = icon_state
if(T.icon != icon)
T.icon = icon
T.copy_atom_colour(src)
T.copy_atom_color(src)
if(T.dir != dir)
T.setDir(dir)
return T
Expand Down
Loading
Loading