mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-20 17:28:14 +07:00
Many bugfixes
This commit is contained in:
parent
315c273de3
commit
7865950ec8
@ -256,7 +256,7 @@ public class RtsAI{
|
||||
|
||||
float estimateStats(float fromX, float fromY, float x, float y, float selfDps, float selfHealth){
|
||||
float[] health = {0f}, dps = {0f};
|
||||
float extraRadius = 30f;
|
||||
float extraRadius = 50f;
|
||||
|
||||
for(var turret : Vars.indexer.getEnemy(data.team, BlockFlag.turret)){
|
||||
if(Intersector.distanceSegmentPoint(fromX, fromY, x, y, turret.x, turret.y) <= ((TurretBuild)turret).range() + extraRadius){
|
||||
|
@ -1701,7 +1701,7 @@ public class Blocks{
|
||||
fogRadius = 27;
|
||||
researchCost = with(Items.silicon, 50, Items.graphite, 50);
|
||||
|
||||
consumePower(0.2f);
|
||||
consumePower(0.1f);
|
||||
}};
|
||||
|
||||
buildTower = new BuildTurret("build-tower"){{
|
||||
@ -2541,7 +2541,7 @@ public class Blocks{
|
||||
tier = 3;
|
||||
size = 2;
|
||||
range = 4;
|
||||
fogRadius = 2;
|
||||
fogRadius = 3;
|
||||
researchCost = with(Items.beryllium, 10);
|
||||
|
||||
consumeLiquid(Liquids.hydrogen, 0.25f / 60f).boost();
|
||||
@ -2556,6 +2556,7 @@ public class Blocks{
|
||||
tier = 5;
|
||||
size = 3;
|
||||
range = 6;
|
||||
fogRadius = 4;
|
||||
laserWidth = 0.7f;
|
||||
itemCapacity = 20;
|
||||
|
||||
@ -2577,6 +2578,8 @@ public class Blocks{
|
||||
blockedItem = Items.thorium;
|
||||
researchCostMultiplier = 0.5f;
|
||||
|
||||
fogRadius = 4;
|
||||
|
||||
consumePower(160f / 60f);
|
||||
consumeLiquid(Liquids.water, 0.2f);
|
||||
}};
|
||||
@ -2601,6 +2604,7 @@ public class Blocks{
|
||||
arrowSpacing = 5f;
|
||||
arrows = 2;
|
||||
glowColor.a = 0.6f;
|
||||
fogRadius = 5;
|
||||
|
||||
//TODO different requirements
|
||||
consumePower(6f);
|
||||
@ -2661,6 +2665,7 @@ public class Blocks{
|
||||
thrusterLength = 34/4f;
|
||||
armor = 5f;
|
||||
alwaysUnlocked = true;
|
||||
incinerateNonBuildable = true;
|
||||
|
||||
//TODO should this be higher?
|
||||
buildCostMultiplier = 0.75f;
|
||||
@ -2678,6 +2683,7 @@ public class Blocks{
|
||||
size = 5;
|
||||
thrusterLength = 40/4f;
|
||||
armor = 10f;
|
||||
incinerateNonBuildable = true;
|
||||
|
||||
unitCapModifier = 30;
|
||||
researchCostMultipliers.put(Items.silicon, 0.4f);
|
||||
@ -2694,6 +2700,7 @@ public class Blocks{
|
||||
size = 6;
|
||||
thrusterLength = 48/4f;
|
||||
armor = 15f;
|
||||
incinerateNonBuildable = true;
|
||||
|
||||
unitCapModifier = 30;
|
||||
researchCostMultipliers.put(Items.silicon, 0.3f);
|
||||
|
@ -310,29 +310,29 @@ public class ErekirTechTree{
|
||||
});
|
||||
|
||||
nodeProduce(Items.beryllium, () -> {
|
||||
nodeProduce(Items.sand, () -> {
|
||||
nodeProduce(Items.silicon, () -> {
|
||||
nodeProduce(Items.oxide, () -> {
|
||||
nodeProduce(Items.fissileMatter, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
nodeProduce(Liquids.water, () -> {
|
||||
nodeProduce(Liquids.ozone, () -> {
|
||||
nodeProduce(Liquids.hydrogen, () -> {
|
||||
nodeProduce(Liquids.nitrogen, () -> {
|
||||
nodeProduce(Liquids.cyanogen, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
nodeProduce(Items.graphite, () -> {
|
||||
nodeProduce(Items.sand, () -> {
|
||||
nodeProduce(Items.silicon, () -> {
|
||||
nodeProduce(Items.oxide, () -> {
|
||||
nodeProduce(Items.fissileMatter, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
nodeProduce(Liquids.water, () -> {
|
||||
nodeProduce(Liquids.ozone, () -> {
|
||||
nodeProduce(Liquids.hydrogen, () -> {
|
||||
nodeProduce(Liquids.nitrogen, () -> {
|
||||
nodeProduce(Liquids.cyanogen, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
nodeProduce(Items.tungsten, () -> {
|
||||
nodeProduce(Liquids.slag, () -> {
|
||||
|
||||
|
@ -37,12 +37,14 @@ public class Items{
|
||||
sand = new Item("sand", Color.valueOf("f7cba4")){{
|
||||
lowPriority = true;
|
||||
alwaysUnlocked = true;
|
||||
buildable = false;
|
||||
}};
|
||||
|
||||
coal = new Item("coal", Color.valueOf("272727")){{
|
||||
explosiveness = 0.2f;
|
||||
flammability = 1f;
|
||||
hardness = 2;
|
||||
buildable = false;
|
||||
}};
|
||||
|
||||
titanium = new Item("titanium", Color.valueOf("8da1e3")){{
|
||||
@ -87,16 +89,19 @@ public class Items{
|
||||
|
||||
sporePod = new Item("spore-pod", Color.valueOf("7457ce")){{
|
||||
flammability = 1.15f;
|
||||
buildable = false;
|
||||
}};
|
||||
|
||||
blastCompound = new Item("blast-compound", Color.valueOf("ff795e")){{
|
||||
flammability = 0.4f;
|
||||
explosiveness = 1.2f;
|
||||
buildable = false;
|
||||
}};
|
||||
|
||||
pyratite = new Item("pyratite", Color.valueOf("ffaa5f")){{
|
||||
flammability = 1.4f;
|
||||
explosiveness = 0.4f;
|
||||
buildable = false;
|
||||
}};
|
||||
|
||||
beryllium = new Item("beryllium", Color.valueOf("3a8f64")){{
|
||||
|
@ -68,7 +68,7 @@ public class Planets{
|
||||
r.attributes.set(Attribute.heat, 0.8f);
|
||||
r.showSpawns = true;
|
||||
r.fog = true;
|
||||
//r.staticFog = false;
|
||||
r.staticFog = true; //TODO false
|
||||
};
|
||||
|
||||
unlockedOnLand.add(Blocks.coreBastion);
|
||||
|
@ -2502,7 +2502,7 @@ public class UnitTypes{
|
||||
|
||||
//TODO make this look nicer
|
||||
bullet = new RailBulletType(){{
|
||||
length = 140f;
|
||||
length = 160f;
|
||||
damage = 45f;
|
||||
hitColor = Color.valueOf("feb380");
|
||||
hitEffect = endEffect = Fx.hitBulletColor;
|
||||
|
@ -874,7 +874,6 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
public void offload(Item item){
|
||||
produced(item, 1);
|
||||
int dump = this.cdump;
|
||||
if(!net.client() && state.isCampaign() && team == state.rules.defaultTeam) item.unlock();
|
||||
|
||||
for(int i = 0; i < proximity.size; i++){
|
||||
incrementDump(proximity.size);
|
||||
@ -911,7 +910,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
}
|
||||
|
||||
public void produced(Item item, int amount){
|
||||
if(Vars.state.rules.sector != null && team == state.rules.defaultTeam) Vars.state.rules.sector.info.handleProduction(item, amount);
|
||||
if(Vars.state.rules.sector != null && team == state.rules.defaultTeam){
|
||||
Vars.state.rules.sector.info.handleProduction(item, amount);
|
||||
|
||||
if(!net.client()) item.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/** Dumps any item with an accumulator. May dump multiple times per frame. Use with care. */
|
||||
@ -1541,6 +1544,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
|
||||
/** Changes this building's team in a safe manner. */
|
||||
public void changeTeam(Team next){
|
||||
if(this.team == next) return;
|
||||
|
||||
Team last = this.team;
|
||||
boolean was = isValid();
|
||||
|
||||
|
@ -152,13 +152,13 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
public boolean inFogTo(Team viewer){
|
||||
if(this.team == viewer || !state.rules.fog) return false;
|
||||
|
||||
if(hitSize <= 14f){
|
||||
if(hitSize <= 16f){
|
||||
return !fogControl.isVisible(viewer, x, y);
|
||||
}else{
|
||||
//for large hitsizes, check around the unit instead
|
||||
float trns = hitSize / 2f;
|
||||
for(var p : Geometry.d8){
|
||||
if(fogControl.isVisible(team, x + p.x * trns, y + p.y * trns)){
|
||||
if(fogControl.isVisible(viewer, x + p.x * trns, y + p.y * trns)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class Objectives{
|
||||
|
||||
@Override
|
||||
public boolean complete(){
|
||||
return preset.sector.save != null && (!preset.sector.isAttacked() || preset.sector.info.wasCaptured) && preset.sector.hasBase();
|
||||
return preset.sector.save != null && preset.sector.isCaptured() && preset.sector.hasBase();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class Rules{
|
||||
/** HIGHLY UNSTABLE/EXPERIMENTAL. DO NOT USE THIS. */
|
||||
public boolean fog = false;
|
||||
/** If fog = true, this is whether static (black) fog is enabled. */
|
||||
public boolean staticFog = true;
|
||||
public boolean staticFog = false;
|
||||
/** Color for static, undiscovered fog of war areas. */
|
||||
public Color staticColor = new Color(0f, 0f, 0f, 1f);
|
||||
/** Color for discovered but un-monitored fog of war areas. */
|
||||
|
@ -114,8 +114,9 @@ public final class FogRenderer{
|
||||
Draw.color(state.rules.dynamicColor);
|
||||
Draw.fbo(dynamicFog.getTexture(), world.width(), world.height(), tilesize);
|
||||
if(state.rules.staticFog){
|
||||
//TODO why does this require a half-tile offset while dynamic does not
|
||||
Draw.color(state.rules.staticColor);
|
||||
Draw.fbo(staticFog.getTexture(), world.width(), world.height(), tilesize);
|
||||
Draw.fbo(staticFog.getTexture(), world.width(), world.height(), tilesize, tilesize/2f);
|
||||
}
|
||||
Draw.shader();
|
||||
}
|
||||
|
@ -667,7 +667,12 @@ public class DesktopInput extends InputHandler{
|
||||
if(Core.input.keyRelease(Binding.break_block) || Core.input.keyRelease(Binding.select)){
|
||||
|
||||
if(mode == placing && block != null){ //touch up while placing, place everything in selection
|
||||
flushPlans(linePlans);
|
||||
if(input.keyDown(Binding.boost)){
|
||||
flushPlansReverse(linePlans);
|
||||
}else{
|
||||
flushPlans(linePlans);
|
||||
}
|
||||
|
||||
linePlans.clear();
|
||||
Events.fire(new LineConfirmEvent());
|
||||
}else if(mode == breaking){ //touch up while breaking, break everything in selection
|
||||
|
@ -736,21 +736,23 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
protected void showSchematicSave(){
|
||||
if(lastSchematic == null) return;
|
||||
|
||||
var last = lastSchematic;
|
||||
|
||||
ui.showTextInput("@schematic.add", "@name", "", text -> {
|
||||
Schematic replacement = schematics.all().find(s -> s.name().equals(text));
|
||||
if(replacement != null){
|
||||
ui.showConfirm("@confirm", "@schematic.replace", () -> {
|
||||
schematics.overwrite(replacement, lastSchematic);
|
||||
schematics.overwrite(replacement, last);
|
||||
ui.showInfoFade("@schematic.saved");
|
||||
ui.schematics.showInfo(replacement);
|
||||
});
|
||||
}else{
|
||||
lastSchematic.tags.put("name", text);
|
||||
lastSchematic.tags.put("description", "");
|
||||
schematics.add(lastSchematic);
|
||||
last.tags.put("name", text);
|
||||
last.tags.put("description", "");
|
||||
schematics.add(last);
|
||||
ui.showInfoFade("@schematic.saved");
|
||||
ui.schematics.showInfo(lastSchematic);
|
||||
Events.fire(new SchematicCreateEvent(lastSchematic));
|
||||
ui.schematics.showInfo(last);
|
||||
Events.fire(new SchematicCreateEvent(last));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -942,6 +944,18 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
}
|
||||
|
||||
protected void flushPlansReverse(Seq<BuildPlan> plans){
|
||||
//reversed iteration.
|
||||
for(int i = plans.size - 1; i >= 0; i--){
|
||||
var plan = plans.get(i);
|
||||
if(plan.block != null && validPlace(plan.x, plan.y, plan.block, plan.rotation)){
|
||||
BuildPlan copy = plan.copy();
|
||||
plan.block.onNewPlan(copy);
|
||||
player.unit().addBuild(copy, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void flushPlans(Seq<BuildPlan> plans){
|
||||
for(var plan : plans){
|
||||
if(plan.block != null && validPlace(plan.x, plan.y, plan.block, plan.rotation)){
|
||||
|
@ -44,6 +44,8 @@ public class Item extends UnlockableContent implements Senseable{
|
||||
public int transitionFrames = 0;
|
||||
/** Ticks in-between animation frames. */
|
||||
public float frameTime = 5f;
|
||||
/** If true, this material is used by buildings. If false, this material will be incinerated in certain cores. */
|
||||
public boolean buildable = true;
|
||||
|
||||
public Item(String name, Color color){
|
||||
super(name);
|
||||
|
@ -109,8 +109,8 @@ public class Sector{
|
||||
}
|
||||
|
||||
public boolean isAttacked(){
|
||||
if(isBeingPlayed()) return state.rules.waves;
|
||||
return save != null && info.waves && info.hasCore;
|
||||
if(isBeingPlayed()) return state.rules.waves || state.rules.attackMode;
|
||||
return save != null && (info.waves || info.attack) && info.hasCore;
|
||||
}
|
||||
|
||||
/** @return whether the player has a base here. */
|
||||
@ -155,7 +155,8 @@ public class Sector{
|
||||
}
|
||||
|
||||
public boolean isCaptured(){
|
||||
return save != null && !info.waves;
|
||||
if(isBeingPlayed()) return !info.waves && !info.attack;
|
||||
return save != null && !info.waves && !info.attack;
|
||||
}
|
||||
|
||||
public boolean hasSave(){
|
||||
|
@ -756,6 +756,9 @@ public class UnitType extends UnlockableContent{
|
||||
out[i] = new ItemStack(stacks[i].item, UI.roundAmount((int)(Math.pow(stacks[i].amount, 1.1) * researchCostMultiplier)));
|
||||
}
|
||||
|
||||
//remove zero-requirements for automatic unlocks
|
||||
out = Structs.filter(ItemStack.class, out, stack -> stack.amount > 0);
|
||||
|
||||
cachedRequirements = out;
|
||||
|
||||
return out;
|
||||
|
@ -33,6 +33,7 @@ public class CoreBlock extends StorageBlock{
|
||||
public @Load(value = "@-thruster2", fallback = "clear-effect") TextureRegion thruster2; //bot left
|
||||
public float thrusterLength = 14f/4f;
|
||||
public boolean isFirstTier;
|
||||
public boolean incinerateNonBuildable = false;
|
||||
|
||||
public UnitType unitType = UnitTypes.alpha;
|
||||
|
||||
@ -388,11 +389,14 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void handleStack(Item item, int amount, Teamc source){
|
||||
int realAmount = Math.min(amount, storageCapacity - items.get(item));
|
||||
boolean incinerate = incinerateNonBuildable && !item.buildable;
|
||||
int realAmount = incinerate ? 0 : Math.min(amount, storageCapacity - items.get(item));
|
||||
super.handleStack(item, realAmount, source);
|
||||
|
||||
if(team == state.rules.defaultTeam && state.isCampaign()){
|
||||
state.rules.sector.info.handleCoreItem(item, amount);
|
||||
if(!incinerate){
|
||||
state.rules.sector.info.handleCoreItem(item, amount);
|
||||
}
|
||||
|
||||
if(realAmount == 0 && wasVisible){
|
||||
Fx.coreBurn.at(x, y);
|
||||
@ -489,12 +493,14 @@ public class CoreBlock extends StorageBlock{
|
||||
|
||||
@Override
|
||||
public void handleItem(Building source, Item item){
|
||||
boolean incinerate = incinerateNonBuildable && !item.buildable;
|
||||
|
||||
if(net.server() || !net.active()){
|
||||
if(team == state.rules.defaultTeam && state.isCampaign()){
|
||||
if(team == state.rules.defaultTeam && state.isCampaign() && !incinerate){
|
||||
state.rules.sector.info.handleCoreItem(item, 1);
|
||||
}
|
||||
|
||||
if(items.get(item) >= storageCapacity){
|
||||
if(items.get(item) >= storageCapacity || incinerate){
|
||||
//create item incineration effect at random intervals
|
||||
if(!noEffect){
|
||||
incinerateEffect(this, source);
|
||||
@ -503,7 +509,7 @@ public class CoreBlock extends StorageBlock{
|
||||
}else{
|
||||
super.handleItem(source, item);
|
||||
}
|
||||
}else if(state.rules.coreIncinerates && items.get(item) >= storageCapacity && !noEffect){
|
||||
}else if(((state.rules.coreIncinerates && items.get(item) >= storageCapacity) || incinerate) && !noEffect){
|
||||
//create item incineration effect at random intervals
|
||||
incinerateEffect(this, source);
|
||||
noEffect = false;
|
||||
|
@ -144,7 +144,7 @@ public class Reconstructor extends UnitBlock{
|
||||
var upgrade = upgrade(pay.unit.type);
|
||||
|
||||
if(upgrade != null){
|
||||
if(!upgrade.unlockedNowHost()){
|
||||
if(!upgrade.unlockedNowHost() && !team.isAI()){
|
||||
//flash "not researched"
|
||||
pay.showOverlay(Icon.tree);
|
||||
}
|
||||
@ -155,7 +155,7 @@ public class Reconstructor extends UnitBlock{
|
||||
}
|
||||
}
|
||||
|
||||
return upgrade != null && upgrade.unlockedNowHost() && !upgrade.isBanned();
|
||||
return upgrade != null && (team.isAI() || upgrade.unlockedNowHost()) && !upgrade.isBanned();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -259,7 +259,7 @@ public class Reconstructor extends UnitBlock{
|
||||
if(payload == null) return null;
|
||||
|
||||
UnitType t = upgrade(payload.unit.type);
|
||||
return t != null && t.unlockedNowHost() ? t : null;
|
||||
return t != null && (t.unlockedNowHost() || team.isAI()) ? t : null;
|
||||
}
|
||||
|
||||
public boolean constructing(){
|
||||
@ -268,7 +268,7 @@ public class Reconstructor extends UnitBlock{
|
||||
|
||||
public boolean hasUpgrade(UnitType type){
|
||||
UnitType t = upgrade(type);
|
||||
return t != null && t.unlockedNowHost() && !type.isBanned();
|
||||
return t != null && (t.unlockedNowHost() || team.isAI()) && !type.isBanned();
|
||||
}
|
||||
|
||||
public UnitType upgrade(UnitType type){
|
||||
|
Loading…
Reference in New Issue
Block a user