Merge pull request #15032 from keronshb/itemhighlight
Ports Inventory Outlines
This commit is contained in:
@@ -146,6 +146,9 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
|
||||
var/list/grind_results //A reagent list containing the reagents this item produces when ground up in a grinder - this can be an empty list to allow for reagent transferring only
|
||||
var/list/juice_results //A reagent list containing blah blah... but when JUICED in a grinder!
|
||||
|
||||
//the outline filter on hover
|
||||
var/outline_filter
|
||||
|
||||
/* Our block parry data. Should be set in init, or something if you are using it.
|
||||
* This won't be accessed without ITEM_CAN_BLOCK or ITEM_CAN_PARRY so do not set it unless you have to to save memory.
|
||||
* If you decide it's a good idea to leave this unset while turning the flags on, you will runtime. Enjoy.
|
||||
@@ -175,6 +178,12 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
|
||||
if(force_string)
|
||||
item_flags |= FORCE_STRING_OVERRIDE
|
||||
|
||||
if(istype(loc, /obj/item/storage))
|
||||
item_flags |= IN_STORAGE
|
||||
|
||||
if(istype(loc, /obj/item/robot_module))
|
||||
item_flags |= IN_INVENTORY
|
||||
|
||||
if(!hitsound)
|
||||
if(damtype == "fire")
|
||||
hitsound = 'sound/items/welder.ogg'
|
||||
@@ -373,6 +382,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
|
||||
if(!allow_attack_hand_drop(user) || !user.temporarilyRemoveItemFromInventory(src))
|
||||
return
|
||||
|
||||
remove_outline()
|
||||
pickup(user)
|
||||
add_fingerprint(user)
|
||||
if(!user.put_in_active_hand(src, FALSE, FALSE))
|
||||
@@ -443,6 +453,7 @@ 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()
|
||||
// if(!silent)
|
||||
// playsound(src, drop_sound, DROP_SOUND_VOLUME, ignore_walls = FALSE)
|
||||
user?.update_equipment_speed_mods()
|
||||
@@ -867,18 +878,49 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb
|
||||
openToolTip(user,src,params,title = name,content = "[desc]<br><b>Force:</b> [force_string]",theme = "")
|
||||
|
||||
/obj/item/MouseEntered(location, control, params)
|
||||
if((item_flags & IN_INVENTORY) && usr.client.prefs.enable_tips && !QDELETED(src))
|
||||
SEND_SIGNAL(src, COMSIG_ITEM_MOUSE_ENTER, location, control, params)
|
||||
if((item_flags & IN_INVENTORY || item_flags & IN_STORAGE) && usr.client.prefs.enable_tips && !QDELETED(src) || isobserver(usr))
|
||||
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.
|
||||
var/mob/living/L = usr
|
||||
if(istype(L) && L.incapacitated())
|
||||
apply_outline(COLOR_RED_GRAY)
|
||||
else
|
||||
apply_outline()
|
||||
|
||||
/obj/item/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params)
|
||||
. = ..()
|
||||
remove_outline()
|
||||
|
||||
/obj/item/MouseExited(location,control,params)
|
||||
SEND_SIGNAL(src, COMSIG_ITEM_MOUSE_EXIT, location, control, params)
|
||||
deltimer(tip_timer)//delete any in-progress timer if the mouse is moved off the item before it finishes
|
||||
closeToolTip(usr)
|
||||
remove_outline()
|
||||
|
||||
/obj/item/MouseEntered(location,control,params)
|
||||
SEND_SIGNAL(src, COMSIG_ITEM_MOUSE_ENTER, location, control, params)
|
||||
/obj/item/proc/apply_outline(colour = null)
|
||||
if(!(item_flags & IN_INVENTORY || item_flags & IN_STORAGE) || QDELETED(src))
|
||||
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
|
||||
|
||||
// Called when a mob tries to use the item as a tool.
|
||||
// Handles most checks.
|
||||
|
||||
Reference in New Issue
Block a user