Redraw beating wings every tick only after a jump

The wing beat touch no longer lowers the entry's interval. Its wings are drawn
every tick during the beat and at their usual interval otherwise; the extra
redraws do not count towards the slot budget.
This commit is contained in:
2026-10-26 15:02:56 +01:00
parent b2300c128e
commit 36e6329f2b
4 changed files with 55 additions and 4 deletions
@@ -0,0 +1,46 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle.elements.touch;
import de.steamwar.lobby.particle.BodyMotion;
import de.steamwar.lobby.particle.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
// Ticks the element every tick for a while after each jump, and as usual otherwise
public class AfterJump extends DelegatingParticleElement {
private final ParticleElement otherwise;
private final int ticks;
public AfterJump(ParticleElement particleElement, ParticleElement otherwise, int ticks) {
super(particleElement);
this.otherwise = otherwise;
this.ticks = ticks;
}
@Override
public void tick(ParticleTickData particleTickData) {
if (BodyMotion.ticksSinceJump(particleTickData.getPlayer()) <= ticks) {
particleElement.tick(particleTickData);
} else {
otherwise.tick(particleTickData);
}
}
}