[MIRROR] Stack splitting now uses right click (#4283)

* Stack splitting now uses right click (#57837)

Co-authored-by: Arkatos <arkatos1234@ email.com>

* Stack splitting now uses right click

Co-authored-by: Arkatos1 <43862960+Arkatos1@users.noreply.github.com>
Co-authored-by: Arkatos <arkatos1234@ email.com>
This commit is contained in:
SkyratBot
2021-03-21 02:04:35 +01:00
committed by GitHub
parent 4ca5ad73c6
commit 80cede3490
+6 -9
View File
@@ -152,7 +152,7 @@
. += "There are [get_amount()] in the stack."
else
. += "There is [get_amount()] in the stack."
. += "<span class='notice'>Alt-click to take a custom amount.</span>"
. += "<span class='notice'><b>Right-click</b> with an empty hand to take a custom amount.</span>"
/obj/item/stack/proc/get_amount()
if(is_cyborg)
@@ -456,21 +456,18 @@
else
. = ..()
/obj/item/stack/AltClick(mob/living/user)
. = ..()
if(isturf(loc)) // to prevent people that are alt clicking a tile to see its content from getting undesidered pop ups
return
/obj/item/stack/attack_hand_secondary(mob/user, modifiers)
if(is_cyborg || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)) || zero_amount())
return
//get amount from user
return SECONDARY_ATTACK_CONTINUE_CHAIN
var/max = get_amount()
var/stackmaterial = round(input(user,"How many sheets do you wish to take out of this stack? (Maximum [max])") as null|num)
var/stackmaterial = round(input(user, "How many sheets do you wish to take out of this stack? (Maximum [max])", "Stack Split") as null|num)
max = get_amount()
stackmaterial = min(max, stackmaterial)
if(stackmaterial == null || stackmaterial <= 0 || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
return SECONDARY_ATTACK_CONTINUE_CHAIN
split_stack(user, stackmaterial)
to_chat(user, "<span class='notice'>You take [stackmaterial] sheets out of the stack.</span>")
return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
/** Splits the stack into two stacks.
*