Fixed alt-click not working with stacks (#34396)
* Can disable auto-merge New argument which lets you stop stacks from automatically merging when picking them up * Fix 0 stacks * Updated simple_animal/put_in_hands()
This commit is contained in:
committed by
CitadelStationBot
parent
969a8ac9ef
commit
ac1b2f76ef
@@ -321,7 +321,7 @@
|
|||||||
var/obj/item/stack/F = new type(user, amount, FALSE)
|
var/obj/item/stack/F = new type(user, amount, FALSE)
|
||||||
. = F
|
. = F
|
||||||
F.copy_evidences(src)
|
F.copy_evidences(src)
|
||||||
user.put_in_hands(F)
|
user.put_in_hands(F, merge_stacks=FALSE)
|
||||||
add_fingerprint(user)
|
add_fingerprint(user)
|
||||||
F.add_fingerprint(user)
|
F.add_fingerprint(user)
|
||||||
use(amount, TRUE)
|
use(amount, TRUE)
|
||||||
|
|||||||
@@ -202,7 +202,7 @@
|
|||||||
//Puts the item our active hand if possible. Failing that it tries other hands. Returns TRUE on success.
|
//Puts the item our active hand if possible. Failing that it tries other hands. Returns TRUE on success.
|
||||||
//If both fail it drops it on the floor and returns FALSE.
|
//If both fail it drops it on the floor and returns FALSE.
|
||||||
//This is probably the main one you need to know :)
|
//This is probably the main one you need to know :)
|
||||||
/mob/proc/put_in_hands(obj/item/I, del_on_fail = FALSE)
|
/mob/proc/put_in_hands(obj/item/I, del_on_fail = FALSE, merge_stacks = TRUE)
|
||||||
if(!I)
|
if(!I)
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
@@ -211,16 +211,20 @@
|
|||||||
var/obj/item/stack/I_stack = I
|
var/obj/item/stack/I_stack = I
|
||||||
var/obj/item/stack/active_stack = get_active_held_item()
|
var/obj/item/stack/active_stack = get_active_held_item()
|
||||||
|
|
||||||
if (istype(active_stack) && istype(I_stack, active_stack.merge_type))
|
if (I_stack.zero_amount())
|
||||||
if (I_stack.merge(active_stack))
|
return FALSE
|
||||||
to_chat(usr, "<span class='notice'>Your [active_stack.name] stack now contains [active_stack.get_amount()] [active_stack.singular_name]\s.</span>")
|
|
||||||
return TRUE
|
if (merge_stacks)
|
||||||
else
|
if (istype(active_stack) && istype(I_stack, active_stack.merge_type))
|
||||||
var/obj/item/stack/inactive_stack = get_inactive_held_item()
|
if (I_stack.merge(active_stack))
|
||||||
if (istype(inactive_stack) && istype(I_stack, inactive_stack.merge_type))
|
to_chat(usr, "<span class='notice'>Your [active_stack.name] stack now contains [active_stack.get_amount()] [active_stack.singular_name]\s.</span>")
|
||||||
if (I_stack.merge(inactive_stack))
|
|
||||||
to_chat(usr, "<span class='notice'>Your [inactive_stack.name] stack now contains [inactive_stack.get_amount()] [inactive_stack.singular_name]\s.</span>")
|
|
||||||
return TRUE
|
return TRUE
|
||||||
|
else
|
||||||
|
var/obj/item/stack/inactive_stack = get_inactive_held_item()
|
||||||
|
if (istype(inactive_stack) && istype(I_stack, inactive_stack.merge_type))
|
||||||
|
if (I_stack.merge(inactive_stack))
|
||||||
|
to_chat(usr, "<span class='notice'>Your [inactive_stack.name] stack now contains [inactive_stack.get_amount()] [inactive_stack.singular_name]\s.</span>")
|
||||||
|
return TRUE
|
||||||
|
|
||||||
if(put_in_active_hand(I))
|
if(put_in_active_hand(I))
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|||||||
@@ -502,8 +502,8 @@
|
|||||||
if(H)
|
if(H)
|
||||||
H.update_icon()
|
H.update_icon()
|
||||||
|
|
||||||
/mob/living/simple_animal/put_in_hands(obj/item/I)
|
/mob/living/simple_animal/put_in_hands(obj/item/I, del_on_fail = FALSE, merge_stacks = TRUE)
|
||||||
..()
|
..(I, del_on_fail, merge_stacks)
|
||||||
update_inv_hands()
|
update_inv_hands()
|
||||||
|
|
||||||
/mob/living/simple_animal/update_inv_hands()
|
/mob/living/simple_animal/update_inv_hands()
|
||||||
|
|||||||
Reference in New Issue
Block a user