code cleanup
This commit is contained in:
parent
e706c69c75
commit
f5ff55898d
@ -1686,6 +1686,7 @@ Styling support for html-defined menus
|
|||||||
Dynamic html-defined menus support button elements that call a client hook when clicked
|
Dynamic html-defined menus support button elements that call a client hook when clicked
|
||||||
Dynamic menu navigation between windows
|
Dynamic menu navigation between windows
|
||||||
Starting formatting npc intro page
|
Starting formatting npc intro page
|
||||||
|
Code cleanup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -91,6 +91,9 @@ public class HtmlParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case "script": {
|
||||||
|
LoggerInterface.loggerUI.WARNING("Script tag not implemented yet");
|
||||||
|
} break;
|
||||||
case "style":
|
case "style":
|
||||||
//silently ignore
|
//silently ignore
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package electrosphere.engine.assetmanager.queue;
|
|||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
|
|
||||||
@ -72,6 +73,11 @@ public class QueuedTexture implements QueuedAsset<Texture> {
|
|||||||
*/
|
*/
|
||||||
boolean suppliedPath = false;
|
boolean suppliedPath = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The runnable to invoke to actually load the model
|
||||||
|
*/
|
||||||
|
Consumer<Texture> loadFunc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the queued texture object
|
* Creates the queued texture object
|
||||||
* @param buffer The data to buffer
|
* @param buffer The data to buffer
|
||||||
@ -147,6 +153,16 @@ public class QueuedTexture implements QueuedAsset<Texture> {
|
|||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the queued texture object
|
||||||
|
* @param image the image to load to gpu
|
||||||
|
*/
|
||||||
|
public static QueuedTexture createFromImage(BufferedImage bufferedImage, Consumer<Texture> loadFunc){
|
||||||
|
QueuedTexture rVal = QueuedTexture.createFromImage(bufferedImage);
|
||||||
|
rVal.loadFunc = loadFunc;
|
||||||
|
return rVal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the queued texture object
|
* Creates the queued texture object
|
||||||
* @param path The path to register this texture to
|
* @param path The path to register this texture to
|
||||||
@ -170,6 +186,9 @@ public class QueuedTexture implements QueuedAsset<Texture> {
|
|||||||
texture = new Texture(Globals.renderingEngine.getOpenGLState(), data, buffer);
|
texture = new Texture(Globals.renderingEngine.getOpenGLState(), data, buffer);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
if(this.loadFunc != null){
|
||||||
|
this.loadFunc.accept(texture);
|
||||||
|
}
|
||||||
hasLoaded = true;
|
hasLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -764,6 +764,7 @@ public class AttachUtils {
|
|||||||
* @param parentEntity
|
* @param parentEntity
|
||||||
* @return The list of entities that are attached to this parent entity, or null if undefined
|
* @return The list of entities that are attached to this parent entity, or null if undefined
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static List<Entity> getChildrenList(Entity parentEntity){
|
public static List<Entity> getChildrenList(Entity parentEntity){
|
||||||
return (List<Entity>)parentEntity.getData(EntityDataStrings.ATTACH_CHILDREN_LIST);
|
return (List<Entity>)parentEntity.getData(EntityDataStrings.ATTACH_CHILDREN_LIST);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -538,6 +538,7 @@ public class ClientAttackTree implements BehaviorTree {
|
|||||||
* @param attackType the attack type
|
* @param attackType the attack type
|
||||||
* @return The moveset if it exists
|
* @return The moveset if it exists
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public List<AttackMove> getMoveset(String attackType){
|
public List<AttackMove> getMoveset(String attackType){
|
||||||
return (List<AttackMove>)parent.getData(attackType);
|
return (List<AttackMove>)parent.getData(attackType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -634,6 +634,7 @@ public class ServerAttackTree implements BehaviorTree {
|
|||||||
* @param attackType the attack type
|
* @param attackType the attack type
|
||||||
* @return The moveset if it exists
|
* @return The moveset if it exists
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public List<AttackMove> getMoveset(String attackType){
|
public List<AttackMove> getMoveset(String attackType){
|
||||||
return (List<AttackMove>)parent.getData(attackType);
|
return (List<AttackMove>)parent.getData(attackType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
* @param equipPoints the list of available points
|
* @param equipPoints the list of available points
|
||||||
*/
|
*/
|
||||||
private ClientEquipState(Entity parent, Object ... params){
|
private ClientEquipState(Entity parent, Object ... params){
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
List<EquipPoint> equipPoints = (List<EquipPoint>)params[0];
|
List<EquipPoint> equipPoints = (List<EquipPoint>)params[0];
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
for(EquipPoint point : equipPoints){
|
for(EquipPoint point : equipPoints){
|
||||||
|
|||||||
@ -60,6 +60,7 @@ public class ServerEquipState implements BehaviorTree {
|
|||||||
Map<String,Entity> equipMap = new HashMap<String,Entity>();
|
Map<String,Entity> equipMap = new HashMap<String,Entity>();
|
||||||
|
|
||||||
public ServerEquipState(Entity parent, Object ... params){
|
public ServerEquipState(Entity parent, Object ... params){
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
List<EquipPoint> equipPoints = (List<EquipPoint>)params[0];
|
List<EquipPoint> equipPoints = (List<EquipPoint>)params[0];
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
for(EquipPoint point : equipPoints){
|
for(EquipPoint point : equipPoints){
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package electrosphere.entity.state.rotator;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joml.Quaterniond;
|
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
@ -58,16 +57,16 @@ public class RotatorTree implements BehaviorTree{
|
|||||||
|
|
||||||
public void applyRotatorNode(RotatorHierarchyNode node){
|
public void applyRotatorNode(RotatorHierarchyNode node){
|
||||||
//apply
|
//apply
|
||||||
String nodeBoneName = node.getBone();
|
// String nodeBoneName = node.getBone();
|
||||||
Quaterniond currentRotation = entityActor.getBoneRotation(nodeBoneName);
|
// Quaterniond currentRotation = entityActor.getBoneRotation(nodeBoneName);
|
||||||
for(RotatorConstraint constraint : node.getRotatorContraints()){
|
for(RotatorConstraint constraint : node.getRotatorContraints()){
|
||||||
float allowedMarginPitch = constraint.getAllowedMarginPitch();
|
// float allowedMarginPitch = constraint.getAllowedMarginPitch();
|
||||||
float allowedMarginYaw = constraint.getAllowedMarginYaw();
|
// float allowedMarginYaw = constraint.getAllowedMarginYaw();
|
||||||
boolean followsBone = constraint.getFollowsBone();
|
boolean followsBone = constraint.getFollowsBone();
|
||||||
boolean followsView = constraint.getFollowsView();
|
boolean followsView = constraint.getFollowsView();
|
||||||
if(followsBone){
|
if(followsBone){
|
||||||
String parentBone = constraint.getParentBone();
|
// String parentBone = constraint.getParentBone();
|
||||||
Quaterniond parentBoneRotation = entityActor.getBoneRotation(parentBone);
|
// Quaterniond parentBoneRotation = entityActor.getBoneRotation(parentBone);
|
||||||
// currentRotation.
|
// currentRotation.
|
||||||
}
|
}
|
||||||
if(followsView){
|
if(followsView){
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package electrosphere.entity.state.rotator;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joml.Quaterniond;
|
|
||||||
import org.joml.Quaternionf;
|
import org.joml.Quaternionf;
|
||||||
import org.joml.Vector3f;
|
import org.joml.Vector3f;
|
||||||
|
|
||||||
@ -58,16 +57,16 @@ public class ServerRotatorTree implements BehaviorTree{
|
|||||||
|
|
||||||
public void applyRotatorNode(RotatorHierarchyNode node){
|
public void applyRotatorNode(RotatorHierarchyNode node){
|
||||||
//apply
|
//apply
|
||||||
String nodeBoneName = node.getBone();
|
// String nodeBoneName = node.getBone();
|
||||||
Quaterniond currentRotation = entityPoseActor.getBoneRotation(nodeBoneName);
|
// Quaterniond currentRotation = entityPoseActor.getBoneRotation(nodeBoneName);
|
||||||
for(RotatorConstraint constraint : node.getRotatorContraints()){
|
for(RotatorConstraint constraint : node.getRotatorContraints()){
|
||||||
float allowedMarginPitch = constraint.getAllowedMarginPitch();
|
// float allowedMarginPitch = constraint.getAllowedMarginPitch();
|
||||||
float allowedMarginYaw = constraint.getAllowedMarginYaw();
|
// float allowedMarginYaw = constraint.getAllowedMarginYaw();
|
||||||
boolean followsBone = constraint.getFollowsBone();
|
boolean followsBone = constraint.getFollowsBone();
|
||||||
boolean followsView = constraint.getFollowsView();
|
boolean followsView = constraint.getFollowsView();
|
||||||
if(followsBone){
|
if(followsBone){
|
||||||
String parentBone = constraint.getParentBone();
|
// String parentBone = constraint.getParentBone();
|
||||||
Quaterniond parentBoneRotation = entityPoseActor.getBoneRotation(parentBone);
|
// Quaterniond parentBoneRotation = entityPoseActor.getBoneRotation(parentBone);
|
||||||
// currentRotation.
|
// currentRotation.
|
||||||
}
|
}
|
||||||
if(followsView){
|
if(followsView){
|
||||||
|
|||||||
@ -451,6 +451,7 @@ public class ItemUtils {
|
|||||||
return item.containsKey(EntityDataStrings.ITEM_EQUIP_WHITELIST);
|
return item.containsKey(EntityDataStrings.ITEM_EQUIP_WHITELIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static List<EquipWhitelist> getEquipWhitelist(Entity item){
|
public static List<EquipWhitelist> getEquipWhitelist(Entity item){
|
||||||
return (List<EquipWhitelist>)item.getData(EntityDataStrings.ITEM_EQUIP_WHITELIST);
|
return (List<EquipWhitelist>)item.getData(EntityDataStrings.ITEM_EQUIP_WHITELIST);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ public class LoreProtocol implements ClientProtocolTemplate<LoreMessage> {
|
|||||||
switch(message.getMessageSubtype()){
|
switch(message.getMessageSubtype()){
|
||||||
case RESPONSERACES:
|
case RESPONSERACES:
|
||||||
//we get back the race list as a json array, deserialize, and push into type loader
|
//we get back the race list as a json array, deserialize, and push into type loader
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
List<String> playableRaces = new Gson().fromJson(message.getdata(), List.class);
|
List<String> playableRaces = new Gson().fromJson(message.getdata(), List.class);
|
||||||
Globals.gameConfigCurrent.getCreatureTypeLoader().loadPlayableRaces(playableRaces);
|
Globals.gameConfigCurrent.getCreatureTypeLoader().loadPlayableRaces(playableRaces);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -77,99 +77,6 @@ public class Texture {
|
|||||||
Globals.renderingEngine.checkError();
|
Globals.renderingEngine.checkError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
/**
|
|
||||||
* Creates an in engine texture object from a java bufferedimage object
|
|
||||||
* @param bufferedImage The java bufferedimage object
|
|
||||||
*/
|
|
||||||
public Texture(OpenGLState openGlState, BufferedImage bufferedImage){
|
|
||||||
this.texturePointer = GL40.glGenTextures();
|
|
||||||
Globals.renderingEngine.checkError();
|
|
||||||
//bind the new texture
|
|
||||||
openGlState.glBindTexture(GL_TEXTURE_2D, texturePointer);
|
|
||||||
//how are we gonna wrap the texture??
|
|
||||||
this.setWrap(openGlState, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
|
|
||||||
this.setWrap(openGlState, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
|
|
||||||
//set the border color to black
|
|
||||||
this.setBorderColor(openGlState, new float[]{ 0.0f, 0.0f, 0.0f, 1.0f });
|
|
||||||
//set magnification and minification operation sampling strategies
|
|
||||||
this.setMinFilter(openGlState, GL_LINEAR);
|
|
||||||
this.setMagFilter(openGlState, GL_LINEAR);
|
|
||||||
//load the image here
|
|
||||||
ByteBuffer data;
|
|
||||||
width = 1;
|
|
||||||
height = 1;
|
|
||||||
BufferedImage image_data = bufferedImage;
|
|
||||||
if (
|
|
||||||
image_data.getType() == BufferedImage.TYPE_3BYTE_BGR ||
|
|
||||||
image_data.getType() == BufferedImage.TYPE_INT_RGB
|
|
||||||
){
|
|
||||||
hasTransparency = false;
|
|
||||||
} else if(
|
|
||||||
image_data.getType() == BufferedImage.TYPE_4BYTE_ABGR ||
|
|
||||||
image_data.getType() == BufferedImage.TYPE_INT_ARGB
|
|
||||||
){
|
|
||||||
hasTransparency = true;
|
|
||||||
}
|
|
||||||
width = image_data.getWidth();
|
|
||||||
height = image_data.getHeight();
|
|
||||||
if(hasTransparency){
|
|
||||||
data = BufferUtils.createByteBuffer(width * height * 4);
|
|
||||||
} else {
|
|
||||||
data = BufferUtils.createByteBuffer(width * height * 3);
|
|
||||||
}
|
|
||||||
for(int y = height - 1; y > -1; y--){
|
|
||||||
for(int x = 0; x < width; x++){
|
|
||||||
int color = image_data.getRGB(x, y);
|
|
||||||
|
|
||||||
// data.put((byte)temp.getRed());
|
|
||||||
// data.put((byte)temp.getGreen());
|
|
||||||
// data.put((byte)temp.getBlue());
|
|
||||||
if(hasTransparency){
|
|
||||||
int blue = color & 0xff;
|
|
||||||
int green = (color & 0xff00) >> 8;
|
|
||||||
int red = (color & 0xff0000) >> 16;
|
|
||||||
int alpha = (color & 0xff000000) >>> 24;
|
|
||||||
data.put((byte)red);
|
|
||||||
data.put((byte)green);
|
|
||||||
data.put((byte)blue);
|
|
||||||
data.put((byte)alpha);
|
|
||||||
} else {
|
|
||||||
int blue = color & 0xff;
|
|
||||||
int green = (color & 0xff00) >> 8;
|
|
||||||
int red = (color & 0xff0000) >> 16;
|
|
||||||
data.put((byte)red);
|
|
||||||
data.put((byte)green);
|
|
||||||
data.put((byte)blue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(data.position() > 0){
|
|
||||||
data.flip();
|
|
||||||
}
|
|
||||||
//call if width != height so opengl figures out how to unpack it properly
|
|
||||||
if(width != height){
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
|
||||||
}
|
|
||||||
//buffer the texture information
|
|
||||||
if(hasTransparency){
|
|
||||||
this.pixelFormat = GL_RGBA;
|
|
||||||
this.datatype = GL_UNSIGNED_BYTE;
|
|
||||||
this.glTexImage2D(openGlState, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
|
||||||
} else {
|
|
||||||
this.pixelFormat = GL_RGB;
|
|
||||||
this.datatype = GL_UNSIGNED_BYTE;
|
|
||||||
this.glTexImage2D(openGlState, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
|
|
||||||
}
|
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
|
||||||
//check build status
|
|
||||||
String errorMessage = RenderingEngine.getErrorInEnglish(Globals.renderingEngine.getError());
|
|
||||||
if(errorMessage != null){
|
|
||||||
LoggerInterface.loggerRenderer.ERROR(new IllegalStateException("Texture Constructor[from bufferedimage]: " + errorMessage));
|
|
||||||
}
|
|
||||||
openGlState.glBindTexture(GL_TEXTURE_2D, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an in engine texture object from a java bufferedimage object
|
* Creates an in engine texture object from a java bufferedimage object
|
||||||
* @param bufferedImage The java bufferedimage object
|
* @param bufferedImage The java bufferedimage object
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
package electrosphere.renderer.ui.font;
|
package electrosphere.renderer.ui.font;
|
||||||
|
|
||||||
|
import electrosphere.engine.Globals;
|
||||||
|
import electrosphere.engine.assetmanager.queue.QueuedTexture;
|
||||||
import electrosphere.logger.LoggerInterface;
|
import electrosphere.logger.LoggerInterface;
|
||||||
import electrosphere.renderer.OpenGLState;
|
import electrosphere.renderer.OpenGLState;
|
||||||
import electrosphere.renderer.model.Material;
|
import electrosphere.renderer.model.Material;
|
||||||
@ -184,8 +186,9 @@ public class FontUtils {
|
|||||||
|
|
||||||
//create material with new font image
|
//create material with new font image
|
||||||
Material uiMat = new Material();
|
Material uiMat = new Material();
|
||||||
Texture texture = new Texture(openGLState, image);
|
Globals.assetManager.queuedAsset(QueuedTexture.createFromImage(image, (Texture tex) -> {
|
||||||
uiMat.setTexturePointer(texture.getTexturePointer());
|
uiMat.setTexturePointer(tex.getTexturePointer());
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
//construct final font object and return
|
//construct final font object and return
|
||||||
|
|||||||
@ -23,24 +23,44 @@ import electrosphere.util.FileUtils;
|
|||||||
*/
|
*/
|
||||||
public class ScriptContext {
|
public class ScriptContext {
|
||||||
|
|
||||||
//the default namespaces for
|
/**
|
||||||
public static String SCRIPT_NAMESPACE_ENGINE = "engine"; //namespace for the engine functions exposed to the script engine
|
* namespace for the engine functions exposed to the script engine
|
||||||
public static String SCRIPT_NAMESPACE_SCRIPT = "script"; //namespace for the core typescript functionsw
|
*/
|
||||||
public static String SCRIPT_NAMESPACE_SCENE = "scene"; //namespace for the current scene
|
public static final String SCRIPT_NAMESPACE_ENGINE = "engine";
|
||||||
|
|
||||||
//the graal context
|
/**
|
||||||
|
* namespace for the core typescript functions
|
||||||
|
*/
|
||||||
|
public static final String SCRIPT_NAMESPACE_SCRIPT = "script";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* namespace for the current scene
|
||||||
|
*/
|
||||||
|
public static final String SCRIPT_NAMESPACE_SCENE = "scene";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the graal context
|
||||||
|
*/
|
||||||
Context context;
|
Context context;
|
||||||
|
|
||||||
//used to build source objects
|
/**
|
||||||
|
* used to build source objects
|
||||||
|
*/
|
||||||
Builder builder;
|
Builder builder;
|
||||||
|
|
||||||
//the javascript object that stores values
|
/**
|
||||||
|
* the javascript object that stores values
|
||||||
|
*/
|
||||||
Value topLevelValue;
|
Value topLevelValue;
|
||||||
|
|
||||||
//the object that contains all host values accessible to javascript land
|
/**
|
||||||
|
* the object that contains all host values accessible to javascript land
|
||||||
|
*/
|
||||||
Value hostObject;
|
Value hostObject;
|
||||||
|
|
||||||
//the engine object
|
/**
|
||||||
|
* the engine object
|
||||||
|
*/
|
||||||
Value engineObject;
|
Value engineObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,7 +168,7 @@ public class ScriptContext {
|
|||||||
* Loads a script from disk
|
* Loads a script from disk
|
||||||
* @param path The path to the script file
|
* @param path The path to the script file
|
||||||
*/
|
*/
|
||||||
void loadDependency(String path){
|
private void loadDependency(String path){
|
||||||
String content;
|
String content;
|
||||||
Source source = null;
|
Source source = null;
|
||||||
try {
|
try {
|
||||||
@ -357,7 +377,7 @@ public class ScriptContext {
|
|||||||
* @param filePath The filepath of the module
|
* @param filePath The filepath of the module
|
||||||
*/
|
*/
|
||||||
public void requireModule(String filePath){
|
public void requireModule(String filePath){
|
||||||
invokeFunction("require", filePath);
|
this.invokeFunction("require", filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -53,7 +53,9 @@ public class ScriptEngine extends SignalServiceImpl {
|
|||||||
*/
|
*/
|
||||||
public static final int GLOBAL_SCENE = -1;
|
public static final int GLOBAL_SCENE = -1;
|
||||||
|
|
||||||
//the map of script filepaths to parsed, in-memory scripts
|
/**
|
||||||
|
* the map of script filepaths to parsed, in-memory scripts
|
||||||
|
*/
|
||||||
Map<String,Source> sourceMap;
|
Map<String,Source> sourceMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +83,9 @@ public class ScriptEngine extends SignalServiceImpl {
|
|||||||
*/
|
*/
|
||||||
boolean initialized = false;
|
boolean initialized = false;
|
||||||
|
|
||||||
//The files that are loaded on init to bootstrap the script engine
|
/**
|
||||||
|
* The files that are loaded on init to bootstrap the script engine
|
||||||
|
*/
|
||||||
public static final String[] filesToLoadOnInit = new String[]{
|
public static final String[] filesToLoadOnInit = new String[]{
|
||||||
//polyfills
|
//polyfills
|
||||||
"Scripts/compiler/require_polyfill.js",
|
"Scripts/compiler/require_polyfill.js",
|
||||||
@ -102,8 +106,10 @@ public class ScriptEngine extends SignalServiceImpl {
|
|||||||
"/Scripts/compiler/host_access.ts",
|
"/Scripts/compiler/host_access.ts",
|
||||||
};
|
};
|
||||||
|
|
||||||
//The classes that will be provided to the scripting engine
|
/**
|
||||||
//https://stackoverflow.com/a/65942034
|
* The classes that will be provided to the scripting engine
|
||||||
|
* https://stackoverflow.com/a/65942034
|
||||||
|
*/
|
||||||
public static final Object[][] staticClasses = new Object[][]{
|
public static final Object[][] staticClasses = new Object[][]{
|
||||||
{"mathUtils",SpatialMathUtils.class},
|
{"mathUtils",SpatialMathUtils.class},
|
||||||
{"simulation",Main.class},
|
{"simulation",Main.class},
|
||||||
@ -116,7 +122,9 @@ public class ScriptEngine extends SignalServiceImpl {
|
|||||||
{"areaUtils",ScriptClientAreaUtils.class},
|
{"areaUtils",ScriptClientAreaUtils.class},
|
||||||
};
|
};
|
||||||
|
|
||||||
//singletons from the host that are provided to the javascript context
|
/**
|
||||||
|
* singletons from the host that are provided to the javascript context
|
||||||
|
*/
|
||||||
public static final Object[][] hostSingletops = new Object[][]{
|
public static final Object[][] hostSingletops = new Object[][]{
|
||||||
{"timekeeper",Globals.timekeeper},
|
{"timekeeper",Globals.timekeeper},
|
||||||
{"currentPlayer",Globals.clientPlayer},
|
{"currentPlayer",Globals.clientPlayer},
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class FluidDiskMap {
|
|||||||
public void init(String saveName){
|
public void init(String saveName){
|
||||||
LoggerInterface.loggerEngine.DEBUG("INIT CHUNK MAP " + saveName);
|
LoggerInterface.loggerEngine.DEBUG("INIT CHUNK MAP " + saveName);
|
||||||
if(FileUtils.getSaveFile(saveName, "chunk.map").exists()){
|
if(FileUtils.getSaveFile(saveName, "chunk.map").exists()){
|
||||||
worldPosFileMap = FileUtils.loadObjectFromSavePath(saveName, "fluid.map", Map.class);
|
worldPosFileMap = FileUtils.loadObjectFromSavePath(saveName, "fluid.map", FluidDiskMap.class).worldPosFileMap;
|
||||||
LoggerInterface.loggerEngine.DEBUG("POS FILE MAP: " + worldPosFileMap.keySet());
|
LoggerInterface.loggerEngine.DEBUG("POS FILE MAP: " + worldPosFileMap.keySet());
|
||||||
} else {
|
} else {
|
||||||
worldPosFileMap = new HashMap<String,String>();
|
worldPosFileMap = new HashMap<String,String>();
|
||||||
@ -59,7 +59,7 @@ public class FluidDiskMap {
|
|||||||
* Saves the disk map to disk
|
* Saves the disk map to disk
|
||||||
*/
|
*/
|
||||||
public void save(){
|
public void save(){
|
||||||
FileUtils.serializeObjectToSavePath(Globals.currentSave.getName(), "fluid.map", worldPosFileMap);
|
FileUtils.serializeObjectToSavePath(Globals.currentSave.getName(), "fluid.map", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user