This commit is contained in:
Anuken 2020-10-16 15:27:30 -04:00
parent 1fbced0433
commit e00daffe6d
14 changed files with 63 additions and 48 deletions

View file

@ -730,7 +730,6 @@ setting.fullscreen.name = Fullscreen
setting.borderlesswindow.name = Borderless Window[lightgray] (restart may be required)
setting.fps.name = Show FPS & Ping
setting.smoothcamera.name = Smooth Camera
setting.blockselectkeys.name = Show Block Select Keys
setting.vsync.name = VSync
setting.pixelate.name = Pixelate
setting.minimap.name = Show Minimap

View file

@ -87,7 +87,7 @@ public class Vars implements Loadable{
/** duration of time between turns in ticks */
public static final float turnDuration = 2 * Time.toMinutes;
/** chance of an invasion per turn, 1 = 100% */
public static final float baseInvasionChance = 1f / 15f;
public static final float baseInvasionChance = 1f / 25f;
/** how many turns have to pass before invasions start */
public static final int invasionGracePeriod = 20;
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */

View file

@ -14,8 +14,6 @@ import mindustry.maps.*;
import mindustry.type.*;
import mindustry.type.Weather.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.ConstructBlock.*;
import java.util.*;
@ -40,32 +38,7 @@ public class Logic implements ApplicationListener{
//skip null entities or un-rebuildables, for obvious reasons; also skip client since they can't modify these requests
if(tile.build == null || !tile.block().rebuildable || net.client()) return;
if(block instanceof ConstructBlock){
ConstructBuild entity = tile.bc();
//update block to reflect the fact that something was being constructed
if(entity.cblock != null && entity.cblock.synthetic()){
block = entity.cblock;
}else{
//otherwise this was a deconstruction that was interrupted, don't want to rebuild that
return;
}
}
TeamData data = state.teams.get(tile.team());
//remove existing blocks that have been placed here.
//painful O(n) iteration + copy
for(int i = 0; i < data.blocks.size; i++){
BlockPlan b = data.blocks.get(i);
if(b.x == tile.x && b.y == tile.y){
data.blocks.removeIndex(i);
break;
}
}
data.blocks.addFirst(new BlockPlan(tile.x, tile.y, (short)tile.build.rotation, block.id, tile.build.config()));
tile.build.addPlan(true);
});
Events.on(BlockBuildEndEvent.class, event -> {

View file

@ -385,7 +385,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
}
public void build(){
float size = 60f;
float size = 58f;
clearChildren();
table(cont -> {
@ -559,10 +559,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
mid.row();
mid.table(t -> {
t.button("@editor.center", Icon.move, Styles.cleart, () -> view.center()).growX().margin(9f);
}).growX().top();
if(!mobile){
mid.table(t -> {
t.button("@editor.center", Icon.move, Styles.cleart, () -> view.center()).growX().margin(9f);
}).growX().top();
}
}).margin(0).left().growY();

View file

@ -39,6 +39,11 @@ public class LaserBulletType extends BulletType{
this(1f);
}
@Override
public float estimateDPS(){
return super.estimateDPS() * 2f;
}
@Override
public void init(){
super.init();

View file

@ -22,6 +22,8 @@ public class LiquidBulletType extends BulletType{
if(liquid != null){
this.liquid = liquid;
this.status = liquid.effect;
lightColor = liquid.lightColor;
lightOpacity = liquid.lightColor.a;
}
ammoMultiplier = 1f;

View file

@ -21,12 +21,14 @@ import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.game.Teams.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.ConstructBlock.*;
import mindustry.world.blocks.environment.*;
import mindustry.world.blocks.payloads.*;
import mindustry.world.blocks.power.*;
@ -191,6 +193,36 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
//endregion
//region utility methods
public void addPlan(boolean checkPrevious){
if(!block.rebuildable) return;
if(self() instanceof ConstructBuild entity){
//update block to reflect the fact that something was being constructed
if(entity.cblock != null && entity.cblock.synthetic()){
block = entity.cblock;
}else{
//otherwise this was a deconstruction that was interrupted, don't want to rebuild that
return;
}
}
TeamData data = state.teams.get(team);
if(checkPrevious){
//remove existing blocks that have been placed here.
//painful O(n) iteration + copy
for(int i = 0; i < data.blocks.size; i++){
BlockPlan b = data.blocks.get(i);
if(b.x == tile.x && b.y == tile.y){
data.blocks.removeIndex(i);
break;
}
}
}
data.blocks.addFirst(new BlockPlan(tile.x, tile.y, (short)rotation, block.id, config()));
}
/** Configure with the current, local player. */
public void configure(Object value){
//save last used config

View file

@ -109,7 +109,7 @@ public class SectorInfo{
entity.items.clear();
entity.items.add(items);
//ensure capacity.
entity.items.each((i, a) -> entity.items.set(i, Math.min(a, entity.block.itemCapacity)));
entity.items.each((i, a) -> entity.items.set(i, Math.min(a, entity.storageCapacity)));
}
//TODO write items.

View file

@ -194,8 +194,8 @@ public class Universe{
//queue random invasions
if(!sector.isAttacked() && turn > invasionGracePeriod){
//TODO use factors like difficulty for better invasion chance
if(sector.near().contains(Sector::hasEnemyBase) && Mathf.chance(baseInvasionChance)){
//invasion chance depends on # of nearby bases
if(Mathf.chance(baseInvasionChance * sector.near().count(Sector::hasEnemyBase))){
int waveMax = Math.max(sector.info.winWave, sector.isBeingPlayed() ? state.wave : 0) + Mathf.random(2, 5) * 5;
//assign invasion-related things

View file

@ -328,7 +328,7 @@ public class SectorDamage{
int radius = 3;
//only penetrate a certain % by health, not by distance
float totalHealth = path.sumf(t -> {
float totalHealth = damage >= 1f ? 1f : path.sumf(t -> {
float s = 0;
for(int dx = -radius; dx <= radius; dx++){
for(int dy = -radius; dy <= radius; dy++){
@ -345,7 +345,7 @@ public class SectorDamage{
float healthCount = 0;
out:
for(int i = 0; i < path.size && healthCount < targetHealth; i++){
for(int i = 0; i < path.size && (healthCount < targetHealth || damage >= 1f); i++){
Tile t = path.get(i);
for(int dx = -radius; dx <= radius; dx++){
@ -365,7 +365,7 @@ public class SectorDamage{
removal.add(other.build);
if(healthCount >= targetHealth){
if(healthCount >= targetHealth && damage < 0.999f){
break out;
}
}
@ -376,6 +376,7 @@ public class SectorDamage{
for(Building r : removal){
if(r.tile.build == r){
r.addPlan(false);
r.tile.remove();
}
}
@ -424,6 +425,7 @@ public class SectorDamage{
Effect.rubble(other.build.x, other.build.y, other.block().size);
}
other.build.addPlan(false);
other.remove();
}
}

View file

@ -339,9 +339,6 @@ public class SettingsMenuDialog extends SettingsDialog{
graphics.checkPref("smoothcamera", true);
graphics.checkPref("position", false);
graphics.checkPref("fps", false);
if(!mobile){
graphics.checkPref("blockselectkeys", true);
}
graphics.checkPref("playerindicators", true);
graphics.checkPref("indicators", true);
graphics.checkPref("animatedwater", true);

View file

@ -289,7 +289,7 @@ public class PlacementFragment extends Fragment{
topTable.table(header -> {
String keyCombo = "";
if(!mobile && Core.settings.getBool("blockselectkeys")){
if(!mobile){
Seq<Block> blocks = getByCategory(currentCategory);
for(int i = 0; i < blocks.size; i++){
if(blocks.get(i) == displayBlock && (i + 1) / 10 - 1 < blockSelect.length){

View file

@ -333,7 +333,7 @@ public class CoreBlock extends StorageBlock{
@Override
public void itemTaken(Item item){
if(state.isCampaign()){
if(state.isCampaign() && team == state.rules.defaultTeam){
//update item taken amount
state.secinfo.handleCoreItem(item, -1);
}
@ -342,7 +342,9 @@ public class CoreBlock extends StorageBlock{
@Override
public void handleItem(Building source, Item item){
if(net.server() || !net.active()){
state.secinfo.handleCoreItem(item, 1);
if(team == state.rules.defaultTeam){
state.secinfo.handleCoreItem(item, 1);
}
if(items.get(item) >= getMaximumAccepted(item)){
//create item incineration effect at random intervals

View file

@ -46,7 +46,9 @@ public class StorageBlock extends Block{
@Override
public void handleItem(Building source, Item item){
if(linkedCore != null){
incinerateEffect(this, source);
if(linkedCore.items.get(item) >= ((CoreBuild)linkedCore).storageCapacity){
incinerateEffect(this, source);
}
((CoreBuild)linkedCore).noEffect = true;
linkedCore.handleItem(source, item);
}else{