mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Add inventory item tooltips
This commit is contained in:
@@ -94,6 +94,8 @@
|
||||
|
||||
var/drop_sound = 'sound/items/drop/device.ogg' // drop sound - this is the default
|
||||
|
||||
var/tip_timer // reference to timer id for a tooltip we might open soon
|
||||
|
||||
/obj/item/New()
|
||||
..()
|
||||
if(embed_chance < 0)
|
||||
@@ -882,4 +884,18 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
|
||||
return FALSE
|
||||
|
||||
/obj/item/proc/is_welder()
|
||||
return FALSE
|
||||
return FALSE
|
||||
|
||||
/obj/item/MouseEntered(location,control,params)
|
||||
. = ..()
|
||||
if(usr.is_preference_enabled(/datum/client_preference/inv_tooltips) && ((src in usr) || isstorage(loc))) // If in inventory or in storage we're looking at
|
||||
var/user = usr
|
||||
tip_timer = addtimer(CALLBACK(src, .proc/openTip, location, control, params, user), 5, TIMER_STOPPABLE)
|
||||
|
||||
/obj/item/MouseExited()
|
||||
. = ..()
|
||||
deltimer(tip_timer)
|
||||
closeToolTip(usr)
|
||||
|
||||
/obj/item/proc/openTip(location, control, params, user)
|
||||
openToolTip(user, src, params, title = name, content = desc)
|
||||
|
||||
@@ -165,6 +165,12 @@ var/list/_client_preferences_by_type
|
||||
enabled_description = "Show"
|
||||
disabled_description = "Hide"
|
||||
|
||||
/datum/client_preference/inv_tooltips
|
||||
description ="Inventory tooltips"
|
||||
key = "INV_TOOLTIPS"
|
||||
enabled_description = "Show"
|
||||
disabled_description = "Hide"
|
||||
|
||||
/datum/client_preference/attack_icons
|
||||
description ="Attack icons"
|
||||
key = "ATTACK_ICONS"
|
||||
|
||||
@@ -295,6 +295,19 @@
|
||||
|
||||
feedback_add_details("admin_verb","TMobTooltips") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/toggle_inv_tooltips()
|
||||
set name = "Toggle Item Tooltips"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles displaying name/desc over items when moused over (only applies in inventory)."
|
||||
|
||||
var/pref_path = /datum/client_preference/inv_tooltips
|
||||
toggle_preference(pref_path)
|
||||
SScharacter_setup.queue_preferences_save(prefs)
|
||||
|
||||
to_chat(src,"You will now [(is_preference_enabled(/datum/client_preference/inv_tooltips)) ? "see" : "not see"] inventory tooltips.")
|
||||
|
||||
feedback_add_details("admin_verb","TInvTooltips") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||
|
||||
/client/verb/toggle_hear_instruments()
|
||||
set name = "Toggle Hear/Ignore Instruments"
|
||||
set category = "Preferences"
|
||||
|
||||
Reference in New Issue
Block a user