Add the Super Flower Pot power-up - #136
Open
Hugman76 wants to merge 1 commit into
Open
Conversation
Resolves #133. The Flower form gets both of the abilities the issue asks for. Growing a flower is a new power-up action, `super_mario:grow_flower`: a 2x2 entity planted at the holder's feet, one step ahead of them, which then rises straight up at a speed of its own that neither gravity nor drag ever touches. It grows through blocks the way the flowers of the source game rise through ceilings, and runs out of both time and height so that it never climbs forever; a data pack that would rather have them pop against blocks can say so instead, and every one of those numbers is a field of the action. It defeats what it grows through, once per entity, and spares its owner along with their team and their pets. The flutter is a reusable ability of the power-up system rather than something the Flower form owns: `PowerUpAbilities` hangs off a power-up the way its cosmetics do, and `FlutterAbility` holds the numbers the flutter is worth. The Tanooki form will only have to name it. Both sides run the same state machine, each for the player it is in charge of, so the client's own movement actually rises rather than waiting on a round trip; the jump key is read from the input packets on the server and from the local input on a client. Cosmetics are placeholders, as the issue reserves them for later: the item texture, the flower model and its texture, and vanilla stand-ins for the growth, wilt and flutter sounds along with the flutter particles. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T42CAmosnCqdPJnhN8dF6D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #133.
Adds the Super Flower Pot, which turns its holder into the Flower form. Both abilities the issue asks for are here: growing huge flowers, and the flutter jump.
Growing a flower
A new power-up action,
super_mario:grow_flower, plants a 2×2 flower entity at the holder's feet, one step ahead of them in the direction they face, so the model never clips into them. Nothing about the shot is aimed — where the holder is looking only decides which side of them the flower comes out of.The flower then rises straight up at a speed of its own that neither gravity nor drag ever touches, so two flowers grown from the same spot follow the exact same path. It grows through blocks, the way the flowers of Super Mario Bros. Wonder rise through ceilings — a flower stopping at the first block would be useless underground, where most of the game is played. What keeps it from reaching halfway across the world is that it runs out of both time and height, whichever comes first.
The issue lists popping against blocks as an alternative worth trying, so that is a field of the action rather than a decision baked into the code. Every number is: speed, lifetime, height limit, and whether blocks stop it.
It defeats what it grows through, once per entity, with the same damage as the ball projectiles, and it is not spent by what it hits — one flower clears a whole column. It spares whoever grew it, along with their team and their pets. It is not a platform: nothing can stand on it, and nothing can shoot it down or deflect it.
The flutter
Implemented as a reusable ability of the power-up system, not as something the Flower form owns, since the Tanooki form will want the same thing later:
PowerUpAbilitieshangs off a power-up the wayPowerUpCosmecticsalready does, so the next ability slots in beside the flutter withoutPowerUpgrowing a field per form.FlutterAbilityholds everything a flutter is worth — duration, ramp, strength, sound and particle — so a second form granting one only has to name its own numbers. It is all data: a data pack can add a flutter to any power-up.Past the peak of a jump, a holder still leaning on the jump key rises again for up to a second, the lift ramping up over the first few ticks so that it reads as a flutter rather than as a second jump. It stops the moment the key is released (and cannot be resumed for that jump), when the duration runs out, or when the player lands, enters water, starts climbing or gets on something. One flutter per jump, handed back by touching the ground.
Both sides run the same state machine, each for the player it is in charge of: the client so that the movement it predicts for itself actually rises rather than waiting on a round trip, the server so that it knows what the movement it is being sent is supposed to look like. The jump key is read where each side has it — from the input packets server-side, from the local input on a client — so no new packet was needed. A synced flag tells the other clients, who draw the particles and play the loop but never simulate someone else's keys. The remaining ticks and the "already fluttered this jump" flag are both saved, and the flutter is cleared if the form is lost mid-air.
Cosmetics
The issue reserves these for later, so they are placeholders: the item texture, the flower model and its texture, and vanilla stand-ins for the growth, wilt and flutter sounds along with the flutter particles. Swapping any of them is a one-line change in the provider or the renderer.
Tests
./gradlew runDatagen && ./gradlew buildis green, unit tests and the 182 game tests included.FlutterAbilityTest(unit) — the shape of the ramp: the first tick already lifts, the lift climbs and then plateaus, a flutter with no ramp is flat, and numbers that would push the holder down are refused.PowerUpCodecTest/PowerUpStreamCodecTest— the new field round trips through both the data pack and the network form, keeps every one of its numbers, and reads back as the defaults when written bare. An empty power-up still writes nothing at all, so the existing power-ups' JSON is untouched.FlutterGameTest(12 tests) — the flutter waits for the way down, carries the player higher than a plain fall, ends when the key is let go and cannot be resumed, counts its own ticks, runs out after its duration, comes back on landing, never happens without the ability or on the ground, and is cut short by losing the form or by water.FlowerGameTest(10 tests) — rises straight up at a constant speed, grows through a ceiling (and pops against one when told to), wilts on both limits, defeats what it grows through, only ever hits the same entity once, spares its owner, and is nothing to stand on.GrowFlowerActionGameTest(7 tests) — the flower is planted in front of its holder, follows where they face, ignores their pitch, carries the numbers of the action, is owned by whoever grew it, and costs a charge.TestPlayersgrew one helper along the way: a tick that drives a mock player the way a client would, sending the keys in and reporting the movement back. Both halves only ever reach the server as packets, and the flutter reads both.I agree to the Contributor License Agreement found in
CONTRIBUTING.md.