mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-17 20:30:46 +01:00
b7969a971d
* Port lootpanel without removing old obj panel * Rip out the loot panel leaving examine tab intact * some fixes * we want nice icons * that * Switch to more robust hotkey detection * Add a reminder to ctrl-r --------- Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
48 lines
1.1 KiB
Plaintext
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
|