From c6c3357979c9545243f79de1be09f695352426ce Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Tue, 31 Dec 2019 21:28:59 +0100 Subject: [PATCH] =?UTF-8?q?Stash=20revised=20=E3=80=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entities/type/base/CraterUnit.java | 21 ++++++++++++++++--- .../distribution/CompressedConveyor.java | 3 +++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/core/src/mindustry/entities/type/base/CraterUnit.java b/core/src/mindustry/entities/type/base/CraterUnit.java index 0a1cd2c09c..270041cab2 100644 --- a/core/src/mindustry/entities/type/base/CraterUnit.java +++ b/core/src/mindustry/entities/type/base/CraterUnit.java @@ -21,6 +21,7 @@ import static mindustry.Vars.*; public class CraterUnit extends GroundUnit{ private final Effect io = Fx.plasticburn; // effect to play when poofing in and out of existence private int inactivity = 0; + private CraterUnit crater = this; private final UnitState @@ -32,14 +33,28 @@ public class CraterUnit extends GroundUnit{ }, move = new UnitState(){ public void update(){ - // move in the direction/rotation of the block its currently on - velocity.add(vec.trnsExact(angleTo(on().front()), type.speed * Time.delta())); - rotation = Mathf.slerpDelta(rotation, baseRotation, type.rotatespeed); // switch to unload when on an end tile if(dst(on()) < 2.5f && on(Track.end)){ state.set(unload); + return; } + + Tile target = on().front(); + + if(!Track.dibs.containsKey(target)){ + Track.dibs.put(target, crater); + if(Track.dibs.get(on()) == crater) Track.dibs.remove(on()); + } + if(Track.dibs.get(target) != crater) target = on(); + + // move in the direction/rotation of the block its currently on + velocity.add(vec.trnsExact(angleTo(target), type.speed * Time.delta())); + rotation = Mathf.slerpDelta(rotation, baseRotation, type.rotatespeed); + +// if(dst(on()) < 0.5f && on() != target){ +// velocity.snap(); +// } } }, unload = new UnitState(){ diff --git a/core/src/mindustry/world/blocks/distribution/CompressedConveyor.java b/core/src/mindustry/world/blocks/distribution/CompressedConveyor.java index b375dc8e2e..7b38690913 100644 --- a/core/src/mindustry/world/blocks/distribution/CompressedConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/CompressedConveyor.java @@ -2,6 +2,7 @@ package mindustry.world.blocks.distribution; import arc.*; import arc.func.*; +import arc.struct.*; import mindustry.type.*; import mindustry.world.*; import arc.graphics.g2d.*; @@ -120,5 +121,7 @@ public class CompressedConveyor extends ArmoredConveyor{ Track(Boolf check){ this.check = check; } + + public static ObjectMap dibs = new ObjectMap<>(); } }