generated from tilera/1710mod
feat: add vibes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d5e9580367
commit
18365c9c85
|
@ -47,6 +47,17 @@ public class EventHandler {
|
|||
}
|
||||
}
|
||||
nodeNBT.setTag("flux", flux);
|
||||
NBTTagList stasis = new NBTTagList();
|
||||
if (node.stasis.size() > 0) {
|
||||
for (Aspect tag : node.stasis.getAspects()) {
|
||||
if (tag == null) continue;
|
||||
NBTTagCompound f = new NBTTagCompound();
|
||||
f.setString("id", tag.getTag());
|
||||
f.setInteger("amount", node.stasis.getAmount(tag));
|
||||
stasis.appendTag(f);
|
||||
}
|
||||
}
|
||||
nodeNBT.setTag("stasis", stasis);
|
||||
nodelist.appendTag(nodeNBT);
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +94,15 @@ public class EventHandler {
|
|||
if (!flux.hasKey("id") || !flux.hasKey("amount")) continue;
|
||||
node.flux.add(Aspect.getAspect(flux.getString("id")), flux.getInteger("amount"));
|
||||
}
|
||||
node.stasis = new AspectList();
|
||||
if (nodeData.hasKey("stasis")) {
|
||||
NBTTagList stasisTags = nodeData.getTagList("stasis", 10);
|
||||
for (int j = 0; j < stasisTags.tagCount(); ++j) {
|
||||
NBTTagCompound stasis = stasisTags.getCompoundTagAt(j);
|
||||
if (!stasis.hasKey("id") || !stasis.hasKey("amount")) continue;
|
||||
node.stasis.add(Aspect.getAspect(stasis.getString("id")), stasis.getInteger("amount"));
|
||||
}
|
||||
}
|
||||
AuraManager.auraNodes.put(node.key, node);
|
||||
AuraManager.addToAuraUpdateList(node);
|
||||
AuraManager.generateNodeNeighbours(node);
|
||||
|
|
|
@ -10,6 +10,7 @@ public class AuraNode implements Serializable {
|
|||
public short baseLevel;
|
||||
public short taint;
|
||||
public AspectList flux = new AspectList();
|
||||
public AspectList stasis = new AspectList();
|
||||
public EnumNodeType type;
|
||||
public int dimension;
|
||||
public double xPos;
|
||||
|
|
|
@ -826,12 +826,17 @@ public class AuraManager {
|
|||
}
|
||||
|
||||
public static void queueNodeChanges(int key, int levelMod, int baseMod, boolean toggleLock, AspectList flx, float x, float y, float z) {
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, 0, toggleLock, flx, x, y, z);
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, 0, toggleLock, flx, null, x, y, z);
|
||||
auraUpdateQueue.add(nc);
|
||||
}
|
||||
|
||||
public static void queueNodeChanges(int key, int levelMod, int baseMod, int taint, boolean toggleLock, AspectList flx, float x, float y, float z) {
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, x, y, z);
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, null, x, y, z);
|
||||
auraUpdateQueue.add(nc);
|
||||
}
|
||||
|
||||
public static void queueNodeChanges(int key, int levelMod, int baseMod, int taint, boolean toggleLock, AspectList flx, AspectList stasis, float x, float y, float z) {
|
||||
NodeChanges nc = new NodeChanges(key, levelMod, baseMod, taint, toggleLock, flx, stasis, x, y, z);
|
||||
auraUpdateQueue.add(nc);
|
||||
}
|
||||
|
||||
|
@ -843,6 +848,31 @@ public class AuraManager {
|
|||
queueNodeChanges(key, 0, 0, taint, false, null, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void addGoodVibes(World world, int x, int y, int z, int amount) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return;
|
||||
queueNodeChanges(key, 0, 0, 0, false, null, new AspectList().add(Aspect.MAGIC, amount), 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void addBadVibes(World world, int x, int y, int z, int amount) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return;
|
||||
queueNodeChanges(key, 0, 0, 0, false, new AspectList().add(Aspect.TAINT, amount), null, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void addBoost(World world, int x, int y, int z, int amount) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return;
|
||||
queueNodeChanges(key, 0, 0, 0, false, null, new AspectList().add(Aspects.TIME, amount), 0, 0, 0);
|
||||
}
|
||||
|
||||
public static int getBoost(World world, int x, int y, int z) {
|
||||
int key = getClosestAuraWithinRange(world, x, y, z, 64);
|
||||
if (key < 0) return 0;
|
||||
AuraNode node = getNode(key);
|
||||
return node.stasis.getAmount(Aspects.TIME);
|
||||
}
|
||||
|
||||
public static AuraNode copyNode(AuraNode in) {
|
||||
try {
|
||||
AuraNode out = new AuraNode();
|
||||
|
@ -856,6 +886,11 @@ public class AuraManager {
|
|||
outflux.add(tag, in.flux.getAmount(tag));
|
||||
}
|
||||
out.flux = outflux;
|
||||
AspectList outstasis = new AspectList();
|
||||
for (Aspect tag : in.stasis.getAspects()) {
|
||||
outstasis.add(tag, in.stasis.getAmount(tag));
|
||||
}
|
||||
out.stasis = outstasis;
|
||||
out.dimension = in.dimension;
|
||||
out.xPos = in.xPos;
|
||||
out.yPos = in.yPos;
|
||||
|
@ -876,6 +911,7 @@ public class AuraManager {
|
|||
out.taint = in.taint;
|
||||
out.type = in.type;
|
||||
out.flux = in.flux;
|
||||
out.stasis = in.stasis;
|
||||
out.dimension = in.dimension;
|
||||
out.xPos = in.xPos;
|
||||
out.yPos = in.yPos;
|
||||
|
@ -891,17 +927,19 @@ public class AuraManager {
|
|||
int taintMod = 0;
|
||||
boolean lock = false;
|
||||
AspectList flux = null;
|
||||
AspectList stasis = null;
|
||||
float motionX;
|
||||
float motionY;
|
||||
float motionZ;
|
||||
|
||||
NodeChanges(int k, int l, int b, int t, boolean lo, AspectList ot, float x, float y, float z) {
|
||||
NodeChanges(int k, int l, int b, int t, boolean lo, AspectList flux, AspectList stasis, float x, float y, float z) {
|
||||
this.key = k;
|
||||
this.levelMod = l;
|
||||
this.baseMod = b;
|
||||
this.taintMod = t;
|
||||
this.lock = lo;
|
||||
this.flux = ot;
|
||||
this.flux = flux;
|
||||
this.stasis = stasis;
|
||||
this.motionX = x;
|
||||
this.motionY = y;
|
||||
this.motionZ = z;
|
||||
|
|
|
@ -74,6 +74,38 @@ public class AuraUpdateThread
|
|||
}
|
||||
}
|
||||
}
|
||||
if (nc.stasis != null) {
|
||||
for (Aspect tag : nc.stasis.getAspects()) {
|
||||
if (nc.stasis.getAmount(tag) > 0) {
|
||||
node.stasis.add(tag, nc.stasis.getAmount(tag));
|
||||
continue;
|
||||
}
|
||||
node.stasis.reduce(tag, -nc.stasis.getAmount(tag)); // TODO:WTF
|
||||
}
|
||||
}
|
||||
if (node.stasis.size() > 0) {
|
||||
ArrayList<Aspect> dt = new ArrayList<>();
|
||||
ArrayList<Aspect> red = new ArrayList<>();
|
||||
for (Aspect tag : node.stasis.getAspects()) {
|
||||
if (node.stasis.getAmount(tag) <= 0) {
|
||||
dt.add(tag);
|
||||
continue;
|
||||
}
|
||||
if (node.stasis.getAmount(tag) <= 100)
|
||||
continue;
|
||||
red.add(tag);
|
||||
}
|
||||
if (red.size() > 0) {
|
||||
for (Aspect tag : red) {
|
||||
node.stasis.reduce(tag, node.stasis.getAmount(tag) - 100);
|
||||
}
|
||||
}
|
||||
if (dt.size() > 0) {
|
||||
for (Aspect tag : dt) {
|
||||
node.stasis.remove(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nc.motionX != 0.0f || nc.motionY != 0.0f || nc.motionZ != 0.0f) {
|
||||
int cx = MathHelper.floor_double((double) node.xPos) / 16;
|
||||
cz = MathHelper.floor_double((double) node.zPos) / 16;
|
||||
|
|
Loading…
Reference in New Issue