Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to remove unit from squad #5256

Merged
merged 10 commits into from
Feb 9, 2025

Conversation

ong-yinggao98
Copy link
Contributor

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

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

Copy link
Member

@myk002 myk002 left a comment

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

library/modules/Military.cpp Outdated Show resolved Hide resolved
library/modules/Military.cpp Outdated Show resolved Hide resolved
Copy link
Member

@myk002 myk002 left a comment

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
Copy link
Contributor Author

ong-yinggao98 commented Feb 8, 2025

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
Copy link
Member

myk002 commented Feb 8, 2025

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
14 checks passed
@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
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants