Commit Graph

62 Commits

Author SHA1 Message Date
Ghom
54dd3c864a basic mobs & co no longer indiscriminately perform close-range actions in the presence of obstacles. (#75687)
## About The Pull Request
Currently, we don't have any such thing as a general ai_behavior flag
for behaviors that need a check for if the current_movement_target is
within reach or not. We could fix it case by case by slapping a
`CanReach()` check in the `performBehavior()` definition of every
`ai_behavior` datum that warrants it, the general issue will keep
resurfacing as long as new behaviors are added to the game anyhow, while
there's a lot less copypasta involved easier to apply solution to
current and future instances of such issue.

Worth mentioning not all ai_behaviors with required_range of 1 have this
flag. Some are fairly innocuous, such as the follow command, some others
kind of handle it already in a more peculiar or complex way, which is
also an argument against making it a hardcoded heck for when the
required_range is 1 or 0.

This has been tested, though there are some rough edges and oddities
also unrelated to his PR that might have evaded scrutiny.

## Why It's Good For The Game
This should fix #74823, fix #69254, and fix #74713 (I guess? it could
have been phrased better).

## Changelog

🆑
fix: basic mobs & co no longer indiscriminately perform close-range
actions in the presence of obstacles such as directional windows between
them and their target.
fix: Doggos should look at you with longing eyes once again if you dare
pick up an edible they are trying to eat.
/🆑
2023-05-29 18:13:13 -06:00
MrMelbert
ed2f04f486 Experiment with replacing weakrefs in AI blackboard with deleting signals, ideally making it easier to work with and harder to cause hard deletes (#74791)
## About The Pull Request

Replaces weakref usage in AI blackboards with deleting signals

All blackboard var setting must go through setters rather than directly

## Why It's Good For The Game

This both makes it a ton easier to develop AI for, and also makes it
harder for hard deletes to sneak in, as has been seen with recent 515
prs showing hard deletes in AI blackboards

(To quantify "making it easier to develop AI", I found multiple bugs in
existing AI code due to the usage of weakrefs.)

I'm looking for `@Jacquerel` `@tralezab` 's opinions on the matter, also
maybe `@LemonInTheDark` if they're interested

## Changelog

🆑 Melbert
refactor: Mob ai refactored once again
/🆑
2023-04-23 17:07:17 -06:00
oranges
4c48966ff8 Renames delta time to be a more obvious name (#74654)
This tracks the seconds per tick of a subsystem, however note that it is
not completely accurate, as subsystems can be delayed, however it's
useful to have this number as a multiplier or ratio, so that if in
future someone changes the subsystem wait time code correctly adjusts
how fast it applies effects

regexes used

git grep --files-with-matches --name-only 'DT_PROB' | xargs -l sed -i
's/DT_PROB/SPT_PROB/g'
git grep --files-with-matches --name-only 'delta_time' | xargs -l sed -i
's/delta_time/seconds_per_tick/g'
2023-04-11 21:31:07 -07:00
Zephyr
ecbcef778d Refactors Regenerate Organs, and a few organ helpers (#74219)
## About The Pull Request

Refactors regenerate organs to be slightly more intelligent in handling
organ changes and replacements.
Noteably:
- We don't remove organs that were modified by the owner; such as
changing out your heart for a cybernetic
- We early break out of the for loop if they aren't supposed to have an
organ there and remove it
- We check for the organ already being correct, and just healing it and
continuing if it is

Also changes the names of some of the organ helpers into snake_case
### Mapping March
Ckey to receive rewards: N/A

## Why It's Good For The Game
## Changelog

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-03-26 17:54:36 +01:00
tralezab
20a1e1e913 Fixes seeing monkey ai examine text if the monkey doesn't have eyes to look primal with. (#73166)
<!-- 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

Refactors ai datum examines to use noticable organ elements.

## Why It's Good For The Game

This preserves the original examine on monkeys and allows future
examines to be dependent on the state of the species, so the examines
are less generic. But if you want generic, it's supported!

## 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: Monkey AI descriptions of "primal eyes" no longer show if the
monkey is missing eyes.
/🆑

<!-- 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. -->
2023-02-16 16:33:34 -07:00
John Willard
c097f167b1 Completely removes do_mob and do_after_mob (#73117)
## About The Pull Request

This is a remake of #70242

Replaces all instances of ``do_mob`` and ``do_after_mob`` with
``do_after``.

## Why It's Good For The Game

All 3 of these are just copy pastes of eachother but some miss some
features (like do_after not checking for target loc change, which helps
towards fixing https://github.com/tgstation/tgstation/issues/66874
though it doesn't because mechs are setting ``do_after`` on the mob in
the mech) and signals only being used on ``do_after``.

## Changelog

🆑
fix: Mechs should now cancel out of drilling when they move.
/🆑
2023-02-02 21:17:20 +00:00
Jacquerel
8cb4947084 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.
/🆑
2022-12-22 00:41:36 -08:00
Jacquerel
58b61a17a7 Basic Mob Carp: Retaliate Element (#71593)
## About The Pull Request

Adds an Element and AI behaviour intended to replicate the "retaliate"
behaviour which made up an entire widely-populated subtype of simple
mobs.
The behaviour is pretty simply "If you fuck with me I fuck with you".
Mobs with the component will "remember" being attacked and will try to
attack people who attacked them, until they lose sight of those people.
They don't have very long memories so breaking line of sight is enough
to remove you from their grudge list.
The implementation unfortunately requires registering to 600 different
"I have been attacked by X" signals but c'est la vie.

It will still be cleaner than
`/mob/living/simple_animal/hostile/retaliate/clown/clownhulk/honcmunculus`
and `mob/living/simple_animal/hostile/retaliate/bat/sgt_araneus`.

I attached it to the pig for testing and left it there because out of
all the farm animals we have right now, a pig would probably get pissed
off if you tried to kill it. Unfortunately it's got a sausage's chance
in hell of ever killing anyone.

## Why It's Good For The Game

It doesn't have much purpose yet but as we make more basic mobs this is
going to see a **lot** of use.

## Changelog

🆑
add: Basic mobs have the capability of being upset that you kicked and
punched them.
add: Pigs destined for slaughter will now ineffectually attempt to
resist their fate, at least until they lose sight of you.
balance: Bar bots are better at noticing that you're trying to kill
them.
/🆑
2022-12-09 19:53:58 +01:00
CapybaraExtravagante
e511ef53e8 Fixes monkeys being unable to retaliate to people who attacked them (#71598)
## About The Pull Request

Monkeys were not attacking creatures they hated, as the check for who to
attack was mangled in messed with in #70722

## Why It's Good For The Game

Monkey castle doctrine is important!

## Changelog

🆑 Capybara holly
fix: After rigorous training excercises monkeys now understand how to
defend themselves from vile greytiders again
/🆑

Co-authored-by: Capybara <Capybara@CapybaraMailingServices.com>
2022-11-29 14:32:15 -08:00
CapybaraExtravagante
8f6528c9ec 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>
2022-11-29 14:30:30 -08:00
AnturK
84f69359a0 More horrible 515 proc compatibility. (#71333)
So i left over some basic `/whatever/proc/format` uses in the original
PR this fixes it.

Notable exceptions to the rule:
- Paths in add_verb/remove_verb, we need full path instead of a name
there to access verb metadata so we can't use proc ref macros there.
- regex.Replace, found out that it does not accept call by name. Instead
i added new REGEX_REPLACE_HANDLER so we can at least try to mark these.

There's still leftover global procs that do not use GLOBAL_PROC_REF but
they functionally equivalent so that's for later.

I don't see any reasonable way to grep for this. But if you got any
ideas please share.
2022-11-22 07:55:43 +00:00
AnturK
4d6a8bc537 515 Compatibility (#71161)
Makes the code compatible with 515.1594+

Few simple changes and one very painful one.
Let's start with the easy:
* puts call behind `LIBCALL` define, so call_ext is properly used in 515
* Adds `NAMEOF_STATIC(_,X)` macro for nameof in static definitions since
src is now invalid there.
* Fixes tgui and devserver. From 515 onward the tmp3333{procid} cache
directory is not appened to base path in browser controls so we don't
check for it in base js and put the dev server dummy window file in
actual directory not the byond root.
* Renames the few things that had /final/ in typepath to ultimate since
final is a new keyword

And the very painful change:
`.proc/whatever` format is no longer valid, so we're replacing it with
new nameof() function. All this wrapped in three new macros.
`PROC_REF(X)`,`TYPE_PROC_REF(TYPE,X)`,`GLOBAL_PROC_REF(X)`. Global is
not actually necessary but if we get nameof that does not allow globals
it would be nice validation.
This is pretty unwieldy but there's no real alternative.
If you notice anything weird in the commits let me know because majority
was done with regex replace.

@tgstation/commit-access Since the .proc/stuff is pretty big change.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
2022-11-15 03:50:11 +00:00
ShizCalev
f54994c260 Fixes some monkey business with monkies trying to give items to mobs with no hands. (#71086)
held_items is only populated if the mob is able to hold things. In this case, lizards (and most simple / basic mobs) don't have hands, so it's just an empty list. Fixed that at the `/mob` level.

Also made the giving logic a little more robust to handle mobs mobs not actually wearing anything as well.
2022-11-06 05:37:33 -05:00
Zephyr
2ee2920284 Monkey Business Unit Test (#70722)
* monkeying around

* 🤷

* haha oops

Co-authored-by: san7890 <34697715+san7890@users.noreply.github.com>

* I'm an idiot

* redo this and add a blackboard to allow targeting monkies

* I'm smart

* requested changes

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>

* a few fixups

* Update code/modules/unit_tests/_unit_tests.dm

Co-authored-by: san7890 <the@san7890.com>

* Nits

Co-authored-by: san7890 <34697715+san7890@users.noreply.github.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: san7890 <the@san7890.com>
2022-10-26 12:09:07 -04:00
Holoo
0b8b9b9b6f fixes monkey controller runtimes and ai_behavior/give (#70778)
* Fixes monkeys' ``give`` AI stuff, allowing Monkeys to properly give things to people now.

Co-authored-by: Holoo <oleksanr.kozyr.yr1@gmail.com>
Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
2022-10-26 06:17:04 -04:00
Tastyfish
c2f124a3d2 Fixes monkey AI runtimes (#70696)
* Fixes monkey combat runtime

* better monkey subtree
2022-10-22 16:10:48 -04:00
itseasytosee
bcfd895c14 Functionality for custom human examine messages when possessed by an AI controller. Implements on humans with monkey AI (#70356)
The "They don't appear to be themselves" line on humans that have AI controllers is now controllable by the AI controller, and is only "They don't appear to be themselves" by default.
Monkeized human now have the line
2022-10-13 18:00:32 -07:00
tralezab
85394d6b0a Fixes monkey ai runtime (#69601) 2022-09-01 22:12:42 +02:00
itseasytosee
96e73097f7 Monkeys won't stay in combat mode forever after getting pissed off anymore. (#69488)
Monkeys will now drop out of combat mode in the following situations

- They have no enemies
- They have enemies but the monkey can not target them because they are far away
- They have enemies but they are dead/disabled
2022-08-30 16:56:31 -07:00
itseasytosee
497fa7b23f Monkey trip mechanic removed from AI controller and added to brain. Adds organ based trait system. (#69496)
Alright, big exciting PR.

First big thing! Traits can now be tried to organs which are granted and removed from the mob with the organ.
The traits PRIMATIVE, LITERATE, CAN_STRIP, and ADVANCED_TOOL_USER have been removed from species inherent traits list, because they apply to the species brain in specific, not their whole body.
The baseline brain gives the traits LITERATE, CAN_STRIP, and ADVANCED_TOOL_USER, all species that had these traits have a baseline brain.
Ashwalkers have been given a "primitive brain" which gives ADVANCEDTOOLUSER, CAN_STRIP, PRIMITIVE, and notably not literacy. These give them the same traits as before, but their privative nature and lack of reading followers their brain no matter which body they inhabit.

Monkeys have been given the "primate brain" which gives CAN_STRIP and PRIMITIVE. The monkey's brain now holds the logic for the monkey tripping mechanic instead of the AI datum which is a huge win. Monkeys with clients can also now toggle if they would like to be tripped by people, in order to better blend in. AI monkeys will always have tripping on. I also have implemented my qol monkey tripping changes from #69478 (the videos on that PR are still accurate)

What this means, is a human's brain in a monkey's body will still be able to use tools, read, and even operate mechs. but will still have the other non mental monkey traits like being able to crawl though vents while naked. So lovely.

Conversely a monkey's brain (even a sentient one) that is put in a human body will still be illiterate, and will be unable to use complex tools.

Transforming into a monkey via genetics or other means will also change your brain into a monkey brain (this mechanic existed before now, it just wasn't applicable)

Some of this code might not be up to standard, please give me your corrections.
2022-08-29 11:41:26 -07:00
itseasytosee
784ce3f568 Improvement to monkey AI's weapon selection ability. Won't attack With zero force items. (#69490)
Monkeys will now drop the item in their hand when selecting a weapon to attack with if it is worse than their basic bite attack, and will avoid picking up a weapon if they can't find one that's better than their basic bite attack.
Because of this, you can no longer completely disable monkeys by filling their hands with zero force items. This also means you can no longer trick monkeys into using sutures and other medical items on you.
2022-08-29 11:35:45 -07:00
Seth Scherer
f1a363c825 Converts a shitload of istypes to their more concise macros (#69260)
* Converts a lot of istypes() to use their istype macro helpers.
2022-08-18 22:08:44 -04:00
John Willard
b4f19a7e0f Greatly increases Pun Pun's abilities and strengths (using desk bells, cross stun immunity) (#68870)
About The Pull Request

Pun Pun has a new AI, with it they received the following:

    Instead of screeching/roaring/scratching/jumping/rolling, Pun Pun will instead sing/dance/bow/clear throat/sign.
    Pun Pun now rings desk bells instead of finding random shit to pick up, and doesn't intentionally seek out weapons.
    Pun Pun has a higher chance of giving people stuff in their hand, so the Bartender can give them a drink and let them go walking around.

Additionally:

    Pun Pun is now immune to being hardstunned by walking into them, giving them a little more bite for greytiders beating them up.
    Monkeys can now use desk bells.

Why It's Good For The Game

I like Pun Pun and when Monkey AIs were originally added, there was a note about giving them a unique AI. Since we're slowly turning the poor monkey into an actual Bartender assistant, I find it thematic that they would ring the bell and give out drinks in their hand, as if the Bartender taught them themselves.

For the hardstun immunity, I mostly did it because I find it annoying for a Bartender to have to carefully navigate around Pun Pun to not knock them over and make them drop an instrument (or anything else) in their hand, but it also works as a buff to people trying to kill them. Pun pun is a unique monkey so I don't believe they should be as easy to kill as any other.

Desk bell addition was necessary for Pun Pun to use it.
Changelog

cl
add: Pun Pun now gives stuff in their hand frequently and rings desk bells.
add: Pun Pun now has gentleman-like emotes, rather than screeching and roaring.
balance: Pun Pun no longer looks for weapons in their off time.
balance: Pun Pun is no longer vulnerable to stuns by being walked into.
qol: Monkeys can now use desk bells.
/cl
2022-08-05 12:38:59 +12:00
MrMelbert
cfe1af3661 Fixes monkey disposalling (#66435)
- Disposal target was changed to a weakref, but this read was not changed to resolve from a weakref, mistakenly
2022-04-23 21:11:33 -07:00
John Willard
cab70f4d1a Restores old monkey knockdowns (monkey nerf) (#65080)
Monkey knockdown used to be on Crossed until it was made an AI here: 55238

Now it instead uses COMSIG_ATOM_ENTERED, which only takes into account walking over the monkey. Something that you can't do unless you are non-dense or they are lying on the floor, in which case you aren't even knocking them down?
Now it uses COMSIG_MOVABLE_CROSS instead so it's how it used to be, actually functional and useful.
2022-03-03 13:45:52 -08:00
John Willard
968795fab7 Makes non-dense mobs not knock monkeys over (#65040)
Monkeys only get knocked over when you walk over them (not even when you swap places with them, which I thought was supposed to be the case), this makes non-dense mobs not knock them over. Which means Revenants, bots, small animals (lizards/butterflies), larvas, ect. will not knock monkeys over.
2022-02-22 09:22:40 +00:00
LemonInTheDark
934a5ea498 Actually fixes strange mob delays: BEEPSKY IS TOO FAST edition (#64351)
* Revert " Properly speeds up a lot of things, mostly mobs (#64270)"

This reverts commit a836574388.
THE BYOND REF WAS A LIE, THE PLAYERS ARE FOOLS, HELP, HELPPPPPPP

It turns out that despite what the byond ref says, the walk proc's delays were not in fact in ticks, but in deciseconds.
This means when I "fixed" mob movement by doubling all walk delays, what I actually did was double the speed of anything that used walk()

I have a feeling that the actual issue players were seeing was just move_to having fucked up distance logic, and the movement of slow mobs being smoothed out. I've changed that, so hopefully this puts a seal on the whole problem

I've had a request put in to make beepsky faster, but I think that's best done in a seperate pr

* Adds a flag to disable smooth moveloop movement
Applies it to hostile mob's Goto()
Backports the fixes to move_to and move_away from the previous pr
2022-01-27 19:50:08 -06:00
LemonInTheDark
a836574388 Properly speeds up a lot of things, mostly mobs (#64270)
When I made my move loop changes (815bb8a) 62567, I converted a few walk() procs to
the new system
What I didn't know when I did that conversion is that walk() operates on ticks, when move loops operate on
deciseconds

So when I converted say, mob movement over, I accidentially halved the attack movespeed of all of our mobs

This resolves that, alongside a few other misteps

Of note: There are old comments implying that walk()'s delay is not actually linear, or simply as the reference says "in ticks"
I don't have a good idea of how fast things actually should be though, which makes this tricky

In light of this, I've decreased the move speed of legion slightly, in hopes that it will feel more "normal"

I've also fixed a bug with move_to and move_away, they were treating their distance parameters as move to this and one more, rather then move to this. This lead to mobs attempting to overlap with your sprite. s cringe, and also fixed
2022-01-21 23:57:36 -08:00
LemonInTheDark
815bb8ae40 Adds a movement looping system, replaces inbuild procs and spacedrift with it (#62567)
* Adds a subsystem to handle automated directional movement, replaces all instances of walk_towards with it. Makes meteors and immovable rods not drift in space, and makes immovable rods more destructive. Note, I've opted not to use byond's method of moving towards something, which is effectively Move(src, get_step(src, get_dir(src, target))) as it's cringe and doesn't make a smooth line. I've replaced it with a autoupdating rise over run setup, read the code for more details

* woop forgot the subsystem

* Documentation, contributing.md entry, and some cleanup

* Makes the moveloop datum more oop friendly, sets us up for a lot of conversions

* Converts the curseblob and walk_away() to the subsystem

* Changes the default for override from FALSE to TRUE

* converts walk() over, still need to add a replacement proc for it, but we didn't actually have anything that used the raw proc

* converts the rest of walk_to() over, nearing the end now

* cleans up some errors

* Fully documents everything, fills in some missing movement types, uses the power of oop to make things cleaner, and typepaths longer

* Finishes the contributing.md stuff

* Done

* Fefaults -> Defaults, can you tell I wrote this at 1AM?

* resolves bubblegum issues

* Roh's suggestions

Co-authored-by: Rohesie <rohesie@gmail.com>

* Cleanup

* Hey lemon, did you know that Destroy() lives on datums? ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

* Converts over the discrepencies created in my absense

* HAHA FUCK YOU I PAY MY DUES

* Whoops lost some stuff in the merge

* Converts the system from seconds to deciseconds to make dealing with the api more sane

* Some stuff I missed

* Makes movement an inheritable subsystem type, splits the moveloop file into two, one for the subsystem, and one for the datums

* Makes a subsystem that handles directing movers out to other subsystems. It's a bit bad right now, but it's a
good first step. I think I'll move the move loop datum to a lazy var on mobs instead of an assoc list, don't
like lists.

Also makes the movement procs global, I'll move em to the /movement subsystem at some point or something like
that

* Converts the existing uses of the procs over to the new format

* Adds support for subsystem precedence, so a type of A can override type B.
General cleanup, still kinda in debug mode but it's getting better

* I'll admit I'm not too familiar with this, but I think it will work

* Adds starting logic so movement types "pausing" makes any sense
Redoes how waiting is handled to make it based on world.time directly. I don't remember why. I think it's better
this way.

Adds a drifting movement type, moves space drift over to it.
Needs severe work before it's ready, too much info stored and modified on the moving object, see comment
Starts work on making drifting smooth

* Moves almost all space drifting vars over to signals on the movement datum
Properly implements glide size stuff for both the subsystem and the loops. Space drift will be smoother now.
It's not perfect, but it'll work just fine for now

Adds a way to override a client'd mob's glide size mid move, uses it to make entering a spacedrift look right
Adds a way to delay a client move outside of just move_delay, meant to be used for long periods, and setup such
that it doesn't make inputs persist

Adds flags to movement loops, alongside MOVELOOP_OVERRIDE_CLIENT_CONTROL, which blocks client movements while
the loop is firing, and for it's visual delay after

This means you can't exit a space drift until you hit the actual wall. This feels a lot better

Some general logic stuff, move() will return true/false if it succeeded or failed
Adds a stop_loop() proc that's called when a move loop is no longer active

Suck my nuts

* Moves precedence to the loop instead of the subsystem

* Moves drifting into a component, this lets me explictly block input after the move loop ends, so people can't
move the moment they functionally move onto a new tile
This is a bit underdeveloped currently, but that's a problem for another day

Cleans up some uses of move procs, fixes runtimes in metoer and curseblob code
Adds signals for stopping/starting a move loop, sending one for destroy is redundant.
Moves existing event signals from the movable being acted on to the loop itself, makes more sense this way
Makes the move handler return the created loop up the chain so we can register to it
Fixes a logic error in loop contesting code that lead to loops never actually being removed from subsystems
because they didn't know they should be.
Properly changes lifetime from a time to stop, to functionally an amount of moves to complete before stopping
Adds some new signals for pre/post loop process. This is to better tie into components.

I decided I didn't like the idea of tying all functionality to the loops themselves
The loop decides functionally how to move, components or just tied in signals can decide when/when not to move
and can modify properties of the loop

Making a new loop for things like atmos drift, something I'm interested in tackling in the future, seemed silly

* Moves movement procs directly to the subsystem for better namespacing or whatever

* Moves movement packets onto /atom/movable, no longer need the debugging
I've decided to not just put their contents fully onto atom movable, since it makes debugging on live much
harder, can't sdql for them anymore.

Fixes a runtime in meteor code, properly this time
Fixes a logic error in stop_looping
Makes move manager NO_INIT, because well, it doesn't init

* Commits human sin, makes Recover() work properly for movement subsystems

* Fixes immovable rod orbits not always working, they were returning too early in moved and fucking up the var we use to track move count, and thus not sending a signal properly

* Reworks the curseblob to use signals more, and to not use override

* Missed this in the movement ss commit

* Removes override, makes having a higher or equal precedence take its place

* Updates documentation

* Cleans up some unused defines

* Nukes the unused flags option

* Whoops forgot to qdel check

* Removes an unused var I had for client move prevention before I started using a component

* Let's do this properly

* Modernizes meteor code to better match how explosions actually work currently

* Some more cleanup

* Cleans up effect code a little bit
Nukes the effect system's sleep loop, we use movement loops instead
As a part of that, instead of 1 timer per effect spawned, we react to loop failure and make it 1 timer per
effect system
This should reduce the amoumt of slowdown we see after mass lighting break

It's not everything, we're still making a timer per spark effect, but it cuts things down significantly

* Updates explosions to not sleep

* Adds support for modifying a loops delay post process, makes extinguisher code suck less then it does currently, nukes some more sleeps and timer loops

* Converts water tank resin over to move loops rather then sleeps, minor behavior change mind, the cooldown starts on fire rather then on land, but I think that makes more sense anyway

* compile and runtime fix

* Fixes some runtimes, cleans up some code, ensures feature parity when it comes to logging

* Prevents resin foam from space drifting

* Adds support for flags back into the system, I need it for reasons

* Updates move_towards to fix some bugs and resolve some inconsistent behavior, implements a flag that makes a loop's first move start instantly

* Fixes extinguishers not actually transfering any reagents

* Converts sprays to the new system. This does actually minorly change behavior, in that I've changed the order of spray actions from step -> sleep -> wash to step -> wash -> sleep, but I'm not terribly torn up about it because frankly I think it feels better

* Converts grav catapults over to the new system

* Converts trays over to moveloops

* Converts robot streaking to move loops, the other two coming soon

* Compile you won't. Also fixes a behavior issue with oil streaks

* Does directional step_to properly, cleans up the other two streaking types

* Converts step_trigger over, not that it's actually used anywhere. Changes how stoping a move works, you need to explicitly qdel, other the step is just considered to be ignored. This will make life easier later

* Adds a jps movement loop. It's a bit bloaty, id is stupid, but it'll work just fine

* Makes the system support passing in a datum that's just used as extra context for the move. The hope is this makes signalizing things less of an absolute headache

* Begins the conversion of ai movement datums to movement loops

* These two are reasonably simple, only weird thing I'm doing is A: Not allowing target hotswapping, which I hope none is doing, and B: passing the controller into the move loop as extra context so things work properly

* JPS is a bit more complex, partially because the old implementation was a bit weird. 2 major things. 1: I'm dropping what I think was a redundant behavior minimum distance check from the premove bit of logic, since I'm pretty sure it didn't do anything. 2, instead of just stoping the step in an error state like being pulled, we count it against our max move total

* Audit

* Moves most forced movement to the framework, adds some components to make things nicer

* Implements a flag that makes the loop always operate, regardless of precedence and without impacting any other loops

* Moves movement subsystems into the right folder

* Hey potato what if you had two procs that did the same thing and one called the other? Wow it's useless

* Merges slipping and force movement

* Converys conveyors over to the system. It's a bit fragile, but I think it's totally worth it to save the sleep loop

* Precedence -> Priority, cleans up some logic errors, makes priority highest to lowest instead of lowest to highest, straight cleans some code up

* Makes poly and bubbles ignore spacedrift, now that precedence actually functions properly. I'm likely missing cases of this, will deal with it later

* Depression, thy name is linter

* Fixes linter, and hopefully fixes the runtimes in ci too

* Wew

* Sets sprays and extinguishers back to legacy, since people do actually seem to have noticed

* Spelling errors my beloved

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>

* More detail, moves return descriptions

* Converts transit tubes to the system?

* Adds the glide size modifier. Not honestly sure that this should be default, considering how crummy it makes things look for normal walking, but it's useful as hell here

* Adds a force move in dir template, actual support for fast initial steps (wtf old me) and a helper proc for setting delay

* Cleans up displosal code a bit, I thought about adding it to the system but it would functionally be just 'disposal loops'. Maybe I'll make a template subtype? not sure how I want to handle stuff like this

* Cleans up mob movement a bit

* Let's use the controller's visual delay

* Makes the resin thrower nicer, cries

* Cleans up some comments, replaces an implicit world.icon_size with an explicit one, fixes up a typecheck

* typecache instead of double istype. Can't do much about the !atom/movable, list would be too big I feel

* hhh

* bro wtf

* Documents the why of SS_TICKER

* Puts SSmovement on SS_TICKER. Lets us support tick steps

* Cleans up the charge action. Makes it use moveloops

* Fixes CI? kinda worried that this just got dropped

* Converts disposal pipes to move loops. They stutter a bit more then usual as of now, hoping that's a me thing, if it's not I'ma look at uping the priority of the base subsystem

* Moves the move subsystems off background, puts some on ssticker

* Prevents some things that shouldn't move in space from moving in space

* Documents the general form and usage of the system

* Virgin one vs chad once

Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>

* Removes unneeded check

* Moves appropriate movement subsystems into SS_BACKGROUND. Removes redundant SS_KEEP_TIMINGs

I do want the behavior of SS_TICKER, which at this point is tick based waits, and ignoring overtime when
calculating next fire.
Since honestly, these subsystems should ignore overtime in regards to next fire, the cost of moving A may be
nothing compared to the cost of moving B.

* Makes the MODULUS macro use floor. I knew our coders would never let me down, glad this exists, thanks ninja
Fixes teleporting caused by shitty round() behavior, adds a "you hit your target" case to homing loops

* Converts blood splatters to move loops, that'll do it

Co-authored-by: Rohesie <rohesie@gmail.com>
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
2022-01-16 14:58:41 -08:00
LemonInTheDark
f8aad14ae8 Harddel Fix Pack #42 + Better Live Reftracking Support (#63877)
* Hard Del Fixes, Ref Tracking Changes
2022-01-12 22:46:13 +01:00
Ghom
7d3b98705f Chimps no longer get grumpy when you hug them or throw things with no throw force at them. (#62685)
* Chimps no longer get pissed when you hug them.

* Pun Pun no longer hates hat throwing.
2021-11-09 22:54:05 -05:00
Seris02
5f07d92757 stops the monkey ai from committing 53k runtimes and makes it so they can disposal people again (#62121) 2021-10-16 19:43:17 -04:00
Ghilker
95c8e00af7 cleanup _HELPERS/_lists.dm and all the necessary files (#61827)
Bring _HELPERS/_lists.dm to latest standards by:
-Adding proper documentation and fixing existing one
-Giving vars proper names
-Procs now use snake case as per standard (many files that use those procs will be affected)
2021-10-12 14:48:51 +01:00
tralezab
3d37916558 Monkey subtree breakup refactor! (#61741)
Splitting up monkey ai into subtrees allows me to make a punpun ai after this pr is merged, makes stopping planning matter for the AI subtrees, and more generic subtrees that can be used by most ais

It also gets rid of bad practices like setting blackboards in the ai controller.
2021-10-10 22:19:33 +01:00
tralezab
d9ede137aa if you give a monkey an instrument, it will begin playing the donkey kong theme (#61726) 2021-09-27 16:35:15 -07:00
AMonkeyThatCodes
f2b6fcb253 Refactors datum AI idle behaviors into datums (#61455)
Co-authored-by: MonkeyThatCodes <monkey>
2021-09-18 23:00:17 -07:00
aaaa1023
f04df890dd fixes misspellings of "aggressive" in a few areas. (#61092)
Fixes the spelling of "aggressive" in a few items, comments and a define.
2021-08-30 20:49:35 +01:00
Timberpoes
5c601e026f Feex (#60976) 2021-08-22 15:39:34 +02:00
AMonkeyThatCodes
a1f113b0eb All AI datum behaviors are now added using a wrapper (#60667) 2021-08-20 20:39:59 -07:00
Watermelon914
ffe2750744 Refactors connect_loc_behalf into a component (#60678)
See title. Also refactors caltrops into a component because they use connect_loc_behalf which requires them to hold the state.

This also fixes COMPONENT_DUPE_SELECTIVE from just outright not working.

connect_loc_behalf doesn't make sense as an element because it tries to hold states. There is also no way to maintain current behaviour and not have the states that it needs.
Due to the fact that it tries to hold states, it means the code itself is a lot more buggy because it's a lot harder to successfully manage these states without runtimes or bugs. 

On metastation, there is only 2519 connect_loc_behalf components at roundstart. MrStonedOne has told me that datums take up this much space:
image

If we do the (oversimplified) math, there are only ever 5 variables that'll likely be changed on most connect_loc_behalf components at runtime:
connections,
tracked,
signal_atom,
parent,
signal_procs

This means that on metastation at roundstart, we take up this amount: (24 + 16 * 5) * 2519 = 261.97600 kilobytes
This is not really significant and the benefits of moving this to a component greatly outweighs the memory cost.

(Basically the memory cost is outweighed by the maint cost of tracking down issues with the thing. It's too buggy to be viable longterm basically)
2021-08-17 12:16:12 -07:00
Ghom
393c80136d Monkeys can now retaliate against xenomorph and animal attacks. (#60157)
Co-authored-by: Rohesie <rohesie@gmail.com>
2021-07-29 03:36:43 -07:00
ma44
7b5e83e1e9 Revives PR #58579; Sligh refactor to AI datums that allows for basic support of subtrees (#60249)
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: coiax <yellowbounder@gmail.com>
Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Rohesie <rohesie@gmail.com>
Co-authored-by: Matthew J. <12817816+ZephyrTFA@users.noreply.github.com>
Co-authored-by: AnturK <AnturK@users.noreply.github.com>
Co-authored-by: Jonathan Rubenstein <jrubcop@gmail.com>
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
Co-authored-by: Jordan Brown <Cyberboss@users.noreply.github.com>
Co-authored-by: Fikou <piotrbryla@onet.pl>
Co-authored-by: Emmanuel S. <emmanuelssr@gmail.com>
2021-07-28 17:56:31 -07:00
Ghom
209d60913b Sentient monkeys are no longer knocked over by mobs in the way. (#60139)
Title. They used to be immune to this in the past, but then they were refactored into a species and things have changed.
2021-07-26 13:47:18 -03:00
Ghom
ffbda0f748 Monkeys and dogs no longer yoink items they can't reach. (#60150)
* Monkeys and dogs no longer yoink items they can't reach.

Title. More ai behavior botherations.
2021-07-11 23:46:55 -07:00
Rohesie
2c5a357035 Reverts Entered() passing dir instead of old loc (#59910) 2021-07-01 17:06:42 -07:00
LemonInTheDark
6fcbce39cd Makes turfs persist their signals, uses this to optimize connect_loc (#59608)
* Makes turfs persist signals

* Splits connect_loc up into two elements, one for stuff that wishes to connect on behalf of something, and one for stuff that just wants to connect normally. Connecting on behalf of someone has a significant amount of overhead, so let's do this to keep things clear

* Converts all uses of connect_loc over to the new patterns

* Adds some comments, actually makes turfs persist signals

* There's no need to detach connect loc anymore, since all it does is unregister signals. Unregisters a signal from formorly decal'd turfs, and makes the changeturf signal persistance stuff actually work

* bro fuck documentation

* Changes from a var to a proc, prevents admemems and idiots

* Extra detail on why we do the copy post qdel
2021-06-22 23:12:34 -04:00
Rohesie
e03cd1aada Refactors move procs to support multitle objects (#59658)
Enter(), Entered(), Exit() and Exited() all passed the old loc forward, but everything except a single a case cared about the direction of the movement more than about the specific source.
Since moving multi-tile objects will have multiple sources of movement but a single direction, this change makes it easier to track their movement.

Cleaned up a lot of code around and made proc inputs compatible.

I'll add opacity support for multi-tile objects in a different PR after this is merged, as this has grown large enough and I don't want to compromise the reviewability.

Tested this locally and as expected it didn't impair movement nor produced any runtimes.
2021-06-20 14:55:37 -07:00
Watermelon914
375a20e49b Refactors most spans into span procs (#59645)
Converts most spans into span procs. Mostly used regex for this and sorted out any compile time errors afterwards so there could be some bugs.
Was initially going to do defines, but ninja said to make it into a proc, and if there's any overhead, they can easily be changed to defines.

Makes it easier to control the formatting and prevents typos when creating spans as it'll runtime if you misspell instead of silently failing.
Reduces the code you need to write when writing spans, as you don't need to close the span as that's automatically handled by the proc.

(Note from Lemon: This should be converted to defines once we update the minimum version to 514. Didn't do it now because byond pain and such)
2021-06-14 13:03:53 -07:00
LemonInTheDark
f90e8cf7a3 Fixes a bunch of harddels that are sourced from player action (#59371)
Sourced from #59118 and a cursed project I'll pr later, This pr contains a lot of harddel fixes for stuff that pops up after a player interacts with something. I'm not gonna list them all here because there's something like 60 130, check the commit log if you're curious

Oh and I moved ref tracking screaming to a separate define, and made some optimizations to the thing in general. I think that's it, this pr is a bit of a frankenstine
2021-06-10 21:44:23 -03:00
Emmett Gaines
c758140489 Fixes monkeys trying to pickpocket grass (#59300) 2021-05-25 23:27:35 -07:00