Fix hivebot harddels (#21953)

nightmare
This commit is contained in:
Wildkins
2026-03-02 06:57:05 +00:00
committed by GitHub
parent 924b94e195
commit 04d2cdd020
4 changed files with 113 additions and 36 deletions
@@ -48,22 +48,38 @@
*/
var/mob/living/simple_animal/hostile/hivebotbeacon/linked_parent = null
/mob/living/simple_animal/hostile/hivebot/Initialize(mapload,mob/living/simple_animal/hostile/hivebot/hivebotbeacon)
/mob/living/simple_animal/hostile/hivebot/Initialize(mapload,mob/living/simple_animal/hostile/hivebotbeacon/beacon)
. = ..()
if(hivebotbeacon)
linked_parent = hivebotbeacon
do_link(beacon)
if(!mapload)
spark(get_turf(src), 2, GLOB.alldirs)
/mob/living/simple_animal/hostile/hivebot/Destroy()
if(linked_parent)
linked_parent.linked_bots -= src
linked_parent = null
unlink()
. = ..()
/mob/living/simple_animal/hostile/hivebot/proc/do_link(mob/living/simple_animal/hostile/hivebotbeacon/beacon)
if(QDELETED(beacon))
return
if(linked_parent)
if(linked_parent == beacon)
return
unlink()
linked_parent = beacon
beacon.do_link(src)
RegisterSignal(linked_parent, COMSIG_QDELETING, PROC_REF(unlink))
/mob/living/simple_animal/hostile/hivebot/proc/unlink()
SIGNAL_HANDLER
if(!linked_parent)
return
linked_parent.unlink(src)
UnregisterSignal(linked_parent, COMSIG_QDELETING)
linked_parent = null
/mob/living/simple_animal/hostile/hivebot/get_bullet_impact_effect_type(var/def_zone)
return BULLET_IMPACT_METAL
@@ -97,12 +113,10 @@
var/robot_gib_type = /obj/effect/decal/cleanable/blood/gibs/robot
var/atom/turf_gibs = locate(robot_gib_type) in current_turf
if(turf_gibs) // we only want to spawn gibs here if there aren't any already
return
var/list/gib_types = typesof(robot_gib_type)
var/selected_gib_type = pick(gib_types)
new selected_gib_type(current_turf)
if(!turf_gibs) // we only want to spawn gibs here if there aren't any already
var/list/gib_types = typesof(robot_gib_type)
var/selected_gib_type = pick(gib_types)
new selected_gib_type(current_turf)
spark(current_turf, 1, GLOB.alldirs)
@@ -155,16 +169,6 @@
mob_swap_flags = ~HEAVY
mob_push_flags = 0
/mob/living/simple_animal/hostile/hivebot/guardian/Initialize(mapload,mob/living/simple_animal/hostile/hivebot/hivebotbeacon)
.=..()
if(hivebotbeacon && linked_parent)
linked_parent.guard_amt++
/mob/living/simple_animal/hostile/hivebot/guardian/Destroy()
.=..()
if(linked_parent)
linked_parent.guard_amt--
/mob/living/simple_animal/hostile/hivebot/guardian/think()
. =..()
if(stance != HOSTILE_STANCE_IDLE)
@@ -69,7 +69,7 @@
var/maximum_linked_and_alive_hivebots_to_playing_players_scaling_factor = 1
///A list of `/mob/living/simple_animal/hostile` hivebots that are linked to this beacon
var/list/mob/living/simple_animal/hostile/hivebot/linked_bots = list()
var/list/mob/living/simple_animal/hostile/linked_bots = list()
///Amount of hivebots spawned and alive linked to this beacon, guardian type
var/guard_amt = 0
@@ -128,8 +128,10 @@
/mob/living/simple_animal/hostile/hivebotbeacon/Destroy()
//Remove the reference from all linked bots to us
for(var/mob/living/simple_animal/hostile/hivebot/latest_child in linked_bots)
latest_child.linked_parent = null
for(var/mob/living/simple_animal/hostile/retaliate/hivebotharvester/hbh in linked_bots)
hbh.unlink()
for(var/mob/living/simple_animal/hostile/hivebot/hb in linked_bots)
hb.unlink()
linked_bots.Cut()
//Smoke effect, we disappear in a smoke
@@ -139,6 +141,48 @@
. = ..()
/mob/living/simple_animal/hostile/hivebotbeacon/proc/do_link(mob/living/simple_animal/hostile/add)
if(QDELETED(add) || (add in linked_bots))
return
var/mob/living/simple_animal/hostile/hivebot/hb = astype(add)
if(!hb)
var/mob/living/simple_animal/hostile/retaliate/hivebotharvester/hbh = astype(add)
if(hbh)
if(hbh.linked_parent != src)
hbh.do_link(src)
harvester_amt++
. = TRUE
else
if(hb.linked_parent != src)
hb.do_link(src)
if(istype(add, /mob/living/simple_animal/hostile/hivebot/guardian))
guard_amt++
. = TRUE
if(.)
linked_bots += add
RegisterSignal(add, COMSIG_QDELETING, PROC_REF(unlink))
/mob/living/simple_animal/hostile/hivebotbeacon/proc/unlink(mob/living/simple_animal/hostile/remove)
SIGNAL_HANDLER
if(!remove || !(remove in linked_bots))
return
UnregisterSignal(remove, COMSIG_QDELETING)
linked_bots -= remove
var/mob/living/simple_animal/hostile/hivebot/hb = astype(remove)
if(hb)
if(hb.linked_parent == src)
hb.unlink()
if(istype(remove, /mob/living/simple_animal/hostile/hivebot/guardian))
guard_amt--
else
var/mob/living/simple_animal/hostile/retaliate/hivebotharvester/hbh = astype(remove)
if(hbh)
if(hbh.linked_parent == src)
hbh.unlink()
harvester_amt--
/mob/living/simple_animal/hostile/hivebotbeacon/proc/generate_warp_destinations()
destinations.Cut()
@@ -45,26 +45,42 @@
psi_pingable = FALSE
sample_data = null
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/Initialize(mapload,mob/living/simple_animal/hostile/hivebot/hivebotbeacon)
if(hivebotbeacon)
linked_parent = hivebotbeacon
linked_parent.harvester_amt ++
.=..()
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/Initialize(mapload,mob/living/simple_animal/hostile/hivebotbeacon/beacon)
do_link(beacon)
. = ..()
set_light(3,2,LIGHT_COLOR_RED)
if(!mapload)
spark(get_turf(src), 3, GLOB.alldirs)
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/proc/do_link(mob/living/simple_animal/hostile/hivebotbeacon/beacon)
if(QDELETED(beacon))
return
if(linked_parent)
if(linked_parent == beacon)
return
linked_parent.unlink(src)
linked_parent = beacon
beacon.do_link(src)
RegisterSignal(linked_parent, COMSIG_QDELETING, PROC_REF(unlink))
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/proc/unlink()
SIGNAL_HANDLER
if(!linked_parent)
return
linked_parent.unlink(src)
UnregisterSignal(linked_parent, COMSIG_QDELETING)
linked_parent = null
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/death()
..(null,"teleports away!")
if(linked_parent)
linked_parent.harvester_amt --
spark(get_turf(src), 3, GLOB.alldirs)
qdel(src)
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/Destroy()
unlink()
. = ..()
if(linked_parent)
linked_parent.linked_bots -= src
/mob/living/simple_animal/hostile/retaliate/hivebotharvester/Allow_Spacemove(var/check_drift = 0)
return 1