Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	tools/src/mindustry/tools/Generators.java
This commit is contained in:
Anuken
2021-10-14 19:15:59 -04:00
29 changed files with 435 additions and 360 deletions

View File

@@ -418,7 +418,7 @@ public class Turret extends ReloadTurret{
tr.trns(rotation, shootLength);
recoil = recoilAmount;
heat = 1f;
bullet(type, rotation + Mathf.range(inaccuracy));
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy));
effects();
charging = false;
});
@@ -448,7 +448,7 @@ public class Turret extends ReloadTurret{
float i = (shotCounter % shots) - (shots-1)/2f;
tr.trns(rotation - 90, spread * i + Mathf.range(xRand), shootLength);
bullet(type, rotation + Mathf.range(inaccuracy));
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy));
}else{
tr.trns(rotation, shootLength, Mathf.range(xRand));

View File

@@ -75,13 +75,13 @@ public class PayloadConveyor extends Block{
public int step = -1, stepAccepted = -1;
@Override
public boolean canControlSelect(Player player){
return this.item == null && !player.unit().spawnedByCore && player.unit().hitSize / tilesize <= payloadLimit && player.tileOn() != null && player.tileOn().build == this;
public boolean canControlSelect(Unit player){
return this.item == null && !player.spawnedByCore && player.hitSize / tilesize <= payloadLimit && player.tileOn() != null && player.tileOn().build == this;
}
@Override
public void onControlSelect(Player player){
acceptPlayerPayload(player, p -> item = p);
public void onControlSelect(Unit player){
handleUnitPayload(player, p -> item = p);
}
@Override

View File

@@ -104,7 +104,7 @@ public class Router extends Block{
int angle = Mathf.mod((int)((angleTo(unit.aimX(), unit.aimY()) + 45) / 90), 4);
if(unit.isShooting()){
Building other = nearby(angle);
Building other = nearby(rotation = angle);
if(other != null && other.acceptItem(this, item)){
return other;
}

View File

@@ -80,16 +80,16 @@ public class PayloadBlock extends Block{
}
@Override
public boolean canControlSelect(Player player){
return !player.unit().spawnedByCore && this.payload == null && acceptUnitPayload(player.unit()) && player.tileOn() != null && player.tileOn().build == this;
public boolean canControlSelect(Unit player){
return !player.spawnedByCore && this.payload == null && acceptUnitPayload(player) && player.tileOn() != null && player.tileOn().build == this;
}
@Override
public void onControlSelect(Player player){
public void onControlSelect(Unit player){
float x = player.x, y = player.y;
acceptPlayerPayload(player, p -> payload = (T)p);
handleUnitPayload(player, p -> payload = (T)p);
this.payVector.set(x, y).sub(this).clamp(-size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f, size * tilesize / 2f);
this.payRotation = player.unit().rotation;
this.payRotation = player.rotation;
}
@Override

View File

@@ -46,6 +46,8 @@ public class Drill extends Block{
public boolean drawMineItem = true;
/** Effect played when an item is produced. This is colored. */
public Effect drillEffect = Fx.mine;
/** Drill effect randomness. Block size by default. */
public float drillEffectRnd = -1f;
/** Speed the drill bit rotates at. */
public float rotateSpeed = 2f;
/** Effect randomly played while drilling. */
@@ -73,6 +75,12 @@ public class Drill extends Block{
ambientSoundVolume = 0.018f;
}
@Override
public void init(){
super.init();
if(drillEffectRnd < 0) drillEffectRnd = size;
}
@Override
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
if(!req.worldContext) return;
@@ -285,7 +293,7 @@ public class Drill extends Block{
progress %= delay;
drillEffect.at(x + Mathf.range(size), y + Mathf.range(size), dominantItem.color);
drillEffect.at(x + Mathf.range(drillEffectRnd), y + Mathf.range(drillEffectRnd), dominantItem.color);
}
}

View File

@@ -242,12 +242,15 @@ public class CoreBlock extends StorageBlock{
}
@Override
public boolean canControlSelect(Player player){
return true;
public boolean canControlSelect(Unit player){
return player.isPlayer();
}
@Override
public void onControlSelect(Player player){
public void onControlSelect(Unit unit){
if(!unit.isPlayer()) return;
Player player = unit.getPlayer();
Fx.spawn.at(player);
if(net.client() && player == Vars.player){
control.input.controlledType = null;