Lua add creature annoyance methods#4616
Merged
Loobinex merged 3 commits intodkfans:masterfrom Mar 13, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Lua creature API to allow reading and updating a creature’s annoyance levels by a named anger reason, and wires up the corresponding reason-string lookup table for Lua.
Changes:
- Added
creature:get_annoyance(reason)andcreature:set_annoyance(reason, value)Lua methods. - Introduced
anger_reason_descas aNamedCommandtable for mapping string reasons toAngR_*values. - Updated Lua class stubs/types to document the new API and provide an
anger_reasonstring union.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lua_api_things.c | Adds Lua bindings for get/set annoyance using a named reason lookup. |
| src/creature_states_mood.h | Exposes anger_reason_desc for cross-module use (Lua binding). |
| src/creature_states_mood.c | Defines the anger_reason_desc mapping table. |
| config/fxdata/lua/classes/Creature.lua | Documents the new Lua creature methods. |
| config/fxdata/lua/aliases.lua | Adds the anger_reason alias for Lua tooling/type checking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
creature:get_annoyance(reason)andcreature:set_annoyance(reason, value)to the Lua APIanger_reason_descNamedCommand table increature_states_mood.cfor string-based reason lookup"NOT_PAID","HUNGRY","NO_LAIR","OTHER"Example usage