Merge pull request #3102 from Citadel-Station-13/upstream-merge-31250
[MIRROR] Greatly speeds up bees
This commit is contained in:
@@ -105,22 +105,22 @@
|
|||||||
/mob/living/simple_animal/hostile/poison/bees/CanAttack(atom/the_target)
|
/mob/living/simple_animal/hostile/poison/bees/CanAttack(atom/the_target)
|
||||||
. = ..()
|
. = ..()
|
||||||
if(!.)
|
if(!.)
|
||||||
return 0
|
return FALSE
|
||||||
if(isliving(the_target))
|
if(isliving(the_target))
|
||||||
var/mob/living/H = the_target
|
var/mob/living/H = the_target
|
||||||
return !H.bee_friendly()
|
return !H.bee_friendly()
|
||||||
|
|
||||||
|
|
||||||
/mob/living/simple_animal/hostile/poison/bees/Found(atom/A)
|
/mob/living/simple_animal/hostile/poison/bees/Found(atom/A)
|
||||||
|
if(isliving(A))
|
||||||
|
var/mob/living/H = A
|
||||||
|
return !H.bee_friendly()
|
||||||
if(istype(A, /obj/machinery/hydroponics))
|
if(istype(A, /obj/machinery/hydroponics))
|
||||||
var/obj/machinery/hydroponics/Hydro = A
|
var/obj/machinery/hydroponics/Hydro = A
|
||||||
if(Hydro.myseed && !Hydro.dead && !Hydro.recent_bee_visit)
|
if(Hydro.myseed && !Hydro.dead && !Hydro.recent_bee_visit)
|
||||||
wanted_objects |= typecacheof(/obj/machinery/hydroponics) //so we only hunt them while they're alive/seeded/not visisted
|
wanted_objects |= typecacheof(/obj/machinery/hydroponics) //so we only hunt them while they're alive/seeded/not visisted
|
||||||
return 1
|
return TRUE
|
||||||
if(isliving(A))
|
return FALSE
|
||||||
var/mob/living/H = A
|
|
||||||
return !H.bee_friendly()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
/mob/living/simple_animal/hostile/poison/bees/AttackingTarget()
|
/mob/living/simple_animal/hostile/poison/bees/AttackingTarget()
|
||||||
@@ -187,7 +187,7 @@
|
|||||||
if(loc == beehome)
|
if(loc == beehome)
|
||||||
idle = min(100, ++idle)
|
idle = min(100, ++idle)
|
||||||
if(idle >= BEE_IDLE_ROAMING && prob(BEE_PROB_GOROAM))
|
if(idle >= BEE_IDLE_ROAMING && prob(BEE_PROB_GOROAM))
|
||||||
forceMove(get_turf(beehome))
|
forceMove(beehome.drop_location())
|
||||||
else
|
else
|
||||||
idle = max(0, --idle)
|
idle = max(0, --idle)
|
||||||
if(idle <= BEE_IDLE_GOHOME && prob(BEE_PROB_GOHOME))
|
if(idle <= BEE_IDLE_GOHOME && prob(BEE_PROB_GOHOME))
|
||||||
@@ -200,6 +200,7 @@
|
|||||||
continue
|
continue
|
||||||
BB.bees |= src
|
BB.bees |= src
|
||||||
beehome = BB
|
beehome = BB
|
||||||
|
break // End loop after the first compatible find.
|
||||||
|
|
||||||
/mob/living/simple_animal/hostile/poison/bees/toxin/Initialize()
|
/mob/living/simple_animal/hostile/poison/bees/toxin/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -215,7 +216,7 @@
|
|||||||
|
|
||||||
//the Queen doesn't leave the box on her own, and she CERTAINLY doesn't pollinate by herself
|
//the Queen doesn't leave the box on her own, and she CERTAINLY doesn't pollinate by herself
|
||||||
/mob/living/simple_animal/hostile/poison/bees/queen/Found(atom/A)
|
/mob/living/simple_animal/hostile/poison/bees/queen/Found(atom/A)
|
||||||
return 0
|
return FALSE
|
||||||
|
|
||||||
|
|
||||||
//leave pollination for the peasent bees
|
//leave pollination for the peasent bees
|
||||||
@@ -234,10 +235,10 @@
|
|||||||
|
|
||||||
/mob/living/simple_animal/hostile/poison/bees/proc/reagent_incompatible(mob/living/simple_animal/hostile/poison/bees/B)
|
/mob/living/simple_animal/hostile/poison/bees/proc/reagent_incompatible(mob/living/simple_animal/hostile/poison/bees/B)
|
||||||
if(!B)
|
if(!B)
|
||||||
return 0
|
return FALSE
|
||||||
if(B.beegent && beegent && B.beegent.id != beegent.id || B.beegent && !beegent || !B.beegent && beegent)
|
if(B.beegent && beegent && B.beegent.id != beegent.id || B.beegent && !beegent || !B.beegent && beegent)
|
||||||
return 1
|
return TRUE
|
||||||
return 0
|
return FALSE
|
||||||
|
|
||||||
|
|
||||||
/obj/item/queen_bee
|
/obj/item/queen_bee
|
||||||
@@ -255,7 +256,7 @@
|
|||||||
if(S.reagents.has_reagent("royal_bee_jelly")) //checked twice, because I really don't want royal bee jelly to be duped
|
if(S.reagents.has_reagent("royal_bee_jelly")) //checked twice, because I really don't want royal bee jelly to be duped
|
||||||
if(S.reagents.has_reagent("royal_bee_jelly",5))
|
if(S.reagents.has_reagent("royal_bee_jelly",5))
|
||||||
S.reagents.remove_reagent("royal_bee_jelly", 5)
|
S.reagents.remove_reagent("royal_bee_jelly", 5)
|
||||||
var/obj/item/queen_bee/qb = new(get_turf(user))
|
var/obj/item/queen_bee/qb = new(user.drop_location())
|
||||||
qb.queen = new(qb)
|
qb.queen = new(qb)
|
||||||
if(queen && queen.beegent)
|
if(queen && queen.beegent)
|
||||||
qb.queen.assign_reagent(queen.beegent) //Bees use the global singleton instances of reagents, so we don't need to worry about one bee being deleted and her copies losing their reagents.
|
qb.queen.assign_reagent(queen.beegent) //Bees use the global singleton instances of reagents, so we don't need to worry about one bee being deleted and her copies losing their reagents.
|
||||||
|
|||||||
@@ -115,7 +115,11 @@
|
|||||||
if(can_see(targets_from, HM, vision_range))
|
if(can_see(targets_from, HM, vision_range))
|
||||||
. += HM
|
. += HM
|
||||||
else
|
else
|
||||||
. = oview(vision_range, targets_from)
|
. = list() // The following code is only very slightly slower than just returning oview(vision_range, targets_from), but it saves us much more work down the line, particularly when bees are involved
|
||||||
|
for (var/obj/A in oview(vision_range, targets_from))
|
||||||
|
. += A
|
||||||
|
for (var/mob/A in oview(vision_range, targets_from))
|
||||||
|
. += A
|
||||||
|
|
||||||
/mob/living/simple_animal/hostile/proc/FindTarget(var/list/possible_targets, var/HasTargetsList = 0)//Step 2, filter down possible targets to things we actually care about
|
/mob/living/simple_animal/hostile/proc/FindTarget(var/list/possible_targets, var/HasTargetsList = 0)//Step 2, filter down possible targets to things we actually care about
|
||||||
. = list()
|
. = list()
|
||||||
|
|||||||
Reference in New Issue
Block a user