fixed sla range
This commit is contained in:
parent
77f01b8596
commit
a017d6988a
7 changed files with 51 additions and 44 deletions
|
@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2g
|
||||||
baseGroup = com.github.stachelbeere1248.zombiesutils
|
baseGroup = com.github.stachelbeere1248.zombiesutils
|
||||||
mcVersion = 1.8.9
|
mcVersion = 1.8.9
|
||||||
modid = zombiesutils
|
modid = zombiesutils
|
||||||
version = 1.3.5
|
version = 1.3.6
|
|
@ -3,15 +3,16 @@ package com.github.stachelbeere1248.zombiesutils.game.waves;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public enum Prefix {
|
public enum Prefix {
|
||||||
BOSS(0xCC5555, "B"),
|
BOSS(0xCC5555, "B"),
|
||||||
BLAZES(0xEFB61F, "F"),
|
BLAZES(0xEFB61F, "BL"),
|
||||||
SLIME(0x88FF88,"S"),
|
SLIME(0x88FF88,"S"),
|
||||||
OLD_ONE(0x55AA55, "O1"),
|
HBM(0x2A415F, "HBM"),
|
||||||
GIANT(0x00FFFF,"G"),
|
WITHER_SKELETON(0x888888, "WS"),
|
||||||
UFO(0x30D5C8,"U"),
|
OLD_ONE(0x55AA55, "O1"),
|
||||||
POLICE(0x16537E,"P"),
|
GIANT(0x00FFFF,"G"),
|
||||||
CELL(0xFF8234,"C"),
|
POLICE(0x16537E,"P"),
|
||||||
WINDOW(0xAAAAAA,"W");
|
CELL(0xFF8234,"C"),
|
||||||
|
WINDOW(0xAAAAAA,"W");
|
||||||
|
|
||||||
private final int color;
|
private final int color;
|
||||||
private final String prefix;
|
private final String prefix;
|
||||||
|
|
|
@ -149,6 +149,7 @@ public class Room {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Contract(" -> new")
|
@Contract(" -> new")
|
||||||
public static Room @NotNull [] getP() {
|
public static Room @NotNull [] getP() {
|
||||||
return new Room[]{
|
return new Room[]{
|
||||||
|
@ -172,7 +173,8 @@ public class Room {
|
||||||
new Window(2, 189, 144, 25),
|
new Window(2, 189, 144, 25),
|
||||||
}),
|
}),
|
||||||
new Room("Visitor's Room", "v", new Window[]{
|
new Room("Visitor's Room", "v", new Window[]{
|
||||||
new Window(1, 261, 146, -45),
|
new Window(1, 261, 144, -45),
|
||||||
|
new Window(2, 273, 144, 13)
|
||||||
}),
|
}),
|
||||||
new Room("Library", "l", new Window[]{
|
new Room("Library", "l", new Window[]{
|
||||||
new Window(1, 265, 158, 9),
|
new Window(1, 265, 158, 9),
|
||||||
|
@ -188,7 +190,8 @@ public class Room {
|
||||||
}),
|
}),
|
||||||
new Room("The Courts", "cs", new Window[]{
|
new Room("The Courts", "cs", new Window[]{
|
||||||
new Window(1, 285, 144, 81),
|
new Window(1, 285, 144, 81),
|
||||||
new Window(2, 211, 144, 157),
|
new Window(2, 247, 144, 157),
|
||||||
|
new Window(3, 211, 144, 157),
|
||||||
}),
|
}),
|
||||||
new Room("Offices", "o", new Window[]{
|
new Room("Offices", "o", new Window[]{
|
||||||
new Window(1, 153, 144, 161),
|
new Window(1, 153, 144, 161),
|
||||||
|
@ -205,6 +208,7 @@ public class Room {
|
||||||
}),
|
}),
|
||||||
new Room("Basement Corridor", "bc", new Window[]{
|
new Room("Basement Corridor", "bc", new Window[]{
|
||||||
new Window(1, 231, 130, 29),
|
new Window(1, 231, 130, 29),
|
||||||
|
new Window(2, 193, 130, 31),
|
||||||
}),
|
}),
|
||||||
new Room("The Deep", "d", new Window[]{
|
new Room("The Deep", "d", new Window[]{
|
||||||
new Window(1, 167, 126, -45),
|
new Window(1, 167, 126, -45),
|
||||||
|
@ -224,6 +228,7 @@ public class Room {
|
||||||
}),
|
}),
|
||||||
new Room("Alleyway", "a", new Window[]{
|
new Room("Alleyway", "a", new Window[]{
|
||||||
new Window(1, 101, 144, 133),
|
new Window(1, 101, 144, 133),
|
||||||
|
new Window(2, 147, 144, 117)
|
||||||
}),
|
}),
|
||||||
new Room("Guard's Gunroom", "gr", new Window[]{
|
new Room("Guard's Gunroom", "gr", new Window[]{
|
||||||
new Window(1, 29, 148, 75),
|
new Window(1, 29, 148, 75),
|
||||||
|
@ -250,6 +255,10 @@ public class Room {
|
||||||
new Window(1, 37, 144, 15),
|
new Window(1, 37, 144, 15),
|
||||||
new Window(2, 37, 144, -11),
|
new Window(2, 37, 144, -11),
|
||||||
}),
|
}),
|
||||||
|
new Room("???", "?", new Window[]{
|
||||||
|
new Window(1, 191, 126, -67),
|
||||||
|
new Window(2, 207, 126, -67),
|
||||||
|
}),
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class SLA {
|
||||||
this.rooms = Room.getAA();
|
this.rooms = Room.getAA();
|
||||||
break;
|
break;
|
||||||
case PRISON:
|
case PRISON:
|
||||||
this.rooms = Room.getP();
|
this.rooms = new Room[0];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Unexpected value: " + map);
|
throw new IllegalStateException("Unexpected value: " + map);
|
||||||
|
@ -86,7 +86,7 @@ public class SLA {
|
||||||
}
|
}
|
||||||
|
|
||||||
// (2x)²+(2y)²+(2z)² = 4(x²+y²+z²) = 4d²
|
// (2x)²+(2y)²+(2z)² = 4(x²+y²+z²) = 4d²
|
||||||
final int slaRange = 40;
|
final int slaRange = 50;
|
||||||
if (distanceDoubledThenSquared < 4 * slaRange * slaRange) {
|
if (distanceDoubledThenSquared < 4 * slaRange * slaRange) {
|
||||||
window.setActive(true);
|
window.setActive(true);
|
||||||
room.increaseActiveWindowCount();
|
room.increaseActiveWindowCount();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.github.stachelbeere1248.zombiesutils.handlers;
|
||||||
|
|
||||||
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
@ -27,5 +28,14 @@ public class RenderPlayerHandler {
|
||||||
}
|
}
|
||||||
public void togglePlayerVisibility() {
|
public void togglePlayerVisibility() {
|
||||||
this.visible = !this.visible;
|
this.visible = !this.visible;
|
||||||
|
final String s;
|
||||||
|
if (this.visible) {
|
||||||
|
s = "§dPlayer Visibility §e is now §rON";
|
||||||
|
} else {
|
||||||
|
s = "§dPlayer Visibility §e is now §8OFF";
|
||||||
|
}
|
||||||
|
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(
|
||||||
|
s
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class Game {
|
||||||
|
|
||||||
if (bestSegment == (short) 0) categoryFile.setBestSegment(round, roundTime);
|
if (bestSegment == (short) 0) categoryFile.setBestSegment(round, roundTime);
|
||||||
else if (roundTime < bestSegment) categoryFile.setBestSegment(round, roundTime);
|
else if (roundTime < bestSegment) categoryFile.setBestSegment(round, roundTime);
|
||||||
final RecordMessageSender recordMessageSender = new RecordMessageSender(this.category.getName(), round, false, roundTime, bestSegment);
|
final RecordMessageSender recordMessageSender = new RecordMessageSender(this.category.getName(), round, roundTime, bestSegment);
|
||||||
recordMessageSender.roundSplit();
|
recordMessageSender.roundSplit();
|
||||||
recordMessageSender.sendRecordMessage();
|
recordMessageSender.sendRecordMessage();
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ public class Game {
|
||||||
|
|
||||||
if (personalBest == 0) categoryFile.setPersonalBest(round, gameTime);
|
if (personalBest == 0) categoryFile.setPersonalBest(round, gameTime);
|
||||||
else if (gameTime < personalBest) categoryFile.setPersonalBest(round, gameTime);
|
else if (gameTime < personalBest) categoryFile.setPersonalBest(round, gameTime);
|
||||||
final RecordMessageSender recordMessageSender = new RecordMessageSender(category.getName(), round, true, gameTime, personalBest);
|
final RecordMessageSender recordMessageSender = new RecordMessageSender(category.getName(), round, gameTime, personalBest);
|
||||||
if (!escaping) recordMessageSender.gameSplit();
|
if (!escaping) recordMessageSender.gameSplit();
|
||||||
else recordMessageSender.helicopterSplit();
|
else recordMessageSender.helicopterSplit();
|
||||||
recordMessageSender.sendRecordMessage();
|
recordMessageSender.sendRecordMessage();
|
||||||
|
|
|
@ -9,33 +9,20 @@ import org.jetbrains.annotations.Contract;
|
||||||
|
|
||||||
public class RecordMessageSender {
|
public class RecordMessageSender {
|
||||||
private final StringBuilder recordMessage;
|
private final StringBuilder recordMessage;
|
||||||
private final int roundTime;
|
private final int newTime;
|
||||||
private final int gameTime;
|
private final int oldTime;
|
||||||
private final int oldPB;
|
|
||||||
private final int oldBS;
|
|
||||||
private final int round;
|
private final int round;
|
||||||
private final String deltaString;
|
private final String deltaString;
|
||||||
private final String timeString;
|
private final String timeString;
|
||||||
private final boolean cumulative;
|
|
||||||
private String copyString;
|
private String copyString;
|
||||||
public RecordMessageSender(final String categoryName, final int round, final boolean cumulative, final int newTime, final int oldTime) {
|
public RecordMessageSender(final String categoryName, final int round, final int newTime, final int oldTime) {
|
||||||
this.recordMessage = new StringBuilder(
|
this.recordMessage = new StringBuilder(
|
||||||
"§l§a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n§e Category: §d" + categoryName
|
"§l§a▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n§e Category: §d" + categoryName
|
||||||
);
|
);
|
||||||
if (cumulative) {
|
this.newTime = newTime;
|
||||||
this.gameTime = newTime;
|
this.oldTime = oldTime;
|
||||||
this.oldPB = oldTime;
|
this.deltaString = oldTime != 0 ? " " + formattedDelta(newTime, oldTime) : "";
|
||||||
this.roundTime = 0;
|
|
||||||
this.oldBS = 0;
|
|
||||||
} else {
|
|
||||||
this.gameTime = 0;
|
|
||||||
this.oldPB = 0;
|
|
||||||
this.roundTime = newTime;
|
|
||||||
this.oldBS = oldTime;
|
|
||||||
}
|
|
||||||
this.deltaString = oldTime != 0 ? formattedDelta(newTime, oldTime) : "";
|
|
||||||
this.timeString = formattedTime(newTime);
|
this.timeString = formattedTime(newTime);
|
||||||
this.cumulative = cumulative;
|
|
||||||
this.round = round;
|
this.round = round;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,14 +37,14 @@ public class RecordMessageSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gameSplit() {
|
public void gameSplit() {
|
||||||
final String announcement = gameTime < oldPB && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
final String announcement = newTime < oldTime && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
||||||
"\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : "";
|
"\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : "";
|
||||||
this.recordMessage.append(announcement)
|
this.recordMessage.append(announcement)
|
||||||
.append("\n§cRound ")
|
.append("\n§cRound ")
|
||||||
.append(round)
|
.append(round)
|
||||||
.append("§e finished at §a")
|
.append("§e finished at §a")
|
||||||
.append(timeString)
|
.append(timeString)
|
||||||
.append(" §9")
|
.append("§9")
|
||||||
.append(deltaString)
|
.append(deltaString)
|
||||||
.append("§e!");
|
.append("§e!");
|
||||||
this.copyString = deltaString.isEmpty() ?
|
this.copyString = deltaString.isEmpty() ?
|
||||||
|
@ -66,16 +53,16 @@ public class RecordMessageSender {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void roundSplit() {
|
public void roundSplit() {
|
||||||
final String announcement = roundTime < oldBS && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
final String announcement = newTime < oldTime && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
||||||
"\n§e§l***§6§l NEW BEST SEGMENT! §e§l***" : "";
|
"\n§e§l***§6§l NEW BEST SEGMENT! §e§l***" : "";
|
||||||
final String timeString = formattedTime(roundTime);
|
final String timeString = formattedTime(newTime);
|
||||||
final String deltaString = oldBS != 0 ? formattedDelta(roundTime, oldBS) : "";
|
final String deltaString = oldTime != 0 ? formattedDelta(newTime, oldTime) : "";
|
||||||
this.recordMessage.append(announcement)
|
this.recordMessage.append(announcement)
|
||||||
.append("\n§cRound ")
|
.append("\n§cRound ")
|
||||||
.append(round)
|
.append(round)
|
||||||
.append("§e took §a")
|
.append("§e took §a")
|
||||||
.append(timeString)
|
.append(timeString)
|
||||||
.append(" §9")
|
.append("§9")
|
||||||
.append(deltaString)
|
.append(deltaString)
|
||||||
.append("§e!");
|
.append("§e!");
|
||||||
this.copyString = deltaString.isEmpty() ?
|
this.copyString = deltaString.isEmpty() ?
|
||||||
|
@ -83,12 +70,12 @@ public class RecordMessageSender {
|
||||||
String.format("Round %d took %s (%s)!", round, timeString, deltaString);
|
String.format("Round %d took %s (%s)!", round, timeString, deltaString);
|
||||||
}
|
}
|
||||||
public void helicopterSplit() {
|
public void helicopterSplit() {
|
||||||
final String announcement = gameTime < oldPB && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
final String announcement = newTime < oldTime && ZombiesUtils.getInstance().getConfig().getAnnouncePB() ?
|
||||||
"\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : "";
|
"\n§e§l***§6§l NEW PERSONAL BEST! §e§l***" : "";
|
||||||
this.recordMessage.append(announcement)
|
this.recordMessage.append(announcement)
|
||||||
.append("§8§lHelicopter §r§ecalled at §a")
|
.append("\n§8§lHelicopter §r§ecalled at §a")
|
||||||
.append(timeString)
|
.append(timeString)
|
||||||
.append(" §9")
|
.append("§9")
|
||||||
.append(deltaString)
|
.append(deltaString)
|
||||||
.append("§e!");
|
.append("§e!");
|
||||||
this.copyString = deltaString.isEmpty() ?
|
this.copyString = deltaString.isEmpty() ?
|
||||||
|
|
Loading…
Add table
Reference in a new issue