Attempt to synchronized logic random seed

This commit is contained in:
Anuken
2021-09-22 20:12:45 -04:00
parent 3f6d5b9dfe
commit 90d1770b3e
6 changed files with 21 additions and 5 deletions
@@ -2,6 +2,7 @@ package mindustry.logic;
import arc.*;
import arc.files.*;
import arc.math.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
@@ -18,6 +19,8 @@ import java.io.*;
public class GlobalConstants{
public static final int ctrlProcessor = 1, ctrlPlayer = 2, ctrlFormation = 3;
public static final ContentType[] lookableContent = {ContentType.block, ContentType.unit, ContentType.item, ContentType.liquid};
/** Global random state. */
public static final Rand rand = new Rand();
private ObjectIntMap<String> namesToIds = new ObjectIntMap<>();
private Seq<Var> vars = new Seq<>(Var.class);
+2 -2
View File
@@ -34,13 +34,13 @@ public enum LogicOp{
angle("angle", true, (x, y) -> Angles.angle((float)x, (float)y)),
len("len", true, (x, y) -> Mathf.dst((float)x, (float)y)),
noise("noise", true, (x, y) -> Simplex.raw2d(0, x, y)),
abs("abs", a -> Math.abs(a)),
abs("abs", a -> Math.abs(a)), //not a method reference because it fails to compile for some reason
log("log", Math::log),
log10("log10", Math::log10),
floor("floor", Math::floor),
ceil("ceil", Math::ceil),
sqrt("sqrt", Math::sqrt),
rand("rand", d -> Mathf.rand.nextDouble() * d),
rand("rand", d -> GlobalConstants.rand.nextDouble() * d),
sin("sin", d -> Math.sin(d * Mathf.doubleDegRad)),
cos("cos", d -> Math.cos(d * Mathf.doubleDegRad)),