Turn the touches back into reward designs styled like any other

The Touch setting is gone. Its unique mechanics become reward designs that use
the entry's particle: Burst (on jumping, landing or sneaking, as a puff or a
ring), Footprints, Team link, Shimmer and Heartbeat. Each is unlocked by any
of the rewards that had it, and Burst's triggers are locked separately. The
wing beat becomes the Beat on jump wing motion, unlocked by WarGear Season
2022. December snow and the glyphs are dropped: the first is a plain particle
with a condition, the second only works with enchanting glyphs.
This commit is contained in:
2026-10-26 15:08:08 +01:00
parent 36e6329f2b
commit db939e27d9
18 changed files with 231 additions and 356 deletions
@@ -30,21 +30,21 @@ import java.util.Deque;
import java.util.Map;
import java.util.WeakHashMap;
// Leaves a print every half step on the ground and keeps showing it for a while after the player walked on
// Leaves a print every given distance on the ground and keeps showing it for a while after the player walked on
public class Footprints extends DelegatingParticleElement {
private static final double STEP = 0.6;
private record Print(Location location, int age) {
}
private final int lifetime;
private final double step;
// Weak keys drop players once they quit
private final Map<Player, Deque<Print>> prints = new WeakHashMap<>();
public Footprints(ParticleElement particleElement, int lifetime) {
public Footprints(ParticleElement particleElement, int lifetime, double step) {
super(particleElement);
this.lifetime = lifetime;
this.step = step;
}
@Override
@@ -54,7 +54,7 @@ public class Footprints extends DelegatingParticleElement {
Deque<Print> playerPrints = prints.computeIfAbsent(player, key -> new ArrayDeque<>());
Location feet = player.getLocation();
Print last = playerPrints.peekLast();
if (player.isOnGround() && (last == null || last.location().getWorld() != feet.getWorld() || last.location().distanceSquared(feet) > STEP * STEP)) {
if (player.isOnGround() && (last == null || last.location().getWorld() != feet.getWorld() || last.location().distanceSquared(feet) > step * step)) {
playerPrints.addLast(new Print(feet, 0));
}
@@ -1,72 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2026 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.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.util.Vector;
// Enchanting glyphs that fly along a path. Spawned with an amount of 0, the offset becomes the glyph's motion: it
// appears at location + offset and flies back to the location, like glyphs flying into an enchanting table.
public class Glyphs implements ParticleElement {
public enum Path {
// From random points on the ground around the player into the chest
INTO_PLAYER,
// From the chest outwards to a ring around the player
OUT_OF_PLAYER,
}
private static final double CHEST = 1.2;
private final Path path;
private final int amount;
private final double radius;
public Glyphs(Path path, int amount, double radius) {
this.path = path;
this.amount = amount;
this.radius = radius;
}
@Override
public void tick(ParticleTickData particleTickData) {
Location chest = particleTickData.getPlayer().getLocation().add(0, CHEST, 0);
for (int i = 0; i < amount; i++) {
Location target;
Vector from;
if (path == Path.INTO_PLAYER) {
double angle = RANDOM.nextDouble() * 2 * Math.PI;
double distance = radius * (0.5 + RANDOM.nextDouble() / 2);
target = chest;
from = new Vector(Math.cos(angle) * distance, -CHEST, Math.sin(angle) * distance);
} else {
double angle = 2 * Math.PI * i / amount;
Vector out = new Vector(Math.cos(angle) * radius, 0, Math.sin(angle) * radius);
target = chest.clone().add(out);
from = out.multiply(-1);
}
Location spawn = target;
display(particleTickData, player -> player.spawnParticle(Particle.ENCHANT, spawn, 0, from.getX(), from.getY(), from.getZ(), 1));
}
}
}
@@ -1,45 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2026 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.ParticleElement;
import de.steamwar.lobby.particle.ParticleTickData;
import de.steamwar.lobby.particle.elements.DelegatingParticleElement;
import java.time.LocalDate;
import java.time.Month;
// Only shows during the given month
public class Seasonal extends DelegatingParticleElement {
private final Month month;
public Seasonal(Month month, ParticleElement particleElement) {
super(particleElement);
this.month = month;
}
@Override
public void tick(ParticleTickData particleTickData) {
if (LocalDate.now().getMonth() == month) {
particleElement.tick(particleTickData);
}
}
}
@@ -34,18 +34,19 @@ import java.util.WeakHashMap;
// A line of particles between nearby players who show the same reward. Each pair is drawn by only one of them.
public class TeamLink extends DelegatingParticleElement {
private static final double RANGE = 8;
private static final double SPACING = 0.5;
public static final double RANGE = 8;
private static final double CHEST = 1.2;
// Per reward, who showed it in which tick
private static final Map<String, Map<Player, Long>> SHOWING = new HashMap<>();
private final String reward;
private final double spacing;
public TeamLink(String reward, ParticleElement particleElement) {
public TeamLink(String reward, ParticleElement particleElement, double spacing) {
super(particleElement);
this.reward = reward;
this.spacing = spacing;
}
@Override
@@ -64,7 +65,7 @@ public class TeamLink extends DelegatingParticleElement {
if (to.getWorld() != from.getWorld() || to.distanceSquared(from) > RANGE * RANGE) continue;
Vector step = to.toVector().subtract(from.toVector());
int points = (int) Math.ceil(step.length() / SPACING);
int points = (int) Math.ceil(step.length() / spacing);
step.multiply(1.0 / points);
for (int i = 1; i < points; i++) {
particleElement.tick(particleTickData.withLocation(from.clone().add(step.clone().multiply(i))));