mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 02:24:11 +01:00
0b0c5ea91e
## About The Pull Request Extends the part of the crafting unit test that ensures consistency between the total mats of the components of a recipe (or rather, the result of said recipe) and a generic instance of the same type as its result, previously only implemented on food recipes. ## Why It's Good For The Game This ensures a degree of consistency with the material composition of various objects in the game. I couldn't do it in the original PR as that one was too big already and it took months to get it merged, and have the relative bugs fixed. Currently a WIP as I slowly deal with the unit test reports. ## Changelog 🆑 refactor: Follow-up to the crafting/material refactor from months ago. All objects crafted with stacks now inherit their mat composition (not necessarily the effects and color) by default, while previously only a few things like chair, sinks and toilets did. Report any object looking or behaving weirdly as a result. fix: The material composition of ammo boxes is no longer a 1/10 of what it's supposed to be. It was a shitty hack to make it harder to recycle empty ammo boxes. Instead, they lose materials as they're emptied now. /🆑
93 lines
3.4 KiB
Plaintext
93 lines
3.4 KiB
Plaintext
/obj/item/reagent_containers/dropper
|
|
name = "dropper"
|
|
desc = "A dropper. Holds up to 5 units."
|
|
icon = 'icons/obj/medical/chemical.dmi'
|
|
icon_state = "dropper0"
|
|
inhand_icon_state = "dropper"
|
|
worn_icon_state = "pen"
|
|
amount_per_transfer_from_this = 5
|
|
possible_transfer_amounts = list(1, 2, 3, 4, 5)
|
|
volume = 5
|
|
initial_reagent_flags = TRANSPARENT
|
|
custom_price = PAYCHECK_CREW
|
|
custom_materials = list(/datum/material/glass = SHEET_MATERIAL_AMOUNT)
|
|
|
|
/obj/item/reagent_containers/dropper/interact_with_atom(atom/target, mob/living/user, list/modifiers)
|
|
if(!target.reagents)
|
|
return NONE
|
|
|
|
if(reagents.total_volume > 0)
|
|
if(target.reagents.holder_full())
|
|
to_chat(user, span_notice("[target] is full."))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!target.is_injectable(user))
|
|
to_chat(user, span_warning("You cannot transfer reagents to [target]!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
var/trans = 0
|
|
var/fraction = min(amount_per_transfer_from_this / reagents.total_volume, 1)
|
|
|
|
if(ismob(target))
|
|
user.changeNext_move(CLICK_CD_MELEE)
|
|
if(ishuman(target))
|
|
var/mob/living/carbon/human/victim = target
|
|
var/obj/item/safe_thing = victim.is_eyes_covered()
|
|
|
|
if(safe_thing)
|
|
if(!safe_thing.reagents)
|
|
safe_thing.create_reagents(100)
|
|
|
|
trans = round(reagents.trans_to(safe_thing, amount_per_transfer_from_this, transferred_by = user, methods = TOUCH), CHEMICAL_VOLUME_ROUNDING)
|
|
|
|
target.visible_message(span_danger("[user] tries to squirt something into [target]'s eyes, but fails!"), \
|
|
span_userdanger("[user] tries to squirt something into your eyes, but fails!"))
|
|
if(trans)
|
|
to_chat(user, span_notice("You transfer [trans] unit\s of the solution."))
|
|
update_appearance()
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
else if(isalien(target)) //hiss-hiss has no eyes!
|
|
to_chat(target, span_danger("[target] does not seem to have any eyes!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
target.visible_message(
|
|
span_danger("[user] squirts something into [target]'s eyes!"),
|
|
span_userdanger("[user] squirts something into your eyes!"),
|
|
)
|
|
SEND_SIGNAL(target, COMSIG_MOB_REAGENTS_DROPPED_INTO_EYES, user, src, reagents, fraction)
|
|
reagents.expose(target, TOUCH, fraction)
|
|
var/mob/M = target
|
|
log_combat(user, M, "squirted", reagents.get_reagent_log_string())
|
|
|
|
trans = round(reagents.trans_to(target, amount_per_transfer_from_this, transferred_by = user), CHEMICAL_VOLUME_ROUNDING)
|
|
if(trans)
|
|
to_chat(user, span_notice("You transfer [trans] unit\s of the solution."))
|
|
update_appearance()
|
|
target.update_appearance()
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
if(!target.is_drawable(user, FALSE)) //No drawing from mobs here
|
|
to_chat(user, span_warning("You cannot directly remove reagents from [target]!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
if(!target.reagents.total_volume)
|
|
to_chat(user, span_warning("[target] is empty!"))
|
|
return ITEM_INTERACT_BLOCKING
|
|
|
|
var/trans = round(target.reagents.trans_to(src, amount_per_transfer_from_this, transferred_by = user), CHEMICAL_VOLUME_ROUNDING)
|
|
if(trans)
|
|
to_chat(user, span_notice("You fill [src] with [trans] unit\s of the solution."))
|
|
|
|
update_appearance()
|
|
target.update_appearance()
|
|
return ITEM_INTERACT_SUCCESS
|
|
|
|
/obj/item/reagent_containers/dropper/update_overlays()
|
|
. = ..()
|
|
if(!reagents.total_volume)
|
|
return
|
|
var/mutable_appearance/filling = mutable_appearance('icons/obj/medical/reagent_fillings.dmi', "dropper")
|
|
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
|
. += filling
|