From 8587a3ff6da2300b61d184ac43ccf3614ff27d0d Mon Sep 17 00:00:00 2001 From: theo-3 <85434590+theo-3@users.noreply.github.com> Date: Tue, 10 Aug 2021 11:28:12 +0300 Subject: [PATCH 1/3] Make bee hitbox much smaller, except if they attack someone If a bee hits someone, they become opaque for a minute Queens, syndie bees, and sentient bees are always opaque --- .../mob/living/simple_animal/hostile/bees.dm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index 0370a84baba..baab28ddab1 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -31,7 +31,6 @@ move_to_delay = 0 obj_damage = 0 environment_smash = 0 - mouse_opacity = MOUSE_OPACITY_OPAQUE pass_flags = PASSTABLE | PASSGRILLE | PASSMOB density = FALSE mob_size = MOB_SIZE_TINY @@ -162,6 +161,7 @@ else . = ..() if(. && isliving(target) && (!client || a_intent == INTENT_HARM)) + make_opaque() var/mob/living/L = target if(L.reagents) if(beegent) @@ -170,6 +170,19 @@ else L.reagents.add_reagent("spidertoxin", 5) +/mob/living/simple_animal/hostile/poison/bees/proc/make_opaque() + // If a bee attacks someone, make it very easy to hit for a while + mouse_opacity = MOUSE_OPACITY_OPAQUE + addtimer(CALLBACK(src, /mob/living/simple_animal/hostile/poison/bees/proc/reset_opacity), 1 MINUTES, TIMER_UNIQUE | TIMER_OVERRIDE) + +/mob/living/simple_animal/hostile/poison/bees/proc/reset_opacity() + if(!mind) + mouse_opacity = initial(mouse_opacity) + +/mob/living/simple_animal/hostile/poison/bees/sentience_act() + . = ..() + make_opaque() + /mob/living/simple_animal/hostile/poison/bees/proc/assign_reagent(datum/reagent/R) if(istype(R)) beegent = R @@ -233,6 +246,7 @@ desc = "She's the queen of bees, BZZ BZZ" icon_base = "queen" isqueen = TRUE + mouse_opacity = MOUSE_OPACITY_OPAQUE //the Queen doesn't leave the box on her own, and she CERTAINLY doesn't pollinate by herself @@ -324,6 +338,7 @@ search_objects = FALSE //these bees don't care about trivial things like plants, especially when there is havoc to sow bee_syndicate = TRUE var/list/master_and_friends = list() + mouse_opacity = MOUSE_OPACITY_OPAQUE /mob/living/simple_animal/hostile/poison/bees/syndi/New() beegent = GLOB.chemical_reagents_list["facid"] //Prepare to die From f9c258f634932289df2132d4908de80a7e9978d8 Mon Sep 17 00:00:00 2001 From: theo-3 <85434590+theo-3@users.noreply.github.com> Date: Tue, 10 Aug 2021 19:51:44 +0300 Subject: [PATCH 2/3] Use Life instead of a timer This should be much more efficient --- code/modules/mob/living/simple_animal/hostile/bees.dm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index baab28ddab1..f946d2f8528 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -50,6 +50,8 @@ var/isqueen = FALSE var/bee_syndicate = FALSE var/icon_base = "bee" + var/last_attack = 0 + var/opacity_time = 1 MINUTES var/static/list/bee_icons = list() var/static/beehometypecache = typecacheof(/obj/structure/beebox) var/static/hydroponicstypecache = typecacheof(/obj/machinery/hydroponics) @@ -172,11 +174,13 @@ /mob/living/simple_animal/hostile/poison/bees/proc/make_opaque() // If a bee attacks someone, make it very easy to hit for a while + last_attack = world.time mouse_opacity = MOUSE_OPACITY_OPAQUE - addtimer(CALLBACK(src, /mob/living/simple_animal/hostile/poison/bees/proc/reset_opacity), 1 MINUTES, TIMER_UNIQUE | TIMER_OVERRIDE) -/mob/living/simple_animal/hostile/poison/bees/proc/reset_opacity() - if(!mind) +/mob/living/simple_animal/hostile/poison/bees/Life(seconds, times_fired) + . = ..() + var/diff = world.time - last_attack + if(diff >= opacity_time) mouse_opacity = initial(mouse_opacity) /mob/living/simple_animal/hostile/poison/bees/sentience_act() From 79381bbd1ba8aa7f8698d30c15943e4e4a2fc01d Mon Sep 17 00:00:00 2001 From: theo-3 <85434590+theo-3@users.noreply.github.com> Date: Tue, 10 Aug 2021 20:40:19 +0300 Subject: [PATCH 3/3] fix life proc --- code/modules/mob/living/simple_animal/hostile/bees.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index f946d2f8528..63a883b4d00 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -179,6 +179,8 @@ /mob/living/simple_animal/hostile/poison/bees/Life(seconds, times_fired) . = ..() + if(mind || (mouse_opacity == initial(mouse_opacity))) + return var/diff = world.time - last_attack if(diff >= opacity_time) mouse_opacity = initial(mouse_opacity)