Skip to content

Commit

Permalink
Make the inventory helper overlay less impactful (tgstation#39824)
Browse files Browse the repository at this point in the history
Reduces alpha and has a traffic light system for the items

-> red ghost when the item can't be placed
-> green ghost when it can
-> full solid colour item, object is in the inventory

This is so you can differentiate the ghost view from the actual object entering
the slot, which was sticky's primary complaint

I moved the cut of overlays only to mouse out, since if that somehow isn't
called we have bigger problems than overlays doubling up. INB4 this causes
server crashes.

Side bonus it removes one image operation, it's worth investigating a cache for
this as well I would say, a simple rotating buffer list of the last x many
images.

Tested and ready to go
  • Loading branch information
optimumtact authored and SpaceManiac committed Aug 22, 2018
1 parent 2ec9da6 commit ae7ab84
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
/obj/screen/inventory/MouseExited()
..()
cut_overlay(object_overlays)
object_overlays.Cut()

/obj/screen/inventory/update_icon()
if(!icon_empty)
Expand All @@ -147,25 +148,21 @@
/obj/screen/inventory/proc/add_overlays()
var/mob/user = hud.mymob

cut_overlay(object_overlays)
object_overlays.Cut()

if(hud && user && slot_id)
var/obj/item/holding = user.get_active_held_item()

if(!holding || user.get_item_by_slot(slot_id))
return

var/image/item_overlay = image(holding)
item_overlay.alpha = 191
object_overlays += item_overlay
item_overlay.alpha = 92

if(!user.can_equip(holding, slot_id, disable_warning = TRUE))
var/image/nope_overlay = image('icons/mob/screen_gen.dmi', "x")
nope_overlay.alpha = 128
nope_overlay.layer = item_overlay.layer + 1
object_overlays += nope_overlay
item_overlay.color = "#FF0000"
else
item_overlay.color = "#00ff00"

object_overlays += item_overlay
add_overlay(object_overlays)

/obj/screen/inventory/hand
Expand Down

0 comments on commit ae7ab84

Please sign in to comment.