Skip to content

Lua add creature annoyance methods#4616

Merged
Loobinex merged 3 commits intodkfans:masterfrom
Shinthoras0815:Lua-add-creature-annoyance-methods
Mar 13, 2026
Merged

Lua add creature annoyance methods#4616
Loobinex merged 3 commits intodkfans:masterfrom
Shinthoras0815:Lua-add-creature-annoyance-methods

Conversation

@Shinthoras0815
Copy link
Copy Markdown
Contributor

  • Adds creature:get_annoyance(reason) and creature:set_annoyance(reason, value) to the Lua API
  • Exposes anger_reason_desc NamedCommand table in creature_states_mood.c for string-based reason lookup
  • Valid reasons: "NOT_PAID", "HUNGRY", "NO_LAIR", "OTHER"

Example usage

local annoy = creature:get_annoyance("NOT_PAID")
creature:set_annoyance("HUNGRY", 500)

Copilot AI review requested due to automatic review settings March 11, 2026 01:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and creature:set_annoyance(reason, value) Lua methods.
  • Introduced anger_reason_desc as a NamedCommand table for mapping string reasons to AngR_* values.
  • Updated Lua class stubs/types to document the new API and provide an anger_reason string 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.

Comment thread src/creature_states_mood.h
Comment thread config/fxdata/lua/aliases.lua Outdated
Comment thread src/lua_api_things.c
Comment thread src/lua_api_things.c
@Loobinex Loobinex requested a review from PieterVdc March 11, 2026 01:20
Copy link
Copy Markdown
Member

@PieterVdc PieterVdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks fine

@Loobinex Loobinex merged commit 0fb54d7 into dkfans:master Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants