[MIRROR] Refactor mob spawner component so that it is independent [MDB IGNORE] (#19560)

Refactor mob spawner component so that it is independent

Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-10 06:08:35 +00:00
committed by GitHub
co-authored by Jacquerel Gandalf
parent 7432ea47f6
commit ca0e0983c7
4 changed files with 58 additions and 40 deletions
@@ -46,8 +46,6 @@
var/recovery_time = 0
/// If this is a megafauna that is real (has achievements, gps signal)
var/true_spawn = TRUE
/// Range the megafauna can move from their nest (if they have one
var/nest_range = 10
/// The chosen attack by the megafauna
var/chosen_attack = 1
/// Attack actions, sets chosen_attack to the number in the action
@@ -74,13 +72,6 @@
//Safety check
if(!loc)
return ..()
if(nest && nest.parent && get_dist(nest.parent, src) > nest_range)
var/turf/closest = get_turf(nest.parent)
for(var/i = 1 to nest_range)
closest = get_step(closest, get_dir(closest, src))
forceMove(closest) // someone teleported out probably and the megafauna kept chasing them
LoseTarget()
return
return ..()
/mob/living/simple_animal/hostile/megafauna/death(gibbed, list/force_grant)
@@ -282,7 +282,14 @@
/mob/living/simple_animal/hostile/big_legion/Initialize(mapload)
.=..()
AddComponent(/datum/component/spawner, list(/mob/living/simple_animal/hostile/asteroid/hivelord/legion), 200, faction, "peels itself off from", 3)
AddComponent(\
/datum/component/spawner,\
mob_types = list(/mob/living/simple_animal/hostile/asteroid/hivelord/legion),\
spawn_time = 20 SECONDS,\
max_mobs = 3,\
spawn_text = "peels itself off from",\
faction = faction,\
)
// Snow Legion
@@ -123,8 +123,6 @@
///If the mob can be spawned with a gold slime core. HOSTILE_SPAWN are spawned with plasma, FRIENDLY_SPAWN are spawned with blood.
var/gold_core_spawnable = NO_SPAWN
var/datum/component/spawner/nest
///Sentience type, for slime potions.
var/sentience_type = SENTIENCE_ORGANIC
@@ -221,10 +219,6 @@
GLOB.simple_animals[AIStatus] -= src
SSnpcpool.currentrun -= src
if(nest)
nest.spawned_mobs -= src
nest = null
var/turf/T = get_turf(src)
if (T && AIStatus == AI_Z_OFF)
SSidlenpcpool.idle_mobs_by_zlevel[T.z] -= src
@@ -455,9 +449,6 @@
new i(loc)
/mob/living/simple_animal/death(gibbed)
if(nest)
nest.spawned_mobs -= src
nest = null
drop_loot()
if(dextrous)
drop_all_held_items()