Fixes beaker feeding not calling the right volume for the ingestion reaction.

Same fix for ninja suit adrenalin boost.
Simplifies reagent_containers/glass/attackby() a bit.
This commit is contained in:
phil235
2015-07-23 13:05:53 +02:00
parent b5dee0558f
commit 9fab0f3641
2 changed files with 29 additions and 36 deletions
@@ -18,7 +18,9 @@
spawn(30)//Slight delay so the enemy does not immedietly know the ability was used. Due to lag, this often came before waking up.
H.say(pick("A CORNERED FOX IS MORE DANGEROUS THAN A JACKAL!","HURT ME MOOORRREEE!","IMPRESSIVE!"))
spawn(70)
reagents.reaction(H, INGEST)
if(reagents.total_volume)
var/fraction = min(a_transfer/reagents.total_volume, 1)
reagents.reaction(H, INGEST, fraction)
reagents.trans_id_to(H, "radium", a_transfer)
H << "<span class='danger'>You are beginning to feel the after-effect of the injection.</span>"
a_boost--
@@ -45,44 +45,35 @@
user << "<span class='warning'>[src] is empty!</span>"
return
if(reagents && reagents.total_volume)
if(istype(M))
if(user.a_intent == "harm")
if(ismob(M))
var/R
M.visible_message("<span class='danger'>[user] splashes the contents of [src] onto [M]!</span>", \
"<span class='userdanger'>[user] splashes the contents of [src] onto [M]!</span>")
if(reagents)
for(var/datum/reagent/A in reagents.reagent_list)
R += A.id + " ("
R += num2text(A.volume) + "),"
reagents.reaction(M, TOUCH)
add_logs(user, M, "splashed", R)
reagents.clear_reagents()
return
else if(M == user)
user << "<span class='notice'>You swallow a gulp of [src].</span>"
if(reagents.total_volume)
reagents.reaction(user, INGEST)
spawn(5)
reagents.trans_to(user, 5)
playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1)
return
else if(ismob(M))
M.visible_message("<span class='danger'>[user] attempts to feed something to [M].</span>", \
var/R
M.visible_message("<span class='danger'>[user] splashes the contents of [src] onto [M]!</span>", \
"<span class='userdanger'>[user] splashes the contents of [src] onto [M]!</span>")
if(reagents)
for(var/datum/reagent/A in reagents.reagent_list)
R += A.id + " ("
R += num2text(A.volume) + "),"
reagents.reaction(M, TOUCH)
add_logs(user, M, "splashed", R)
reagents.clear_reagents()
else
if(M != user)
M.visible_message("<span class='danger'>[user] attempts to feed something to [M].</span>", \
"<span class='userdanger'>[user] attempts to feed something to you.</span>")
if(!do_mob(user, M)) return
if(!reagents.total_volume) return // The drink might be empty after the delay, such as by spam-feeding
M.visible_message("<span class='danger'>[user] feeds something to [M].</span>", "<span class='userdanger'>[user] feeds something to you.</span>")
add_logs(user, M, "fed", reagentlist(src))
if(reagents.total_volume)
reagents.reaction(M, INGEST)
spawn(5)
reagents.trans_to(M, 5)
if(!do_mob(user, M))
return
if(!reagents || !reagents.total_volume)
return // The drink might be empty after the delay, such as by spam-feeding
M.visible_message("<span class='danger'>[user] feeds something to [M].</span>", "<span class='userdanger'>[user] feeds something to you.</span>")
add_logs(user, M, "fed", reagentlist(src))
else
user << "<span class='notice'>You swallow a gulp of [src].</span>"
var/fraction = min(5/reagents.total_volume, 1)
reagents.reaction(user, INGEST, fraction)
spawn(5)
reagents.trans_to(user, 5)
playsound(M.loc,'sound/items/drink.ogg', rand(10,50), 1)
return
/obj/item/weapon/reagent_containers/glass/afterattack(obj/target, mob/user, proximity)
if((!proximity) || !check_allowed_items(target,target_self=1)) return