Commit Graph

33 Commits

Author SHA1 Message Date
Serhii Snitsaruk f90c48eb81
Merge pull request #242 from limbonaut/fix-hsm-reparenting-saga-episode-three
Fix re-parenting an agent interrupts its state machine
2024-11-01 11:11:45 -07:00
Serhii Snitsaruk 162de0f868
Fix re-parenting agent interrupts its state machine 2024-11-01 18:47:36 +01:00
Serhii Snitsaruk bbe71bb378
Add transition guards 2024-11-01 14:00:30 +01:00
Serhii Snitsaruk 60142b191d
Fix invalid access crash on exit in LimboHSM
Since #131, `LimboState::_exit()` became a source of potential crashes
if object references are used without a validity check. It's too easy
to miss this, which can lead to game crashing during runtime.

This fix reverts #131 change and proposes alternative approach of
re-activating root HSM upon tree entering if it was previously active.
Note that it's not an ideal solution, as some state will be lost upon
re-parenting: HSM exits and then re-activates and enters its initial state.
2024-09-22 13:57:15 +02:00
Serhii Snitsaruk 9da16a1e0f
Clean up unused string names 2024-08-21 20:04:35 +02:00
Serhii Snitsaruk bed04dbf87
Hide update_mode for non-root HSMs 2024-07-31 14:50:04 +02:00
Serhii Snitsaruk a1d6276097
Fix process_input is not enabled in active substate 2024-07-31 12:15:15 +02:00
Serhii Snitsaruk cf99a27692
Refactor LimboHSM 2024-07-21 13:45:36 +02:00
Serhii Snitsaruk f7eb374c1e
Add `LimboHSM.has_transition(from, event)` 2024-07-21 13:35:16 +02:00
Serhii Snitsaruk a7881a0eea
Rework HSM transitions bookkeeping
Fixes a potential rare hash collision situation, and allows additional
attributes to be stored with the transition data in future.
2024-07-21 13:28:59 +02:00
Serhii Snitsaruk 0934e4e672
Expose `LimboHSM.change_active_state()` 2024-07-20 18:15:21 +02:00
Serhii Snitsaruk 7c57c7dd62
Add LimboHSM.remove_transition 2024-07-20 17:23:13 +02:00
Serhii Snitsaruk c4df916bdf
HSM: Delay state transition till update is finished 2024-04-20 21:30:26 +02:00
Serhii Snitsaruk 06ebff7518 Fix includes and build errors 2024-03-12 21:09:28 +01:00
Dave Palais 653bf13a7d Set parent scope in state initialization 2024-03-07 14:00:27 -05:00
Serhii Snitsaruk 2658060b1c Move prefetching code into `BlackboardPlan` and add checkbox to the plan editor 2024-03-06 21:28:06 +01:00
Serhii Snitsaruk 193743e782 Provide the previous state in the state_changed signal
- Also provide `get_previous_active_state()` method.
- Rename state_changed -> active_state_changed.
2024-03-05 12:58:55 +01:00
Serhii Snitsaruk 4c26583007 Remove "p_" from the argument names in the `ClassDB` bindings 2024-03-04 21:36:16 +01:00
Serhii Snitsaruk 88df78c4a2 Refactor HSM to use StringName for events 2024-03-04 16:19:35 +01:00
Serhii Snitsaruk eaeb57e2d7 Allow `LimboState::dispatch` to be called from inside the hierarchy.
Improves usability and removes requirement to call this method on the root state (see #49).
2024-03-01 11:02:32 +01:00
Serhii Snitsaruk 1c01767a56 Fix crashing on HSM update with state transition 2024-02-26 21:34:30 +01:00
Serhii Snitsaruk 22c472fdd1 Disallow LimboHSM transitions to self when ANYSTATE is used
Resolves #29
2024-02-07 13:39:45 +01:00
Serhii Snitsaruk 2612ec0855 Fix LimboHSM::add_transition signature 2024-01-28 11:56:53 +01:00
Serhii Snitsaruk 8155c2764a Refactoring and clean up 2024-01-25 14:35:48 +01:00
Serhii Snitsaruk a3f8c09766 Use the new virtual workaround and rework LimboState and HSM 2024-01-18 11:33:24 +01:00
Serhii Snitsaruk f546e285b7 Refactor and clean up the code 2024-01-13 17:10:42 +01:00
Serhii Snitsaruk 947e253bf9 Fix infinite call recursion crash due to virtual function workaround 2024-01-12 23:20:39 +01:00
Serhii Snitsaruk 59a8ab97d8 chore: Rename macro LSNAME to LW_NAME 2024-01-09 13:42:54 +01:00
Serhii Snitsaruk f5b1b52f67 Port LimboHSM, LimboState and BTState 2024-01-07 05:54:17 +01:00
Serhii Snitsaruk 0e10c2022f Add tests for HSM 2023-09-11 15:33:13 +02:00
Serhii Snitsaruk f651c9c228 Fix LimboHSM compile errors with mono glue 2023-07-25 18:39:41 +02:00
Serhii Snitsaruk 62e07e4395 Add MIT license - LimboAI is now Open Source! 2023-07-22 19:41:01 +02:00
Serhii Snitsaruk 5dc002098f Reorganize files and sort includes 2023-07-20 18:35:36 +02:00
Renamed from limbo_hsm.cpp (Browse further)