Files
Bubberstation/code/modules/lootpanel/ui.dm
SkyratBot b572cd89cc [MIRROR] Enables right click, alt click, ctrl click for alt-click item window (#27675)
* Enables right click, alt click, ctrl click for alt-click item window (#83179)

## About The Pull Request

This fix enables most of the clicks that have been disabled in the alt
click menu up to this point. However, I did have to cut out the pointing
thing it would do for right clicking. The only thing you aren't able to
do with the new alt-click menu at this point is dragging items onto each
other, pointing, and the shift-click context menu. Maybe we'll leave
that for another PR, because I think I'd have to rewrite core components
of TGUI for that?
## Why It's Good For The Game

Lets you perform almost all of the alternative and right click functions
on things you have alt-clicked the tiles for. I believe this outweighs
the benefits of pointing at stuff on a tile instead.
## Changelog

The alt-click item panel now lets you perform most of the alternative
click options.
🆑 Bisar
qol: Most of the alternate click modes (right click, control clicking,
shift clicking, etc) have been enabled in the alt-click item menu.
fix: You will no longer point at things you right-click in the alt-click
item menu.
/🆑

* Enables right click, alt click, ctrl click for alt-click item window

---------

Co-authored-by: Joshua Kidder <49173900+Metekillot@users.noreply.github.com>
2024-05-15 00:58:09 +02:00

48 lines
1.1 KiB
Plaintext

/// UI helper for converting the associative list to a list of lists
/datum/lootpanel/proc/get_contents()
var/list/items = list()
for(var/datum/search_object/index as anything in contents)
UNTYPED_LIST_ADD(items, list(
"icon_state" = index.icon_state,
"icon" = index.icon,
"name" = index.name,
"path" = index.path,
"ref" = REF(index),
))
return items
/// Clicks an object from the contents. Validates the object and the user
/datum/lootpanel/proc/grab(mob/user, list/params)
var/ref = params["ref"]
if(isnull(ref))
return FALSE
var/datum/search_object/index = locate(ref) in contents
var/atom/thing = index?.item
if(QDELETED(index) || QDELETED(thing)) // Obj is gone
return FALSE
if(thing != source_turf && !(locate(thing) in source_turf.contents))
qdel(index) // Item has moved
return TRUE
var/modifiers = ""
if(params["ctrl"])
modifiers += "ctrl=1;"
if(params["middle"])
modifiers += "middle=1;"
if(params["shift"])
modifiers += "shift=1;"
if(params["alt"])
modifiers += "alt=1;"
if(params["right"])
modifiers += "right=1;"
user.ClickOn(thing, modifiers)
return TRUE