Add ExprFuseTicks - #8552
Conversation
I kind of forgot about it lol though what needs to be done on it just accepting the changes you suggested n updating the branch? |
|
|
||
| static { | ||
| if(Skript.methodExists(LivingEntity.class, "getMaxFuseTicks")) | ||
| register(ExprCreeperMaxFuseTicks.class, Long.class, "[creeper] max[imum] fuse tick[s]", "livingentities"); |
There was a problem hiding this comment.
This syntax doesn't conflict, so it may be worth it to deprecate it for a version instead of outright removing it. Thoughts from others?
There was a problem hiding this comment.
Deprecation is better
| @Description("The fuse duration of a creeper or primed TNT. For creepers, this is the total fuse duration before explosion. For primed TNT, this is the remaining time before explosion.") | ||
| @Example(""" |
There was a problem hiding this comment.
So creepers have max and elapsed fuse ticks, with which you can calculate remaining.
Tnt just has remaining fuse ticks.
I think you should change this to [:elapsed|:remaining|max] fuse duration and have creepers support all, tnt support remaining. Thoughts? I'm not a fan of fuse duration meaning two different things and also just not implementing creeper's getFuseTicks
| public static void register(SyntaxRegistry registry) { | ||
| registry.register( | ||
| SyntaxRegistry.EXPRESSION, | ||
| infoBuilder(ExprFuseDuration.class, Timespan.class, "fuse (duration|time)", "entities", false).build() |
Just gonna close it in favor of this one, this one has better code. Edit: Oh wait, sorry, I thought you (Owl) opened this one too! Are you ok with letting CJH take this PR or do you want to finish it out yourself? |
|
|
||
| static { | ||
| if(Skript.methodExists(LivingEntity.class, "getMaxFuseTicks")) | ||
| register(ExprCreeperMaxFuseTicks.class, Long.class, "[creeper] max[imum] fuse tick[s]", "livingentities"); |
There was a problem hiding this comment.
Deprecation is better
Co-authored-by: SirSmurfy2 <82696841+Absolutionism@users.noreply.github.com>
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Co-authored-by: sovdee <10354869+sovdeeth@users.noreply.github.com>
Problem
#8489
Solution
Adds a new
fuse ticksexpression for creepers and primed tnts using Paper's getMaxFuseTicks()/setMaxFuseTicks() for creepers and getFuseTicks()/setFuseTicks() for tntsTesting Completed
src/test/skript/tests/syntaxes/expressions/ExprFuseTicks.sk

Also did a quick test with effect commands in skriptTestDev
Supporting Information
Completes: #8489
Related: none
AI assistance: none