mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-21 11:07:12 +01:00
Allowed cyborgs to set transfer amounts on their modules. (#24573)
* Allowed cyborgs to set transfer amounts on their modules. * Added an explanation comment to the 'redundant' check. * Applied review suggestions.
This commit is contained in:
@@ -15,19 +15,43 @@
|
||||
var/temperature_min = 0 // To limit the temperature of a reagent container can atain when exposed to heat/cold
|
||||
var/temperature_max = 10000
|
||||
|
||||
/obj/item/reagent_containers/proc/can_set_transfer_amount(mob/user)
|
||||
if(!length(possible_transfer_amounts))
|
||||
// Nothing to configure.
|
||||
return FALSE
|
||||
if(isrobot(user) && src.loc == user)
|
||||
// Borgs can configure their modules.
|
||||
return TRUE
|
||||
if(!Adjacent(user))
|
||||
// No configuring the beaker across the room.
|
||||
return FALSE
|
||||
if(!ishuman(user))
|
||||
// Although a funny idea, station pets changing transfer
|
||||
// amounts on random conatiners would probably be frustrating
|
||||
// for the crew.
|
||||
return FALSE
|
||||
if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
|
||||
// I guess there's, like, a switch or a dial or something?
|
||||
// Whatever, you need to use your hands for this.
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/item/reagent_containers/AltClick(mob/user)
|
||||
if(!Adjacent(user) || !length(possible_transfer_amounts) || !ishuman(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
|
||||
if(!can_set_transfer_amount(user))
|
||||
return
|
||||
|
||||
var/new_transfer_rate = tgui_input_list(user, "Amount per transfer from this:", "[src]", possible_transfer_amounts, "[amount_per_transfer_from_this]")
|
||||
if(!new_transfer_rate)
|
||||
return
|
||||
|
||||
if(!Adjacent(user))
|
||||
to_chat(user, "<span class='warning'>You have moved too far away!</span>")
|
||||
return
|
||||
if(!ishuman(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
|
||||
to_chat(user, "<span class='warning'>You can't use your hands!</span>")
|
||||
// This looks redundant, but it's not. Time elapsed while the input
|
||||
// list was open, so we need to re-check our conditions and give an
|
||||
// error if they changed.
|
||||
if(!can_set_transfer_amount(user))
|
||||
if(!Adjacent(user))
|
||||
to_chat(user, "<span class='warning'>You have moved too far away!</span>")
|
||||
if(!ishuman(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
|
||||
to_chat(user, "<span class='warning'>You can't use your hands!</span>")
|
||||
return
|
||||
|
||||
amount_per_transfer_from_this = new_transfer_rate
|
||||
|
||||
Reference in New Issue
Block a user