From 8aea1c8a896a83cb7f7c892bcdb1dc611a35637b Mon Sep 17 00:00:00 2001 From: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:49:22 +0300 Subject: [PATCH] (no gbp) make the bee care more about the polinating (#77293) ## About The Pull Request the bee when he found a man he was focused on attacking him and he forget about the pollinating until the man is gone or died. now he will care more about polinating even if there is a man near him butbe care because he will still atacked u if u dont wear a protect suit! and a small thin now the raegent incompatibile proc will checked the raegent type insted of the datum himself. ## Why It's Good For The Game make the bee better at polinating ## Changelog :cl: fix: the bee will now care more about polinating qol: in case u miscliked the bee queen with a seringe 2 times, the raegent will not be transfered to the quen if he alredy have this raegent /:cl: --- .../mob/living/basic/farm_animals/bee/_bee.dm | 20 ++++++++++++------- .../basic/farm_animals/bee/bee_ai_behavior.dm | 8 ++++++-- .../basic/farm_animals/bee/bee_ai_subtree.dm | 12 ++++++++--- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/basic/farm_animals/bee/_bee.dm b/code/modules/mob/living/basic/farm_animals/bee/_bee.dm index be2d270e34a..a175deacb93 100644 --- a/code/modules/mob/living/basic/farm_animals/bee/_bee.dm +++ b/code/modules/mob/living/basic/farm_animals/bee/_bee.dm @@ -132,7 +132,7 @@ /mob/living/basic/bee/proc/reagent_incompatible(mob/living/basic/bee/ruler) if(!ruler) return FALSE - if(ruler.beegent != beegent) + if(ruler.beegent?.type != beegent?.type) return TRUE return FALSE @@ -256,13 +256,19 @@ user.visible_message(span_notice("[user] injects [src] with royal bee jelly, causing it to split into two bees, MORE BEES!"),span_warning("You inject [src] with royal bee jelly, causing it to split into two bees, MORE BEES!")) return var/datum/reagent/chemical = needle.reagents.get_master_reagent() - if(chemical && needle.reagents.has_reagent(chemical.type, 5)) - needle.reagents.remove_reagent(chemical.type, 5) - queen.assign_reagent(chemical) - user.visible_message(span_warning("[user] injects [src]'s genome with [chemical.name], mutating its DNA!"),span_warning("You inject [src]'s genome with [chemical.name], mutating its DNA!")) - name = queen.name - else + if(isnull(chemical)) + return + if(chemical.type == queen.beegent?.type) + to_chat(user, span_warning("[queen] already has this chemical!")) + return + if(!(needle.reagents.has_reagent(chemical.type, 5))) to_chat(user, span_warning("You don't have enough units of that chemical to modify the bee's DNA!")) + return + needle.reagents.remove_reagent(chemical.type, 5) + var/datum/reagent/bee_chem = GLOB.chemical_reagents_list[chemical.type] + queen.assign_reagent(bee_chem) + user.visible_message(span_warning("[user] injects [src]'s genome with [chemical.name], mutating its DNA!"),span_warning("You inject [src]'s genome with [chemical.name], mutating its DNA!")) + name = queen.name /obj/item/queen_bee/suicide_act(mob/living/user) user.visible_message(span_suicide("[user] eats [src]! It looks like [user.p_theyre()] trying to commit suicide!")) diff --git a/code/modules/mob/living/basic/farm_animals/bee/bee_ai_behavior.dm b/code/modules/mob/living/basic/farm_animals/bee/bee_ai_behavior.dm index 2dee3b15461..137de67dfc6 100644 --- a/code/modules/mob/living/basic/farm_animals/bee/bee_ai_behavior.dm +++ b/code/modules/mob/living/basic/farm_animals/bee/bee_ai_behavior.dm @@ -15,17 +15,21 @@ /datum/ai_behavior/enter_exit_hive behavior_flags = AI_BEHAVIOR_REQUIRE_MOVEMENT | AI_BEHAVIOR_REQUIRE_REACH -/datum/ai_behavior/enter_exit_hive/setup(datum/ai_controller/controller, target_key) +/datum/ai_behavior/enter_exit_hive/setup(datum/ai_controller/controller, target_key, attack_key) . = ..() var/atom/target = controller.blackboard[target_key] if(QDELETED(target)) return FALSE set_movement_target(controller, target) -/datum/ai_behavior/enter_exit_hive/perform(seconds_per_tick, datum/ai_controller/controller, target_key) +/datum/ai_behavior/enter_exit_hive/perform(seconds_per_tick, datum/ai_controller/controller, target_key, attack_key) . = ..() var/obj/structure/beebox/current_home = controller.blackboard[target_key] var/mob/living/bee_pawn = controller.pawn + var/atom/attack_target = controller.blackboard[attack_key] + + if(attack_target) // forget about who we attacking when we go home + controller.clear_blackboard_key(attack_key) var/datum/callback/callback = CALLBACK(bee_pawn, TYPE_PROC_REF(/mob/living/basic/bee, handle_habitation), current_home) callback.Invoke() diff --git a/code/modules/mob/living/basic/farm_animals/bee/bee_ai_subtree.dm b/code/modules/mob/living/basic/farm_animals/bee/bee_ai_subtree.dm index 4eb47eb0c53..e2d6ac04f7e 100644 --- a/code/modules/mob/living/basic/farm_animals/bee/bee_ai_subtree.dm +++ b/code/modules/mob/living/basic/farm_animals/bee/bee_ai_subtree.dm @@ -10,11 +10,17 @@ planning_subtrees = list( /datum/ai_planning_subtree/find_valid_home, /datum/ai_planning_subtree/enter_exit_home, - /datum/ai_planning_subtree/simple_find_target, - /datum/ai_planning_subtree/basic_melee_attack_subtree, /datum/ai_planning_subtree/find_and_hunt_target/pollinate, + /datum/ai_planning_subtree/simple_find_target/bee, + /datum/ai_planning_subtree/basic_melee_attack_subtree, ) +/datum/ai_planning_subtree/simple_find_target/bee/SelectBehaviors(datum/ai_controller/controller, seconds_per_tick) + var/atom/hydro_target = controller.blackboard[BB_TARGET_HYDRO] + if(hydro_target) + return SUBTREE_RETURN_FINISH_PLANNING + return ..() + /datum/ai_controller/basic_controller/queen_bee blackboard = list( BB_TARGETTING_DATUM = new /datum/targetting_datum/basic/bee, @@ -68,7 +74,7 @@ if(!SPT_PROB(action_prob, seconds_per_tick)) return - controller.queue_behavior(/datum/ai_behavior/enter_exit_hive, BB_CURRENT_HOME) + controller.queue_behavior(/datum/ai_behavior/enter_exit_hive, BB_CURRENT_HOME, BB_BASIC_MOB_CURRENT_TARGET) return SUBTREE_RETURN_FINISH_PLANNING //the queen spend more time in the hive