mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 18:45:22 +01:00
Turns Changeling Headslugs into a Basic Mob (#75601)
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request Short and simple, just converts the changeling's headslug (that ability they get that lets them infest another body) into a basic mob. Also touches up some of the code, as well as split up the code such that the headslug resides in the basic mobs folder, while the eggs are in the changeling's antagonist folder, rather than one megafile for both. No AI because this is 100% a player-controlled mob, it never exists in any other context. No UpdatePaths for the same reason as well, this shouldn't (and really doesn't) exist on maps because its sole purpose is player-driven. <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game Knocks another one off the list, potentially clears up some janky code with how this operated and just beautifies it overall. I also standardized the name "headslug" in any applicable context because the name "headcrab" is quite confusing. Some other code still refers to it as headcrab/crab, but that's whatever, at least the paths are a-okay now. Also opens the door in case someone really wants these to be AI-powered? That sounds really weird and I don't really support that idea, but it's indeed possible.  Grow and regrow, the life cycle. <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> ## Changelog <!-- If your PR modifies aspects of the game that can be concretely observed by players or admins you should add a changelog. If your change does NOT meet this description, remove this section. Be sure to properly mark your PRs to prevent unnecessary GBP loss. You can read up on GBP and it's effects on PRs in the tgstation guides for contributors. Please note that maintainers freely reserve the right to remove and add tags should they deem it appropriate. You can attempt to finagle the system all you want, but it's best to shoot for clear communication right off the bat. --> 🆑 refactor: Headslugs (the really small slug-like changeling form) are now basic mobs. They only wander around aimlessly now instead of attacking corpses all the time, and examining will let you know what type. Should probably still smash them before they suddenly gain sapience... /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. -->
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* ## Headslugs
|
||||
*
|
||||
* Player-controlled slugs that arise from a changeling ability in order to live on in an extremely limited capacity until they can find a suitable corpse to inhabit.
|
||||
*/
|
||||
/mob/living/basic/headslug
|
||||
name = "headslug"
|
||||
desc = "A small, slug-like creature with a large, gaping maw. It's covered in a thick, slimy mucus."
|
||||
icon_state = "headslug"
|
||||
icon_living = "headslug"
|
||||
icon_dead = "headslug_dead"
|
||||
gender = NEUTER
|
||||
health = 50
|
||||
maxHealth = 50
|
||||
melee_damage_lower = 5
|
||||
melee_damage_upper = 5
|
||||
attack_verb_continuous = "chomps"
|
||||
attack_verb_simple = "chomp"
|
||||
attack_sound = 'sound/weapons/bite.ogg'
|
||||
attack_vis_effect = ATTACK_EFFECT_BITE
|
||||
faction = list(FACTION_CREATURE)
|
||||
obj_damage = 0
|
||||
environment_smash = ENVIRONMENT_SMASH_NONE
|
||||
speak_emote = list("squeaks")
|
||||
|
||||
ai_controller = /datum/ai_controller/basic_controller/headslug
|
||||
|
||||
/// Set to true once we've implanted our egg
|
||||
var/egg_lain = FALSE
|
||||
|
||||
/mob/living/basic/headslug/Initialize(mapload)
|
||||
. = ..()
|
||||
ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT)
|
||||
RegisterSignal(src, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(check_and_implant))
|
||||
|
||||
/mob/living/basic/headslug/Destroy()
|
||||
UnregisterSignal(src, COMSIG_HOSTILE_POST_ATTACKINGTARGET)
|
||||
return ..()
|
||||
|
||||
/mob/living/basic/headslug/examine(mob/user)
|
||||
. = ..()
|
||||
if(isnull(client))
|
||||
. += span_notice("It appears to be moving around listlessly.")
|
||||
else
|
||||
. += span_warning("It's moving around intelligently!")
|
||||
|
||||
/// Signal Handler proc that runs on every attack and checks to see if this is a valid target for implantation. If so, it implants the egg and starts the countdown to death.
|
||||
/mob/living/basic/headslug/proc/check_and_implant(mob/living/basic/attacker, atom/target)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if (egg_lain || !iscarbon(target) || ismonkey(target))
|
||||
return
|
||||
|
||||
var/mob/living/carbon/victim = target
|
||||
if(victim.stat == DEAD)
|
||||
return
|
||||
if(HAS_TRAIT(victim, TRAIT_XENO_HOST))
|
||||
target.balloon_alert(src, "already pregnant!") // Maybe the worst balloon alert in the codebase
|
||||
return
|
||||
|
||||
if(!infect(victim))
|
||||
target.balloon_alert(src, "failed to implant egg!")
|
||||
stack_trace("[key] in [src] failed to implant egg in [victim], despite all checks suggesting it should have worked!")
|
||||
return
|
||||
|
||||
egg_lain = TRUE
|
||||
to_chat(src, span_userdanger("With our egg laid, our death approaches rapidly..."))
|
||||
addtimer(CALLBACK(src, PROC_REF(death)), 10 SECONDS)
|
||||
|
||||
/// Simply infects the target corpse with our changeling eggs. This shouldn't fail, because all checks should have been done in check_and_implant()
|
||||
/// Just to be super-duper safe to the player, we do return TRUE if all goes well and read that value in check_and_implant() to be nice to the player.
|
||||
/mob/living/basic/headslug/proc/infect(mob/living/carbon/victim)
|
||||
var/obj/item/organ/internal/body_egg/changeling_egg/egg = new(victim)
|
||||
egg.Insert(victim)
|
||||
|
||||
egg.origin = mind
|
||||
|
||||
for(var/obj/item/organ/target in src)
|
||||
target.forceMove(egg)
|
||||
|
||||
visible_message(
|
||||
span_warning("[src] plants something in [victim]'s flesh!"),
|
||||
span_danger("We inject our egg into [victim]'s body!"),
|
||||
)
|
||||
|
||||
return TRUE
|
||||
|
||||
/// This is a bit neutered since these aren't intended to exist outside of player control, but it's a bit weird to just have these guys be completely stationary.
|
||||
/// No attacking or anything like that, though. Just something so they seem alive.
|
||||
/datum/ai_controller/basic_controller/headslug
|
||||
ai_movement = /datum/ai_movement/basic_avoidance
|
||||
idle_behavior = /datum/idle_behavior/idle_random_walk
|
||||
Reference in New Issue
Block a user