From 391f1d25521fd9669a7fabba792cc7dcfb602982 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Fri, 12 Mar 2021 23:44:54 +0100
Subject: [PATCH] [MIRROR] Item hover outline FX (#4090)
* Revert "[MODULAR] Adds item outline glow (#3861)"
This reverts commit 9ea4373618926c95687bcbdf14e415bf23e442bd.
* ..
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
---
code/__DEFINES/colors.dm | 9 +++
code/_onclick/hud/screen_objects.dm | 6 --
.../components/storage/concrete/_concrete.dm | 11 ---
code/datums/components/storage/storage.dm | 8 +-
code/game/objects/items.dm | 79 ++++++++++++-------
code/modules/client/preferences.dm | 8 +-
code/modules/client/preferences_savefile.dm | 3 +
.../modules/client/preferences.dm | 18 ++---
.../modules/client/preferences_savefile.dm | 3 +
.../item_outline/code/outline_procs.dm | 37 ---------
.../modules/item_outline/code/readme.md | 32 --------
tgstation.dme | 1 -
12 files changed, 79 insertions(+), 136 deletions(-)
delete mode 100644 modular_skyrat/modules/item_outline/code/outline_procs.dm
delete mode 100644 modular_skyrat/modules/item_outline/code/readme.md
diff --git a/code/__DEFINES/colors.dm b/code/__DEFINES/colors.dm
index 6d6e87ef6bb..07500afb982 100644
--- a/code/__DEFINES/colors.dm
+++ b/code/__DEFINES/colors.dm
@@ -104,6 +104,15 @@
#define COLOR_SAMPLE_BROWN "#91542d"
#define COLOR_SAMPLE_GRAY "#5e5856"
+///Main colors for UI themes
+#define COLOR_THEME_MIDNIGHT "#6086A0"
+#define COLOR_THEME_PLASMAFIRE "#FFB200"
+#define COLOR_THEME_RETRO "#24CA00"
+#define COLOR_THEME_SLIMECORE "#4FB259"
+#define COLOR_THEME_OPERATIVE "#B8221F"
+#define COLOR_THEME_GLASS "#75A4C4"
+#define COLOR_THEME_CLOCKWORK "#CFBA47"
+
/**
* Some defines to generalise colours used in lighting.
*
diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm
index 40e31b00ab0..7ac15e1baa2 100644
--- a/code/_onclick/hud/screen_objects.dm
+++ b/code/_onclick/hud/screen_objects.dm
@@ -152,17 +152,11 @@
/atom/movable/screen/inventory/MouseEntered()
..()
add_overlays()
- //SKYRAT EDIT ADDITION START - ITEM_OUTLINE - Apply the outline effect
- add_stored_outline()
- //SKYRAT EDIT END
/atom/movable/screen/inventory/MouseExited()
..()
cut_overlay(object_overlay)
QDEL_NULL(object_overlay)
- //SKYRAT EDIT ADDITION START - ITEM_OUTLINE - Remvoe the outline effect
- remove_stored_outline()
- //SKYRAT EDIT END
/atom/movable/screen/inventory/update_icon_state()
if(!icon_empty)
diff --git a/code/datums/components/storage/concrete/_concrete.dm b/code/datums/components/storage/concrete/_concrete.dm
index 959c5a6c7ef..a04099dd0f7 100644
--- a/code/datums/components/storage/concrete/_concrete.dm
+++ b/code/datums/components/storage/concrete/_concrete.dm
@@ -122,22 +122,11 @@
var/list/seeing_mobs = can_see_contents()
for(var/mob/M in seeing_mobs)
M.client.screen -= AM
- /* SKYRAT EDIT CHANGE - ITEM_OUTLINE - ORIGINAL
if(ismob(parent.loc) && isitem(AM))
var/obj/item/I = AM
var/mob/M = parent.loc
I.dropped(M, TRUE)
I.item_flags &= ~IN_STORAGE
- */
- //SKYRAT EDIT CHANGE START - ITEM_OUTLINE
- if(isitem(AM))
- var/obj/item/I = AM
- I.item_flags &= ~IN_STORAGE
- I.remove_outline()
- if(ismob(parent.loc))
- var/mob/M = parent.loc
- I.dropped(M)
- //SKYRAT EDIT END
if(new_location)
//Reset the items values
_removal_reset(AM)
diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm
index ba1cb4534aa..b19c849df07 100644
--- a/code/datums/components/storage/storage.dm
+++ b/code/datums/components/storage/storage.dm
@@ -558,12 +558,6 @@
set waitfor = FALSE
. = COMPONENT_NO_MOUSEDROP
- //SKYRAT EDIT ADDITON START - ITEM_OUTLINE
- var/atom/A = parent
- if(istype(A, /obj/item))
- var/obj/item/I = A
- I.remove_outline() //Removes the outline when we drag
- //SKRYAT EDIT END
if(!ismob(M))
return
if(!over_object)
@@ -572,7 +566,7 @@
return
if(M.incapacitated() || !M.canUseStorage())
return
- //var/atom/A = parent SKYRAT EDIT REMOVAL
+ var/atom/A = parent
A.add_fingerprint(M)
// this must come before the screen objects only block, dunno why it wasn't before
if(over_object == M)
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index d75f8686f75..6fcfe1589fa 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -191,8 +191,9 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
var/list/juice_results
var/canMouseDown = FALSE
-
- var/outline_filter //SKYRAT EDIT ADDITION - ITEM_OUTLINE - the outline filter on hover
+
+ /// item hover FX
+ var/outline_filter
/obj/item/Initialize()
@@ -211,14 +212,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
if(force_string)
item_flags |= FORCE_STRING_OVERRIDE
- //SKYRAT EDIT ADDITION BEGIN - ITEM_OUTLINE
- if(istype(loc, /obj/item/storage))
- item_flags |= IN_STORAGE
-
- if(istype(loc, /obj/item/robot_model))
- item_flags |= IN_INVENTORY
- //SKYRAT EDIT END
-
if(!hitsound)
if(damtype == BURN)
hitsound = 'sound/items/welder.ogg'
@@ -407,8 +400,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
return
. = FALSE
-
- remove_outline() //SKYRAT EDIT ADDITION - ITEM_OUTLINE
pickup(user)
add_fingerprint(user)
if(!user.put_in_active_hand(src, FALSE, FALSE))
@@ -482,7 +473,6 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
qdel(src)
item_flags &= ~IN_INVENTORY
SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user)
- remove_outline() //SKYRAT EDIT ADDITION - ITEM_OUTLINE
if(!silent)
playsound(src, drop_sound, DROP_SOUND_VOLUME, ignore_walls = FALSE)
user?.update_equipment_speed_mods()
@@ -838,26 +828,59 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
/obj/item/MouseEntered(location, control, params)
. = ..()
- if((item_flags & IN_INVENTORY || item_flags & IN_STORAGE) && usr.client.prefs.enable_tips && !QDELETED(src))
- var/timedelay = usr.client.prefs.tip_delay/100
- var/user = usr
- tip_timer = addtimer(CALLBACK(src, .proc/openTip, location, control, params, user), timedelay, TIMER_STOPPABLE)//timer takes delay in deciseconds, but the pref is in milliseconds. dividing by 100 converts it.
-//SKYRAT EDIT ADDITON BEGIN - ITEM_OUTLINE
- var/mob/living/L = usr
- if(istype(L) && L.incapacitated())
- apply_outline(COLOR_RED_GRAY)
- else
- apply_outline()
+ if((item_flags & IN_INVENTORY || item_flags & IN_STORAGE) && !QDELETED(src))
+ var/mob/living/L = usr
+ if(usr.client.prefs.enable_tips)
+ var/timedelay = usr.client.prefs.tip_delay/100
+ tip_timer = addtimer(CALLBACK(src, .proc/openTip, location, control, params, usr), timedelay, TIMER_STOPPABLE)//timer takes delay in deciseconds, but the pref is in milliseconds. dividing by 100 converts it.
+ if(usr.client.prefs.itemoutline_pref)
+ if(istype(L) && L.incapacitated())
+ apply_outline(COLOR_RED_GRAY) //if they're dead or handcuffed, let's show the outline as red to indicate that they can't interact with that right now
+ else
+ apply_outline() //if the player's alive and well we send the command with no color set, so it uses the theme's color
/obj/item/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
. = ..()
- remove_outline()
-//SKYRAT EDIT END
-
+ remove_outline() //get rid of the hover effect in case the mouse exit isn't called if someone drags and drops an item and somthing goes wrong
+e
/obj/item/MouseExited()
- deltimer(tip_timer)//delete any in-progress timer if the mouse is moved off the item before it finishes
+ deltimer(tip_timer) //delete any in-progress timer if the mouse is moved off the item before it finishes
closeToolTip(usr)
- remove_outline() //SKYRAT EDIT ADDITION - ITEM_OUTLINE
+ remove_outline()
+
+/obj/item/proc/apply_outline(outline_color = null)
+ if(!(item_flags & IN_INVENTORY || item_flags & IN_STORAGE) || QDELETED(src) || isobserver(usr)) //cancel if the item isn't in an inventory, is being deleted, or if the person hovering is a ghost (so that people spectating you don't randomly make your items glow)
+ return
+ var/theme = lowertext(usr.client.prefs.UI_style)
+ if(!outline_color) //if we weren't provided with a color, take the theme's color
+ switch(theme) //yeah it kinda has to be this way
+ if("midnight")
+ outline_color = COLOR_THEME_MIDNIGHT
+ if("plasmafire")
+ outline_color = COLOR_THEME_PLASMAFIRE
+ if("retro")
+ outline_color = COLOR_THEME_RETRO //just as garish as the rest of this theme
+ if("slimecore")
+ outline_color = COLOR_THEME_SLIMECORE
+ if("operative")
+ outline_color = COLOR_THEME_OPERATIVE
+ if("clockwork")
+ outline_color = COLOR_THEME_CLOCKWORK //if you want free gbp go fix the fact that clockwork's tooltip css is glass'
+ if("glass")
+ outline_color = COLOR_THEME_GLASS
+ else //this should never happen, hopefully
+ outline_color = COLOR_WHITE
+ if(color)
+ outline_color = COLOR_WHITE //if the item is recolored then the outline will be too, let's make the outline white so it becomes the same color instead of some ugly mix of the theme and the tint
+ if(outline_filter)
+ filters -= outline_filter
+ outline_filter = filter(type="outline", size=1, color=outline_color)
+ filters += outline_filter
+
+/obj/item/proc/remove_outline()
+ if(outline_filter)
+ filters -= outline_filter
+ outline_filter = null
/// Called when a mob tries to use the item as a tool. Handles most checks.
/obj/item/proc/use_tool(atom/target, mob/living/user, delay, amount=0, volume=0, datum/callback/extra_checks)
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 52d73695770..fcb500b10fd 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -114,6 +114,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/screentip_pref = TRUE
///Color of screentips at top of screen
var/screentip_color = "#ffd391"
+ ///Do we show item hover outlines?
+ var/itemoutline_pref = TRUE
var/ambientocclusion = TRUE
///Should we automatically fit the viewport?
@@ -644,7 +646,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "Set screentip mode: [screentip_pref ? "Enabled" : "Disabled"]
"
dat += "Screentip color: Change
"
-
+ dat += "Item Hover Outlines: [itemoutline_pref ? "Enabled" : "Disabled"]
"
+
dat += "Ambient Occlusion: [ambientocclusion ? "Enabled" : "Disabled"]
"
dat += "Fit Viewport: [auto_fit_viewport ? "Auto" : "Manual"]
"
@@ -1844,6 +1847,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(new_screentipcolor)
screentip_color = sanitize_ooccolor(new_screentipcolor)
+ if("itemoutline_pref")
+ itemoutline_pref = !itemoutline_pref
+
if("ambientocclusion")
ambientocclusion = !ambientocclusion
if(parent?.screen && parent.screen.len)
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index 5dd52d592a2..a6d7c72ca9c 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -198,6 +198,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
READ_FILE(S["parallax"], parallax)
READ_FILE(S["ambientocclusion"], ambientocclusion)
READ_FILE(S["screentip_pref"], screentip_pref)
+ READ_FILE(S["itemoutline_pref"], itemoutline_pref)
READ_FILE(S["auto_fit_viewport"], auto_fit_viewport)
READ_FILE(S["widescreenpref"], widescreenpref)
READ_FILE(S["pixel_size"], pixel_size)
@@ -248,6 +249,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
parallax = sanitize_integer(parallax, PARALLAX_INSANE, PARALLAX_DISABLE, null)
ambientocclusion = sanitize_integer(ambientocclusion, FALSE, TRUE, initial(ambientocclusion))
screentip_pref = sanitize_integer(screentip_pref, FALSE, TRUE, initial(screentip_pref))
+ itemoutline_pref = sanitize_integer(itemoutline_pref, FALSE, TRUE, initial(itemoutline_pref))
auto_fit_viewport = sanitize_integer(auto_fit_viewport, FALSE, TRUE, initial(auto_fit_viewport))
widescreenpref = sanitize_integer(widescreenpref, FALSE, TRUE, initial(widescreenpref))
pixel_size = sanitize_float(pixel_size, PIXEL_SCALING_AUTO, PIXEL_SCALING_3X, 0.5, initial(pixel_size))
@@ -327,6 +329,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["parallax"], parallax)
WRITE_FILE(S["ambientocclusion"], ambientocclusion)
WRITE_FILE(S["screentip_pref"], screentip_pref)
+ WRITE_FILE(S["itemoutline_pref"], itemoutline_pref)
WRITE_FILE(S["auto_fit_viewport"], auto_fit_viewport)
WRITE_FILE(S["widescreenpref"], widescreenpref)
WRITE_FILE(S["pixel_size"], pixel_size)
diff --git a/modular_skyrat/modules/customization/modules/client/preferences.dm b/modular_skyrat/modules/customization/modules/client/preferences.dm
index 912481f1b56..0180e7cbcb6 100644
--- a/modular_skyrat/modules/customization/modules/client/preferences.dm
+++ b/modular_skyrat/modules/customization/modules/client/preferences.dm
@@ -140,11 +140,8 @@ GLOBAL_LIST_INIT(food, list(
var/screentip_pref = TRUE
///Color of screentips at top of screen
var/screentip_color = "#ffd391"
-
- //Do we want to show item glow?
- var/outline_enabled = TRUE
- //Colour of said glow
- var/outline_color = COLOR_BLUE_GRAY
+ ///Do we show item hover outlines?
+ var/itemoutline_pref = TRUE
var/ambientocclusion = TRUE
///Should we automatically fit the viewport?
@@ -1018,9 +1015,8 @@ GLOBAL_LIST_INIT(food, list(
dat += "Set screentip mode: [screentip_pref ? "Enabled" : "Disabled"]
"
dat += "Screentip color: Change
"
+ dat += "Item Hover Outlines: [itemoutline_pref ? "Enabled" : "Disabled"]
"
- dat += "Set item outline mode: [outline_enabled ? "Enabled" : "Disabled"]
"
- dat += "Item outline Color: Change
"
dat += "Ambient Occlusion: [ambientocclusion ? "Enabled" : "Disabled"]
"
dat += "Fit Viewport: [auto_fit_viewport ? "Auto" : "Manual"]
"
@@ -2695,13 +2691,9 @@ GLOBAL_LIST_INIT(food, list(
if(new_screentipcolor)
screentip_color = sanitize_ooccolor(new_screentipcolor)
- if("outline_enabled")
- outline_enabled = !outline_enabled
+ if("itemoutline_pref")
+ itemoutline_pref = !itemoutline_pref
- if("outline_color")
- var/pickedOutlineColor = input(user, "Choose your outline color.", "General Preference", outline_color) as color|null
- if(pickedOutlineColor)
- outline_color = pickedOutlineColor
if("ambientocclusion")
ambientocclusion = !ambientocclusion
diff --git a/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm b/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm
index 5825460967d..2cf6f1a4834 100644
--- a/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm
+++ b/modular_skyrat/modules/customization/modules/client/preferences_savefile.dm
@@ -188,6 +188,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
READ_FILE(S["parallax"], parallax)
READ_FILE(S["ambientocclusion"], ambientocclusion)
READ_FILE(S["screentip_pref"], screentip_pref)
+ READ_FILE(S["itemoutline_pref"], itemoutline_pref)
READ_FILE(S["auto_fit_viewport"], auto_fit_viewport)
READ_FILE(S["widescreenpref"], widescreenpref)
READ_FILE(S["pixel_size"], pixel_size)
@@ -232,6 +233,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
clientfps = sanitize_integer(clientfps, 0, 1000, 40)
parallax = sanitize_integer(parallax, PARALLAX_INSANE, PARALLAX_DISABLE, null)
screentip_pref = sanitize_integer(screentip_pref, FALSE, TRUE, initial(screentip_pref))
+ itemoutline_pref = sanitize_integer(itemoutline_pref, FALSE, TRUE, initial(itemoutline_pref))
ambientocclusion = sanitize_integer(ambientocclusion, FALSE, TRUE, initial(ambientocclusion))
auto_fit_viewport = sanitize_integer(auto_fit_viewport, FALSE, TRUE, initial(auto_fit_viewport))
widescreenpref = sanitize_integer(widescreenpref, FALSE, TRUE, initial(widescreenpref))
@@ -294,6 +296,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["parallax"], parallax)
WRITE_FILE(S["ambientocclusion"], ambientocclusion)
WRITE_FILE(S["screentip_pref"], screentip_pref)
+ WRITE_FILE(S["itemoutline_pref"], itemoutline_pref)
WRITE_FILE(S["auto_fit_viewport"], auto_fit_viewport)
WRITE_FILE(S["widescreenpref"], widescreenpref)
WRITE_FILE(S["pixel_size"], pixel_size)
diff --git a/modular_skyrat/modules/item_outline/code/outline_procs.dm b/modular_skyrat/modules/item_outline/code/outline_procs.dm
deleted file mode 100644
index 1979e066a58..00000000000
--- a/modular_skyrat/modules/item_outline/code/outline_procs.dm
+++ /dev/null
@@ -1,37 +0,0 @@
-/atom/movable/screen/inventory/proc/add_stored_outline()
- if(hud?.mymob && slot_id)
- var/obj/item/inv_item = hud.mymob.get_item_by_slot(slot_id)
- if(inv_item)
- if(hud?.mymob.incapacitated())
- inv_item.apply_outline(COLOR_RED_GRAY)
- else
- inv_item.apply_outline()
-
-/atom/movable/screen/inventory/proc/remove_stored_outline()
- if(hud?.mymob && slot_id)
- var/obj/item/inv_item = hud.mymob.get_item_by_slot(slot_id)
- if(inv_item)
- inv_item.remove_outline()
-
-/obj/item/proc/apply_outline(colour = null)
- if(!Adjacent(usr) || QDELETED(src) || isobserver(usr))
- return
- if(usr.client)
- if(!usr.client.prefs.outline_enabled)
- return
- if(!colour)
- if(usr.client)
- colour = usr.client.prefs.outline_color
- if(!colour)
- colour = COLOR_BLUE_GRAY
- else
- colour = COLOR_BLUE_GRAY
- if(outline_filter)
- filters -= outline_filter
- outline_filter = filter(type="outline", size=1, color=colour)
- filters += outline_filter
-
-/obj/item/proc/remove_outline()
- if(outline_filter)
- filters -= outline_filter
- outline_filter = null
diff --git a/modular_skyrat/modules/item_outline/code/readme.md b/modular_skyrat/modules/item_outline/code/readme.md
deleted file mode 100644
index 1da2476ecf6..00000000000
--- a/modular_skyrat/modules/item_outline/code/readme.md
+++ /dev/null
@@ -1,32 +0,0 @@
-## Title: Item outlines
-
-MODULE ID: ITEM_OUTLINE
-
-### Description:
-
-Creates an outline over any items you move your mouse over, very nice!
-
-### TG Proc Changes:
-
-- /datum/component/storage/concrete/remove_from_storage
-- /atom/movable/screen/inventory/MouseEntered()
-- /atom/movable/screen/inventory/MouseExited()
-- /datum/component/storage/proc/mousedrop_onto()
-- /obj/item/proc/dropped()
-- /obj/item/attack_hand()
-- /obj/item/Initialize()
-
-### Defines:
-
-- N/A
-
-### Master file additions
-
-- N/A
-
-### Included files that are not contained in this module:
-
-- N/A
-
-### Credits:
-Gandalf2k15 - Porting
diff --git a/tgstation.dme b/tgstation.dme
index 288dbc75987..1b5dd1b8efb 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -3868,7 +3868,6 @@
#include "modular_skyrat\modules\implants\code\research\designs\medical_designs.dm"
#include "modular_skyrat\modules\implants\code\research\techweb\medical_nodes.dm"
#include "modular_skyrat\modules\inflatables\code\inflatable.dm"
-#include "modular_skyrat\modules\item_outline\code\outline_procs.dm"
#include "modular_skyrat\modules\jukebox\code\controllers\subsystem\jukeboxes.dm"
#include "modular_skyrat\modules\jukebox\code\controllers\subsystem\game\machinery\dance_machine.dm"
#include "modular_skyrat\modules\jungle\code\game\objects\structures\flora.dm"