Skip to content

Commit c26ea16

Browse files
authored
Fix dead bees not being their proper bee self (tgstation#87150)
## About The Pull Request Fixes tgstation#87147 Whomever refactored bees null'd the beegent before spawning the corpse, and we pass the bee by ref into corpse init to grab beegent ## Changelog :cl: Melbert fix: Dead bees maintain their color and reagents /:cl:
1 parent ab20e64 commit c26ea16

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

code/modules/mob/living/basic/farm_animals/bee/_bee.dm

+2-7
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,8 @@
100100
return ..()
101101

102102
/mob/living/basic/bee/death(gibbed)
103-
if(beehome)
104-
beehome.bees -= src
105-
beehome = null
106-
beegent = null
107-
if(flags_1 & HOLOGRAM_1 || gibbed)
108-
return ..()
109-
spawn_corpse()
103+
if(!(flags_1 & HOLOGRAM_1) && !gibbed)
104+
spawn_corpse()
110105
return ..()
111106

112107
/// Leave something to remember us by

code/modules/unit_tests/_unit_tests.dm

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
#include "bake_a_cake.dm"
100100
#include "barsigns.dm"
101101
#include "baseturfs.dm"
102+
#include "bee.dm"
102103
#include "bespoke_id.dm"
103104
#include "binary_insert.dm"
104105
#include "bitrunning.dm"

code/modules/unit_tests/bee.dm

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/// Test beegent transfer
2+
/datum/unit_test/beegent
3+
4+
/datum/unit_test/beegent/Run()
5+
var/mob/living/basic/bee/bee = allocate(__IMPLIED_TYPE__)
6+
var/turf/bee_turf = get_turf(bee)
7+
var/datum/reagent/picked = GLOB.chemical_reagents_list[/datum/reagent/toxin/fentanyl]
8+
bee.assign_reagent(picked)
9+
bee.death()
10+
var/obj/item/trash/bee/dead_bee = locate() in bee_turf
11+
TEST_ASSERT_NOTNULL(dead_bee, "The bee did not leave a corpse.")
12+
TEST_ASSERT_EQUAL(dead_bee.beegent, picked, "The bee's corpse did not have the correct beegent assigned.")
13+
TEST_ASSERT(dead_bee.reagents.has_reagent(/datum/reagent/toxin/fentanyl), "The bee's corpse did not contain any of the beegent.")
14+
// clean up, we aren't allocated
15+
QDEL_NULL(dead_bee)

0 commit comments

Comments
 (0)