Merge pull request #10449 from Ghommie/Ghommie-cit498

Improves the set_APTFT verb into a proc.
This commit is contained in:
Lin
2020-01-10 00:38:06 +00:00
committed by GitHub
4 changed files with 17 additions and 12 deletions

View File

@@ -9,6 +9,7 @@
w_class = WEIGHT_CLASS_TINY
var/amount_per_transfer_from_this = 5
var/list/possible_transfer_amounts = list(5,10,15,20,25,30)
var/APTFT_altclick = TRUE //will the set amount_per_transfer_from_this proc be called on AltClick() ?
var/volume = 30
var/reagent_flags
var/list/list_reagents = null
@@ -19,20 +20,12 @@
var/container_HP = 2
var/cached_icon
/obj/item/reagent_containers/verb/set_APTFT(mob/user) //set amount_per_transfer_from_this
set name = "Set Transfer Amount"
set category = "Object"
var/N = input("Amount per transfer from this:","[src]") as null|anything in possible_transfer_amounts
if(N)
amount_per_transfer_from_this = N
to_chat(user, "<span class='notice'>[src]'s transfer amount is now [amount_per_transfer_from_this] units.</span>")
/obj/item/reagent_containers/Initialize(mapload, vol)
. = ..()
if(isnum(vol) && vol > 0)
volume = vol
if(!possible_transfer_amounts)
src.verbs -= /obj/item/reagent_containers/verb/set_APTFT
if(length(possible_transfer_amounts))
verbs += /obj/item/reagent_containers/proc/set_APTFT
create_reagents(volume, reagent_flags)
if(spawned_disease)
var/datum/disease/F = new spawned_disease()
@@ -48,8 +41,18 @@
/obj/item/reagent_containers/AltClick(mob/user)
. = ..()
if(possible_transfer_amounts && user.Adjacent(src))
if(APTFT_altclick && length(possible_transfer_amounts) > 1 && user.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
set_APTFT()
return TRUE
/obj/item/reagent_containers/proc/set_APTFT(mob/user) //set amount_per_transfer_from_this
set name = "Set Transfer Amount"
set category = "Object"
set waitfor = FALSE
var/N = input("Amount per transfer from this:","[src]") as null|anything in possible_transfer_amounts
if(N)
amount_per_transfer_from_this = N
to_chat(user, "<span class='notice'>[src]'s transfer amount is now [amount_per_transfer_from_this] units.</span>")
/obj/item/reagent_containers/proc/add_initial_reagents()
if(list_reagents)

View File

@@ -8,6 +8,7 @@
var/comes_with = list() //Easy way of doing this.
volume = 10
possible_transfer_amounts = list(1,2,5,10)
APTFT_altclick = FALSE
obj_flags = UNIQUE_RENAME
unique_reskin = list("hypovial" = "hypovial",
"red hypovial" = "hypovial-b",

View File

@@ -8,6 +8,7 @@
reagent_flags = REFILLABLE | DRAINABLE
amount_per_transfer_from_this = 5
possible_transfer_amounts = list()
APTFT_altclick = FALSE
volume = 5
spillable = FALSE
var/wipe_sound

View File

@@ -8,4 +8,4 @@
spillable = TRUE
resistance_flags = ACID_PROOF
amount_per_transfer_from_this = 0
possible_transfer_amounts = list(0)
possible_transfer_amounts = list()