Reagent transfer to a mob is split up into a type proc.

This commit is contained in:
MistakeNot4892
2022-08-27 16:02:17 +10:00
parent b36de76c15
commit 68a209597c
7 changed files with 27 additions and 26 deletions

View File

@@ -552,4 +552,12 @@
else
if(src.wear_mask) //if the mob is not human, it cleans the mask without asking for bitflags
if(src.wear_mask.clean_blood())
src.update_inv_wear_mask(0)
src.update_inv_wear_mask(0)
/mob/living/carbon/handle_reagent_transfer(var/datum/reagents/holder, var/amount = 1, var/chem_type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0)
if(chem_type == CHEM_BLOOD)
return holder.trans_to_holder(reagents, amount, multiplier, copy)
if(chem_type == CHEM_INGEST)
return ingest(holder, ingested, amount, multiplier, copy)
if(chem_type == CHEM_TOUCH)
return holder.trans_to_holder(touching, amount, multiplier, copy)

View File

@@ -296,6 +296,9 @@ var/global/list/last_drake_howl = list()
return ..()
return 0.25 // Quarter nutrition from non-meat.
/mob/living/simple_mob/animal/sif/grafadreka/handle_reagent_transfer(var/datum/reagents/holder, var/amount = 1, var/chem_type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0)
return holder.trans_to_holder(reagents, amount, multiplier, copy)
/mob/living/simple_mob/animal/sif/grafadreka/Life()
. = ..()

View File

@@ -1187,4 +1187,9 @@
return mind.grab_ghost(force = force)
/mob/proc/get_sound_volume_multiplier()
return !ear_deaf
return !ear_deaf
/mob/proc/handle_reagent_transfer(var/datum/reagents/holder, var/amount = 1, var/chem_type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0)
var/datum/reagents/R = new /datum/reagents(amount)
. = holder.trans_to_holder(R, amount, multiplier, copy)
R.touch_mob(src)

View File

@@ -413,24 +413,9 @@
perm = L.reagent_permeability()
return trans_to_mob(target, amount, CHEM_TOUCH, perm, copy)
/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0) // Transfer after checking into which holder...
if(!target || !istype(target))
return
if(iscarbon(target))
var/mob/living/carbon/C = target
if(type == CHEM_BLOOD)
var/datum/reagents/R = C.reagents
return trans_to_holder(R, amount, multiplier, copy)
if(type == CHEM_INGEST)
var/datum/reagents/R = C.ingested
return C.ingest(src, R, amount, multiplier, copy)
if(type == CHEM_TOUCH)
var/datum/reagents/R = C.touching
return trans_to_holder(R, amount, multiplier, copy)
else
var/datum/reagents/R = new /datum/reagents(amount)
. = trans_to_holder(R, amount, multiplier, copy)
R.touch_mob(target)
/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/chem_type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0) // Transfer after checking into which holder...
if(istype(target))
return target.handle_reagent_transfer(src, amount, chem_type, multiplier, copy)
/datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Turfs don't have any reagents (at least, for now). Just touch it.
if(!target)
@@ -517,7 +502,7 @@
trans_to(T, total_volume, multiplier, copy)
if (total_volume <= 0)
qdel(src)
/**
* Calls [/datum/reagent/proc/on_update] on every reagent in this holder
*

View File

@@ -118,7 +118,7 @@ About the Holder:
Checks mob's clothing if [clothes] is 1 and transfers [amount] reagents to mob's skin.
Don't call this directly. Call apply_to() instead.
trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0)
trans_to_mob(var/mob/target, var/amount = 1, var/chem_type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0)
Transfers [amount] reagents to the mob's appropriate holder, depending on [type]. Ignores protection.
trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0)
@@ -302,4 +302,4 @@ About the Tools:
transfer code since you will not be able to use the standard
tools to manipulate it.
*/
*/

View File

@@ -219,7 +219,7 @@
update_icon()
if(trans)
to_chat(user, "<span class='notice'>You inject [trans] units of the solution. The syringe now contains [src.reagents.total_volume] units.</span>")
to_chat(user, SPAN_NOTICE("You inject [trans] unit\s of the solution. The syringe now contains [src.reagents.total_volume] unit\s."))
if(ismob(target))
add_attack_logs(user,target,"Injected with [src.name] containing [contained], trasferred [trans] units")
else