Compare commits

...

3 Commits

Author SHA1 Message Date
FatBoy 6a6856876e stronghold generation 2025-01-05 09:15:27 -06:00
FatBoy d1971e7d6e stronghold islands? 2025-01-04 19:34:59 -06:00
FatBoy 2dfa7b9090 stronghold islands? 2025-01-04 19:20:19 -06:00
3 changed files with 78 additions and 0 deletions
@@ -3,9 +3,11 @@ package engine.gameManager;
import engine.Enum; import engine.Enum;
import engine.InterestManagement.InterestManager; import engine.InterestManagement.InterestManager;
import engine.InterestManagement.WorldGrid; import engine.InterestManagement.WorldGrid;
import engine.math.Vector2f;
import engine.math.Vector3f; import engine.math.Vector3f;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.objects.*; import engine.objects.*;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList; import java.util.ArrayList;
@@ -344,4 +346,38 @@ public class StrongholdManager {
} }
} }
} }
//=====================================NEW STUFF
public static void generateMaze(){
Zone stronghold = ZoneManager.getZoneByUUID(995);
ArrayList<Vector3fImmutable> gridLocs = new ArrayList<>();
for(int x = -7; x < 8; x++){
for(int z = -7; z < 8; z++) {
if((x >= -1 || x <= 1) && (z >= -1 || z <= 1))
continue;
float offsetX = x * 128;
float offsetZ = z * 128;
Vector3fImmutable sLoc = stronghold.getLoc();
Vector3fImmutable loc = new Vector3fImmutable(offsetX,sLoc.y,offsetZ);
gridLocs.add(loc);
}
}
for(Vector3fImmutable loc : gridLocs){
createBuilding(stronghold,405600,loc);
}
}
public static void createBuilding(Zone zone, int blueprint, Vector3fImmutable offset){
Vector3fImmutable localLoc = ZoneManager.worldToLocal(offset, zone);
Building building = DbManager.BuildingQueries.
CREATE_BUILDING(
zone.getObjectUUID(), 0, "", 1,
localLoc, 1.0f, 0, Enum.ProtectionState.PROTECTED, 0, 1,
null, blueprint, 0, 0);
building.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
WorldGrid.addObject(building,zone.getLoc().x + offset.x,zone.getLoc().z + offset.z);
}
} }
+41
View File
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
public class Zone extends AbstractGameObject { public class Zone extends AbstractGameObject {
@@ -103,6 +104,46 @@ public class Zone extends AbstractGameObject {
} }
//custom constructor
public Zone(int template, Vector3fImmutable loc, String name){
this.parentZoneID = 100;//seafloor
this.playerCityID = 0;
this.isPlayerCity = false;
this.zoneName = name;
this.xCoord = loc.x;
this.zCoord = loc.z;
this.yCoord = loc.y;
this.loadNum = template;
this.safeZone = (byte)0;
this.Icon1 = "T_Bandits";
this.Icon2 = "B_Standard";
this.Icon3 = "H_T_Bandits";
this.hash = null;
this.minLvl = 10;
this.maxLvl = 75;
//this needs to be here specifically for new zones created after server boot (e.g. player city zones)
Zone parentZone = ZoneManager.getZoneByUUID(parentZoneID);
this.setParent(parentZone);
if (this.minLvl == 0 && parentZone != null) {
this.minLvl = parentZone.minLvl;
this.maxLvl = parentZone.maxLvl;
}
if (parentZone != null)
parentZone.addNode(this);
// If zone doesn't yet hava a hash then write it back to the zone table
if (hash == null)
setHash();
}
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) { public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
if (zone.loadNum == 0 && zone.playerCityID == 0) if (zone.loadNum == 0 && zone.playerCityID == 0)
+1
View File
@@ -524,6 +524,7 @@ public class WorldServer {
printThreads(); printThreads();
Logger.info("Threads Running:"); Logger.info("Threads Running:");
StrongholdManager.generateMaze();
return true; return true;
} }