From 664b7174021d749df0bd3d1a2cec14ebbddc4b9c Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 24 Jul 2026 15:31:28 -0400 Subject: [PATCH] Migrate bee briefcase to the new attack chain. (#32294) * Migrate bee briefcase to the new attack chain. * Add fingerprints. * Apply suggestions from CRUNCH review Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan * Use cooldown macros. --------- Signed-off-by: Alan Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> --- .../objects/items/weapons/bee_briefcase.dm | 90 +++++++++++-------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/code/game/objects/items/weapons/bee_briefcase.dm b/code/game/objects/items/weapons/bee_briefcase.dm index 95d15ecd728..8ea5455e018 100644 --- a/code/game/objects/items/weapons/bee_briefcase.dm +++ b/code/game/objects/items/weapons/bee_briefcase.dm @@ -12,7 +12,8 @@ var/bees_left = 10 var/list/blood_list = list() var/sound_file = 'sound/misc/briefcase_bees.ogg' - var/next_sound = 0 + new_attack_chain = TRUE + COOLDOWN_DECLARE(bee_sound_cooldown) /obj/item/bee_briefcase/Destroy() blood_list.Cut() @@ -28,45 +29,60 @@ if(isAntag(user)) . += SPAN_WARNING("A briefcase filled with deadly bees, you should inject this with a syringe of your own blood before opening it. Exotic blood cannot be used.") -/obj/item/bee_briefcase/attackby__legacy__attackchain(obj/item/I, mob/user, params) - if(istype(I, /obj/item/reagent_containers/syringe)) - var/obj/item/reagent_containers/syringe/S = I - if(!bees_left) - to_chat(user, SPAN_WARNING("The briefcase is empty, so there is no point in injecting something into it.")) - return - if(S.reagents && S.reagents.total_volume) - to_chat(user, SPAN_NOTICE("You inject [src] with [S].")) - for(var/datum/reagent/A in S.reagents.reagent_list) - if(A.id == "blood") - if(!(A.data["donor"] in blood_list)) - blood_list += A.data["donor"] - if(A.id == "lazarus_reagent") //RELOAD THE BEES (1 bee per 1 unit, max 15 bees) - if(bees_left < 15) - bees_left = min(15, round((bees_left + A.volume), 1)) //No partial bees, max 15 bees in case at any given time - to_chat(user, SPAN_WARNING("The buzzing inside the briefcase intensifies as new bees form inside.")) - else - to_chat(user, SPAN_WARNING("The buzzing inside the briefcase swells momentarily, then returns to normal. Guess it was too cramped...")) - S.reagents.clear_reagents() - S.update_icon() - else if(istype(I, /obj/item/reagent_containers/spray/pestspray)) +/obj/item/bee_briefcase/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/reagent_containers/spray/pestspray)) bees_left = max(0, (bees_left - 6)) - to_chat(user, "You spray [I] into [src].") + to_chat(user, "You spray [used] into [src].") playsound(loc, 'sound/effects/spray3.ogg', 50, TRUE, -6) + return ITEM_INTERACT_COMPLETE + + if(!istype(used, /obj/item/reagent_containers/syringe)) + return ..() + + var/obj/item/reagent_containers/syringe/syringe = used + if(!bees_left) + to_chat(user, SPAN_WARNING("[src] is empty, so there is no point in injecting something into it!")) + return ITEM_INTERACT_COMPLETE + + if(!syringe.reagents || !syringe.reagents.total_volume) + to_chat(user, SPAN_WARNING("[syringe] is empty!")) + return ITEM_INTERACT_COMPLETE + + to_chat(user, SPAN_NOTICE("You inject [src] with [syringe].")) + for(var/datum/reagent/each_reagent in syringe.reagents.reagent_list) + if(each_reagent.id == "blood") + if(!(each_reagent.data["donor"] in blood_list)) + blood_list += each_reagent.data["donor"] + if(each_reagent.id == "lazarus_reagent") // RELOAD THE BEES (1 bee per 1 unit, max 15 bees). + if(bees_left < 15) + bees_left = min(15, round((bees_left + each_reagent.volume), 1)) // No partial bees, max 15 bees in case at any given time. + to_chat(user, SPAN_WARNING("The buzzing inside [src] intensifies as new bees form inside.")) + else + to_chat(user, SPAN_WARNING("The buzzing inside [src] swells momentarily, then returns to normal. Guess it was too cramped...")) + syringe.reagents.clear_reagents() + syringe.update_icon() + add_fingerprint(user) + return ITEM_INTERACT_COMPLETE + +/obj/item/bee_briefcase/activate_self(mob/user) + if(..()) + return ITEM_INTERACT_COMPLETE -/obj/item/bee_briefcase/attack_self__legacy__attackchain(mob/user) - var/bees_released if(!bees_left) to_chat(user, SPAN_DANGER("The lack of all and any bees at this event has been somewhat of a let-down...")) - return - else - if(world.time >= next_sound) //This cooldown doesn't prevent us from releasing bees, just stops the sound - next_sound = world.time + 90 - playsound(loc, sound_file, 35) + return ITEM_INTERACT_COMPLETE - //Release up to 5 bees per use. Without using Lazarus Reagent, that means two uses. WITH Lazarus Reagent, you can get more if you don't release the last bee - for(var/bee = min(5, bees_left), bee > 0, bee--) - var/mob/living/basic/bee/syndi/B = new /mob/living/basic/bee/syndi(get_turf(user)) // RELEASE THE BEES! - for(var/mob/living/fren in blood_list) - B.befriend(fren) - bees_released++ - bees_left -= bees_released + if(COOLDOWN_FINISHED(src, bee_sound_cooldown)) // This cooldown doesn't prevent us from releasing bees, just stops the sound. + playsound(loc, sound_file, 35) + COOLDOWN_START(src, bee_sound_cooldown, 90 SECONDS) + + var/bees_released + // Release up to 5 bees per use. Without using Lazarus Reagent, that means two uses. WITH Lazarus Reagent, you can get more if you don't release the last bee. + for(var/bee = min(5, bees_left), bee > 0, bee--) + var/mob/living/basic/bee/syndi/B = new /mob/living/basic/bee/syndi(get_turf(user)) // RELEASE THE BEES! + for(var/mob/living/fren in blood_list) + B.befriend(fren) + bees_released++ + bees_left -= bees_released + add_fingerprint(user) + return ITEM_INTERACT_COMPLETE