Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features
Conflicts: gradle.properties
This commit is contained in:
@@ -774,6 +774,11 @@ public class Block extends UnlockableContent{
|
||||
return ContentType.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean logicVisible(){
|
||||
return buildVisibility != BuildVisibility.hidden;
|
||||
}
|
||||
|
||||
/** Called after all blocks are created. */
|
||||
@Override
|
||||
@CallSuper
|
||||
@@ -838,7 +843,7 @@ public class Block extends UnlockableContent{
|
||||
//load specific team regions
|
||||
teamRegions = new TextureRegion[Team.all.length];
|
||||
for(Team team : Team.all){
|
||||
teamRegions[team.id] = teamRegion.found() ? Core.atlas.find(name + "-team-" + team.name, teamRegion) : teamRegion;
|
||||
teamRegions[team.id] = teamRegion.found() && team.hasPalette ? Core.atlas.find(name + "-team-" + team.name, teamRegion) : teamRegion;
|
||||
}
|
||||
|
||||
if(variants != 0){
|
||||
|
||||
@@ -134,24 +134,26 @@ public class Build{
|
||||
return false;
|
||||
}
|
||||
|
||||
//find closest core, if it doesn't match the team, placing is not legal
|
||||
if(state.rules.polygonCoreProtection){
|
||||
float mindst = Float.MAX_VALUE;
|
||||
CoreBuild closest = null;
|
||||
for(TeamData data : state.teams.active){
|
||||
for(CoreBuild tile : data.cores){
|
||||
float dst = tile.dst2(x * tilesize + type.offset, y * tilesize + type.offset);
|
||||
if(dst < mindst){
|
||||
closest = tile;
|
||||
mindst = dst;
|
||||
if(!state.rules.editor){
|
||||
//find closest core, if it doesn't match the team, placing is not legal
|
||||
if(state.rules.polygonCoreProtection){
|
||||
float mindst = Float.MAX_VALUE;
|
||||
CoreBuild closest = null;
|
||||
for(TeamData data : state.teams.active){
|
||||
for(CoreBuild tile : data.cores){
|
||||
float dst = tile.dst2(x * tilesize + type.offset, y * tilesize + type.offset);
|
||||
if(dst < mindst){
|
||||
closest = tile;
|
||||
mindst = dst;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(closest != null && closest.team != team){
|
||||
if(closest != null && closest.team != team){
|
||||
return false;
|
||||
}
|
||||
}else if(state.teams.eachEnemyCore(team, core -> Mathf.dst(x * tilesize + type.offset, y * tilesize + type.offset, core.x, core.y) < state.rules.enemyCoreBuildRadius + type.size * tilesize / 2f)){
|
||||
return false;
|
||||
}
|
||||
}else if(state.teams.eachEnemyCore(team, core -> Mathf.dst(x * tilesize + type.offset, y * tilesize + type.offset, core.x, core.y) < state.rules.enemyCoreBuildRadius + type.size * tilesize / 2f)){
|
||||
return false;
|
||||
}
|
||||
|
||||
Tile tile = world.tile(x, y);
|
||||
|
||||
@@ -109,10 +109,15 @@ public class Accelerator extends Block{
|
||||
|
||||
if(!state.isCampaign() || !consValid()) return;
|
||||
|
||||
ui.planet.showPlanetLaunch(state.rules.sector, sector -> {
|
||||
//TODO cutscene, etc...
|
||||
consume();
|
||||
});
|
||||
//TODO implement
|
||||
if(true){
|
||||
ui.showInfo("@indev.campaign");
|
||||
}else{
|
||||
ui.planet.showPlanetLaunch(state.rules.sector, sector -> {
|
||||
//TODO cutscene, etc...
|
||||
consume();
|
||||
});
|
||||
}
|
||||
Events.fire(Trigger.acceleratorUse);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public class LaunchPad extends Block{
|
||||
public void display(Table table){
|
||||
super.display(table);
|
||||
|
||||
if(!state.isCampaign()) return;
|
||||
if(!state.isCampaign() || net.client()) return;
|
||||
|
||||
table.row();
|
||||
table.label(() -> {
|
||||
|
||||
@@ -3,8 +3,10 @@ package mindustry.world.blocks.defense;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
@@ -18,6 +20,9 @@ public class ShockMine extends Block{
|
||||
public int length = 10;
|
||||
public int tendrils = 6;
|
||||
public Color lightningColor = Pal.lancerLaser;
|
||||
public int shots = 6;
|
||||
public float inaccuracy = 0f;
|
||||
public @Nullable BulletType bullet;
|
||||
public float teamAlpha = 0.3f;
|
||||
public @Load("@-team-top") TextureRegion teamRegion;
|
||||
|
||||
@@ -46,17 +51,26 @@ public class ShockMine extends Block{
|
||||
|
||||
@Override
|
||||
public void drawCracks(){
|
||||
|
||||
//no
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unitOn(Unit unit){
|
||||
if(enabled && unit.team != team && timer(timerDamage, cooldown)){
|
||||
for(int i = 0; i < tendrils; i++){
|
||||
Lightning.create(team, lightningColor, damage, x, y, Mathf.random(360f), length);
|
||||
}
|
||||
triggered();
|
||||
damage(tileDamage);
|
||||
}
|
||||
}
|
||||
|
||||
public void triggered(){
|
||||
for(int i = 0; i < tendrils; i++){
|
||||
Lightning.create(team, lightningColor, damage, x, y, Mathf.random(360f), length);
|
||||
}
|
||||
if(bullet != null){
|
||||
for(int i = 0; i < shots; i++){
|
||||
bullet.create(this, x, y, (360f / shots) * i + Mathf.random(inaccuracy));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ public class ItemTurret extends Turret{
|
||||
}
|
||||
|
||||
BulletType type = ammoTypes.get(item);
|
||||
if(type == null) return;
|
||||
totalAmmo += type.ammoMultiplier;
|
||||
|
||||
//find ammo entry by type
|
||||
|
||||
@@ -100,17 +100,27 @@ public class LiquidTurret extends Turret{
|
||||
@Override
|
||||
protected void findTarget(){
|
||||
if(extinguish && liquids.current().canExtinguish()){
|
||||
Fire result = null;
|
||||
float mindst = 0f;
|
||||
int tr = (int)(range / tilesize);
|
||||
for(int x = -tr; x <= tr; x++){
|
||||
for(int y = -tr; y <= tr; y++){
|
||||
Tile other = world.tileWorld(x + tile.x, y + tile.y);
|
||||
Tile other = world.tile(x + tile.x, y + tile.y);
|
||||
var fire = Fires.get(x + tile.x, y + tile.y);
|
||||
float dst = fire == null ? 0 : dst2(fire);
|
||||
//do not extinguish fires on other team blocks
|
||||
if(other != null && Fires.has(x + tile.x, y + tile.y) && (other.build == null || other.team() == team)){
|
||||
target = Fires.get(x + tile.x, y + tile.y);
|
||||
return;
|
||||
if(other != null && fire != null && Fires.has(other.x, other.y) && dst <= range * range && (result == null || dst < mindst) && (other.build == null || other.team() == team)){
|
||||
result = fire;
|
||||
mindst = dst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(result != null){
|
||||
target = result;
|
||||
//don't run standard targeting
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
super.findTarget();
|
||||
|
||||
@@ -43,6 +43,10 @@ public class PayloadRouter extends PayloadConveyor{
|
||||
do{
|
||||
rotation = (rotation + 1) % 4;
|
||||
onProximityUpdate();
|
||||
//force update to transfer if necessary
|
||||
if(next instanceof PayloadConveyorBuild && !(next instanceof PayloadRouterBuild)){
|
||||
next.updateTile();
|
||||
}
|
||||
//this condition intentionally uses "accept from itself" conditions, because payload conveyors only accept during the start
|
||||
//"accept from self" conditions are for dropped payloads and are less restrictive
|
||||
}while((blocked || next == null || !next.acceptPayload(next, item)) && ++rotations < 4);
|
||||
|
||||
@@ -12,6 +12,7 @@ import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.blocks.storage.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -69,7 +70,7 @@ public class PayloadSource extends PayloadBlock{
|
||||
}
|
||||
|
||||
public boolean canProduce(Block b){
|
||||
return b.isVisible() && b.size < size;
|
||||
return b.isVisible() && b.size < size && !(b instanceof CoreBlock);
|
||||
}
|
||||
|
||||
public boolean canProduce(UnitType t){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.world.blocks.production;
|
||||
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
@@ -67,6 +68,8 @@ public class Fracker extends SolidPump{
|
||||
super.updateTile();
|
||||
accumulator += delta() * efficiency();
|
||||
}else{
|
||||
warmup = Mathf.lerpDelta(warmup, 0f, 0.02f);
|
||||
lastPump = 0f;
|
||||
dumpLiquid(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import arc.util.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.production.GenericCrafter.*;
|
||||
|
||||
//TODO
|
||||
public class DrawArcSmelter extends DrawBlock{
|
||||
public TextureRegion top, bottom;
|
||||
public Color flameColor = Color.valueOf("f58349"), midColor = Color.valueOf("f2d585");
|
||||
|
||||
@@ -38,6 +38,6 @@ public class DrawWeave extends DrawBlock{
|
||||
|
||||
@Override
|
||||
public TextureRegion[] icons(Block block){
|
||||
return new TextureRegion[]{bottom, block.region, weave};
|
||||
return new TextureRegion[]{bottom, weave, block.region};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user