From 2a995efa2ac9d0240da8fcb6e48ef164ff400add Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 6 Sep 2020 13:26:23 -0400 Subject: [PATCH] Fixed default campaign core spawning units in blocks --- core/assets/baseparts/core1.msch | Bin 273 -> 598 bytes core/src/mindustry/Vars.java | 4 ++-- core/src/mindustry/ai/WaveSpawner.java | 4 ++-- .../maps/generators/BaseGenerator.java | 12 ++++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/assets/baseparts/core1.msch b/core/assets/baseparts/core1.msch index 43439698d7b307b263d6e4122ada2ee7f39bfe10..a9df583d3b89aef5fae8fe18cf2d4f9989b98140 100644 GIT binary patch literal 598 zcmV-c0;&CNb7N=$c$`g?X>Q{%423Bvw!BDQ z-?u}m>wf>-zV}1QWB)MA$NjdiFZ!#w?#Fg{{92C}5&5J4QcG}(Ry>{(o}5IYBJ>RC z_|yYlO7UKyoTfELC8<4ON2@qo$;MI!#H16GPE0yk(!t{wvUMi2Y!kCh z%r-IGglvOi=D06tLRN1ZIE#}RC$krsy~x%Jr*Dy2oNT=a=3%|a43`-$vlm&z+3Gm4 zh45k%ZIjbsA__%AB%Wnr!VYyTRmZ{WIe0yEKtm)Vi!G;l4jL!`0f7bz1_}lW1_}m^ zV4i1qj`SSqInr}vN)rkW*s@O86TtRl;<8RCywe+XC4(ZO)H9nuV;H9A;R2X(!GZ#|Z;ReyPna`B;!{WTz!T2?0_`+35sEt(!T$nYYZL=f1|x80aC52hJ?$?<>kh5Yv(=iV`lk zIK-p=G^DS3whw`vTYWs*K-v27YQKFToppb8T(*9{w{d;feMcVsX{_h5_j=RYy7ken z=XV`90H69J0!|^r5d_XF6nJlG&sRH~QhZPl_^7GK$RkZco{^C2wHyKDI)a~|and7N z1w*|skrfw9XthqtSAs`K3c;SUQqxR`2}J$M^uG`i4{BOB>KX_Fp&&$hBrlt!vzwSW zM=P8^Ga#&(yMVdU5vUaZjmmT`=G<9A*i9%xFcG0hU}sKMxMxNQX573KCE2zXuA4q| XiR_@ag$3+qJy!0Ap!@g(3*a6~<6eQW diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index 506b4dfc15..91939f332c 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java @@ -37,7 +37,7 @@ public class Vars implements Loadable{ /** Whether the logger is loaded. */ public static boolean loadedLogger = false, loadedFileLogger = false; /** Maximum extra padding around deployment schematics. */ - public static final int maxLoadoutSchematicPad = 4; + public static final int maxLoadoutSchematicPad = 5; /** Maximum schematic size.*/ public static final int maxSchematicSize = 32; /** All schematic base64 starts with this string.*/ @@ -134,7 +134,7 @@ public class Vars implements Loadable{ /** whether typing into the console is enabled - developers only */ public static boolean enableConsole = false; /** whether to clear sector saves when landing */ - public static boolean clearSectors = false; + public static boolean clearSectors = true; /** whether any light rendering is enabled */ public static boolean enableLight = true; /** Whether to draw shadows of blocks at map edges and static blocks. diff --git a/core/src/mindustry/ai/WaveSpawner.java b/core/src/mindustry/ai/WaveSpawner.java index 4ac1b4d8f8..151ff65418 100644 --- a/core/src/mindustry/ai/WaveSpawner.java +++ b/core/src/mindustry/ai/WaveSpawner.java @@ -17,7 +17,7 @@ import mindustry.world.*; import static mindustry.Vars.*; public class WaveSpawner{ - private static final float margin = 40f, coreMargin = tilesize * 3; //how far away from the edge flying units spawn + private static final float margin = 40f, coreMargin = tilesize * 3.5f; private Seq spawns = new Seq<>(); private boolean spawning = false; @@ -91,7 +91,7 @@ public class WaveSpawner{ if(state.rules.attackMode && state.teams.isActive(state.rules.waveTeam) && !state.teams.playerCores().isEmpty()){ Building firstCore = state.teams.playerCores().first(); for(Building core : state.rules.waveTeam.cores()){ - Tmp.v1.set(firstCore).sub(core).limit(coreMargin + core.block().size * tilesize); + Tmp.v1.set(firstCore).sub(core).limit(coreMargin + core.block().size * tilesize /2f * Mathf.sqrt2); cons.accept(core.x + Tmp.v1.x, core.y + Tmp.v1.y, false); } } diff --git a/core/src/mindustry/maps/generators/BaseGenerator.java b/core/src/mindustry/maps/generators/BaseGenerator.java index 74672f2fb0..a9be2c15fc 100644 --- a/core/src/mindustry/maps/generators/BaseGenerator.java +++ b/core/src/mindustry/maps/generators/BaseGenerator.java @@ -83,10 +83,22 @@ public class BaseGenerator{ } }); + //replace walls with the correct type + pass(tile -> { + if(tile.block() instanceof Wall && tile.team() == team && tile.block() != wall && tile.block() != wallLarge){ + tile.setBlock(tile.block().size == 2 ? wallLarge : wall, team); + } + }); + if(wallAngle > 0){ //small walls pass(tile -> { + //no walls around cores + if(cores.contains(t -> t.within(tile, (3 + 4) * tilesize))){ + return; + } + if(tile.block().alwaysReplace){ boolean any = false;