-
Notifications
You must be signed in to change notification settings - Fork 272
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!: Additional Lua bindings, documentation, attitude decoupled from creature #3990
Conversation
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
I do not want the automated commit
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 anymoreIt's safe to ignore this message. I edit this PR through web UIYou can ignore this message and continue working. I have no idea what this message is talking aboutYou can ignore this message and continue working. If you find any problem, please ask for help and ping @scarf005. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feat!: Additional Lua bindings, documentation, attitude decoupled from creature
Would it be possible to list commits or changes for attitude decoupled from creature
? As this is a huge change , Splitting this PR into two step would make it easier to review, e.g)
refactor: decouple attitude from creature
feat!: additional lua bindings
huge
Splitting this PR into two per request of scarf005. |
Summary
SUMMARY: Infrastructure "More game, mostly creature class-family's, functions/methods exposed to Lua. Additional documentation added for Lua. Decoupled creature attitude from creature header. Incremented internal Lua version constant to 2."
Purpose of change
Building on top of #2216, 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.
Added docs for binding Lua classes/structs by transforming the definition.
As suggested by olanti-p, I've decoupled the creature attitude enum from its class so as not to include the massive
creature.h
file in catalua files.Describe the solution
In order to bind most of the creature class family's methods and members to Lua, the types used/returned had to be bound to Lua first, which required additions to them, most of them covered by doc/LUA_SUPPORT.md. By using (mostly) regex, header files of the classes in question were formatted step-by-step so that it wouldn't be as tedious as doing it manually, however looking over the result was necessary sometimes. Preprocessor macros were made to make typing bindings manually less of a hassle when the regex processing didn't work.
Writing Lua bindings by hand can be quite cumbersome and tedious, so through the use of macros and regular expression substitution on a class definition, binding large classes/structs shouldn't be as awful.
The creature attitude enum is now a part of
enums.h
file. Additionally, aenum_conversions.cpp
file was created to have theenum_to_string<Attitude>
needed for Lua bindings.Testing
Additional context