Format code [skip actions]

This commit is contained in:
github-actions 2023-07-29 15:40:10 +00:00
parent 98fbc4e512
commit 4320bc7d29
4 changed files with 48 additions and 21 deletions

View File

@ -275,7 +275,9 @@ public final class ResourceLoader {
val data = JsonUtils.loadToClass(path, SceneRoutes.class); val data = JsonUtils.loadToClass(path, SceneRoutes.class);
val routesArray = data.getRoutes(); val routesArray = data.getRoutes();
if (routesArray == null) return; if (routesArray == null) return;
val routesMap = GameData.getSceneRouteData().getOrDefault(data.getSceneId(), new Int2ObjectOpenHashMap<>()); val routesMap =
GameData.getSceneRouteData()
.getOrDefault(data.getSceneId(), new Int2ObjectOpenHashMap<>());
for (Route route : routesArray) { for (Route route : routesArray) {
routesMap.put(route.getLocalId(), route); routesMap.put(route.getLocalId(), route);
} }

View File

@ -257,7 +257,16 @@ public class EntityGadget extends EntityBaseGadget {
Position prevpos; Position prevpos;
if (currIndex == 0) { if (currIndex == 0) {
prevpos = getPosition(); prevpos = getPosition();
this.getScene().getScriptManager().callEvent(new ScriptArgs(this.getGroupId(), EventType.EVENT_PLATFORM_REACH_POINT, this.getConfigId(), configRoute.getRouteId()).setParam3(0).setEventSource(this.getConfigId())); this.getScene()
.getScriptManager()
.callEvent(
new ScriptArgs(
this.getGroupId(),
EventType.EVENT_PLATFORM_REACH_POINT,
this.getConfigId(),
configRoute.getRouteId())
.setParam3(0)
.setEventSource(this.getConfigId()));
} else { } else {
prevpos = points[currIndex].getPos(); prevpos = points[currIndex].getPos();
} }
@ -267,13 +276,29 @@ public class EntityGadget extends EntityBaseGadget {
time += points[i].getPos().computeDistance(prevpos) / points[i].getTargetVelocity(); time += points[i].getPos().computeDistance(prevpos) / points[i].getTargetVelocity();
prevpos = points[i].getPos(); prevpos = points[i].getPos();
val I = i; val I = i;
configRoute.getScheduledIndexes().add(this.getScene().getScheduler().scheduleDelayedTask(() -> { configRoute
.getScheduledIndexes()
.add(
this.getScene()
.getScheduler()
.scheduleDelayedTask(
() -> {
if (points[I].isHasReachEvent() && I > currIndex) { if (points[I].isHasReachEvent() && I > currIndex) {
this.getScene().getScriptManager().callEvent(new ScriptArgs(this.getGroupId(), EventType.EVENT_PLATFORM_REACH_POINT, this.getConfigId(), configRoute.getRouteId()).setParam3(I).setEventSource(this.getConfigId())); this.getScene()
.getScriptManager()
.callEvent(
new ScriptArgs(
this.getGroupId(),
EventType.EVENT_PLATFORM_REACH_POINT,
this.getConfigId(),
configRoute.getRouteId())
.setParam3(I)
.setEventSource(this.getConfigId()));
} }
configRoute.setStartIndex(I); configRoute.setStartIndex(I);
this.position.set(points[I].getPos()); this.position.set(points[I].getPos());
},(int)time)); },
(int) time));
} }
} }
} }

View File

@ -4,10 +4,10 @@ import emu.grasscutter.game.world.Position;
import emu.grasscutter.net.proto.MovingPlatformTypeOuterClass; import emu.grasscutter.net.proto.MovingPlatformTypeOuterClass;
import emu.grasscutter.net.proto.PlatformInfoOuterClass; import emu.grasscutter.net.proto.PlatformInfoOuterClass;
import emu.grasscutter.scripts.data.SceneGadget; import emu.grasscutter.scripts.data.SceneGadget;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import lombok.Getter;
import lombok.Setter;
public class ConfigRoute extends BaseRoute { public class ConfigRoute extends BaseRoute {