* Dominate & Lazarus Inject basic mobs. Lazarus Injected mobs don't fight each other. (#72440)
Fixes#72404
The Lazarus Injector doesn't currently work on basic mobs, but should.
Problem:
The EMPed state of the Lazarus Injector is intended to make a revived
mob hostile to everyone except you, including other mobs you have
revived wtih an EMPed Lazarus Injector.
This is trivial to achieve for Simple Mobs which essentially all share
the same AI, but I could not think of a single workable solution for
Basic Mobs which don't, or at least any which didn't come with a tedious
requirement to closely consider this niche item when programming any
additional AI.
Solution:
Change the default behaviour of the Lazarus Injector so this is not a
problem.
If all it does it make the mob loyal to you _and_ friendly to other mobs
which are loyal to you, then it's pretty easy because we can just use
the existing faction flags.
This is unambiguously a buff to using the item for nefarious purposes as
now if you revive four ice drakes and fulton them onto the station they
won't kill each other until only one is left, but is the only workable
solution I could really think of.
A lot of the very dangerous mining fauna can't be dragged so
transporting your army to the station still poses a question.
The alternate solution was just to replace the AI controller of any
emp-revived basic mob with a "zombie" AI controller, but this has the
problem that
A- It would now make things like cows and dogs into hostile creatures
when they previously weren't.
B- It loses any interesting behaviour the mob previously had and for
cases like Bileworms doesn't even make any sense (they'd try to walk and
just get stuck in place).
This ultimately leads to needing to make bespoke versions for various
mobs, which doesn't seem desirable from a maintainability standpoint.
As a side note it's still not a great idea to revive Bileworms _anyway_
as, their ability to move is tied to their ability to attack so once
they don't have a target they will just kind of sit there and if they
_do_ get a target their attempts to help you fight are difficult to
distinguish from attempts to kill you... but at least being able to
revive them makes it easier to make one sapient if you really want to
trap a player's mind inside a body which is incapable of leaving
lavaland.
Additional edit:
At Fikou's suggestion I've also added a sentience comparison proc to
`mob/living` and removed some code duplication which dealt with this
problem in the sentience/mind transfer potions, as well as added it to
the Dominate spell.
This device is meant to revive mobs and it shouldn't be required for
players to memorise an arbitrary list of which mobs it does and doesn't
work on.
Especially as the goal is eventually that all simple mobs should be
basic mobs.
This way of working is more intuitive, even if it is also stronger. I
was surprised when I used EMPed injectors and my "new minions" just
killed each other.
🆑
fix: You can now revive 'basic mobs' with a Lazarus Injector, such as
dogs, cows, axolotls, or carp.
fix: The same category of mobs can also now be effected by the Runic
Golem Dominate spell.
fix: Basic Mobs will switch target if they can no longer attack their
current target; meaning that if you become a Bileworm's friend it will
stop attacking you.
balance: Mobs injected with the Lazarus Injector while it is EMPed will
no longer attack other mobs revived by EMPed Lazarus Injectors.
/🆑
* Update code/modules/research/xenobiology/xenobiology.dm
* Update code/modules/research/xenobiology/xenobiology.dm
---------
Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
* Basic mobs won't shoot walls / Basic mobs won't leave permanent bullet casings (#72494)
## About The Pull Request
Basic mobs using the generic ranged attack behaviour will now not
attempt to shoot a target which they can no longer see.
If they can still see you through a window that's fine because shooting
in your direction will probably break the window eventually, but a mob
knowing you're on the other side of a wall and pointlessly firing at it
isn't useful.
Additionally, adds a component to bullet casings fired by basic mobs
which deletes them after 30 seconds.
https://user-images.githubusercontent.com/7483112/211012442-027455c7-2846-426e-89fb-c8c89d891e4f.mp4
Here's a demonstration but sped up so they vanish after 5 seconds
instead.
## Why It's Good For The Game

We're not actually sure that's where these 75,000 bullet casings came
from (it's probably related to that pAI down there) but it's one way it
could happen.
Players with limited ammo leaving persistent bullet casings should
rarely be a problem, mobs have infinite ammo and so should not be able
to generate infinite debris. Having them just sort of disappear after 30
seconds is... less than immersive, but I feel like it's better than the
alternative.
You can attach the element to other things to thanos snap them if you
want.
## Changelog
🆑
fix: Syndicate mobs will no longer attempt to shoot you through walls,
building up massive piles of empty bullet casings in the process.
qol: Bullet casings from "weapons" fired by certain mobs will clean
themselves up after 30 seconds.
/🆑
* Basic mobs won't shoot walls / Basic mobs won't leave permanent bullet casings
Co-authored-by: Jacquerel <hnevard@gmail.com>
* Some tweaks to mobs running away (#72529)
## About The Pull Request
Mice running away behaviour wasn't working quite how it was supposed to
due to a couple of bugs.
First of all, the action was written as if it would `perform` every
tick, which it doesn't. This means that the code checking if you had
left line of sight didn't function, meaning mobs would continue fleeing
you even when they couldn't see you any more.
Secondly, mobs spent an awful lot of time pathing into walls which was
especially noticeable on mice who just would _not_ stop repeatedly
squeaking in a way that is kind of funny but gets old when you keep
hearing it. Now the pathing stops if it hits a barrier.
I'm not... totally fond of this solution because it has a few
assumptions baked in (that we want to try and path through doors even if
they're dense for one) but I can't for the moment think of a better
"path away from" implementation that isn't way more complicated, and
this doesn't really need to be complicated.
For good measure I noticed a couple of other actions weren't passing a
`source_atom` into `is_blocked_turf` so rats were potentially attacking
"obstacles" they could simply walk over.
Additionally a couple of places were setting
`controller.movement_target` directly instead of using the helper method
which has a minor risk of runtiming under certain conditions.
## Why It's Good For The Game
Mice will stop constantly screaming if they can see someone, and should
repath once they have a different escape route more quickly rather than
dedicating themselves to trying to burrow through an iron wall.
Rats won't bite at tables and racks they can just climb over.
## Changelog
🆑
fix: Mice won't try to path through walls to escape from sight and
constantly squeak.
fix: Mice will stop running away from you if they can't see you any
more.
fix: Rats won't bite racks and tables while passing over them.
/🆑
* Some tweaks to mobs running away
Co-authored-by: Jacquerel <hnevard@gmail.com>
* Dogs use the Pet Command system
* modular pets
* modular dogs
* oops
* NO
Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: tastyfish <crazychris32@gmail.com>
AI actions won't unassign each other's movement targets & Mice stop being scared of people if fed cheese (#72130)
## About The Pull Request
Fixes#72116
I've had a persistent issue with basic mob actions reporting this error
and think I finally cracked it
When replanning with `AI_BEHAVIOR_CAN_PLAN_DURING_EXECUTION` it can run
`Setup` on one action leading to the plan changing, meaning that it runs
`finishCommand` to cancel all other existing commands
If you triggered a replan by setting up a movement action in the middle
of another movement action, cancelling the existing action would remove
the target already set by the current one.
We want actions to be able to remove _their own_ movement target but not
if it has been changed by something else in the intervening time.
I fixed this by passing a source every time you set a movement target
and adding a proc which only clears it if you are the source... but this
feels kind of ugly. I couldn't think of anything but if you have a
better idea let me know.
Also while I was doing this I turned it into a feature because I'm
crazy.
If you feed a mouse cheese by hand it will stop being scared of humans
and so will any other mice it attracts from eating more cheese. This is
mostly because I think industrial mouse farming to pass cargo bounties
is funny.
Mice controlled by a Regal Rat lose this behaviour and forget any past
loyalties they may have had.
https://user-images.githubusercontent.com/7483112/208779368-3bd1da0f-4191-4405-86e5-b55a58c2cd00.mp4
Oh also I removed a block about cancelling if you have another target
from the "hunt" behaviour, everywhere using this already achieves that
simply by ordering the actions in expected priority order and it was
messing with how I expected mice to work.
Now if they happen to stop by some cheese they will correctly stop
fleeing in order to eat it before continuing to run away.
## Why It's Good For The Game
Fixes a bug I kept running into.
Makes it possible to set up a mouse farm without them screaming
constantly.
Lets people more easily domesticate mice to support Ratatouille
gameplay.
## Changelog
🆑
add: Mice who are fed cheese by hand will accept humans as friends, at
least until reminded otherwise by their rightful lord.
fix: Fixed a runtime preventing mice from acting correctly when trying
to flee and also eat cheese at the same time.
/🆑
Co-authored-by: Jacquerel <hnevard@gmail.com>
* Basic Mobs can run away (#71963)
## About The Pull Request
That's right I'm still atomising #71421, some day I might even post
something related to carp.
This PR adds various behaviours to basic mobs allowing them to run away,
in a couple of variations.
Mice will flee from anyone who doesn't share their factions, at all
times (so they will scatter from most humans, but not regal rats).
Rabbits and Sheep will flee from anyone who has attacked them.
Pigs will run away from people who have attacked them, but only if
they're below half health.
https://user-images.githubusercontent.com/7483112/207127135-d1737f91-d3f7-468a-ac60-7c7ae5d6623d.mp4
Mice are still plenty catchable because they don't run _very far_ (or
very fast) but I think the chase will be good enrichment.
To achieve this I had to change the signal COMSIG_CARBON_HEALTH_UPDATE
into COMSIG_LIVING_HEALTH_UPDATE but frankly the latter seems more
sensible anyway.
## Why It's Good For The Game
More behaviours to use later when designing mobs, gradually gives mobs
more things to do rather than just sort of moving aimlessly around the
area you left them in.
It'll give people hunting rats in maintenance some exercise.
## Changelog
🆑
add: Mice will now run away from you, you have to catch them if you want
to eat them. Use those traps!
add: Rabbits, Sheep, and Pigs likewise won't just sit there and let you
pulverise them if they can see an escape route.
/🆑
* Basic Mobs can run away
* Modular!
Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: Funce <funce.973@gmail.com>
* Pet Command Component + Regal Rats can order their subjects around (#71590)
## About The Pull Request
Another atomisation of #71421 but I had a fun idea while I was testing
it.
This adds a component based on the existing system for giving
instructions to tamed carp or dogs, but hopefully more modular.
It also gives it to the rat minions of a regal rat.
The basic function allows the mob to listen and react to spoken
commands, which passes things to its AI blackboard. Additionally if you
alt-click a commandable mob it will show a radial menu which both allows
you to select a command, and also contains tooltips explaining what they
do and what audible words trigger it.
<details>
<summary>Video</summary>
https://user-images.githubusercontent.com/7483112/204308693-0eccebec-75c9-411c-81c5-5aa0d682d1a5.mp4
</details>
Now if you riot some rats, you can alt click on them individually to
give them specific orders (more useful for other creatures than rats),
or you can speak out loud to command your legion.
Rats aren't very smart so you can't give them many instructions, but
this is expandable for other creatures.
Additional change: Mice don't squeak if stepped on by other mice because
this made an absolutely unholy noise and I am not sure there's a way to
get non-dense mobs to spread out.
## Why It's Good For The Game
Allows for giving more mobs the ability to be tamed and instructable by
their owner, without copy/pasting code which lives inside a specific
mob.
Yelling at your rats to give them commands is funny. It also adds the
possibility of telling your rats to stop biting someone if they have
agreed to your demands, allowing for more courtly roleplay.
When Regal Rat is converted to a basic mob its AI can also give other
AIs instructions by yelling at them which I think is a good feature.
## Changelog
🆑
add: The followers of Regal Rats will now respond to simple
instructions, if given by their rightful lord. Except frogs. They're too
busy licking themselves and watching the colours.
/🆑
* Pet Command Component + Regal Rats can order their subjects around
Co-authored-by: Jacquerel <hnevard@gmail.com>
* Allows datum AI to switch to different movement datums (#71595)
## About The Pull Request
Allows basic mobs / datum AI to switch between movement datums. Useful
if you need JPS in some moments, but simple obstacle avoidance in others
This isn't used anywhere yet, but is a building block for basic bots.
## Why It's Good For The Game
Allows us to pick the right tool for the job!
## Changelog
🆑 Capybara Holly
refactor: Datum AI can now switch to different movement datums in their
behavior.
/🆑
Co-authored-by: Capybara <Capybara@ CapybaraMailingServices.com>
* Allows datum AI to switch to different movement datums
Co-authored-by: CapybaraExtravagante <110635252+CapybaraExtravagante@users.noreply.github.com>
Co-authored-by: Capybara <Capybara@ CapybaraMailingServices.com>
* Fixes bileworms being unable to act (#69874)
* Makes bileworm AI use weakrefs for targets
* Apply suggestions from code review
* Update code/datums/ai/basic_mobs/basic_ai_behaviors/try_mob_ability.dm
* question mark
Co-authored-by: ShizCalev <ShizCalev@ users.noreply.github.com>
* Fixes bileworms being unable to act
Co-authored-by: GoblinBackwards <22856555+GoblinBackwards@users.noreply.github.com>
Co-authored-by: ShizCalev <ShizCalev@ users.noreply.github.com>
* Cows can eat wheat off the ground. If cows see wheat on the ground, they'll try to go eat it (+ moonicorns with galaxy thistle) (#69253)
About The Pull Request
Cows are now grazers, they love eatin' wheat and it even heals them if hurt. If they see it just on the ground, they might eat it all! Careful, botanists! While tamed, cows won't eat off the ground if they're busy ferrying you around.
FYI: this is going to conflict with #69247 and so thiss should not be merged until that is
Why It's Good For The Game
Wanted to add this with the original port of cows to basic mobs, didn't have the TECH to do so. Now I do, now it's done. I also wanted it ready for the future where mice and rats are ported, so they'd seek out cheese to eat. I also also think it's a neat way for a cow to heal.
* Cows can eat wheat off the ground. If cows see wheat on the ground, they'll try to go eat it (+ moonicorns with galaxy thistle)
Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>