Skip to content

Commit 93bc308

Browse files
authored
Merge pull request Darkrp-community#371 from zoktiik/middleclick-improvements
2 parents e3c6179 + 0492c2e commit 93bc308

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

code/_onclick/click.dm

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@
513513
if(user.get_active_held_item())
514514
return
515515
var/list/atomy = list()
516+
var/list/atomcounts = list()
517+
var/list/atomrefs = list()
516518
var/list/overrides = list()
517519
for(var/image/I in user.client.images)
518520
if(I.loc && I.loc.loc == src && I.override)
@@ -526,12 +528,26 @@
526528
continue
527529
if(A.IsObscured())
528530
continue
529-
atomy += A
530-
var/atom/AB = input(user, "[src.name]","",null) as null|anything in atomy
531+
if(!A.name)
532+
continue
533+
var/AN = A.name
534+
atomcounts[AN] += 1
535+
if(!atomrefs[AN]) // Only the FIRST item that matches the same name
536+
atomrefs[AN] = A // If this one item can't get picked up, sucks to be you
537+
if(length(atomrefs))
538+
for(var/AC in atomrefs)
539+
var/AD = "[AC] ([atomcounts[AC]])"
540+
atomy[AD] = atomrefs[AC]
541+
var/atom/AB = input(user, "What will I take?","Items on [src.name ? "\the [src.name]:" : "the floor:"]",null) as null|anything in atomy
531542
if(!AB)
532543
return
544+
if(QDELETED(atomy[AB]))
545+
return
546+
if(atomy[AB].loc != src)
547+
return
548+
var/AE = atomy[AB]
533549
user.used_intent = user.a_intent
534-
user.UnarmedAttack(AB,1,params)
550+
user.UnarmedAttack(AE,1,params)
535551

536552
/mob/proc/ShiftMiddleClickOn(atom/A, params)
537553
. = SEND_SIGNAL(src, COMSIG_MOB_MIDDLECLICKON, A)

0 commit comments

Comments
 (0)