-
Notifications
You must be signed in to change notification settings - Fork 283
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(content): add Lua bindings for spell types #5851
Conversation
…hell for naming convention purposes
…into lua-spellbinding-101
…into lua-spellbinding-101
…into lua-spellbinding-101
…into lua-spellbinding-101
…r SpellSimple invocation.
Autofix has formatted code style violation in this PR. I edit commits locally (e.g: git, github desktop) and want to keep autofix
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. |
Welcome to our (magic mods) world :) |
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.
Testing on Linux:
- It builds and loads!
- The provided invisibility and lava bomb examples work
- Summoning items works, and the water prompt actually popped up while still in the console lol
- What I thought would be a curveball, pain split, also worked!
- What didn't work, however, was cure light wounds ("light_healing")
It clearly recognized the spell ID, but did not actually heal me for anything (test was done before pain split, but it didn't work after that either)
For reference, how I inputted the custom spell tests (literally just exchanging invisibility's ID for other spell ids in Magical Nights since I had an MN test world already)
Additional findings: |
And same with the recover_pain! |
For the record: If a spell has Under the given circumstances, it arguably should break (a spell that with |
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.
Turns out I am a silly goober and moved after I set pos
. So long as you actually, you know, have the position variable stay correct by not moving after setting pos
everything works perfectly fine!
... it's just that somehow, most of the spells actually work in spite of moving off of that tile?!? Magic code is hecking weird, man.
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.
- Compiled and load-tested.
- Started up a world with Magiclysm added.
- Entered first command shown in testing section.
- Died from going "I don't care how big the room is, I CAST FIREBALL"
Checklist
Required
main
so it won't cause conflict when updatingmain
branch later.Purpose of change
Further work on expanding what Lua scripts are capable of in Cataclysm~
Describe the solution
This is a set of Lua bindings that allow spells to be cast through Lua. While there's room for expansion, it means that the varied and powerful effects spells offer are now possible to invoke through Lua! (They still need a spell defined through JSON; this isn't quite that magical.)
Describe alternatives you've considered
Binding every single type that spells touch and modify so people don't need to work through spells.
To be clear, that's still my ideal end goal for Lua; spells are (in my humble opinion) clunky and annoying to work with. But they allow a range of effects that simply aren't possible with the current tools (such as spawning items), so this seemed like the natural next step.
Testing
Here are some basic tests:
The longer form invocation makes it clearer what's going on here, and allows more control:
A list of all spells can be retrieved via
SpellTypeRaw
, e.g.:...so go nuts~
Additional context
Two things of import:
Creature
'sget_pos_ms()
into:cast
. (Or plug anotherCreature
in as the first argument, and the player's position—both should work.)