Adds special click actions for Toggle Suit Sensors and Set Transfer Amount (#18431)

* Add AltClick action for setting container transfer amount

* Move jumpsuit accessory removal to AltShiftClick

* Add AltClick action for toggling jumpsuit sensors

* Fix toggling transfer amounts/suit sensors remotely/through windows

* HAS_TRAIR

* Revert the jumpsuit AltClick-AltShiftClick action swap

* Move adjacency checks into the main procs; fix whoopsie

* Update reagent container/jumpsuit examine messages

* Fix Set Transfer Amount verb catching items on the floor; spacing

* Refine guard clauses

* Use warning spans when mob moves away from item during dialog

* Add post-`input()` sanity checks

* Magic numbers begone
This commit is contained in:
Nathan Winters
2022-07-20 18:05:33 +01:00
committed by GitHub
parent d028faf515
commit 07219f941c
2 changed files with 54 additions and 25 deletions
+16 -3
View File
@@ -17,17 +17,29 @@
/obj/item/reagent_containers/verb/set_APTFT() //set amount_per_transfer_from_this
set name = "Set transfer amount"
set category = "Object"
set src in range(0)
set src in usr
if(usr.incapacitated())
if(!usr.Adjacent(src) || !ishuman(usr) || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED))
return
var/default = null
if(amount_per_transfer_from_this in possible_transfer_amounts)
default = amount_per_transfer_from_this
var/N = input("Amount per transfer from this:", "[src]", default) as null|anything in possible_transfer_amounts
if(!usr.Adjacent(src))
to_chat(usr, "<span class='warning'>You have moved too far away!</span>")
return
if(!ishuman(usr) || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED))
to_chat(usr, "<span class='warning'>You can't use your hands!</span>")
return
if(N)
amount_per_transfer_from_this = N
/obj/item/reagent_containers/AltClick()
set_APTFT()
/obj/item/reagent_containers/New()
create_reagents(volume, temperature_min, temperature_max)
..()
@@ -91,4 +103,5 @@
// Food has no valid possible_transfer_amounts, and we don't want to show
// this message on examining food.
if(possible_transfer_amounts)
. += "<span class='notice'>It will transfer [amount_per_transfer_from_this] unit[amount_per_transfer_from_this > 1 ? "s" : ""] at a time."
. += "<span class='notice'>It will transfer [amount_per_transfer_from_this] unit[amount_per_transfer_from_this > 1 ? "s" : ""] at a time.</span>"
. += "<span class='notice'>Alt-click to change the transfer amount.</span>"