ghxula, other changes, full quicksla

This commit is contained in:
Stachelbeere1248 2023-11-09 13:55:27 +01:00
parent a53195bedf
commit bc65a45437
8 changed files with 118 additions and 88 deletions

View file

@ -21,13 +21,13 @@ public class SlaCommand extends CommandBase {
@Override @Override
public String getCommandUsage(ICommandSender sender) { public String getCommandUsage(ICommandSender sender) {
return "/sla off\n/sla offset [x] [x] [x]\n/sla rotate\n/sla mirror\n/sla map <de|bb|aa>"; return "/sla off\n/sla offset [x] [x] [x]\n/sla rotate\n/sla mirror\n/sla map <de|bb|aa>\n/sla quick";
} }
@Override @Override
public void processCommand(ICommandSender sender, String @NotNull [] args) throws CommandException { public void processCommand(ICommandSender sender, String @NotNull [] args) throws CommandException {
if (args.length == 0) throw new WrongUsageException( if (args.length == 0) throw new WrongUsageException(
"[Missing option] options: off, offset, rotate, mirror, map"); "[Missing option] options: off, offset, rotate, mirror, map, quick");
else { else {
switch (args[0]) { switch (args[0]) {
case "off": case "off":
@ -118,7 +118,7 @@ public class SlaCommand extends CommandBase {
@Override @Override
public List<String> addTabCompletionOptions(ICommandSender sender, String @NotNull [] args, BlockPos blockPos) { public List<String> addTabCompletionOptions(ICommandSender sender, String @NotNull [] args, BlockPos blockPos) {
List<String> options = new ArrayList<>(); List<String> options = new ArrayList<>();
if (args.length == 1) options.addAll(Arrays.asList("off", "offset", "rotate", "mirror", "map")); if (args.length == 1) options.addAll(Arrays.asList("off", "offset", "rotate", "mirror", "map", "quick"));
else { else {
if (args.length > 1) switch (args[0]) { if (args.length > 1) switch (args[0]) {
case "offset": case "offset":

View file

@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
public class ZombiesUtilsConfig { public class ZombiesUtilsConfig {
public static Configuration config; public static Configuration config;
private static boolean slaToggle; private static boolean slaToggle;
private static boolean slaShortener;
private static String chatMacro; private static String chatMacro;
private static String defaultCategory; private static String defaultCategory;
public static void load() { public static void load() {
@ -22,6 +23,12 @@ public class ZombiesUtilsConfig {
slaToggle, slaToggle,
"Should SLA be started when a game starts?" "Should SLA be started when a game starts?"
); );
slaShortener = config.getBoolean(
"shortened SLA",
Configuration.CATEGORY_GENERAL,
slaShortener,
"If on, inactive windows / rooms will not show"
);
chatMacro = config.getString( chatMacro = config.getString(
"Chat Macro", "Chat Macro",
Configuration.CATEGORY_GENERAL, Configuration.CATEGORY_GENERAL,
@ -49,6 +56,9 @@ public class ZombiesUtilsConfig {
public static boolean isSlaToggled() { public static boolean isSlaToggled() {
return slaToggle; return slaToggle;
} }
public static boolean isSlaShortened() {
return slaShortener;
}
public static String getChatMacro() { public static String getChatMacro() {
return chatMacro; return chatMacro;
} }

View file

@ -11,10 +11,12 @@ public class QuickSLA {
} }
public static void ghxula() { public static void ghxula() {
SLA.instance = new SLA(Map.DEAD_END); SLA.instance = new SLA(Map.DEAD_END);
//TODO SLA.instance.rotate(1);
SLA.instance.setOffset(new int[]{27, 35, 5});
} }
public static void ghxulaGarden() { public static void ghxulaGarden() {
SLA.instance = new SLA(Map.DEAD_END); SLA.instance = new SLA(Map.DEAD_END);
//TODO SLA.instance.rotate(1);
SLA.instance.setOffset(new int[]{13, 53, -8});
} }
} }

View file

@ -32,7 +32,6 @@ public class SLA {
window.rotate(rotations); window.rotate(rotations);
} }
} }
System.out.println("Co3 now at " + Arrays.toString(rooms[0].getWindows()[0].getXYZ()));
} }
public void mirrorX() { public void mirrorX() {
for (Room room : rooms) { for (Room room : rooms) {

View file

@ -1,20 +1,23 @@
package com.github.stachelbeere1248.zombiesutils.game.windows; package com.github.stachelbeere1248.zombiesutils.game.windows;
import com.github.stachelbeere1248.zombiesutils.config.ZombiesUtilsConfig;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class Room { public class Room {
private final Window[] windows; private final Window[] windows;
private final String name;
private final String alias; private final String alias;
private int activeWindowCount; private int activeWindowCount;
public Room(String alias, Window[] windows) { public Room(String name,String alias, Window[] windows) {
this.windows = windows; this.windows = windows;
this.name = name;
this.alias = alias; this.alias = alias;
} }
public String getAlias() { public String getName() {
return alias; return name;
} }
public Window[] getWindows() { public Window[] getWindows() {
return windows; return windows;
@ -25,51 +28,51 @@ public class Room {
Vec3 t = new Vec3(3,3,3); Vec3 t = new Vec3(3,3,3);
t.rotatePitch(3); t.rotatePitch(3);
return new Room[]{ return new Room[]{
new Room("Alley", new Window[]{ new Room("Alley", "al", new Window[]{
new Window(1,13,138,63), new Window(1,9,138,87),
new Window(2,9,138,87), new Window(2,13,138,63),
new Window(3,79,140,17), new Window(3,85,140,59),
new Window(4,85,140,59), new Window(4,79,140,17)
}), }),
new Room("Office", new Window[]{ new Room("Office", "o", new Window[]{
new Window(1,85,152,53), new Window(1,85,152,53),
new Window(2,105,152,63), new Window(2,105,152,63),
new Window(3,115,152,129), new Window(3,115,152,129)
}), }),
new Room("Hotel", new Window[]{ new Room("Hotel", "h", new Window[]{
new Window(1,1,136,93), new Window(1,1,136,93),
new Window(2,-19,136,29), new Window(2,-19,136,29),
new Window(3,51,138,-7), new Window(3,53,138,7),
new Window(4,53,138,7), new Window(4,51,138,-7),
new Window(5,-7,152,-43), new Window(5,-7,152,-43),
new Window(6,51,152,-11), new Window(6,51,152,-11)
}), }),
new Room("Apartments", new Window[]{ new Room("Apartments", "a", new Window[]{
new Window(1,39,152,19), new Window(1,39,152,19),
new Window(2,-31,152,31), new Window(2,-31,152,31),
new Window(3,-27,152,103), new Window(3,-27,152,103),
new Window(4,-9,152,125), new Window(4,-9,152,125)
}), }),
new Room("Power Station", new Window[]{ new Room("Power Station", "ps", new Window[]{
new Window(1,7,166,125), new Window(1,-5,166,65),
new Window(2,-5,166,65), new Window(2,7,166,125),
new Window(3,-11,136,133), new Window(3,-11,136,133)
}), }),
new Room("Rooftop", new Window[]{ new Room("Rooftop", "rt", new Window[]{
new Window(1,-31,166,129), new Window(1,-31,166,129),
new Window(2,-27,166,61), new Window(2,-27,166,61),
new Window(3,-99,166,77), new Window(3,-75,166,51),
new Window(4,-75,166,51), new Window(4,-99,166,77)
}), }),
new Room("Gallery", new Window[]{ new Room("Garden", "g", new Window[]{
new Window(1,45,152,155),
new Window(2,61,152,109),
new Window(3,31,152,131),
}),
new Room("Garden", new Window[]{
new Window(1,1,136,-33), new Window(1,1,136,-33),
new Window(2,49,136,-67), new Window(2,49,136,-67),
new Window(3,69,136,-33), new Window(3,69,136,-33)
}),
new Room("Gallery", "gal", new Window[]{
new Window(1,45,152,155),
new Window(2,61,152,109),
new Window(3,31,152,131)
}) })
}; };
} }
@ -77,52 +80,52 @@ public class Room {
@Contract(" -> new") @Contract(" -> new")
public static Room @NotNull [] getBB() { public static Room @NotNull [] getBB() {
return new Room[]{ return new Room[]{
new Room("Courtyard", new Window[]{ new Room("Courtyard", "co", new Window[]{
new Window(1,49,138,-37), new Window(1,39,138,41),
new Window(2,61,138,21), new Window(2,61,138,21),
new Window(3,39,138,41), new Window(3,49,138,-37),
new Window(4,25,138,-35), new Window(4,25,138,-35)
}), }),
new Room("Mansion", new Window[]{ new Room("Mansion", "m", new Window[]{
new Window(1,1,148,-35), new Window(1,1,148,-35),
new Window(2,1,148,37), new Window(2,1,148,37),
new Window(3,-25,146,57), new Window(3,-25,146,57)
}), }),
new Room("Library", new Window[]{ new Room("Library", "l", new Window[]{
new Window(1,3,148,-89), new Window(1,3,148,-89),
new Window(2,-41,148,-59), new Window(2,-41,148,-59),
new Window(3,-81,148,-61), new Window(3,-81,148,-61),
new Window(4,-79,148,-115), new Window(4,-79,148,-115),
new Window(5,-109,148,-93), new Window(5,-109,148,-93),
new Window(6,-107,148,-67), new Window(6,-107,148,-67)
}), }),
new Room("Dungeon", new Window[]{ new Room("Dungeon", "d", new Window[]{
new Window(1,-57,136,-69), new Window(1,-21,136,-99),
new Window(2,-73,136,-23), new Window(2,-57,136,-69),
new Window(3,-19,136,-37), new Window(3,-19,136,-45),
new Window(4,-19,136,-45), new Window(4,-19,136,-37),
new Window(5,-21,136,-99), new Window(5,-73,136,-23)
}), }),
new Room("Crypts", new Window[]{ new Room("Crypts", "cr", new Window[]{
new Window(1,-7,136,-5), new Window(1,-7,136,-5),
new Window(2,-31,136,1), new Window(2,-31,136,1),
new Window(3,-57,136,41), new Window(3,-57,136,41)
}), }),
new Room("Graveyard", new Window[]{ new Room("Graveyard", "gy", new Window[]{
new Window(1,-13,136,67), new Window(1,-71,136,63),
new Window(2,-71,136,63), new Window(2,-33,136,101),
new Window(3,-33,136,101), new Window(3,-13,136,67)
}), }),
new Room("Balcony", new Window[]{ new Room("Balcony", "b", new Window[]{
new Window(1,-83,136,55), new Window(1,-65,148,-37),
new Window(2,-107,144,25), new Window(2,-113,148,5),
new Window(3,-113,148,5), new Window(3,-107,144,25),
new Window(4,-65,148,-37), new Window(4,-83,136,55)
}), }),
new Room("Great Hall", new Window[]{ new Room("Great Hall", "gh", new Window[]{
new Window(1,-39,148,-27), new Window(1,-39,148,-27),
new Window(2,-63,152,31), new Window(2,-55,148,31),
new Window(3,-55,148,31), new Window(3,-63,152,31)
}) })
}; };
@ -130,24 +133,24 @@ public class Room {
@Contract(" -> new") @Contract(" -> new")
public static Room @NotNull [] getAA() { public static Room @NotNull [] getAA() {
return new Room[]{ return new Room[]{
new Room("Park Entrance", new Window[]{ new Room("Park Entrance", "ent", new Window[]{
new Window(1,13,144,63), new Window(1,13,144,63),
new Window(2,-21,144,-11), new Window(2,-45,144,31),
new Window(3,-43,144,21), new Window(3,-43,144,21),
new Window(4,-45,144,31), new Window(4,-21,144,-11),
new Window(5,45,144,27), new Window(5,45,144,27)
}), }),
new Room("Roller Coaster", new Window[]{ new Room("Roller Coaster", "rc", new Window[]{
new Window(1,-57,144,55), new Window(1,-25,144,79),
new Window(2,-25,144,79), new Window(2,-57,144,55)
}), }),
new Room("Ferris Wheel", new Window[]{ new Room("Ferris Wheel", "fw", new Window[]{
new Window(1,35,144,89), new Window(1,55,144,63),
new Window(2,55,144,63), new Window(2,35,144,89)
}), }),
new Room("Bumper Cars", new Window[]{ new Room("Bumper Cars", "bp", new Window[]{
new Window(1,67,146,-3), new Window(1,45,146,-27),
new Window(2,45,146,-27), new Window(2,67,146,-3)
}) })
}; };
} }
@ -161,4 +164,12 @@ public class Room {
public int getActiveWindowCount() { public int getActiveWindowCount() {
return activeWindowCount; return activeWindowCount;
} }
public String getSlaString() {
StringBuilder slaString = new StringBuilder(String.format("§6%s§r§d %x§e:", this.getName(), activeWindowCount));
for (Window window: this.windows) {
if (window.isActive()) slaString.append("§2 ").append(alias).append(window.getID());
else if (!ZombiesUtilsConfig.isSlaShortened()) slaString.append("§c ").append(alias).append(window.getID());
}
return slaString.toString();
}
} }

View file

@ -1,17 +1,21 @@
package com.github.stachelbeere1248.zombiesutils.game.windows; package com.github.stachelbeere1248.zombiesutils.game.windows;
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
import java.util.Arrays;
public class Window { public class Window {
private final short[] xyz = new short[3]; private final short[] xyz = new short[3];
private final int alias; private final int id;
private boolean isActive; private boolean isActive;
public Window(int alias, int x, int y, int z) { public Window(int id, int x, int y, int z) {
this.alias = alias; this.id = id;
xyz[0] = (short) x; xyz[1] = (short) y; xyz[2] = (short) z; xyz[0] = (short) x; xyz[1] = (short) y; xyz[2] = (short) z;
} }
public int getAlias() { public int getID() {
return alias; return id;
} }
public short[] getXYZ() { public short[] getXYZ() {
return xyz; return xyz;

View file

@ -1,5 +1,6 @@
package com.github.stachelbeere1248.zombiesutils.render; package com.github.stachelbeere1248.zombiesutils.render;
import com.github.stachelbeere1248.zombiesutils.config.ZombiesUtilsConfig;
import com.github.stachelbeere1248.zombiesutils.game.sla.SLA; import com.github.stachelbeere1248.zombiesutils.game.sla.SLA;
import com.github.stachelbeere1248.zombiesutils.game.windows.Room; import com.github.stachelbeere1248.zombiesutils.game.windows.Room;
import com.github.stachelbeere1248.zombiesutils.timer.Timer; import com.github.stachelbeere1248.zombiesutils.timer.Timer;
@ -47,10 +48,13 @@ public class RenderGameOverlayHandler {
private void renderSla(Room @NotNull [] rooms) { private void renderSla(Room @NotNull [] rooms) {
int y = 0; int y = 0;
for (Room room: rooms) { for (Room room: rooms) {
int actives = room.getActiveWindowCount(); if (ZombiesUtilsConfig.isSlaShortened() && room.getActiveWindowCount() == 0) continue;
if (actives == 0) continue; fontRenderer.drawStringWithShadow(
String roomString = String.format("%s: %x",room.getAlias(), actives); room.getSlaString(),
fontRenderer.drawStringWithShadow(roomString,1,1+y*fontRenderer.FONT_HEIGHT,0xFFFFFF); 1,
1 + y * fontRenderer.FONT_HEIGHT,
0xFFFFFF
);
y++; y++;
} }
} }

View file

@ -45,13 +45,13 @@ public class Timer {
* @param passedRound The round that has been passed. * @param passedRound The round that has been passed.
*/ */
public void split(byte passedRound) { public void split(byte passedRound) {
if (dontDupeSplitPlease == passedRound || passedRound == 0) { final int gameTime = gameTime();
if (dontDupeSplitPlease == passedRound || passedRound == 0 || gameTime == 0) {
ZombiesUtils.getInstance().getLogger().debug("SPLIT CANCELLED"); ZombiesUtils.getInstance().getLogger().debug("SPLIT CANCELLED");
return; return;
} }
if (passedRound == (byte) 1) pbTracking = true; if (passedRound == (byte) 1) pbTracking = true;
final int gameTime = gameTime();
final short roundTime = (short) (gameTime - passedRoundsTickSum); final short roundTime = (short) (gameTime - passedRoundsTickSum);
ZombiesUtils.getInstance().getLogger().debug("Passed round: " + passedRound); ZombiesUtils.getInstance().getLogger().debug("Passed round: " + passedRound);