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
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
public void processCommand(ICommandSender sender, String @NotNull [] args) throws CommandException {
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 {
switch (args[0]) {
case "off":
@ -118,7 +118,7 @@ public class SlaCommand extends CommandBase {
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String @NotNull [] args, BlockPos blockPos) {
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 {
if (args.length > 1) switch (args[0]) {
case "offset":

View file

@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
public class ZombiesUtilsConfig {
public static Configuration config;
private static boolean slaToggle;
private static boolean slaShortener;
private static String chatMacro;
private static String defaultCategory;
public static void load() {
@ -22,6 +23,12 @@ public class ZombiesUtilsConfig {
slaToggle,
"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(
"Chat Macro",
Configuration.CATEGORY_GENERAL,
@ -49,6 +56,9 @@ public class ZombiesUtilsConfig {
public static boolean isSlaToggled() {
return slaToggle;
}
public static boolean isSlaShortened() {
return slaShortener;
}
public static String getChatMacro() {
return chatMacro;
}

View file

@ -11,10 +11,12 @@ public class QuickSLA {
}
public static void ghxula() {
SLA.instance = new SLA(Map.DEAD_END);
//TODO
SLA.instance.rotate(1);
SLA.instance.setOffset(new int[]{27, 35, 5});
}
public static void ghxulaGarden() {
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);
}
}
System.out.println("Co3 now at " + Arrays.toString(rooms[0].getWindows()[0].getXYZ()));
}
public void mirrorX() {
for (Room room : rooms) {

View file

@ -1,20 +1,23 @@
package com.github.stachelbeere1248.zombiesutils.game.windows;
import com.github.stachelbeere1248.zombiesutils.config.ZombiesUtilsConfig;
import net.minecraft.util.Vec3;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
public class Room {
private final Window[] windows;
private final String name;
private final String alias;
private int activeWindowCount;
public Room(String alias, Window[] windows) {
public Room(String name,String alias, Window[] windows) {
this.windows = windows;
this.name = name;
this.alias = alias;
}
public String getAlias() {
return alias;
public String getName() {
return name;
}
public Window[] getWindows() {
return windows;
@ -25,51 +28,51 @@ public class Room {
Vec3 t = new Vec3(3,3,3);
t.rotatePitch(3);
return new Room[]{
new Room("Alley", new Window[]{
new Window(1,13,138,63),
new Window(2,9,138,87),
new Window(3,79,140,17),
new Window(4,85,140,59),
new Room("Alley", "al", new Window[]{
new Window(1,9,138,87),
new Window(2,13,138,63),
new Window(3,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(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(2,-19,136,29),
new Window(3,51,138,-7),
new Window(4,53,138,7),
new Window(3,53,138,7),
new Window(4,51,138,-7),
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(2,-31,152,31),
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 Window(1,7,166,125),
new Window(2,-5,166,65),
new Window(3,-11,136,133),
new Room("Power Station", "ps", new Window[]{
new Window(1,-5,166,65),
new Window(2,7,166,125),
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(2,-27,166,61),
new Window(3,-99,166,77),
new Window(4,-75,166,51),
new Window(3,-75,166,51),
new Window(4,-99,166,77)
}),
new Room("Gallery", 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 Room("Garden", "g", new Window[]{
new Window(1,1,136,-33),
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")
public static Room @NotNull [] getBB() {
return new Room[]{
new Room("Courtyard", new Window[]{
new Window(1,49,138,-37),
new Room("Courtyard", "co", new Window[]{
new Window(1,39,138,41),
new Window(2,61,138,21),
new Window(3,39,138,41),
new Window(4,25,138,-35),
new Window(3,49,138,-37),
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(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(2,-41,148,-59),
new Window(3,-81,148,-61),
new Window(4,-79,148,-115),
new Window(5,-109,148,-93),
new Window(6,-107,148,-67),
new Window(6,-107,148,-67)
}),
new Room("Dungeon", new Window[]{
new Window(1,-57,136,-69),
new Window(2,-73,136,-23),
new Window(3,-19,136,-37),
new Window(4,-19,136,-45),
new Window(5,-21,136,-99),
new Room("Dungeon", "d", new Window[]{
new Window(1,-21,136,-99),
new Window(2,-57,136,-69),
new Window(3,-19,136,-45),
new Window(4,-19,136,-37),
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(2,-31,136,1),
new Window(3,-57,136,41),
new Window(3,-57,136,41)
}),
new Room("Graveyard", new Window[]{
new Window(1,-13,136,67),
new Window(2,-71,136,63),
new Window(3,-33,136,101),
new Room("Graveyard", "gy", new Window[]{
new Window(1,-71,136,63),
new Window(2,-33,136,101),
new Window(3,-13,136,67)
}),
new Room("Balcony", new Window[]{
new Window(1,-83,136,55),
new Window(2,-107,144,25),
new Window(3,-113,148,5),
new Window(4,-65,148,-37),
new Room("Balcony", "b", new Window[]{
new Window(1,-65,148,-37),
new Window(2,-113,148,5),
new Window(3,-107,144,25),
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(2,-63,152,31),
new Window(3,-55,148,31),
new Window(2,-55,148,31),
new Window(3,-63,152,31)
})
};
@ -130,24 +133,24 @@ public class Room {
@Contract(" -> new")
public static Room @NotNull [] getAA() {
return new Room[]{
new Room("Park Entrance", new Window[]{
new Room("Park Entrance", "ent", new Window[]{
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(4,-45,144,31),
new Window(5,45,144,27),
new Window(4,-21,144,-11),
new Window(5,45,144,27)
}),
new Room("Roller Coaster", new Window[]{
new Window(1,-57,144,55),
new Window(2,-25,144,79),
new Room("Roller Coaster", "rc", new Window[]{
new Window(1,-25,144,79),
new Window(2,-57,144,55)
}),
new Room("Ferris Wheel", new Window[]{
new Window(1,35,144,89),
new Window(2,55,144,63),
new Room("Ferris Wheel", "fw", new Window[]{
new Window(1,55,144,63),
new Window(2,35,144,89)
}),
new Room("Bumper Cars", new Window[]{
new Window(1,67,146,-3),
new Window(2,45,146,-27),
new Room("Bumper Cars", "bp", new Window[]{
new Window(1,45,146,-27),
new Window(2,67,146,-3)
})
};
}
@ -161,4 +164,12 @@ public class Room {
public int getActiveWindowCount() {
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;
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
import java.util.Arrays;
public class Window {
private final short[] xyz = new short[3];
private final int alias;
private final int id;
private boolean isActive;
public Window(int alias, int x, int y, int z) {
this.alias = alias;
public Window(int id, int x, int y, int z) {
this.id = id;
xyz[0] = (short) x; xyz[1] = (short) y; xyz[2] = (short) z;
}
public int getAlias() {
return alias;
public int getID() {
return id;
}
public short[] getXYZ() {
return xyz;

View file

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

View file

@ -45,13 +45,13 @@ public class Timer {
* @param passedRound The round that has been passed.
*/
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");
return;
}
if (passedRound == (byte) 1) pbTracking = true;
final int gameTime = gameTime();
final short roundTime = (short) (gameTime - passedRoundsTickSum);
ZombiesUtils.getInstance().getLogger().debug("Passed round: " + passedRound);