Fixed bridges not linking when landing
This commit is contained in:
@@ -31,7 +31,6 @@ import mindustry.net.*;
|
|||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.power.PowerNode.*;
|
|
||||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -245,8 +244,8 @@ public class Control implements ApplicationListener, Loadable{
|
|||||||
float maxDelay = 0f;
|
float maxDelay = 0f;
|
||||||
|
|
||||||
for(var build : state.rules.defaultTeam.data().buildings){
|
for(var build : state.rules.defaultTeam.data().buildings){
|
||||||
//power nodes need to be configured later once everything is built
|
//some blocks need to be configured later once everything is built
|
||||||
if(build instanceof PowerNodeBuild){
|
if(build.block.delayLandingConfig){
|
||||||
toBePlacedConfigs.add(new Object[]{build, build.config()});
|
toBePlacedConfigs.add(new Object[]{build, build.config()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ public class Scripts implements Disposable{
|
|||||||
Object o = context.evaluateString(scope, text, "console.js", 1);
|
Object o = context.evaluateString(scope, text, "console.js", 1);
|
||||||
if(o instanceof NativeJavaObject n) o = n.unwrap();
|
if(o instanceof NativeJavaObject n) o = n.unwrap();
|
||||||
if(o == null) o = "null";
|
if(o == null) o = "null";
|
||||||
|
|
||||||
else if(o instanceof Undefined) o = "undefined";
|
else if(o instanceof Undefined) o = "undefined";
|
||||||
|
|
||||||
else if(o instanceof Object[] arr) o = Arrays.toString(arr);
|
else if(o instanceof Object[] arr) o = Arrays.toString(arr);
|
||||||
else if(o instanceof int[] arr) o = Arrays.toString(arr);
|
else if(o instanceof int[] arr) o = Arrays.toString(arr);
|
||||||
else if(o instanceof float[] arr) o = Arrays.toString(arr);
|
else if(o instanceof float[] arr) o = Arrays.toString(arr);
|
||||||
|
|||||||
@@ -261,6 +261,8 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
public int selectionRows = 5, selectionColumns = 4;
|
public int selectionRows = 5, selectionColumns = 4;
|
||||||
/** If true, this block can be configured by logic. */
|
/** If true, this block can be configured by logic. */
|
||||||
public boolean logicConfigurable = false;
|
public boolean logicConfigurable = false;
|
||||||
|
/** If true, configuration is delayed when playing the landing block buildup animation. This may be removed in the future! */
|
||||||
|
public boolean delayLandingConfig;
|
||||||
/** Whether this block consumes touchDown events when tapped. */
|
/** Whether this block consumes touchDown events when tapped. */
|
||||||
public boolean consumesTap;
|
public boolean consumesTap;
|
||||||
/** Whether to draw the glow of the liquid for this block, if it has one. */
|
/** Whether to draw the glow of the liquid for this block, if it has one. */
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ public class ItemBridge extends Block{
|
|||||||
allowConfigInventory = false;
|
allowConfigInventory = false;
|
||||||
ignoreResizeConfig = true;
|
ignoreResizeConfig = true;
|
||||||
priority = TargetPriority.transport;
|
priority = TargetPriority.transport;
|
||||||
|
delayLandingConfig = true;
|
||||||
|
|
||||||
//point2 config is relative
|
//point2 config is relative
|
||||||
config(Point2.class, (ItemBridgeBuild tile, Point2 i) -> tile.link = Point2.pack(i.x + tile.tileX(), i.y + tile.tileY()));
|
config(Point2.class, (ItemBridgeBuild tile, Point2 i) -> tile.link = Point2.pack(i.x + tile.tileX(), i.y + tile.tileY()));
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class PowerNode extends PowerBlock{
|
|||||||
drawDisabled = false;
|
drawDisabled = false;
|
||||||
envEnabled |= Env.space;
|
envEnabled |= Env.space;
|
||||||
destructible = true;
|
destructible = true;
|
||||||
|
delayLandingConfig = true;
|
||||||
|
|
||||||
//nodes do not even need to update
|
//nodes do not even need to update
|
||||||
update = false;
|
update = false;
|
||||||
|
|||||||
@@ -329,6 +329,16 @@ public class PatcherTests{
|
|||||||
assertEquals(1, Blocks.conveyor.size);
|
assertEquals(1, Blocks.conveyor.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void assignStringToObject() throws Exception{
|
||||||
|
Vars.state.patcher.apply(Seq.with("""
|
||||||
|
unit.dagger.weapons: ["frog"]
|
||||||
|
"""));
|
||||||
|
|
||||||
|
assertEquals(1, Vars.state.patcher.patches.first().warnings.size);
|
||||||
|
assertEquals(2, UnitTypes.dagger.weapons.size);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void gibberish() throws Exception{
|
void gibberish() throws Exception{
|
||||||
Vars.state.patcher.apply(Seq.with("""
|
Vars.state.patcher.apply(Seq.with("""
|
||||||
|
|||||||
Reference in New Issue
Block a user