Files
Bubberstation/code/game/objects/structures/spawner.dm
SkyratBot c056f4dac9 [MIRROR] Nanotrasen basic mobs. [MDB IGNORE] (#24573)
* Nanotrasen basic mobs. (#78917)

## About The Pull Request

First and foremost, converts all Nanotrasen simplemobs into basic mobs.

To avoid messy and redundant code, or god forbid, making Nanotrasen mobs
a subtype of Syndicate ones, I've made Syndicate, Russian, and
Nanotrasen mobs all share a unified "Trooper" parent. This should have
no effect on their behaviors, but makes things much easier to extend
further in the future.

While most of this PR is pretty cut-and-dry, I've done a couple notable
things. For one, all types of ranged trooper will now avoid friendly
fire, instead of shooting their friends in the back. Even the Russians
have trigger discipline.

I've also created a new AI subtree that allows mobs to call for
reinforcements. I've hopefully made this easy to extend, but the
existing version works as follows:

- A mob with this subtree that gains a target that is also a mob will
call out to all mobs within 15 tiles.
- If they share a faction, mobs receiving the call will have the target
added to their retaliate list, and have a new key set targeting the
calling mob.
- If they have the correct subtree in their AI controller, called-to
mobs will then run over to help out.

Sadly, this behavior is currently used only by a few completely unused
Nanotrasen mobs, so in practice it will not yet be seen.

Finally, I've fixed a minor issue where melee Russian mobs punch people
to death despite holding a knife. They now use the proper effects for
stabbing instead of punching.
## Why It's Good For The Game

Removes 8 more simple animals from the list.

As said above, making all "trooper" type mobs share a common parent cuts
down on code reuse, ensures consistency of behavior, and makes it much
easier to add new troopers not affiliated with these groups. I expect
that I'll make pirates share this same parent next.

The new "reinforcements" behavior, though extremely powerful, opens up
exciting new opportunities in the future. There aren't many existing
behaviors that allow basic mobs to work _together_ in interesting ways,
and I think adding some enemy teamwork could be fun.
## Changelog
🆑
refactor: Hostile Nanotrasen mobs now use the basic mob framework. This
should make them a little smarter and more dangerous. Please report any
bugs.
fix: Russian mobs will now actually use those knives they're holding.
/🆑

* Nanotrasen basic mobs.

* Modular

---------

Co-authored-by: lizardqueenlexi <105025397+lizardqueenlexi@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
2023-10-24 21:42:47 -04:00

223 lines
7.6 KiB
Plaintext

/obj/structure/spawner
name = "monster nest"
icon = 'icons/mob/simple/animal.dmi'
icon_state = "hole"
max_integrity = 100
move_resist = MOVE_FORCE_EXTREMELY_STRONG
anchored = TRUE
density = TRUE
faction = list(FACTION_HOSTILE)
var/max_mobs = 5
var/spawn_time = 30 SECONDS
var/mob_types = list(/mob/living/basic/carp)
var/spawn_text = "emerges from"
var/spawner_type = /datum/component/spawner
/// Is this spawner taggable with something?
var/scanner_taggable = FALSE
/// If this spawner's taggable, what can we tag it with?
var/static/list/scanner_types = list(/obj/item/mining_scanner, /obj/item/t_scanner/adv_mining_scanner)
/// If this spawner's taggable, what's the text we use to describe what we can tag it with?
var/scanner_descriptor = "mining analyzer"
/// Has this spawner been tagged/analyzed by a mining scanner?
var/gps_tagged = FALSE
/// A short identifier for the mob it spawns. Keep around 3 characters or less?
var/mob_gps_id = "???"
/// A short identifier for what kind of spawner it is, for use in putting together its GPS tag.
var/spawner_gps_id = "Creature Nest"
/// A complete identifier. Generated on tag (if tagged), used for its examine.
var/assigned_tag
/obj/structure/spawner/examine(mob/user)
. = ..()
if(!scanner_taggable)
return
if(gps_tagged)
. += span_notice("A holotag's been attached, projecting \"<b>[assigned_tag]</b>\".")
else
. += span_notice("It looks like you could probably scan and tag it with a <b>[scanner_descriptor]</b>.")
/obj/structure/spawner/attackby(obj/item/item, mob/user, params)
. = ..()
if(.)
return TRUE
if(scanner_taggable && is_type_in_list(item, scanner_types))
gps_tag(user)
return TRUE
/// Tag the spawner, prefixing its GPS entry with an identifier - or giving it one, if nonexistent.
/obj/structure/spawner/proc/gps_tag(mob/user)
if(gps_tagged)
to_chat(user, span_warning("[src] already has a holotag attached!"))
return
to_chat(user, span_notice("You affix a holotag to [src]."))
playsound(src, 'sound/machines/twobeep.ogg', 100)
gps_tagged = TRUE
assigned_tag = "\[[mob_gps_id]-[rand(100,999)]\] " + spawner_gps_id
var/datum/component/gps/our_gps = GetComponent(/datum/component/gps)
if(our_gps)
our_gps.gpstag = assigned_tag
return
AddComponent(/datum/component/gps, assigned_tag)
/obj/structure/spawner/Initialize(mapload)
. = ..()
AddComponent(spawner_type, mob_types, spawn_time, max_mobs, faction, spawn_text)
/obj/structure/spawner/attack_animal(mob/living/simple_animal/user, list/modifiers)
if(faction_check(faction, user.faction, FALSE) && !user.client)
return
return ..()
/obj/structure/spawner/syndicate
name = "warp beacon"
icon = 'icons/obj/device.dmi'
icon_state = "syndbeacon"
spawn_text = "warps in from"
mob_types = list(/mob/living/basic/trooper/syndicate/ranged)
faction = list(ROLE_SYNDICATE)
mob_gps_id = "SYN" // syndicate
spawner_gps_id = "Hostile Warp Beacon"
/obj/structure/spawner/skeleton
name = "bone pit"
desc = "A pit full of bones, and some still seem to be moving..."
icon_state = "hole"
icon = 'icons/mob/simple/lavaland/nest.dmi'
max_integrity = 150
max_mobs = 15
spawn_time = 15 SECONDS
mob_types = list(/mob/living/basic/skeleton)
spawn_text = "climbs out of"
faction = list(FACTION_SKELETON)
mob_gps_id = "SKL" // skeletons
spawner_gps_id = "Bone Pit"
/obj/structure/spawner/clown
name = "Laughing Larry"
desc = "A laughing, jovial figure. Something seems stuck in his throat."
icon_state = "clownbeacon"
icon = 'icons/obj/device.dmi'
max_integrity = 200
max_mobs = 15
spawn_time = 15 SECONDS
mob_types = list(
/mob/living/basic/clown,
/mob/living/basic/clown/banana,
/mob/living/basic/clown/clownhulk,
/mob/living/basic/clown/clownhulk/chlown,
/mob/living/basic/clown/clownhulk/honkmunculus,
/mob/living/basic/clown/fleshclown,
/mob/living/basic/clown/mutant/glutton,
/mob/living/basic/clown/honkling,
/mob/living/basic/clown/longface,
/mob/living/basic/clown/lube,
)
spawn_text = "climbs out of"
faction = list(FACTION_CLOWN)
mob_gps_id = "???" // clowns
spawner_gps_id = "Clown Planet Distortion"
/obj/structure/spawner/mining
name = "monster den"
desc = "A hole dug into the ground, harboring all kinds of monsters found within most caves or mining asteroids."
icon_state = "hole"
max_integrity = 200
max_mobs = 3
icon = 'icons/mob/simple/lavaland/nest.dmi'
spawn_text = "crawls out of"
mob_types = list(
/mob/living/basic/mining/basilisk,
/mob/living/basic/mining/goldgrub,
/mob/living/basic/mining/goliath/ancient,
/mob/living/basic/mining/hivelord,
/mob/living/basic/wumborian_fugu,
)
faction = list(FACTION_MINING)
/obj/structure/spawner/mining/goldgrub
name = "goldgrub den"
desc = "A den housing a nest of goldgrubs, annoying but arguably much better than anything else you'll find in a nest."
mob_types = list(/mob/living/basic/mining/goldgrub)
mob_gps_id = "GG"
/obj/structure/spawner/mining/goliath
name = "goliath den"
desc = "A den housing a nest of goliaths, oh god why?"
mob_types = list(/mob/living/basic/mining/goliath/ancient)
mob_gps_id = "GL|A"
/obj/structure/spawner/mining/hivelord
name = "hivelord den"
desc = "A den housing a nest of hivelords."
mob_types = list(/mob/living/basic/mining/hivelord)
mob_gps_id = "HL"
/obj/structure/spawner/mining/basilisk
name = "basilisk den"
desc = "A den housing a nest of basilisks, bring a coat."
mob_types = list(/mob/living/basic/mining/basilisk)
mob_gps_id = "BK"
/obj/structure/spawner/mining/wumborian
name = "wumborian fugu den"
desc = "A den housing a nest of wumborian fugus, how do they all even fit in there?"
mob_types = list(/mob/living/basic/wumborian_fugu)
mob_gps_id = "WF"
/obj/structure/spawner/nether
name = "netherworld link"
desc = null //see examine()
icon_state = "nether"
max_integrity = 50
spawn_time = 60 SECONDS
max_mobs = 15
icon = 'icons/mob/simple/lavaland/nest.dmi'
spawn_text = "crawls through"
mob_types = list(
/mob/living/basic/blankbody,
/mob/living/basic/creature,
/mob/living/basic/migo,
)
faction = list(FACTION_NETHER)
scanner_taggable = TRUE
mob_gps_id = "?!?"
spawner_gps_id = "Netheric Distortion"
/obj/structure/spawner/nether/Initialize(mapload)
. = ..()
START_PROCESSING(SSprocessing, src)
/obj/structure/spawner/nether/examine(mob/user)
. = ..()
if(isskeleton(user) || iszombie(user))
. += "A direct link to another dimension full of creatures very happy to see you. [span_nicegreen("You can see your house from here!")]"
else
. += "A direct link to another dimension full of creatures not very happy to see you. [span_warning("Entering the link would be a very bad idea.")]"
/obj/structure/spawner/nether/attack_hand(mob/user, list/modifiers)
. = ..()
if(isskeleton(user) || iszombie(user))
to_chat(user, span_notice("You don't feel like going home yet..."))
else
user.visible_message(span_warning("[user] is violently pulled into the link!"), \
span_userdanger("Touching the portal, you are quickly pulled through into a world of unimaginable horror!"))
contents.Add(user)
/obj/structure/spawner/nether/process(seconds_per_tick)
for(var/mob/living/living_mob in contents)
if(living_mob)
playsound(src, 'sound/magic/demon_consume.ogg', 50, TRUE)
living_mob.adjustBruteLoss(60 * seconds_per_tick)
new /obj/effect/gibspawner/generic(get_turf(living_mob), living_mob)
if(living_mob.stat == DEAD)
var/mob/living/basic/blankbody/newmob = new(loc)
newmob.name = "[living_mob]"
newmob.desc = "It's [living_mob], but [living_mob.p_their()] flesh has an ashy texture, and [living_mob.p_their()] face is featureless save an eerie smile."
src.visible_message(span_warning("[living_mob] reemerges from the link!"))
qdel(living_mob)