A few things (#401)

- Can't attack players or npcs through doors/walls anymore
- Cleaned up a few small bits of code
- Added a few new boundaries to the boundary system
- Removed dialogue asking are you sure you want to empty your inventory for admins
This commit is contained in:
Mr Extremez
2020-04-10 19:03:28 -05:00
committed by GitHub
parent 43f4b14dbf
commit b4371d3129
19 changed files with 130 additions and 183 deletions
@@ -1,8 +1,8 @@
package com.rebotted.world.clip;
public final class ObjectDef {
public final class ObjectDefinition {
public static ObjectDef getObjectDef(int i) {
public static ObjectDefinition getObjectDef(int i) {
for (int j = 0; j < 20; j++) {
if (cache[j].type == i) {
return cache[j];
@@ -10,7 +10,7 @@ public final class ObjectDef {
}
cacheIndex = (cacheIndex + 1) % 20;
ObjectDef class46 = cache[cacheIndex];
ObjectDefinition class46 = cache[cacheIndex];
class46.type = i;
class46.setDefaults();
byte[] buffer = archive.get(i);
@@ -50,9 +50,9 @@ public final class ObjectDef {
public static void loadConfig() {
archive = new MemoryArchive(new ByteStream(getBuffer("loc.dat")),
new ByteStream(getBuffer("loc.idx")));
cache = new ObjectDef[20];
cache = new ObjectDefinition[20];
for (int k = 0; k < 20; k++) {
cache[k] = new ObjectDef();
cache[k] = new ObjectDefinition();
}
System.out.println("[ObjectDef] DONE LOADING OBJECT CONFIGURATION");
}
@@ -251,7 +251,7 @@ public final class ObjectDef {
}
}
private ObjectDef() {
private ObjectDefinition() {
type = -1;
}
@@ -308,7 +308,7 @@ public final class ObjectDef {
public boolean hasActions;
public boolean aBoolean779;
public int anInt781;
private static ObjectDef[] cache;
private static ObjectDefinition[] cache;
private int[] modifiedModelColors;
public String actions[];
private static MemoryArchive archive;
@@ -580,40 +580,40 @@ public class Region {
}
public static void addObject(int objectId, int x, int y, int height, int type, int direction, boolean startUp) {
if (ObjectDef.getObjectDef(objectId) == null) {
if (ObjectDefinition.getObjectDef(objectId) == null) {
}
int xLength;
int yLength;
if (direction != 1 && direction != 3) {
xLength = ObjectDef.getObjectDef(objectId).xLength();
yLength = ObjectDef.getObjectDef(objectId).yLength();
xLength = ObjectDefinition.getObjectDef(objectId).xLength();
yLength = ObjectDefinition.getObjectDef(objectId).yLength();
} else {
xLength = ObjectDef.getObjectDef(objectId).yLength();
yLength = ObjectDef.getObjectDef(objectId).xLength();
xLength = ObjectDefinition.getObjectDef(objectId).yLength();
yLength = ObjectDefinition.getObjectDef(objectId).xLength();
}
if (type == 22) {
if (ObjectDef.getObjectDef(objectId).hasActions()
&& ObjectDef.getObjectDef(objectId).aBoolean767()) {
if (ObjectDefinition.getObjectDef(objectId).hasActions()
&& ObjectDefinition.getObjectDef(objectId).aBoolean767()) {
addClipping(x, y, height, 0x200000);
if (ObjectDef.getObjectDef(objectId).isUnshootable()) {
if (ObjectDefinition.getObjectDef(objectId).isUnshootable()) {
addProjectileClipping(x, y, height, 0x200000);
}
}
} else if (type >= 9) {
if (ObjectDef.getObjectDef(objectId).aBoolean767()) {
if (ObjectDefinition.getObjectDef(objectId).aBoolean767()) {
addClippingForSolidObject(x, y, height, xLength, yLength,
ObjectDef.getObjectDef(objectId).solid());
if (ObjectDef.getObjectDef(objectId).isUnshootable()) {
ObjectDefinition.getObjectDef(objectId).solid());
if (ObjectDefinition.getObjectDef(objectId).isUnshootable()) {
addProjectileClippingForSolidObject(x, y, height, xLength, yLength,
ObjectDef.getObjectDef(objectId).solid());
ObjectDefinition.getObjectDef(objectId).solid());
}
}
} else if (type >= 0 && type <= 3) {
if (ObjectDef.getObjectDef(objectId).aBoolean767()) {
if (ObjectDefinition.getObjectDef(objectId).aBoolean767()) {
addClippingForVariableObject(x, y, height, type, direction,
ObjectDef.getObjectDef(objectId).solid());
if (ObjectDef.getObjectDef(objectId).isUnshootable()) {
addProjectileClippingForVariableObject(x, y, height, type, direction, ObjectDef.getObjectDef(objectId).solid());
ObjectDefinition.getObjectDef(objectId).solid());
if (ObjectDefinition.getObjectDef(objectId).isUnshootable()) {
addProjectileClippingForVariableObject(x, y, height, type, direction, ObjectDefinition.getObjectDef(objectId).solid());
}
}
}
@@ -656,8 +656,7 @@ public class Region {
return 0;
}
public static boolean getClipping(int x, int y, int height, int moveTypeX,
int moveTypeY) {
public static boolean getClipping(int x, int y, int height, int moveTypeX, int moveTypeY) {
try {
if (height > 3) {
height = 0;