Skip to content

Commit cca6857

Browse files
committed
Version for Mindustry 8
Release 0.3.0
1 parent d6eea07 commit cca6857

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ allprojects{
3434

3535
dependencies{
3636
compileOnly "com.github.Anuken.Arc:arc-core:$mindustryVersion"
37-
compileOnly "com.github.Anuken.Mindustry:core:$mindustryVersion"
38-
// compileOnly 'com.github.Anuken:MindustryJitpack:1470d3d32f'
37+
// Manually put latest commit ID here from https://github.com/Anuken/MindustryJitpack/commits/main/
38+
compileOnly 'com.github.Anuken:MindustryJitpack:47cf3c4'
3939

4040
annotationProcessor "com.github.Anuken:jabel:$jabelVersion"
4141
}

mod.hjson

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#the mod name as displayed in-game
2-
displayName: "Mlog Assertions"
2+
displayName: "Mlog Assertions (v8)"
33

44
#the internal name of your mod
5-
name: "mlog-assertions"
5+
name: "mlog-assertions-8"
66

77
subtitle: "Easier debugging for mlog",
88

@@ -16,10 +16,10 @@ main: "cardillan.mlogassertions.Main"
1616
description: "Provides custom mlog instructions for enhanced runtime checks in Mindustry Logic."
1717

1818
#the mod version
19-
version: 0.2.0
19+
version: 0.3.0
2020

2121
#the minimum game build required to run this mod
22-
minGameVersion: 146
22+
minGameVersion: 147
2323

2424
#this is a java mod
2525
java: true

src/cardillan/mlogassertions/Assertions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static void init() {
5555
}
5656

5757
private static void draw(LogicBuild block) {
58-
if (block.tile().build != block) {
58+
if (block.tile.build != block) {
5959
removeX = (int) block.getX();
6060
removeY = (int) block.getY();
6161
return;

src/cardillan/mlogassertions/logic/AssertionType.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ public enum AssertionType {
1111
;
1212

1313
public static final AssertionType[] all = values();
14-
public final TypeAssertionObjLambda objFunction;
15-
public final TypeAssertionLambda function;
14+
public final AssertionTypeObjLambda objFunction;
15+
public final AssertionTypeLambda function;
1616

17-
AssertionType(TypeAssertionLambda function) {
17+
AssertionType(AssertionTypeLambda function) {
1818
this(function, obj -> false);
1919
}
2020

21-
AssertionType(TypeAssertionLambda function, TypeAssertionObjLambda objFunction) {
21+
AssertionType(AssertionTypeLambda function, AssertionTypeObjLambda objFunction) {
2222
this.function = function;
2323
this.objFunction = objFunction;
2424
}
@@ -28,11 +28,11 @@ public String toString() {
2828
return super.toString();
2929
}
3030

31-
public interface TypeAssertionObjLambda {
31+
public interface AssertionTypeObjLambda {
3232
boolean get(Object obj);
3333
}
3434

35-
public interface TypeAssertionLambda {
35+
public interface AssertionTypeLambda {
3636
boolean get(double val);
3737
}
3838
}

src/cardillan/mlogassertions/logic/LogicInstructions.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
import cardillan.mlogassertions.Assertions;
44
import mindustry.gen.Building;
55
import mindustry.logic.LExecutor;
6-
import mindustry.logic.LExecutor.Var;
6+
import mindustry.logic.LVar;
77
import mindustry.world.blocks.logic.LogicBlock;
88

99
public class LogicInstructions {
1010

1111
public static class AssertI implements LExecutor.LInstruction {
1212
public AssertionType type = AssertionType.any;
13-
public int multiple = 1;
14-
public int min;
13+
public LVar multiple;
14+
public LVar min;
1515
public AssertOp opMin = AssertOp.lessThanEq;
16-
public int value;
16+
public LVar value;
1717
public AssertOp opMax = AssertOp.lessThanEq;
18-
public int max;
19-
public int message;
18+
public LVar max;
19+
public LVar message;
2020

21-
public AssertI(AssertionType type, int multiple, int min, AssertOp opMin, int value, AssertOp opMax, int max, int message) {
21+
public AssertI(AssertionType type, LVar multiple, LVar min, AssertOp opMin, LVar value, AssertOp opMax, LVar max, LVar message) {
2222
this.type = type;
2323
this.multiple = multiple;
2424
this.min = min;
@@ -34,16 +34,16 @@ public AssertI() {
3434

3535
@Override
3636
public final void run(LExecutor exec) {
37-
Building building = exec.building( LExecutor.varThis);
37+
Building building = exec.thisv.building();
3838

39-
Var vaVal = var(exec, value);
39+
LVar vaVal = var(exec, value);
4040
if ((vaVal.isobj ? type.objFunction.get(vaVal.objval) : type.function.get(vaVal.numval))
4141
&& (type != AssertionType.multiple || (vaVal.numval % var(exec, multiple).numval == 0))
4242
&& (opMin.function.get(num(exec,min), num(exec,value)))
4343
&& (opMax.function.get(num(exec,value), num(exec,max)))) {
4444
Assertions.remove((LogicBlock.LogicBuild) building);
4545
} else {
46-
Var message = var(exec, this.message);
46+
LVar message = var(exec, this.message);
4747
Assertions.add((LogicBlock.LogicBuild) building, LExecutor.PrintI.toString(message.objval));
4848

4949
//skip back to self.
@@ -54,12 +54,12 @@ public final void run(LExecutor exec) {
5454

5555
// For easier switching between v7 and v8 logic
5656

57-
private Var var(LExecutor exec, int var) {
58-
return exec.var(var);
57+
private LVar var(LExecutor exec, LVar var) {
58+
return var;
5959
}
6060

61-
private double num(LExecutor exec, int var) {
62-
return exec.num(var);
61+
private double num(LExecutor exec, LVar var) {
62+
return var.num();
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)