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

feat!: lua bindings mostly for creature #4070

Merged
merged 5 commits into from
Jan 8, 2024

Conversation

AluminumAlman
Copy link
Contributor

@AluminumAlman AluminumAlman commented Jan 6, 2024

Purpose of change

Building on top of #2216 to extend Lua bindings, a whole bunch of functions for creature, character, avatar and NPC are now exposed to Lua, with other bindings in order for the aforementioned bindings to work, and a few other miscellaneous bindings.

Describe the solution

In order to bind most of the creature class family's methods and members to Lua, the types used/returned were bound to Lua, which required refactoring/changes/additions, most of which were covered by the project's Lua documentation. Still, I had to do more than what the documentation had, and so I added those things to the documentation.
To make binding less tiresome, preprocessor macros were created to help. Though binding large classes like those of the creature family still looked threatening, and for that I used my editor's (Neovim) regex functionality to produce most of the bindings, which I outlined in the changed Lua documentation.
A enum_conversions.cpp file was created for enum_to_string<...>s needed for Lua bindings.

Testing

  • Project builds on my machine;
  • All tests green on my machine;
  • Ran some bound functions through the Lua console to make sure that they worked;
  • Changed global Lua api tests, added units (energy, angle, mass, volume) tests;
  • Current tests may be lacking (e. g. no creature class family tests);
  • The removed Lua global API binding for getting the avatar name did not appear in any of mods prepackaged with the project.

Additional context

@github-actions github-actions bot added docs PRs releated to docs page src changes related to source code. JSON related to game datas in JSON format. tests changes related to tests mods PR changes related to mods. labels Jan 6, 2024
Copy link
Contributor

autofix-ci bot commented Jan 6, 2024

The Autofix app has found code style violation and automatically formatted this Pull Request.

I locally edit my commits (e.g: git, github desktop)

Please choose following options:

I'd like to accept the automated commit
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

This PR is complete and I don't want to edit it anymore

It's safe to ignore this message.

I edit this PR through web UI

You can ignore this message and continue working.

I have no idea what this message is talking about

You can ignore this message and continue working. If you find any problem, please ask for help and ping @scarf005.

@scarf005 scarf005 changed the title feat!: Additional Lua documentation, bindings, mostly for creature class family. feat!: lua bindings mostly for creature Jan 7, 2024
@scarf005 scarf005 self-requested a review January 7, 2024 04:54
@scarf005 scarf005 self-assigned this Jan 7, 2024
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

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

Haven't playtested yet, but looks good and tests pass.

@scarf005
Copy link
Member

scarf005 commented Jan 8, 2024

let's see how it goes.

@scarf005 scarf005 merged commit 11a397d into cataclysmbnteam:main Jan 8, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs PRs releated to docs page JSON related to game datas in JSON format. mods PR changes related to mods. src changes related to source code. tests changes related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants