mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 03:08:38 +07:00
Bugfixes
This commit is contained in:
parent
6b3039dba2
commit
870f06218b
@ -45,10 +45,7 @@ public class UnitTypes implements ContentList{
|
||||
public static @EntityDef({Unitc.class, Builderc.class, Minerc.class, Trailc.class}) UnitType alpha, beta, gamma;
|
||||
|
||||
//water
|
||||
public static @EntityDef({Unitc.class, WaterMovec.class, Commanderc.class}) UnitType risse, minke;
|
||||
|
||||
//water + payload
|
||||
public static @EntityDef({Unitc.class, WaterMovec.class, Commanderc.class, Payloadc.class}) UnitType bryde;
|
||||
public static @EntityDef({Unitc.class, WaterMovec.class, Commanderc.class}) UnitType risse, minke, bryde;
|
||||
|
||||
//special block unit type
|
||||
public static @EntityDef({Unitc.class, BlockUnitc.class}) UnitType block;
|
||||
@ -776,7 +773,6 @@ public class UnitTypes implements ContentList{
|
||||
trailX = 7f;
|
||||
trailY = -9f;
|
||||
trailScl = 1.5f;
|
||||
payloadCapacity = 4;
|
||||
|
||||
abilities.add(new HealFieldAbility(22f, 60f * 4, 70f), new ShieldFieldAbility(20f, 40f, 60f * 4, 60f));
|
||||
|
||||
|
@ -539,6 +539,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
return base();
|
||||
}
|
||||
|
||||
public @Nullable Payload getPayload(){
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Tries to take the payload. Returns null if no payload is present. */
|
||||
public @Nullable Payload takePayload(){
|
||||
return null;
|
||||
|
@ -12,7 +12,7 @@ import mindustry.world.blocks.payloads.*;
|
||||
|
||||
/** An entity that holds a payload. */
|
||||
@Component
|
||||
abstract class PayloadComp implements Posc, Rotc{
|
||||
abstract class PayloadComp implements Posc, Rotc, Hitboxc{
|
||||
@Import float x, y, rotation;
|
||||
|
||||
Seq<Payload> payloads = new Seq<>();
|
||||
|
@ -129,6 +129,8 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
if(tile.block().buildVisibility != BuildVisibility.hidden && tile.block().size <= 2){
|
||||
pay.pickup(tile);
|
||||
}else{ //pick up block payload
|
||||
Payload current = tile.getPayload();
|
||||
if(current != null && current.canBeTaken(pay)){
|
||||
Payload taken = tile.takePayload();
|
||||
if(taken != null){
|
||||
pay.addPayload(taken);
|
||||
@ -137,6 +139,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Remote(targets = Loc.both, called = Loc.server, forward = true)
|
||||
public static void dropPayload(Player player, float x, float y){
|
||||
|
@ -88,6 +88,11 @@ public class PayloadConveyor extends Block{
|
||||
blocked = (next != null && next.solid()) || (this.next != null && (this.next.rotation() + 2)%4 == rotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Payload getPayload(){
|
||||
return item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
progress = Time.time() % moveTime;
|
||||
|
@ -33,6 +33,11 @@ public class BlockPayload implements Payload{
|
||||
tile.setBlock(entity.block(), entity.team(), rotation, () -> entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeTaken(Payloadc picker){
|
||||
return entity.block.size <= 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fits(){
|
||||
return entity.block().size < 3;
|
||||
|
@ -27,6 +27,11 @@ public interface Payload{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return whether the unit can pick up this payload. */
|
||||
default boolean canBeTaken(Payloadc picker){
|
||||
return true;
|
||||
}
|
||||
|
||||
/** writes the payload for saving. */
|
||||
void write(Writes write);
|
||||
|
||||
|
@ -20,6 +20,11 @@ public class UnitPayload implements Payload{
|
||||
return unit.hitSize <= 16f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeTaken(Payloadc picker){
|
||||
return unit.hitSize < picker.hitSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
write.b(payloadUnit);
|
||||
|
@ -65,6 +65,11 @@ public class PayloadAcceptor extends Block{
|
||||
updatePayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Payload getPayload(){
|
||||
return payload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Payload takePayload(){
|
||||
T t = payload;
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=bb0d60276c0471b920a636d3d32ea838e73be8c2
|
||||
archash=a49c1c1da93e43d0afe43e565fc3a0800a5137a5
|
||||
|
Loading…
Reference in New Issue
Block a user