server macro data update scanning
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
This commit is contained in:
parent
f3b79bafcf
commit
7a8405230a
@ -1875,6 +1875,8 @@ Filter test scenes out of level selection
|
||||
Visualize interaction engine collidables
|
||||
AIs build structures based on their character's race
|
||||
Scaffolding jobs assigned by town to characters
|
||||
Fix character position not saving on creating a player's character for the first time
|
||||
Server utility to move entities scans to see if it needs to create macro data if moving a player's entity
|
||||
|
||||
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import electrosphere.entity.state.attach.AttachUtils;
|
||||
import electrosphere.entity.state.hitbox.HitboxCollectionState;
|
||||
import electrosphere.entity.state.inventory.ServerInventoryState;
|
||||
import electrosphere.entity.state.server.ServerCharacterData;
|
||||
import electrosphere.entity.state.server.ServerPlayerViewDirTree;
|
||||
import electrosphere.entity.types.collision.CollisionObjUtils;
|
||||
import electrosphere.logger.LoggerInterface;
|
||||
import electrosphere.net.parser.net.message.EntityMessage;
|
||||
@ -118,6 +119,11 @@ public class ServerEntityUtils {
|
||||
if(oldDataCell != null && oldDataCell.getScene().containsEntity(entity)){
|
||||
throw new Error("Entity not removed from scene!");
|
||||
}
|
||||
//if macro data hasn't been generated in this area, generate it
|
||||
//but only if it's a player's entity
|
||||
if(ServerPlayerViewDirTree.hasTree(entity)){
|
||||
realm.updateMacroData(position);
|
||||
}
|
||||
}
|
||||
if(AttachUtils.hasChildren(entity)){
|
||||
List<Entity> children = AttachUtils.getChildrenList(entity);
|
||||
|
||||
@ -45,7 +45,7 @@ public class SceneLoader {
|
||||
}
|
||||
|
||||
//instantiate scene data
|
||||
serverInstantiateSceneFile(file,macroData,serverWorldData,isLevelEditor);
|
||||
SceneLoader.serverInstantiateSceneFile(file,macroData,serverWorldData,isLevelEditor);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +59,7 @@ public class SceneLoader {
|
||||
String sanitizedPath = FileUtils.sanitizeFilePath("/Scenes/" + sceneName + "/scene.json");
|
||||
SceneFile file = FileUtils.loadObjectFromAssetPath(sanitizedPath, SceneFile.class);
|
||||
//instantiate scene data
|
||||
serverInstantiateSceneFile(file,null,serverWorldData,isLevelEditor);
|
||||
SceneLoader.serverInstantiateSceneFile(file,null,serverWorldData,isLevelEditor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -13,6 +13,7 @@ import electrosphere.server.datacell.interfaces.DataCellManager;
|
||||
import electrosphere.server.datacell.interfaces.PathfindingManager;
|
||||
import electrosphere.server.entity.ServerContentManager;
|
||||
import electrosphere.server.macro.MacroData;
|
||||
import electrosphere.server.macro.MacroDataUpdater;
|
||||
import electrosphere.server.simulation.MacroSimulation;
|
||||
|
||||
import java.util.HashSet;
|
||||
@ -363,5 +364,18 @@ public class Realm {
|
||||
public MacroData getMacroData(){
|
||||
return this.macroData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates macro data that needs to be generated near a given player's position
|
||||
* @param playerPosition The player's position
|
||||
*/
|
||||
public void updateMacroData(Vector3d playerPosition){
|
||||
if(playerPosition == null){
|
||||
throw new Error("Null position!");
|
||||
}
|
||||
if(macroData != null){
|
||||
MacroDataUpdater.update(macroData, playerPosition);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package electrosphere.server.macro;
|
||||
|
||||
import org.joml.Vector3d;
|
||||
|
||||
/**
|
||||
* Updates macro data as a player comes into range of it
|
||||
*/
|
||||
public class MacroDataUpdater {
|
||||
|
||||
/**
|
||||
* Updates the macro data
|
||||
* @param macroData The data
|
||||
* @param playerPos The player's position
|
||||
*/
|
||||
public static void update(MacroData macroData, Vector3d playerPos){
|
||||
//scan for all objects within update range
|
||||
//update them
|
||||
}
|
||||
|
||||
}
|
||||
@ -53,10 +53,16 @@ public class PlayerCharacterCreation {
|
||||
ServerWorldData.convertRealToChunkSpace(spawnPoint.z)
|
||||
));
|
||||
realm.getDataCellManager().addPlayerToRealm(playerObject);
|
||||
//save character's position in case the engine crashes for some reason (ie I hit the x button instead of save)
|
||||
Globals.serverState.characterService.saveCharacter(newPlayerEntity);
|
||||
|
||||
//must come after the player is assigned, otherwise the player will not get the item attachment messages
|
||||
CreatureUtils.serverApplyTemplate(realm, newPlayerEntity, template);
|
||||
|
||||
//if macro data hasn't been generated in this area, generate it
|
||||
//but only if it's a player's entity
|
||||
realm.updateMacroData(spawnPoint);
|
||||
|
||||
//
|
||||
//error checking
|
||||
Realm searchedRealm = Globals.serverState.realmManager.getEntityRealm(newPlayerEntity);
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package electrosphere.server.macro.town;
|
||||
|
||||
import electrosphere.server.macro.MacroData;
|
||||
|
||||
/**
|
||||
* Lays out town objects
|
||||
*/
|
||||
public class TownLayout {
|
||||
|
||||
/**
|
||||
* Lays out structures for a town
|
||||
* @param macroData The macro data
|
||||
* @param town The town
|
||||
*/
|
||||
public static void layoutTown(MacroData macroData, Town town){
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user