Almost all reagent containers now have verb to change how many contents will be transferred from. Syringes and hypospray haven't such feature, that is intentional.

Rephrased some of APC repairing messages to be more clear.


git-svn-id: http://tgstation13.googlecode.com/svn/trunk@873 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
rastaf.zero@gmail.com
2011-01-16 13:28:29 +00:00
parent 7df3994016
commit 33bf34e94c
2 changed files with 90 additions and 63 deletions

View File

@@ -1,7 +1,3 @@
// Bottles transfer 50 units
// Beakers transfer 50 units
// Syringes transfer 15 units
// Droppers transfer 5 units
//BUG!!!: reactions on splashing etc cause errors because stuff gets deleted before it executes. //BUG!!!: reactions on splashing etc cause errors because stuff gets deleted before it executes.
// Bandaid fix using spawn - very ugly, need to fix this. // Bandaid fix using spawn - very ugly, need to fix this.
@@ -295,6 +291,7 @@
pressure_resistance = 2*ONE_ATMOSPHERE pressure_resistance = 2*ONE_ATMOSPHERE
var/amount_per_transfer_from_this = 10 var/amount_per_transfer_from_this = 10
var/possible_transfer_amounts = list(10,25,50,100)
attackby(obj/item/weapon/W as obj, mob/user as mob) attackby(obj/item/weapon/W as obj, mob/user as mob)
return return
@@ -303,6 +300,9 @@
var/datum/reagents/R = new/datum/reagents(1000) var/datum/reagents/R = new/datum/reagents(1000)
reagents = R reagents = R
R.my_atom = src R.my_atom = src
if (!possible_transfer_amounts)
src.verbs -= /obj/reagent_dispensers/verb/set_APTFT
..()
examine() examine()
set src in view(2) set src in view(2)
@@ -315,6 +315,13 @@
else else
usr << "\blue Nothing." usr << "\blue Nothing."
verb/set_APTFT() //set amount_per_transfer_from_this
set name = "Set transfer amount"
set src in range(1)
var/N = input("Amount per transfer from this:","[src]") as null|anything in possible_transfer_amounts
if (N)
amount_per_transfer_from_this = N
ex_act(severity) ex_act(severity)
switch(severity) switch(severity)
if(1.0) if(1.0)
@@ -347,9 +354,20 @@
icon_state = null icon_state = null
w_class = 1 w_class = 1
var/amount_per_transfer_from_this = 5 var/amount_per_transfer_from_this = 5
var/possible_transfer_amounts = list(5,10,25)
verb/set_APTFT() //set amount_per_transfer_from_this
set name = "Set transfer amount"
set src in range(0)
var/N = input("Amount per transfer from this:","[src]") as null|anything in possible_transfer_amounts
if (N)
amount_per_transfer_from_this = N
/* New() New()
var/datum/reagents/R = new/datum/reagents(50) if (!possible_transfer_amounts)
src.verbs -= /obj/item/weapon/reagent_containers/verb/set_APTFT
..()
/* var/datum/reagents/R = new/datum/reagents(50)
reagents = R reagents = R
R.my_atom = src */ R.my_atom = src */
@@ -374,19 +392,21 @@
icon_state = "null" icon_state = "null"
item_state = "null" item_state = "null"
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,25)
flags = FPRINT | TABLEPASS | OPENCONTAINER flags = FPRINT | TABLEPASS | OPENCONTAINER
var/list/can_be_placed_into = list( var/list/can_be_placed_into = list(
/obj/machinery/chem_master/, /obj/machinery/chem_master/,
/obj/table, /obj/table,
/obj/secure_closet, /obj/secure_closet,
/obj/closet, /obj/closet,
/obj/item/weapon/storage, /obj/item/weapon/storage,
/obj/machinery/atmospherics/unary/cryo_cell, /obj/machinery/atmospherics/unary/cryo_cell,
/obj/item/weapon/chem_grenade, /obj/item/weapon/chem_grenade,
/obj/machinery/bot/medbot, /obj/machinery/bot/medbot,
/obj/machinery/computer/pandemic, /obj/machinery/computer/pandemic,
/obj/item/weapon/secstorage/ssafe) /obj/item/weapon/secstorage/ssafe
)
examine() examine()
set src in view(2) set src in view(2)
@@ -403,6 +423,7 @@
var/datum/reagents/R = new/datum/reagents(50) var/datum/reagents/R = new/datum/reagents(50)
reagents = R reagents = R
R.my_atom = src R.my_atom = src
..()
afterattack(obj/target, mob/user , flag) afterattack(obj/target, mob/user , flag)
@@ -427,7 +448,7 @@
user << "\red [src] is full." user << "\red [src] is full."
return return
var/trans = target.reagents.trans_to(src, 10) var/trans = target.reagents.trans_to(src, target:amount_per_transfer_from_this)
user << "\blue You fill [src] with [trans] units of the contents of [target]." user << "\blue You fill [src] with [trans] units of the contents of [target]."
else if(target.is_open_container() && target.reagents) //Something like a glass. Player probably wants to transfer TO it. else if(target.is_open_container() && target.reagents) //Something like a glass. Player probably wants to transfer TO it.
@@ -439,7 +460,7 @@
user << "\red [target] is full." user << "\red [target] is full."
return return
var/trans = src.reagents.trans_to(target, 10) var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
user << "\blue You transfer [trans] units of the solution to [target]." user << "\blue You transfer [trans] units of the solution to [target]."
else if(reagents.total_volume) else if(reagents.total_volume)
@@ -461,12 +482,14 @@
icon = 'chemical.dmi' icon = 'chemical.dmi'
icon_state = "dropper0" icon_state = "dropper0"
amount_per_transfer_from_this = 5 amount_per_transfer_from_this = 5
possible_transfer_amounts = list(1,2,3,4,5)
var/filled = 0 var/filled = 0
New() New()
var/datum/reagents/R = new/datum/reagents(5) var/datum/reagents/R = new/datum/reagents(5)
reagents = R reagents = R
R.my_atom = src R.my_atom = src
..()
afterattack(obj/target, mob/user , flag) afterattack(obj/target, mob/user , flag)
if(!target.reagents) return if(!target.reagents) return
@@ -486,10 +509,11 @@
O.show_message(text("\red <B>[] drips something onto []!</B>", user, target), 1) O.show_message(text("\red <B>[] drips something onto []!</B>", user, target), 1)
src.reagents.reaction(target, TOUCH) src.reagents.reaction(target, TOUCH)
spawn(5) src.reagents.trans_to(target, 5) var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
user << "\blue You transfer 5 units of the solution." user << "\blue You transfer [trans] units of the solution."
filled = 0 if (src.reagents.total_volume<=0)
icon_state = "dropper[filled]" filled = 0
icon_state = "dropper[filled]"
else else
@@ -501,9 +525,9 @@
user << "\red [target] is empty." user << "\red [target] is empty."
return return
target.reagents.trans_to(src, 5) var/trans = target.reagents.trans_to(src, amount_per_transfer_from_this)
user << "\blue You fill the dropper with 5 units of the solution." user << "\blue You fill the dropper with [trans] units of the solution."
filled = 1 filled = 1
icon_state = "dropper[filled]" icon_state = "dropper[filled]"
@@ -523,6 +547,7 @@
item_state = "syringe_0" item_state = "syringe_0"
icon_state = "0" icon_state = "0"
amount_per_transfer_from_this = 5 amount_per_transfer_from_this = 5
possible_transfer_amounts = null //list(5,10,15)
var/mode = "d" var/mode = "d"
New() New()
@@ -530,6 +555,7 @@
reagents = R reagents = R
R.maximum_volume = 15 R.maximum_volume = 15
R.my_atom = src R.my_atom = src
..()
on_reagent_change() on_reagent_change()
update_icon() update_icon()
@@ -613,9 +639,9 @@
user << "\red You cannot directly remove reagents from this object." user << "\red You cannot directly remove reagents from this object."
return return
target.reagents.trans_to(src, 5) var/trans = target.reagents.trans_to(src, target:amount_per_transfer_from_this)
user << "\blue You fill the syringe with 5 units of the solution." user << "\blue You fill the syringe with [trans] units of the solution."
if("i") if("i")
if(!reagents.total_volume) if(!reagents.total_volume)
@@ -640,8 +666,8 @@
if(ismob(target) && target == user) if(ismob(target) && target == user)
src.reagents.reaction(target, INGEST) src.reagents.reaction(target, INGEST)
spawn(5) spawn(5)
src.reagents.trans_to(target, 5) var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
user << "\blue You inject 5 units of the solution. The syringe now contains [src.reagents.total_volume] units." user << "\blue You inject [trans] units of the solution. The syringe now contains [src.reagents.total_volume] units."
return return
update_icon() update_icon()
@@ -667,11 +693,11 @@
item_state = "hypo" item_state = "hypo"
icon_state = "hypo" icon_state = "hypo"
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
possible_transfer_amounts = null
flags = FPRINT | ONBELT | TABLEPASS | OPENCONTAINER flags = FPRINT | ONBELT | TABLEPASS | OPENCONTAINER
/obj/item/weapon/reagent_containers/hypospray/attack_paw(mob/user as mob) /obj/item/weapon/reagent_containers/hypospray/attack_paw(mob/user as mob)
return src.attack_hand(user) return src.attack_hand(user)
return
/obj/item/weapon/reagent_containers/hypospray/New() /obj/item/weapon/reagent_containers/hypospray/New()
var/datum/reagents/R = new/datum/reagents(30) var/datum/reagents/R = new/datum/reagents(30)
@@ -685,11 +711,12 @@
if (!( istype(M, /mob) )) if (!( istype(M, /mob) ))
return return
if (reagents.total_volume) if (reagents.total_volume)
user << "\red You inject [M] with the hypospray." user << "\blue You inject [M] with the hypospray."
M << "\red You feel a tiny prick!" M << "\red You feel a tiny prick!"
src.reagents.reaction(M, INGEST) src.reagents.reaction(M, INGEST)
if(M.reagents) reagents.trans_to(M, 10) if(M.reagents)
user << "\red 10 units injected. [reagents.total_volume] units remaining in the hypospray." var/trans = reagents.trans_to(M, amount_per_transfer_from_this)
user << "\blue [trans] units injected. [reagents.total_volume] units remaining in the hypospray."
return return
@@ -697,6 +724,7 @@
/// Food. /// Food.
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/obj/item/weapon/reagent_containers/food /obj/item/weapon/reagent_containers/food
possible_transfer_amounts = null
New() //Sets the default container amount for all food items. New() //Sets the default container amount for all food items.
var/datum/reagents/R = new/datum/reagents(50) // if you want a food item with a different capacity var/datum/reagents/R = new/datum/reagents(50) // if you want a food item with a different capacity
@@ -704,6 +732,7 @@
R.my_atom = src R.my_atom = src
src.pixel_x = rand(-5.0, 5) //Randomizes postion slightly. src.pixel_x = rand(-5.0, 5) //Randomizes postion slightly.
src.pixel_y = rand(-5.0, 5) src.pixel_y = rand(-5.0, 5)
..()
/obj/item/weapon/reagent_containers/food/condiment //Food items that aren't eaten normally and leave an empty container behind. /obj/item/weapon/reagent_containers/food/condiment //Food items that aren't eaten normally and leave an empty container behind.
name = "Condiment Container" name = "Condiment Container"
@@ -711,6 +740,7 @@
icon = 'food.dmi' icon = 'food.dmi'
icon_state = "emptycondiment" icon_state = "emptycondiment"
flags = FPRINT | TABLEPASS | OPENCONTAINER flags = FPRINT | TABLEPASS | OPENCONTAINER
possible_transfer_amounts = list(1,5,10)
attackby(obj/item/weapon/W as obj, mob/user as mob) attackby(obj/item/weapon/W as obj, mob/user as mob)
return return
@@ -719,7 +749,7 @@
attack(mob/M as mob, mob/user as mob, def_zone) attack(mob/M as mob, mob/user as mob, def_zone)
var/datum/reagents/R = src.reagents var/datum/reagents/R = src.reagents
if(!R.total_volume || !R) if(!R || !R.total_volume)
user << "\red None of [src] left, oh no!" user << "\red None of [src] left, oh no!"
return 0 return 0
@@ -763,7 +793,7 @@
user << "\red [src] is full." user << "\red [src] is full."
return return
var/trans = target.reagents.trans_to(src, 5) var/trans = target.reagents.trans_to(src, target:amount_per_transfer_from_this)
user << "\blue You fill [src] with [trans] units of the contents of [target]." user << "\blue You fill [src] with [trans] units of the contents of [target]."
//Something like a glass or a food item. Player probably wants to transfer TO it. //Something like a glass or a food item. Player probably wants to transfer TO it.
@@ -774,7 +804,7 @@
if(target.reagents.total_volume >= target.reagents.maximum_volume) if(target.reagents.total_volume >= target.reagents.maximum_volume)
user << "\red you can't add anymore to [target]." user << "\red you can't add anymore to [target]."
return return
var/trans = src.reagents.trans_to(target, 5) var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
user << "\blue You transfer [trans] units of the condiment to [target]." user << "\blue You transfer [trans] units of the condiment to [target]."
@@ -869,6 +899,7 @@
icon_state = null icon_state = null
flags = FPRINT | TABLEPASS | OPENCONTAINER flags = FPRINT | TABLEPASS | OPENCONTAINER
var/gulp_size = 5 //This is now officially broken ... need to think of a nice way to fix it. var/gulp_size = 5 //This is now officially broken ... need to think of a nice way to fix it.
possible_transfer_amounts = list(5,10,25)
New() New()
var/datum/reagents/R = new/datum/reagents(50) var/datum/reagents/R = new/datum/reagents(50)
@@ -916,7 +947,7 @@
if(isrobot(user)) //Cyborg modules that include drinks automatically refill themselves, but drain the borg's cell if(isrobot(user)) //Cyborg modules that include drinks automatically refill themselves, but drain the borg's cell
var/mob/living/silicon/robot/bro = user var/mob/living/silicon/robot/bro = user
bro.cell.charge -= 30 bro.cell.use(30)
var/refill = R.get_master_reagent_id() var/refill = R.get_master_reagent_id()
spawn(600) spawn(600)
R.add_reagent(refill, fillevel) R.add_reagent(refill, fillevel)
@@ -942,7 +973,7 @@
user << "\red [src] is full." user << "\red [src] is full."
return return
var/trans = target.reagents.trans_to(src, 10) var/trans = target.reagents.trans_to(src, target:amount_per_transfer_from_this)
user << "\blue You fill [src] with [trans] units of the contents of [target]." user << "\blue You fill [src] with [trans] units of the contents of [target]."
else if(target.is_open_container()) //Something like a glass. Player probably wants to transfer TO it. else if(target.is_open_container()) //Something like a glass. Player probably wants to transfer TO it.
@@ -954,12 +985,12 @@
user << "\red [target] is full." user << "\red [target] is full."
return return
var/trans = src.reagents.trans_to(target, 10) var/trans = src.reagents.trans_to(target, amount_per_transfer_from_this)
user << "\blue You transfer [trans] units of the solution to [target]." user << "\blue You transfer [trans] units of the solution to [target]."
if(isrobot(user)) //Cyborg modules that include drinks automatically refill themselves, but drain the borg's cell if(isrobot(user)) //Cyborg modules that include drinks automatically refill themselves, but drain the borg's cell
var/mob/living/silicon/robot/bro = user var/mob/living/silicon/robot/bro = user
bro.cell.charge -= 30 bro.cell.use(30)
var/refill = reagents.get_master_reagent_id() var/refill = reagents.get_master_reagent_id()
spawn(600) spawn(600)
reagents.add_reagent(refill, trans) reagents.add_reagent(refill, trans)
@@ -978,6 +1009,7 @@
icon = 'chemical.dmi' icon = 'chemical.dmi'
icon_state = null icon_state = null
item_state = "pill" item_state = "pill"
possible_transfer_amounts = null
New() New()
var/datum/reagents/R = new/datum/reagents(50) var/datum/reagents/R = new/datum/reagents(50)
@@ -1060,9 +1092,10 @@
m_amt = 200 m_amt = 200
g_amt = 0 g_amt = 0
w_class = 3.0 w_class = 3.0
amount_per_transfer_from_this = 20 amount_per_transfer_from_this = 20
possible_transfer_amounts = list(10,20,30,50,70)
flags = FPRINT | OPENCONTAINER flags = FPRINT | OPENCONTAINER
New() New()
var/datum/reagents/R = new/datum/reagents(70) var/datum/reagents/R = new/datum/reagents(70)
reagents = R reagents = R
@@ -1094,6 +1127,7 @@
w_class = 4.0 w_class = 4.0
amount_per_transfer_from_this = 20 amount_per_transfer_from_this = 20
possible_transfer_amounts = list(10,20,30,60)
flags = FPRINT flags = FPRINT
New() New()
var/datum/reagents/R = new/datum/reagents(120) var/datum/reagents/R = new/datum/reagents(120)
@@ -1165,6 +1199,7 @@
icon_state = null icon_state = null
item_state = "atoxinbottle" item_state = "atoxinbottle"
amount_per_transfer_from_this = 10 amount_per_transfer_from_this = 10
possible_transfer_amounts = list(5,10,15)
flags = FPRINT | TABLEPASS | OPENCONTAINER flags = FPRINT | TABLEPASS | OPENCONTAINER
New() New()
@@ -1906,11 +1941,8 @@
attackby(obj/item/weapon/W as obj, mob/user as mob) attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/kitchenknife /*|| /obj/item/weapon/scalpel*/)) if(istype(W, /obj/item/weapon/kitchenknife /*|| /obj/item/weapon/scalpel*/))
W.visible_message(" \red <B>You slice the meatbread! </B>", 1) W.visible_message(" \red <B>You slice the meatbread! </B>", 1)
new /obj/item/weapon/reagent_containers/food/snacks/meatbreadslice (src.loc) for(var/i=0,i<5,i++)
new /obj/item/weapon/reagent_containers/food/snacks/meatbreadslice (src.loc) new /obj/item/weapon/reagent_containers/food/snacks/meatbreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/meatbreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/meatbreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/meatbreadslice (src.loc)
del(src) del(src)
return return
@@ -1936,11 +1968,8 @@
attackby(obj/item/weapon/W as obj, mob/user as mob) attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/kitchenknife /*|| /obj/item/weapon/scalpel*/)) if(istype(W, /obj/item/weapon/kitchenknife /*|| /obj/item/weapon/scalpel*/))
W.visible_message(" \red <B>You slice the xenomeatbread! </B>", 1) W.visible_message(" \red <B>You slice the xenomeatbread! </B>", 1)
new /obj/item/weapon/reagent_containers/food/snacks/xenomeatbreadslice (src.loc) for(var/i=0,i<5,i++)
new /obj/item/weapon/reagent_containers/food/snacks/xenomeatbreadslice (src.loc) new /obj/item/weapon/reagent_containers/food/snacks/xenomeatbreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/xenomeatbreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/xenomeatbreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/xenomeatbreadslice (src.loc)
del(src) del(src)
return return
@@ -1966,11 +1995,8 @@
attackby(obj/item/weapon/W as obj, mob/user as mob) attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/kitchenknife /*|| /obj/item/weapon/scalpel*/)) if(istype(W, /obj/item/weapon/kitchenknife /*|| /obj/item/weapon/scalpel*/))
W.visible_message(" \red <B>You slice the tofubread! </B>", 1) W.visible_message(" \red <B>You slice the tofubread! </B>", 1)
new /obj/item/weapon/reagent_containers/food/snacks/tofubreadslice (src.loc) for(var/i=0,i<5,i++)
new /obj/item/weapon/reagent_containers/food/snacks/tofubreadslice (src.loc) new /obj/item/weapon/reagent_containers/food/snacks/tofubreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/tofubreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/tofubreadslice (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/tofubreadslice (src.loc)
del(src) del(src)
return return
@@ -1996,11 +2022,8 @@
attackby(obj/item/weapon/W as obj, mob/user as mob) attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/kitchenknife /* || /obj/item/weapon/scalpel*/)) if(istype(W, /obj/item/weapon/kitchenknife /* || /obj/item/weapon/scalpel*/))
W.visible_message(" \red <B> You slice the cheese! </B>", 1) W.visible_message(" \red <B> You slice the cheese! </B>", 1)
new /obj/item/weapon/reagent_containers/food/snacks/cheesewedge (src.loc) for(var/i=0,i<5,i++)
new /obj/item/weapon/reagent_containers/food/snacks/cheesewedge (src.loc) new /obj/item/weapon/reagent_containers/food/snacks/cheesewedge (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/cheesewedge (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/cheesewedge (src.loc)
new /obj/item/weapon/reagent_containers/food/snacks/cheesewedge (src.loc)
del(src) del(src)
return return
@@ -2081,7 +2104,10 @@
icon_state = "oliveoil" icon_state = "oliveoil"
else else
name = "Misc Condiment Bottle" name = "Misc Condiment Bottle"
desc = "A mixture of various condiments" if (reagents.reagent_list.len==1)
desc = "Looks like it is [reagents.get_master_reagent_name()], but you are not sure."
else
desc = "A mixture of various condiments. [reagents.get_master_reagent_name()] is one of them."
icon_state = "mixedcondiments" icon_state = "mixedcondiments"
else else
icon_state = "emptycondiment" icon_state = "emptycondiment"
@@ -2473,6 +2499,7 @@
amount_per_transfer_from_this = 5 amount_per_transfer_from_this = 5
icon = 'vending.dmi' icon = 'vending.dmi'
icon_state = "water_cooler" icon_state = "water_cooler"
possible_transfer_amounts = null
New() New()
..() ..()
anchored = 1 anchored = 1

View File

@@ -327,7 +327,7 @@
user << "You fail to [ locked ? "unlock" : "lock"] the APC interface." user << "You fail to [ locked ? "unlock" : "lock"] the APC interface."
else if (istype(W, /obj/item/weapon/cable_coil) && !terminal && opened && has_electronics!=2) else if (istype(W, /obj/item/weapon/cable_coil) && !terminal && opened && has_electronics!=2)
if (src.loc:intact) if (src.loc:intact)
user << "\red You must remove the plating first." user << "\red You must remove the floor plating first."
return return
var/obj/item/weapon/cable_coil/C = W var/obj/item/weapon/cable_coil/C = W
if(C.amount < 10) if(C.amount < 10)
@@ -348,7 +348,7 @@
terminal.connect_to_network() terminal.connect_to_network()
else if (istype(W, /obj/item/weapon/wirecutters) && terminal && opened && has_electronics!=2) else if (istype(W, /obj/item/weapon/wirecutters) && terminal && opened && has_electronics!=2)
if (src.loc:intact) if (src.loc:intact)
user << "\red You must remove the plating first." user << "\red You must remove the floor plating first."
return return
user << "You begin to cut cables..." user << "You begin to cut cables..."
playsound(src.loc, 'Deconstruct.ogg', 50, 1) playsound(src.loc, 'Deconstruct.ogg', 50, 1)