mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-30 07:28:53 +01:00
Merge nutrition refactor for vorestation
This commit is contained in:
@@ -38,11 +38,12 @@
|
||||
|
||||
/obj/item/weapon/implant/reagent_generator/process()
|
||||
var/before_gen
|
||||
if(imp_in && generated_reagents)
|
||||
if(isliving(imp_in) && generated_reagents)
|
||||
before_gen = reagents.total_volume
|
||||
var/mob/living/L = imp_in
|
||||
if(reagents.total_volume < reagents.maximum_volume)
|
||||
if(imp_in.nutrition >= gen_cost)
|
||||
do_generation()
|
||||
if(L.nutrition >= gen_cost)
|
||||
do_generation(L)
|
||||
else
|
||||
return
|
||||
else
|
||||
@@ -55,8 +56,8 @@
|
||||
else if(reagents.total_volume == reagents.maximum_volume && before_gen < reagents.maximum_volume)
|
||||
to_chat(imp_in, "<span class='warning'>[pick(full_message)]</span>")
|
||||
|
||||
/obj/item/weapon/implant/reagent_generator/proc/do_generation()
|
||||
imp_in.nutrition -= gen_cost
|
||||
/obj/item/weapon/implant/reagent_generator/proc/do_generation(var/mob/living/L)
|
||||
L.adjust_nutrition(-gen_cost)
|
||||
for(var/reagent in generated_reagents)
|
||||
reagents.add_reagent(reagent, generated_reagents[reagent])
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
|
||||
/obj/item/weapon/cell/standin/give(var/amount)
|
||||
. = ..(amount * NUTRITION_COEFF) //Shrink amount to store
|
||||
hume.nutrition += . //Add the amount we really stored
|
||||
hume.adjust_nutrition(.) //Add the amount we really stored
|
||||
. /= NUTRITION_COEFF //Inflate amount to take from the giver
|
||||
|
||||
#undef NUTRITION_COEFF
|
||||
|
||||
Reference in New Issue
Block a user