mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-11 15:48:07 +07:00
parent
54ba4b31a1
commit
187cb79265
@ -7,6 +7,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import arc.util.async.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.game.*;
|
||||
@ -116,7 +117,7 @@ public class Pathfinder implements Runnable{
|
||||
tile.getTeamID(),
|
||||
tile.solid(),
|
||||
tile.floor().isLiquid,
|
||||
tile.staticDarkness() >= 2,
|
||||
tile.staticDarkness() >= 2 || (tile.floor().solid && tile.block() == Blocks.air),
|
||||
nearLiquid,
|
||||
nearGround,
|
||||
nearSolid,
|
||||
|
@ -418,13 +418,27 @@ public class Schematics implements Loadable{
|
||||
}
|
||||
|
||||
public static void placeLoadout(Schematic schem, int x, int y, Team team, Block resource){
|
||||
placeLoadout(schem, x, y, team, resource, true);
|
||||
}
|
||||
|
||||
public static void placeLoadout(Schematic schem, int x, int y, Team team, Block resource, boolean check){
|
||||
Stile coreTile = schem.tiles.find(s -> s.block instanceof CoreBlock);
|
||||
Seq<Tile> seq = new Seq<>();
|
||||
if(coreTile == null) throw new IllegalArgumentException("Loadout schematic has no core tile!");
|
||||
int ox = x - coreTile.x, oy = y - coreTile.y;
|
||||
schem.tiles.each(st -> {
|
||||
Tile tile = world.tile(st.x + ox, st.y + oy);
|
||||
if(tile == null) return;
|
||||
|
||||
//check for blocks that are in the way.
|
||||
if(check && !(st.block instanceof CoreBlock)){
|
||||
seq.clear();
|
||||
tile.getLinkedTilesAs(st.block, seq);
|
||||
if(seq.contains(t -> !t.block().alwaysReplace)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
tile.setBlock(st.block, team, st.rotation);
|
||||
|
||||
Object config = st.config;
|
||||
|
@ -21,7 +21,7 @@ public class Universe{
|
||||
private int turn;
|
||||
private float turnCounter;
|
||||
|
||||
private Schematic lastLoadout;
|
||||
private @Nullable Schematic lastLoadout;
|
||||
private ItemSeq lastLaunchResources = new ItemSeq();
|
||||
|
||||
public Universe(){
|
||||
@ -92,6 +92,15 @@ public class Universe{
|
||||
}
|
||||
}
|
||||
|
||||
public void clearLoadoutInfo(){
|
||||
lastLoadout = null;
|
||||
lastLaunchResources = new ItemSeq();
|
||||
Core.settings.remove("launch-resources-seq");
|
||||
Core.settings.remove("lastloadout-core-shard");
|
||||
Core.settings.remove("lastloadout-core-nucleus");
|
||||
Core.settings.remove("lastloadout-core-foundation");
|
||||
}
|
||||
|
||||
public ItemSeq getLaunchResources(){
|
||||
lastLaunchResources = Core.settings.getJson("launch-resources-seq", ItemSeq.class, ItemSeq::new);
|
||||
return lastLaunchResources;
|
||||
|
@ -159,9 +159,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
player.unit().eachGroup(unit -> {
|
||||
Item item = unit.item();
|
||||
int accepted = tile.acceptStack(item, unit.stack.amount, unit);
|
||||
unit.stack.amount -= accepted;
|
||||
|
||||
Call.transferItemTo(item, accepted, unit.x, unit.y, tile);
|
||||
Call.transferItemTo(unit, item, accepted, unit.x, unit.y, tile);
|
||||
|
||||
if(unit == player.unit()){
|
||||
Events.fire(new DepositEvent(tile, player, item, accepted));
|
||||
|
@ -60,7 +60,7 @@ public class BaseGenerator{
|
||||
|
||||
for(Tile tile : cores){
|
||||
tile.clearOverlay();
|
||||
Schematics.placeLoadout(coreschem.schematic, tile.x, tile.y, team, coreschem.required instanceof Item ? bases.ores.get((Item)coreschem.required) : Blocks.oreCopper);
|
||||
Schematics.placeLoadout(coreschem.schematic, tile.x, tile.y, team, coreschem.required instanceof Item ? bases.ores.get((Item)coreschem.required) : Blocks.oreCopper, false);
|
||||
|
||||
//fill core with every type of item (even non-material)
|
||||
Building entity = tile.build;
|
||||
|
@ -121,6 +121,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
|
||||
t.button("@settings.clearresearch", Icon.trash, style, () -> {
|
||||
ui.showConfirm("@confirm", "@settings.clearresearch.confirm", () -> {
|
||||
universe.clearLoadoutInfo();
|
||||
for(TechNode node : TechTree.all){
|
||||
node.reset();
|
||||
}
|
||||
|
@ -58,16 +58,16 @@ public class StackConveyor extends Block implements Autotiler{
|
||||
|
||||
@Override
|
||||
public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
|
||||
if(tile.build instanceof StackConveyorBuild){
|
||||
int state = ((StackConveyorBuild)tile.build).state;
|
||||
if(tile.build instanceof StackConveyorBuild b){
|
||||
int state = b.state;
|
||||
if(state == stateLoad){ //standard conveyor mode
|
||||
return otherblock.outputsItems() && lookingAtEither(tile, rotation, otherx, othery, otherrot, otherblock);
|
||||
}else if(state == stateUnload){ //router mode
|
||||
return otherblock.acceptsItems &&
|
||||
(notLookingAt(tile, rotation, otherx, othery, otherrot, otherblock) ||
|
||||
(otherblock instanceof StackConveyor && facing(otherx, othery, otherrot, tile.x, tile.y))) &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorBuild && ((StackConveyorBuild)world.build(otherx, othery)).state == stateUnload) &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorBuild && ((StackConveyorBuild)world.build(otherx, othery)).state == stateMove &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorBuild s && s.state == stateUnload) &&
|
||||
!(world.build(otherx, othery) instanceof StackConveyorBuild s2 && s2.state == stateMove &&
|
||||
!facing(otherx, othery, otherrot, tile.x, tile.y));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user