mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-21 20:18:06 +07:00
Bugfixes
This commit is contained in:
parent
cb6920b8be
commit
dd68241d1f
@ -41,27 +41,31 @@ public class AsyncLogic{
|
||||
}
|
||||
|
||||
public void begin(){
|
||||
//sync begin
|
||||
for(AsyncProcess p : processes){
|
||||
p.begin();
|
||||
}
|
||||
if(Vars.state.isPlaying()){
|
||||
//sync begin
|
||||
for(AsyncProcess p : processes){
|
||||
p.begin();
|
||||
}
|
||||
|
||||
futures.clear();
|
||||
futures.clear();
|
||||
|
||||
//submit all tasks
|
||||
for(AsyncProcess p : processes){
|
||||
if(p.shouldProcess()){
|
||||
futures.add(executor.submit(p::process));
|
||||
//submit all tasks
|
||||
for(AsyncProcess p : processes){
|
||||
if(p.shouldProcess()){
|
||||
futures.add(executor.submit(p::process));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void end(){
|
||||
complete();
|
||||
if(Vars.state.isPlaying()){
|
||||
complete();
|
||||
|
||||
//sync end (flush data)
|
||||
for(AsyncProcess p : processes){
|
||||
p.end();
|
||||
//sync end (flush data)
|
||||
for(AsyncProcess p : processes){
|
||||
p.end();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class PhysicsProcess implements AsyncProcess{
|
||||
ref.lastVelocity.set(ref.velocity);
|
||||
}
|
||||
|
||||
physics.step(Core.graphics.getDeltaTime(), 8, 8);
|
||||
physics.step(Core.graphics.getDeltaTime(), 5, 8);
|
||||
|
||||
//get delta vectors
|
||||
for(PhysicRef ref : refs){
|
||||
@ -121,7 +121,7 @@ public class PhysicsProcess implements AsyncProcess{
|
||||
ref.position.set(entity);
|
||||
|
||||
//add delta velocity - this doesn't work very well yet
|
||||
//entity.vel().add(ref.velocity).sub(ref.lastVelocity);
|
||||
entity.vel().add(ref.velocity).sub(ref.lastVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,10 @@ public class GameState{
|
||||
return (is(State.paused) && !net.active()) || (gameOver && !net.active());
|
||||
}
|
||||
|
||||
public boolean isPlaying(){
|
||||
return state == State.playing;
|
||||
}
|
||||
|
||||
/** @return whether the current state is *not* the menu. */
|
||||
public boolean isGame(){
|
||||
return state != State.menu;
|
||||
|
@ -44,17 +44,26 @@ public class Units{
|
||||
}
|
||||
|
||||
/** Returns whether there are any entities on this tile. */
|
||||
public static boolean anyEntities(Tile tile){
|
||||
public static boolean anyEntities(Tile tile, boolean ground){
|
||||
float size = tile.block().size * tilesize;
|
||||
return anyEntities(tile.drawx() - size/2f, tile.drawy() - size/2f, size, size);
|
||||
return anyEntities(tile.drawx() - size/2f, tile.drawy() - size/2f, size, size, ground);
|
||||
}
|
||||
|
||||
/** Returns whether there are any entities on this tile. */
|
||||
public static boolean anyEntities(Tile tile){
|
||||
return anyEntities(tile, true);
|
||||
}
|
||||
|
||||
public static boolean anyEntities(float x, float y, float width, float height){
|
||||
return anyEntities(x, y, width, height, true);
|
||||
}
|
||||
|
||||
public static boolean anyEntities(float x, float y, float width, float height, boolean ground){
|
||||
boolResult = false;
|
||||
|
||||
nearby(x, y, width, height, unit -> {
|
||||
if(boolResult) return;
|
||||
if(unit.isGrounded()){
|
||||
if(unit.isGrounded() == ground){
|
||||
unit.hitbox(hitrect);
|
||||
|
||||
if(hitrect.overlaps(x, y, width, height)){
|
||||
|
@ -39,7 +39,7 @@ abstract class CommanderComp implements Unitc{
|
||||
|
||||
//make sure to reset command state when the controller is switched
|
||||
@Override
|
||||
public void controller(UnitController unitController){
|
||||
public void controller(UnitController next){
|
||||
clearCommand();
|
||||
}
|
||||
|
||||
|
@ -222,13 +222,15 @@ public class UnitFactory extends Block{
|
||||
if(currentPlan != -1){
|
||||
UnitPlan plan = plans[currentPlan];
|
||||
|
||||
if(progress >= plan.time){
|
||||
if(progress >= plan.time/* && !Units.anyEntities(tile, !plan.unit.flying)*/){
|
||||
progress = 0f;
|
||||
|
||||
Call.onUnitFactorySpawn(tile);
|
||||
useContent(plan.unit);
|
||||
consume();
|
||||
}
|
||||
|
||||
progress = Mathf.clamp(progress, 0, plan.time);
|
||||
}else{
|
||||
progress = 0f;
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=98e63e76cb6b5c925531ae5518b5182522def509
|
||||
archash=6069cba645e3d301a6bf4169182bb191f562b4da
|
||||
|
Loading…
Reference in New Issue
Block a user