-
Notifications
You must be signed in to change notification settings - Fork 126
Add proper support for escape manipulation by Actions #1047
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
base: main
Are you sure you want to change the base?
Changes from all commits
81e9ad1
8f2d934
fe0fe44
6b605c9
4bfb427
c39e057
6be85dc
7931919
10130d0
0b9b599
e58dd41
78edd4b
76b3118
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Robotgiggle marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,17 @@ | ||
| package at.petrak.hexcasting.api.casting.castables | ||
|
|
||
| import at.petrak.hexcasting.api.casting.eval.CastResult | ||
| import at.petrak.hexcasting.api.casting.eval.CastingEnvironment | ||
| import at.petrak.hexcasting.api.casting.eval.OperationResult | ||
| import at.petrak.hexcasting.api.casting.eval.ParenthesizedOperationResult | ||
| import at.petrak.hexcasting.api.casting.eval.ResolvedPatternType | ||
| import at.petrak.hexcasting.api.casting.eval.vm.CastingImage | ||
| import at.petrak.hexcasting.api.casting.eval.vm.CastingImage.ParenthesizedIota | ||
| import at.petrak.hexcasting.api.casting.eval.vm.SpellContinuation | ||
| import at.petrak.hexcasting.api.casting.iota.Iota | ||
| import at.petrak.hexcasting.api.casting.math.HexPattern | ||
| import at.petrak.hexcasting.api.casting.mishaps.Mishap | ||
| import at.petrak.hexcasting.common.lib.hex.HexEvalSounds | ||
| import net.minecraft.world.phys.Vec3 | ||
| import java.text.DecimalFormat | ||
|
|
||
|
|
@@ -41,6 +47,30 @@ interface Action { | |
| continuation: SpellContinuation | ||
| ): OperationResult | ||
|
|
||
| /** | ||
| * The behavior of this action when inside parentheses (meaning `image.parenCount` will always be greater than 0). | ||
| * By default, this just adds the pattern to the parenthesized list without updating the op count or performing any of its effects. | ||
| * | ||
| * Note that behavior defined here can throw mishaps as usual, such as when [OpUndo][at.petrak.hexcasting.common.casting.actions.escaping.OpUndo] | ||
| * tries to remove a pattern but there aren't any left. Mishapping here will not affect the paren count, so the caster will still | ||
| * be in list-building mode after the mishap resolves. | ||
| */ | ||
|
Robotgiggle marked this conversation as resolved.
|
||
| @Throws(Mishap::class) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, is it really a good idea to allow addons to throw mishaps while parenthesized? Do we handle this correctly? I don't think any base hex pattern currently does this.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Throwing mishaps while parenthesized will be necessary to address the Evanition issue you mentioned above, along with a plan I have for a read-from-offhand-into-parens pattern. Also, I see no reason why allowing addons to do that would be problematic - imo it's better to natively allow interesting functionality like that rather than forcing people to make their own workarounds. As for handling, any thrown mishap will be caught and handled by the try/catch in |
||
| fun operateInParens( | ||
| env: CastingEnvironment, | ||
| image: CastingImage, | ||
| continuation: SpellContinuation, | ||
| thisIota: Iota, | ||
| ): ParenthesizedOperationResult { | ||
| return ParenthesizedOperationResult( | ||
| image.withNewParenthesized(thisIota), | ||
| listOf(), | ||
| continuation, | ||
| HexEvalSounds.NORMAL_EXECUTE, | ||
| ResolvedPatternType.ESCAPED | ||
| ) | ||
| } | ||
|
|
||
| companion object { | ||
| // I see why vazkii did this: you can't raycast out to infinity! | ||
| const val RAYCAST_DISTANCE: Double = 32.0 | ||
|
|
||
|
Robotgiggle marked this conversation as resolved.
|
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.
Should we also document that Hasty Retrospection was renamed to Absent Introspection?