-
-
Notifications
You must be signed in to change notification settings - Fork 403
Rework Potions #4183
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: dev/feature
Are you sure you want to change the base?
Rework Potions #4183
Conversation
Also makes changes to ExprPotionEffect and adds a new converter to try and keep some syntax working (it is also syntax that flows nicely)
Marking as a draft again as more in-depth changes are now planned |
Modules do not exist yet so it's not really one
I don't agree with PotionEffectType to PotionEffect as a converter because you can simply do What converter you would need is PotionEffect to PotionEffectType. |
I've now pushed my major changes that have been sitting locally for a while now. This PR depends on #4573, so there is currently some temporary stuff going on to register the potion stuff. |
skript.bukkit -> skriptbukkit
This pull request is finally ready to review! There are some minor fixes/changes I need to make, but the core of the rework is ready. I'll also be updating the description with more information early next week. |
src/main/java/org/skriptlang/skript/bukkit/potion/LegacyPotionEffectTypeInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/LegacyPotionEffectTypeInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/LegacyPotionEffectTypeInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/LegacyPotionEffectTypeInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/LegacyPotionEffectTypeInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/LegacyPotionEffectTypeInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/elements/effects/EffPotionParticles.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprPotionAmplifier.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprPotionEffect.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprSecPotionEffect.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprSecPotionEffect.java
Outdated
Show resolved
Hide 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.
surface level pass
src/main/java/org/skriptlang/skript/bukkit/potion/LegacyPotionEffectTypeInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/PotionModule.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/PotionModule.java
Outdated
Show resolved
Hide resolved
"%skriptpotioneffects% [active]", | ||
"livingentities"); |
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.
CondContains conflicts? %inventories% (has|have) %itemtypes%
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.
CondContains has an earlier priority, so I think this should be okay? I can't think of a great syntax here, and I'd like to avoid something like player has potion potion effect of speed
... type hints (once widely available) would resolve any issues like this. The optional active
keyword exists for dealing with conflicts in the meantime - which is the approach I think we should prefer to take for these situations
src/main/java/org/skriptlang/skript/bukkit/potion/elements/conditions/CondIsPotionInfinite.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprPotionEffect.java
Outdated
Show resolved
Hide resolved
...a/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprPotionEffectTypeCategory.java
Outdated
Show resolved
Hide resolved
src/main/java/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprPotionEffects.java
Show resolved
Hide resolved
...in/java/org/skriptlang/skript/bukkit/potion/elements/expressions/ExprSkriptPotionEffect.java
Outdated
Show resolved
Hide 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.
potion of pickle 😋
.description("A potion effect, including the potion effect type, tier and duration.") | ||
.usage("speed of tier 1 for 10 seconds") | ||
.since("2.5.2") | ||
.parser(new Parser<>() { |
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.
could this be a nested class to avoid indentation hell
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.
II might prefer to keep them together, but if you really think the indentation is too much
src/main/java/org/skriptlang/skript/bukkit/potion/util/SkriptPotionEffect.java
Outdated
Show resolved
Hide 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.
just some small documentation stuff
Problem
Potions syntax in Skript is confusing, duplicated, and fails to follow vanilla behavior. Support for numerous properties of potion effects/potion effects types are missing.
Solution
This pull request aims to completely rework (and reimagine) how potions can be used with Skript. The primary goals of this rework were as follows:
I believe this rework has now achieved these goals, and the breaking changes are well worth the benefits.
Obtaining Potion Effects
Just as before, potion effects can be obtained through syntax like:
However, it is now also possible to obtain specific potion effects:
Potion Creation
Potions are currently buildable using an Expression or an Effect. What properties are available in each is not consistent. For this rework, the potion syntax has been condensed into an Expression (Section) for building potions:
The potion effect has been replaced with an effect for applying potion effects. It does have the ability to override the duration as this enables nicer syntax:
apply speed to the player for 15 seconds
rather thanapply potion effect of speed for 15 seconds to the player
Potion Modification
The six primary properties of potion effects are supported:
type
,duration
,amplifier
,ambient
,particles
, andicon
.All of these properties may be modified in the builder (see above).
It is also now possible to modify existing potion effects:
More impressively, it is now possible to modify potion effects that are actively applied to entities and items:
Hidden Effects
Full support for hidden effects has been implemented too. Hidden effects allow a player to have multiple effects of the same type. For example, if a player has speed 1 for 30 seconds, and is then affected by speed 2 for 15 seconds, after those 15 seconds, the player will have 15 seconds of speed 1 remaining.
Support for obtaining these effects has been implemented:
Just as with active effects, hidden effects support being changed too! How they work with changers is specific, so I'll cover the behavior below:
Comparisons
Support for more lenient comparisons has been implemented too:
CondCompare (e.g.
x is y
) can be used for exact comparisons.These comparisons are also used for removals:
Other Changes
... more to come!
Testing Completed
Added
potion module.sk
which includes extensive testing of all syntax.Supporting Information
There are multiple breaking changes included in these changes:
Completes: #4178
Related: none