And the macros used for the implementation are available here: https://github.com/FrictionalGames/AmnesiaTheDarkDescent/blo...
Scary stuff.
The most scary part is the usage of if(0).
That's common for generated code, though. It makes it so that the other code can always use "else if".
I'm also amused that such gameplay scripting logic is implemented in C++, but not on some scripting language like Lua or Python.
It has over 15 different behavior states:
Idle, GoHome, Wait, Patrol, Investigate, Alert, Search, Eat, Hurt, Hunt, HuntPause, HuntWander, AttackMeleeShort, AttackMeleeLong, AttackRange, BreakDoor, Dead, Flee, Stalk, Track
States:
https://github.com/FrictionalGames/AmnesiaTheDarkDescent/blo...
Implementation:
https://github.com/FrictionalGames/AmnesiaTheDarkDescent/blo...
There's also naming gems like "mindfuckevents"
https://github.com/FrictionalGames/AmnesiaTheDarkDescent/blo...