|
513 | 513 | if(user.get_active_held_item())
|
514 | 514 | return
|
515 | 515 | var/list/atomy = list()
|
| 516 | + var/list/atomcounts = list() |
| 517 | + var/list/atomrefs = list() |
516 | 518 | var/list/overrides = list()
|
517 | 519 | for(var/image/I in user.client.images)
|
518 | 520 | if(I.loc && I.loc.loc == src && I.override)
|
|
526 | 528 | continue
|
527 | 529 | if(A.IsObscured())
|
528 | 530 | 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 |
531 | 542 | if(!AB)
|
532 | 543 | return
|
| 544 | + if(QDELETED(atomy[AB])) |
| 545 | + return |
| 546 | + if(atomy[AB].loc != src) |
| 547 | + return |
| 548 | + var/AE = atomy[AB] |
533 | 549 | user.used_intent = user.a_intent
|
534 |
| - user.UnarmedAttack(AB,1,params) |
| 550 | + user.UnarmedAttack(AE,1,params) |
535 | 551 |
|
536 | 552 | /mob/proc/ShiftMiddleClickOn(atom/A, params)
|
537 | 553 | . = SEND_SIGNAL(src, COMSIG_MOB_MIDDLECLICKON, A)
|
|
0 commit comments