-
-
Notifications
You must be signed in to change notification settings - Fork 416
Consumable Components #8216
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?
Consumable Components #8216
Conversation
# src/main/java/ch/njol/skript/registrations/Feature.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/ComponentWrapper.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/EquippableModule.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/EquippableWrapper.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompDamage.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompDispensable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompInteract.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompShearable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompSwapEquipment.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompDamageable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompDispensable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompInteract.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompShearable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompSwapEquipment.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompCameraOverlay.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompEntities.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompEquipSound.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompModel.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompShearSound.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompSlot.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquippableComponent.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprSecBlankEquipComp.java # src/main/resources/lang/default.lang
…leComponent # Conflicts: # src/main/java/ch/njol/skript/Skript.java # src/main/java/ch/njol/skript/registrations/Feature.java # src/main/java/ch/njol/skript/util/ItemSource.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/ComponentUtils.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/ComponentWrapper.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/ItemComponentModule.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/EquippableModule.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/EquippableWrapper.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompDamage.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompDispensable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompInteract.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompShearable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/CondEquipCompSwapEquipment.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompDamageable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompDispensable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompInteract.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompShearable.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/EffEquipCompSwapEquipment.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompCameraOverlay.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompEntities.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompEquipSound.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompModel.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompShearSound.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquipCompSlot.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprEquippableComponent.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/equippable/elements/ExprSecBlankEquipComp.java # src/main/java/org/skriptlang/skript/bukkit/itemcomponents/generic/ExprItemCompCopy.java # src/main/resources/lang/default.lang
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.
The parser rework would be needed, but thoughts on something akin to
when {x} is consumed:
clear all potion effects
teleport randomly in a radius of 10
play sound "xyz"
or
add the following consumption effects to {x}:
....
?
|
|
||
| @Override | ||
| public Class<?> @Nullable [] acceptChange(ChangeMode mode) { | ||
| if (mode == ChangeMode.SET) |
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.
pretty much all of these attributes need RESET support and their default values spelled out in the description.
This one should also support DELETE
| public static void register(SyntaxRegistry registry) { | ||
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| infoBuilder(ExprConsCompEffects.class, ConsumeEffect.class, "consum(e|ption) effects", "consumablecomponents", true) |
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.
| infoBuilder(ExprConsCompEffects.class, ConsumeEffect.class, "consum(e|ption) effects", "consumablecomponents", true) | |
| infoBuilder(ExprConsCompEffects.class, ConsumeEffect.class, "consum(e|ption) [potion] effects", "consumablecomponents", true) |
|
|
||
| @Name("Consumable Component - Consume Effects") | ||
| @Description(""" | ||
| The consume effects that should activate when the item is consumed. |
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.
| The consume effects that should activate when the item is consumed. | |
| The potion effects that should activate when the item is consumed. |
| public static void register(SyntaxRegistry registry) { | ||
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| infoBuilder(ExprConsCompTime.class, Timespan.class, "consum(e|ption) time", "consumablecomponents", true) |
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.
| infoBuilder(ExprConsCompTime.class, Timespan.class, "consum(e|ption) time", "consumablecomponents", true) | |
| infoBuilder(ExprConsCompTime.class, Timespan.class, "consum(e|ption) duration", "consumablecomponents", true) |
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| SyntaxInfo.Expression.builder(ExprConsumeEffectApply.class, ConsumeEffect.class) | ||
| .addPatterns("[a] consume effect to apply %potioneffects% with [a] probability of %number%") |
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.
| .addPatterns("[a] consume effect to apply %potioneffects% with [a] probability of %number%") | |
| .addPatterns("[a] consume effect that applies %potioneffects% with [a] probability of %number%") |
or [a] chance to apply %potioneffects% with [a] probability of %number% if you want to get a bit more fluid with the syntax.
| //noinspection unchecked | ||
| effects = (Expression<PotionEffect>) exprs[0]; | ||
| //noinspection unchecked |
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.
you can suppress with annotation instead
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| SyntaxInfo.Expression.builder(ExprConsumeEffectRemove.class, ConsumeEffect.class) | ||
| .addPatterns("[a] consume effect to remove %potioneffecttypes%") |
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.
| .addPatterns("[a] consume effect to remove %potioneffecttypes%") | |
| .addPatterns("[a] consume effect that (removes|clears|cures) %potioneffecttypes%") |
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| SyntaxInfo.Expression.builder(ExprConsumeEffectSound.class, ConsumeEffect.class) | ||
| .addPatterns("[a] consume effect to play [[the] sound] %string%") |
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.
| .addPatterns("[a] consume effect to play [[the] sound] %string%") | |
| .addPatterns("[a] consume effect that plays [[the] sound] %string%") |
|
|
||
| @Name("Blank Consumable Component") | ||
| @Description(""" | ||
| Gets a blank consumable component. |
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.
DEFAULTS!!!!
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| SyntaxInfo.Expression.builder(LitConsumeEffectClear.class, ConsumeEffect.class) | ||
| .addPatterns("[a] consume effect to clear all (potion|status) effects") |
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.
| .addPatterns("[a] consume effect to clear all (potion|status) effects") | |
| .addPatterns("[a] consume effect that clears all (potion|status) effects") |
Problem
Skript does not have support for Consumable Components yet. Leaving players unable to modify items to be consumable and other correlating data.
Solution
Adds Consumable Components and all correlating data to Skript following the backend of the component system locked behind a experiment. Allows players to modify items regarding consumption sound, consumption time, consume effects and many more.
Additionally adds
ConsumeEffectswith a customConsumeEffectTypeenumTesting Completed
ConsumableComponents.skSupporting Information
N/A
Completes: none
Related: none