Skip to content

Add function to remove unit from squad#5256

Merged
myk002 merged 10 commits into
DFHack:developfrom
ong-yinggao98:squad-features
Feb 9, 2025
Merged

Add function to remove unit from squad#5256
myk002 merged 10 commits into
DFHack:developfrom
ong-yinggao98:squad-features

Conversation

@ong-yinggao98

@ong-yinggao98 ong-yinggao98 commented Feb 7, 2025

Copy link
Copy Markdown
Contributor

Originally intended to be used in a now-cancelled Lua script feature, but figured it may be useful for those dabbling in military matters.

@myk002 myk002 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you expose this function to Lua (in LuaAPI.cpp) and add documentation in Lua API.rst?

Also, needs changelog under the API and Lua (after being exposed to Lua) sections

Comment thread library/modules/Military.cpp Outdated
Comment thread library/modules/Military.cpp Outdated

@myk002 myk002 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM -- should I remove the "draft" PR status?

@ong-yinggao98 ong-yinggao98 marked this pull request as ready for review February 8, 2025 06:27
@ong-yinggao98

ong-yinggao98 commented Feb 8, 2025

Copy link
Copy Markdown
Contributor Author

LGTM -- should I remove the "draft" PR status?

Sure, thank you!

Do you think that the function should return a value? If it returns false at any point after changing game state it would likely be a bug that leaves game state inconsistent, so maybe I should just have it be void and expect that it works fine?

@myk002

myk002 commented Feb 8, 2025

Copy link
Copy Markdown
Member

Do you think that the function should return a value?

That's a good point. I think that it should return false if the unit is not in a squad or other preconditions fail. I think it should return true if it has updated all the state that is feasible to update. If some dependent data structure cannot be found, I think it can skip it and still return true.

@myk002 myk002 merged commit 39fabcb into DFHack:develop Feb 9, 2025
@ong-yinggao98 ong-yinggao98 deleted the squad-features branch February 9, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants