Placement range check rule implemented

This commit is contained in:
Anuken
2022-02-13 21:02:33 -05:00
parent c8b11c4447
commit 3ebdb5309e
5 changed files with 6 additions and 3 deletions

View File

@@ -119,7 +119,7 @@ public class Drawf{
}
public static void dashLineDst(Color color, float x, float y, float x2, float y2){
dashLine(color, x, y, x2, y2, (int)(Mathf.dst(x, y, x2, y2) / tilesize * 2));
dashLine(color, x, y, x2, y2, (int)(Mathf.dst(x, y, x2, y2) / tilesize));
}
public static void dashLine(Color color, float x, float y, float x2, float y2){

View File

@@ -234,7 +234,7 @@ public class DesktopInput extends InputHandler{
if(!valid && state.rules.placeRangeCheck){
var blocker = Build.getEnemyOverlap(block, player.team(), cursorX, cursorY);
if(blocker != null){
Drawf.selected(blocker, blocker.team.color);
Drawf.selected(blocker, Pal.remove);
Tmp.v1.set(cursorX, cursorY).scl(tilesize).add(block.offset, block.offset).sub(blocker).scl(-1f).nor();
Drawf.dashLineDst(Pal.remove,
cursorX * tilesize + block.offset + Tmp.v1.x * block.size * tilesize/2f,

View File

@@ -185,6 +185,7 @@ public class CustomRulesDialog extends BaseDialog{
check("@rules.attack", b -> rules.attackMode = b, () -> rules.attackMode);
check("@rules.buildai", b -> rules.teams.get(rules.waveTeam).ai = rules.teams.get(rules.waveTeam).infiniteResources = b, () -> rules.teams.get(rules.waveTeam).ai);
check("@rules.corecapture", b -> rules.coreCapture = b, () -> rules.coreCapture);
check("@rules.placerangecheck", b -> rules.placeRangeCheck = b, () -> rules.placeRangeCheck);
check("@rules.polygoncoreprotection", b -> rules.polygonCoreProtection = b, () -> rules.polygonCoreProtection);
number("@rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200), () -> !rules.polygonCoreProtection);

View File

@@ -16,6 +16,7 @@ import static mindustry.Vars.*;
public class BaseTurret extends Block{
public float range = 80f;
public float placeOverlapMargin = 8 * 6f;
public float rotateSpeed = 5;
public float coolantUsage = 0.2f;
@@ -45,7 +46,7 @@ public class BaseTurret extends Block{
consumes.add(coolantOverride != null ? new ConsumeLiquid(coolantOverride, coolantUsage) : new ConsumeCoolant(coolantUsage)).update(false).boost();
}
placeOverlapRange = Math.max(placeOverlapRange, range);
placeOverlapRange = Math.max(placeOverlapRange, range + placeOverlapMargin);
super.init();
}