60% Complete.

This commit is contained in:
NgLamVN
2020-11-27 15:28:21 +07:00
committed by GitHub
38 changed files with 162 additions and 101 deletions
+4 -1
View File
@@ -23,7 +23,7 @@ gameover.waiting = [accent]Waiting for next map...
highscore = [accent]New highscore! highscore = [accent]New highscore!
copied = Copied. copied = Copied.
indev.notready = This part of the game isn't ready yet indev.notready = This part of the game isn't ready yet
indev.campaign = [accent]You've reached the end of the campaign![]\n\nThis is as far as the content goes. Interplanetary travel will be added in future updates. indev.campaign = [accent]Congratulations! You've reached the end of the campaign![]\n\nThis is as far as the content goes right now. Interplanetary travel will be added in future updates.
load.sound = Sounds load.sound = Sounds
load.map = Maps load.map = Maps
@@ -149,6 +149,9 @@ unlocked = New content unlocked!
available = New research available! available = New research available!
completed = [accent]Completed completed = [accent]Completed
techtree = Tech Tree techtree = Tech Tree
research.legacy = [accent]5.0[] research data found.\nDo you want to [accent]load this data[], or [accent]discard it[] and restart research in the new campaign (recommended)?
research.load = Load
research.discard = Discard
research.list = [lightgray]Research: research.list = [lightgray]Research:
research = Research research = Research
researched = [lightgray]{0} researched. researched = [lightgray]{0} researched.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -88,7 +88,7 @@ public class Vars implements Loadable{
/** duration of time between turns in ticks */ /** duration of time between turns in ticks */
public static final float turnDuration = 2 * Time.toMinutes; public static final float turnDuration = 2 * Time.toMinutes;
/** chance of an invasion per turn, 1 = 100% */ /** chance of an invasion per turn, 1 = 100% */
public static final float baseInvasionChance = 1f / 75f; public static final float baseInvasionChance = 1f / 85f;
/** how many turns have to pass before invasions start */ /** how many turns have to pass before invasions start */
public static final int invasionGracePeriod = 20; public static final int invasionGracePeriod = 20;
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */ /** min armor fraction damage; e.g. 0.05 = at least 5% damage */
+1 -1
View File
@@ -67,7 +67,7 @@ public class FormationAI extends AIController implements FormationMember{
if(core != null && leader.mineTile.drop() != null && unit.within(core, unit.type.range) && !unit.acceptsItem(leader.mineTile.drop())){ if(core != null && leader.mineTile.drop() != null && unit.within(core, unit.type.range) && !unit.acceptsItem(leader.mineTile.drop())){
if(core.acceptStack(unit.stack.item, unit.stack.amount, unit) > 0){ if(core.acceptStack(unit.stack.item, unit.stack.amount, unit) > 0){
Call.transferItemTo(unit.stack.item, unit.stack.amount, unit.x, unit.y, core); Call.transferItemTo(unit, unit.stack.item, unit.stack.amount, unit.x, unit.y, core);
unit.clearItem(); unit.clearItem();
} }
+1 -1
View File
@@ -65,7 +65,7 @@ public class MinerAI extends AIController{
if(unit.within(core, unit.type.range)){ if(unit.within(core, unit.type.range)){
if(core.acceptStack(unit.stack.item, unit.stack.amount, unit) > 0){ if(core.acceptStack(unit.stack.item, unit.stack.amount, unit) > 0){
Call.transferItemTo(unit.stack.item, unit.stack.amount, unit.x, unit.y, core); Call.transferItemTo(unit, unit.stack.item, unit.stack.amount, unit.x, unit.y, core);
} }
unit.clearItem(); unit.clearItem();
+1 -1
View File
@@ -1388,7 +1388,7 @@ public class Blocks implements ContentList{
size = 5; size = 5;
unitCapModifier = 24; unitCapModifier = 24;
researchCostMultiplier = 0.05f; researchCostMultiplier = 0.06f;
}}; }};
vault = new StorageBlock("vault"){{ vault = new StorageBlock("vault"){{
+1 -15
View File
@@ -37,7 +37,7 @@ public class Bullets implements ContentList{
waterShot, cryoShot, slagShot, oilShot, heavyWaterShot, heavyCryoShot, heavySlagShot, heavyOilShot, waterShot, cryoShot, slagShot, oilShot, heavyWaterShot, heavyCryoShot, heavySlagShot, heavyOilShot,
//environment, misc. //environment, misc.
damageLightning, damageLightningGround, fireball, basicFlame, pyraFlame, driverBolt, healBullet, healBulletBig; damageLightning, damageLightningGround, fireball, basicFlame, pyraFlame, driverBolt;
@Override @Override
public void load(){ public void load(){
@@ -374,20 +374,6 @@ public class Bullets implements ContentList{
knockback = 0.7f; knockback = 0.7f;
}}; }};
healBullet = new LaserBoltBulletType(5.2f, 13){{
healPercent = 3f;
collidesTeam = true;
backColor = Pal.heal;
frontColor = Color.white;
}};
healBulletBig = new LaserBoltBulletType(5.2f, 15){{
healPercent = 5.5f;
collidesTeam = true;
backColor = Pal.heal;
frontColor = Color.white;
}};
fireball = new BulletType(1f, 4){ fireball = new BulletType(1f, 4){
{ {
pierce = true; pierce = true;
+4 -4
View File
@@ -98,11 +98,11 @@ public class TechTree implements ContentList{
node(platedConduit, () -> { node(platedConduit, () -> {
}); });
});
node(rotaryPump, () -> { node(rotaryPump, () -> {
node(thermalPump, () -> { node(thermalPump, () -> {
});
}); });
}); });
}); });
@@ -422,7 +422,7 @@ public class TechTree implements ContentList{
node(additiveReconstructor, Seq.with(new SectorComplete(biomassFacility)), () -> { node(additiveReconstructor, Seq.with(new SectorComplete(biomassFacility)), () -> {
node(multiplicativeReconstructor, () -> { node(multiplicativeReconstructor, () -> {
node(exponentialReconstructor, () -> { node(exponentialReconstructor, Seq.with(new SectorComplete(overgrowth)), () -> {
node(tetrativeReconstructor, () -> { node(tetrativeReconstructor, () -> {
}); });
+21 -7
View File
@@ -292,6 +292,7 @@ public class UnitTypes implements ContentList{
shootSound = Sounds.lasershoot; shootSound = Sounds.lasershoot;
bullet = new LaserBoltBulletType(5.2f, 14){{ bullet = new LaserBoltBulletType(5.2f, 14){{
lifetime = 37f;
healPercent = 5f; healPercent = 5f;
collidesTeam = true; collidesTeam = true;
backColor = Pal.heal; backColor = Pal.heal;
@@ -311,7 +312,7 @@ public class UnitTypes implements ContentList{
mineTier = 2; mineTier = 2;
mineSpeed = 5f; mineSpeed = 5f;
commandLimit = 8; commandLimit = 9;
abilities.add(new ShieldRegenFieldAbility(20f, 40f, 60f * 5, 60f)); abilities.add(new ShieldRegenFieldAbility(20f, 40f, 60f * 5, 60f));
ammoType = AmmoTypes.power; ammoType = AmmoTypes.power;
@@ -975,7 +976,7 @@ public class UnitTypes implements ContentList{
zenith = new UnitType("zenith"){{ zenith = new UnitType("zenith"){{
health = 700; health = 700;
speed = 1.7f; speed = 1.8f;
accel = 0.04f; accel = 0.04f;
drag = 0.016f; drag = 0.016f;
flying = true; flying = true;
@@ -997,7 +998,7 @@ public class UnitTypes implements ContentList{
velocityRnd = 0.2f; velocityRnd = 0.2f;
shootSound = Sounds.missile; shootSound = Sounds.missile;
bullet = new MissileBulletType(3f, 12){{ bullet = new MissileBulletType(3f, 14){{
width = 8f; width = 8f;
height = 8f; height = 8f;
shrinkY = 0f; shrinkY = 0f;
@@ -1005,7 +1006,7 @@ public class UnitTypes implements ContentList{
homingRange = 60f; homingRange = 60f;
keepVelocity = false; keepVelocity = false;
splashDamageRadius = 25f; splashDamageRadius = 25f;
splashDamage = 10f; splashDamage = 14f;
lifetime = 60f; lifetime = 60f;
trailColor = Pal.unitBack; trailColor = Pal.unitBack;
backColor = Pal.unitBack; backColor = Pal.unitBack;
@@ -1264,6 +1265,7 @@ public class UnitTypes implements ContentList{
engineSize = 3f; engineSize = 3f;
payloadCapacity = (2 * 2) * tilePayload; payloadCapacity = (2 * 2) * tilePayload;
buildSpeed = 2.6f; buildSpeed = 2.6f;
isCounted = false;
ammoType = AmmoTypes.power; ammoType = AmmoTypes.power;
@@ -1274,7 +1276,13 @@ public class UnitTypes implements ContentList{
x = 8f; x = 8f;
y = -6f; y = -6f;
rotate = true; rotate = true;
bullet = Bullets.healBulletBig; bullet = new LaserBoltBulletType(5.2f, 10){{
lifetime = 35f;
healPercent = 5.5f;
collidesTeam = true;
backColor = Pal.heal;
frontColor = Color.white;
}};
}}, }},
new Weapon("heal-weapon-mount"){{ new Weapon("heal-weapon-mount"){{
shootSound = Sounds.lasershoot; shootSound = Sounds.lasershoot;
@@ -1282,7 +1290,13 @@ public class UnitTypes implements ContentList{
x = 4f; x = 4f;
y = 5f; y = 5f;
rotate = true; rotate = true;
bullet = Bullets.healBullet; bullet = new LaserBoltBulletType(5.2f, 8){{
lifetime = 35f;
healPercent = 3f;
collidesTeam = true;
backColor = Pal.heal;
frontColor = Color.white;
}};
}}); }});
}}; }};
@@ -1349,7 +1363,7 @@ public class UnitTypes implements ContentList{
collides = false; collides = false;
healPercent = 15f; healPercent = 15f;
splashDamage = 240f; splashDamage = 230f;
splashDamageRadius = 120f; splashDamageRadius = 120f;
}}; }};
}}); }});
+5 -3
View File
@@ -53,10 +53,11 @@ public class Weathers implements ContentList{
baseSpeed = 5.4f; baseSpeed = 5.4f;
attrs.set(Attribute.light, -0.1f); attrs.set(Attribute.light, -0.1f);
attrs.set(Attribute.water, -0.1f); attrs.set(Attribute.water, -0.1f);
opacityMultiplier = 0.5f; opacityMultiplier = 0.4f;
force = 0.1f; force = 0.1f;
sound = Sounds.wind; sound = Sounds.wind;
soundVol = 0.3f; soundVol = 0.8f;
duration = 7f * Time.toMinutes;
}}; }};
sporestorm = new ParticleWeather("sporestorm"){{ sporestorm = new ParticleWeather("sporestorm"){{
@@ -77,7 +78,8 @@ public class Weathers implements ContentList{
opacityMultiplier = 0.75f; opacityMultiplier = 0.75f;
force = 0.1f; force = 0.1f;
sound = Sounds.wind; sound = Sounds.wind;
soundVol = 0.3f; soundVol = 0.7f;
duration = 7f * Time.toMinutes;
}}; }};
fog = new ParticleWeather("fog"){{ fog = new ParticleWeather("fog"){{
+17
View File
@@ -334,10 +334,27 @@ public class Control implements ApplicationListener, Loadable{
state.wave = 1; state.wave = 1;
//set up default wave time //set up default wave time
state.wavetime = state.rules.waveSpacing * 2f; state.wavetime = state.rules.waveSpacing * 2f;
//reset captured state
sector.info.wasCaptured = false;
//reset win wave?? //reset win wave??
state.rules.winWave = state.rules.attackMode ? -1 : sector.preset != null ? sector.preset.captureWave : 40; state.rules.winWave = state.rules.attackMode ? -1 : sector.preset != null ? sector.preset.captureWave : 40;
//if there's still an enemy base left, fix it
if(state.rules.attackMode){
//replace all broken blocks
for(var plan : state.rules.waveTeam.data().blocks){
Tile tile = world.tile(plan.x, plan.y);
if(tile != null){
tile.setBlock(content.block(plan.block), state.rules.waveTeam, plan.rotation);
if(plan.config != null && tile.build != null){
tile.build.configure(plan.config);
}
}
}
state.rules.waveTeam.data().blocks.clear();
}
//kill all units, since they should be dead anyway //kill all units, since they should be dead anyway
Groups.unit.clear(); Groups.unit.clear();
Groups.fire.clear(); Groups.fire.clear();
+9
View File
@@ -109,6 +109,13 @@ public class Logic implements ApplicationListener{
} }
state.rules.waveTeam.rules().aiTier = state.getSector().threat * 0.8f; state.rules.waveTeam.rules().aiTier = state.getSector().threat * 0.8f;
state.rules.waveTeam.rules().infiniteResources = true; state.rules.waveTeam.rules().infiniteResources = true;
//fill enemy cores by default.
for(var core : state.rules.waveTeam.cores()){
for(Item item : content.items()){
core.items.set(item, core.block.itemCapacity);
}
}
} }
//save settings //save settings
@@ -260,6 +267,8 @@ public class Logic implements ApplicationListener{
if(state.rules.sector == null) return; if(state.rules.sector == null) return;
state.rules.sector.info.wasCaptured = true;
//fire capture event //fire capture event
Events.fire(new SectorCaptureEvent(state.rules.sector)); Events.fire(new SectorCaptureEvent(state.rules.sector));
+5
View File
@@ -447,6 +447,11 @@ public class NetServer implements ApplicationListener{
return; return;
} }
if(currentlyKicking[0].target.team() != player.team()){
player.sendMessage("[scarlet]You can't vote for other teams.");
return;
}
if(!arg[0].toLowerCase().equals("y") && !arg[0].toLowerCase().equals("n")){ if(!arg[0].toLowerCase().equals("y") && !arg[0].toLowerCase().equals("n")){
player.sendMessage("[scarlet]Vote either 'y' (yes) or 'n' (no)."); player.sendMessage("[scarlet]Vote either 'y' (yes) or 'n' (no).");
return; return;
+11 -5
View File
@@ -2,7 +2,6 @@ package mindustry.entities;
import arc.*; import arc.*;
import arc.func.*; import arc.func.*;
import arc.graphics.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*; import arc.math.geom.*;
import arc.struct.*; import arc.struct.*;
@@ -33,15 +32,22 @@ public class Damage{
private static Unit tmpUnit; private static Unit tmpUnit;
/** Creates a dynamic explosion based on specified parameters. */ /** Creates a dynamic explosion based on specified parameters. */
public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, Color color, boolean damage){ public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, boolean damage){
dynamicExplosion(x, y, flammability, explosiveness, power, radius, damage, true, null);
}
/** Creates a dynamic explosion based on specified parameters. */
public static void dynamicExplosion(float x, float y, float flammability, float explosiveness, float power, float radius, boolean damage, boolean fire, @Nullable Team ignoreTeam){
if(damage){ if(damage){
for(int i = 0; i < Mathf.clamp(power / 20, 0, 6); i++){ for(int i = 0; i < Mathf.clamp(power / 20, 0, 6); i++){
int branches = 5 + Mathf.clamp((int)(power / 30), 1, 20); int branches = 5 + Mathf.clamp((int)(power / 30), 1, 20);
Time.run(i * 2f + Mathf.random(4f), () -> Lightning.create(Team.derelict, Pal.power, 3, x, y, Mathf.random(360f), branches + Mathf.range(2))); Time.run(i * 2f + Mathf.random(4f), () -> Lightning.create(Team.derelict, Pal.power, 3, x, y, Mathf.random(360f), branches + Mathf.range(2)));
} }
for(int i = 0; i < Mathf.clamp(flammability / 4, 0, 30); i++){ if(fire){
Time.run(i / 2f, () -> Call.createBullet(Bullets.fireball, Team.derelict, x, y, Mathf.random(360f), Bullets.fireball.damage, 1, 1)); for(int i = 0; i < Mathf.clamp(flammability / 4, 0, 30); i++){
Time.run(i / 2f, () -> Call.createBullet(Bullets.fireball, Team.derelict, x, y, Mathf.random(360f), Bullets.fireball.damage, 1, 1));
}
} }
int waves = Mathf.clamp((int)(explosiveness / 4), 0, 30); int waves = Mathf.clamp((int)(explosiveness / 4), 0, 30);
@@ -49,7 +55,7 @@ public class Damage{
for(int i = 0; i < waves; i++){ for(int i = 0; i < waves; i++){
int f = i; int f = i;
Time.run(i * 2f, () -> { Time.run(i * 2f, () -> {
Damage.damage(x, y, Mathf.clamp(radius + explosiveness, 0, 50f) * ((f + 1f) / waves), explosiveness / 2f); Damage.damage(ignoreTeam, x, y, Mathf.clamp(radius + explosiveness, 0, 50f) * ((f + 1f) / waves), explosiveness / 2f, false);
Fx.blockExplosionSmoke.at(x + Mathf.range(radius), y + Mathf.range(radius)); Fx.blockExplosionSmoke.at(x + Mathf.range(radius), y + Mathf.range(radius));
}); });
} }
@@ -435,7 +435,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
} }
/** Handle a stack input. */ /** Handle a stack input. */
public void handleStack(Item item, int amount, Teamc source){ public void handleStack(Item item, int amount, @Nullable Teamc source){
noSleep(); noSleep();
items.add(item, amount); items.add(item, amount);
} }
@@ -519,6 +519,8 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
public void dumpLiquid(Liquid liquid){ public void dumpLiquid(Liquid liquid){
int dump = this.cdump; int dump = this.cdump;
if(liquids.get(liquid) <= 0.0001f) return;
if(!net.client() && state.isCampaign() && team == state.rules.defaultTeam) liquid.unlock(); if(!net.client() && state.isCampaign() && team == state.rules.defaultTeam) liquid.unlock();
for(int i = 0; i < proximity.size; i++){ for(int i = 0; i < proximity.size; i++){
@@ -970,34 +972,13 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}); });
} }
Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * block.size / 2f, Pal.darkFlame, state.rules.damageExplosions); Damage.dynamicExplosion(x, y, flammability, explosiveness * 3.5f, power, tilesize * block.size / 2f, state.rules.damageExplosions);
if(!floor().solid && !floor().isLiquid){ if(!floor().solid && !floor().isLiquid){
Effect.rubble(x, y, block.size); Effect.rubble(x, y, block.size);
} }
} }
/**
* Returns the flammability of the Used for fire calculations.
* Takes flammability of floor liquid into account.
*/
public float getFlammability(){
if(!block.hasItems){
if(floor().isLiquid && !block.solid){
return floor().liquidDrop.flammability;
}
return 0;
}else{
float result = items.sum((item, amount) -> item.flammability * amount);
if(block.hasLiquids){
result += liquids.sum((liquid, amount) -> liquid.flammability * amount / 3f);
}
return result;
}
}
public String getDisplayName(){ public String getDisplayName(){
return block.localizedName; return block.localizedName;
} }
@@ -26,7 +26,7 @@ abstract class FireComp implements Timedc, Posc, Firec, Syncc{
@Override @Override
public void update(){ public void update(){
if(Mathf.chance(0.1 * Time.delta)){ if(Mathf.chance(0.09 * Time.delta)){
Fx.fire.at(x + Mathf.range(4f), y + Mathf.range(4f)); Fx.fire.at(x + Mathf.range(4f), y + Mathf.range(4f));
} }
@@ -59,7 +59,7 @@ abstract class FireComp implements Timedc, Posc, Firec, Syncc{
} }
if(baseFlammability < 0 || block != tile.block()){ if(baseFlammability < 0 || block != tile.block()){
baseFlammability = tile.build == null ? 0 : tile.build.getFlammability(); baseFlammability = tile.build == null ? 0 : tile.getFlammability();
block = tile.block(); block = tile.block();
} }
@@ -77,12 +77,12 @@ abstract class FireComp implements Timedc, Posc, Firec, Syncc{
} }
} }
if(Mathf.chance(0.1 * Time.delta)){ if(Mathf.chance(0.025 * Time.delta)){
Puddlec p = Puddles.get(tile); Puddlec p = Puddles.get(tile);
puddleFlammability = p != null ? p.getFlammability() / 3f : 0; puddleFlammability = p != null ? p.getFlammability() / 3f : 0;
if(damage){ if(damage){
entity.damage(0.4f); entity.damage(1.6f);
} }
Damage.damageUnits(null, tile.worldx(), tile.worldy(), tilesize, 3f, Damage.damageUnits(null, tile.worldx(), tile.worldy(), tilesize, 3f,
unit -> !unit.isFlying() && !unit.isImmune(StatusEffects.burning), unit -> !unit.isFlying() && !unit.isImmune(StatusEffects.burning),
@@ -46,8 +46,8 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
} }
void wobble(){ void wobble(){
x += Mathf.sin(Time.time() + id() * 99, 25f, 0.05f) * Time.delta * elevation; x += Mathf.sin(Time.time() + (id() % 10) * 12, 25f, 0.05f) * Time.delta * elevation;
y += Mathf.cos(Time.time() + id() * 99, 25f, 0.05f) * Time.delta * elevation; y += Mathf.cos(Time.time() + (id() % 10) * 12, 25f, 0.05f) * Time.delta * elevation;
} }
void moveAt(Vec2 vector, float acceleration){ void moveAt(Vec2 vector, float acceleration){
@@ -55,7 +55,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
if(core != null && mineTile != null && mineTile.drop() != null && !acceptsItem(mineTile.drop()) && within(core, mineTransferRange) && !offloadImmediately()){ if(core != null && mineTile != null && mineTile.drop() != null && !acceptsItem(mineTile.drop()) && within(core, mineTransferRange) && !offloadImmediately()){
int accepted = core.acceptStack(item(), stack().amount, this); int accepted = core.acceptStack(item(), stack().amount, this);
if(accepted > 0){ if(accepted > 0){
Call.transferItemTo(item(), accepted, Call.transferItemTo(self(), item(), accepted,
mineTile.worldx() + Mathf.range(tilesize / 2f), mineTile.worldx() + Mathf.range(tilesize / 2f),
mineTile.worldy() + Mathf.range(tilesize / 2f), core); mineTile.worldy() + Mathf.range(tilesize / 2f), core);
clearItem(); clearItem();
@@ -77,7 +77,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
mineTimer = 0; mineTimer = 0;
if(core != null && within(core, mineTransferRange) && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){ if(core != null && within(core, mineTransferRange) && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){
Call.transferItemTo(item, 1, Call.transferItemTo(self(), item, 1,
mineTile.worldx() + Mathf.range(tilesize / 2f), mineTile.worldx() + Mathf.range(tilesize / 2f),
mineTile.worldy() + Mathf.range(tilesize / 2f), core); mineTile.worldy() + Mathf.range(tilesize / 2f), core);
}else if(acceptsItem(item)){ }else if(acceptsItem(item)){
@@ -397,9 +397,12 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
/** Actually destroys the unit, removing it and creating explosions. **/ /** Actually destroys the unit, removing it and creating explosions. **/
public void destroy(){ public void destroy(){
float explosiveness = 2f + item().explosiveness * stack().amount / 2.4f; float explosiveness = 2f + item().explosiveness * stack().amount * 1.53f;
float flammability = item().flammability * stack().amount / 2.4f; float flammability = item().flammability * stack().amount / 1.9f;
Damage.dynamicExplosion(x, y, flammability, explosiveness, 0f, bounds() / 2f, Pal.darkFlame, state.rules.damageExplosions);
if(!spawnedByCore){
Damage.dynamicExplosion(x, y, flammability, explosiveness, 0f, bounds() / 2f, state.rules.damageExplosions, item().flammability > 1, team);
}
float shake = hitSize / 3f; float shake = hitSize / 3f;
@@ -415,7 +418,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
} }
//if this unit crash landed (was flying), damage stuff in a radius //if this unit crash landed (was flying), damage stuff in a radius
if(type.flying){ if(type.flying && !spawnedByCore){
Damage.damage(team,x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true); Damage.damage(team,x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);
} }
+1 -1
View File
@@ -59,7 +59,7 @@ public class Objectives{
@Override @Override
public boolean complete(){ public boolean complete(){
return preset.sector.save != null && !preset.sector.isAttacked() && preset.sector.hasBase(); return preset.sector.save != null && (!preset.sector.isAttacked() || preset.sector.info.wasCaptured) && preset.sector.hasBase();
} }
@Override @Override
+2
View File
@@ -33,6 +33,8 @@ public class SectorInfo{
public int storageCapacity = 0; public int storageCapacity = 0;
/** Whether a core is available here. */ /** Whether a core is available here. */
public boolean hasCore = true; public boolean hasCore = true;
/** Whether this sector was ever fully captured. */
public boolean wasCaptured = false;
/** Sector that was launched from. */ /** Sector that was launched from. */
public @Nullable Sector origin; public @Nullable Sector origin;
/** Launch destination. */ /** Launch destination. */
+1 -8
View File
@@ -6,7 +6,6 @@ import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
import mindustry.io.legacy.*;
import mindustry.maps.*; import mindustry.maps.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.blocks.storage.*; import mindustry.world.blocks.storage.*;
@@ -27,13 +26,6 @@ public class Universe{
public Universe(){ public Universe(){
load(); load();
//load legacy research
Events.on(ClientLoadEvent.class, e -> {
if(Core.settings.has("unlocks")){
LegacyIO.readResearch();
}
});
//update base coverage on capture //update base coverage on capture
Events.on(SectorCaptureEvent.class, e -> { Events.on(SectorCaptureEvent.class, e -> {
if(!net.client() && state.isCampaign()){ if(!net.client() && state.isCampaign()){
@@ -188,6 +180,7 @@ public class Universe{
}else if(attacked && wavesPassed > 0 && sector.info.winWave > 1 && sector.info.wave + wavesPassed >= sector.info.winWave && !sector.hasEnemyBase()){ }else if(attacked && wavesPassed > 0 && sector.info.winWave > 1 && sector.info.wave + wavesPassed >= sector.info.winWave && !sector.hasEnemyBase()){
//autocapture the sector //autocapture the sector
sector.info.waves = false; sector.info.waves = false;
sector.info.wasCaptured = true;
//fire the event //fire the event
Events.fire(new SectorCaptureEvent(sector)); Events.fire(new SectorCaptureEvent(sector));
+6 -7
View File
@@ -96,18 +96,17 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
} }
@Remote(called = Loc.server, unreliable = true) @Remote(called = Loc.server, unreliable = true)
public static void transferItemTo(Item item, int amount, float x, float y, Building build){ public static void setItem(Building build, Item item, int amount){
if(build == null || build.items == null) return; if(build == null || build.items == null) return;
for(int i = 0; i < Mathf.clamp(amount / 5, 1, 8); i++){ build.items.set(item, amount);
Time.run(i * 3, () -> createItemTransfer(item, amount, x, y, build, () -> {}));
}
build.items.add(item, amount);
} }
@Remote(called = Loc.server, unreliable = true) @Remote(called = Loc.server, unreliable = true)
public static void transferItemTo(Unit unit, Item item, int amount, float x, float y, Building build){ public static void transferItemTo(@Nullable Unit unit, Item item, int amount, float x, float y, Building build){
if(build == null || build.items == null) return; if(build == null || build.items == null) return;
unit.stack.amount = Math.max(unit.stack.amount - amount, 0);
if(unit != null) unit.stack.amount = Math.max(unit.stack.amount - amount, 0);
for(int i = 0; i < Mathf.clamp(amount / 3, 1, 8); i++){ for(int i = 0; i < Mathf.clamp(amount / 3, 1, 8); i++){
Time.run(i * 3, () -> createItemTransfer(item, amount, x, y, build, () -> {})); Time.run(i * 3, () -> createItemTransfer(item, amount, x, y, build, () -> {}));
} }
+2 -2
View File
@@ -338,9 +338,9 @@ public class SectorDamage{
info.waveDpsSlope = reg.slope; info.waveDpsSlope = reg.slope;
//enemy units like to aim for a lot of non-essential things, so increase resulting health slightly //enemy units like to aim for a lot of non-essential things, so increase resulting health slightly
info.sumHealth = sumHealth * 1.2f; info.sumHealth = sumHealth * 1.05f;
//players tend to have longer range units/turrets, so assume DPS is higher //players tend to have longer range units/turrets, so assume DPS is higher
info.sumDps = sumDps * 1.2f; info.sumDps = sumDps * 1.05f;
info.sumRps = sumRps; info.sumRps = sumRps;
info.wavesSurvived = getWavesSurvived(info); info.wavesSurvived = getWavesSurvived(info);
+1 -1
View File
@@ -225,7 +225,7 @@ public class ContentParser{
currentContent = block; currentContent = block;
read(() -> { read(() -> {
if(value.has("consumes")){ if(value.has("consumes") && value.get("consumes").isObject()){
for(JsonValue child : value.get("consumes")){ for(JsonValue child : value.get("consumes")){
if(child.name.equals("item")){ if(child.name.equals("item")){
block.consumes.item(find(ContentType.item, child.asString())); block.consumes.item(find(ContentType.item, child.asString()));
+1 -1
View File
@@ -21,7 +21,7 @@ import static mindustry.Vars.*;
public abstract class Weather extends UnlockableContent{ public abstract class Weather extends UnlockableContent{
/** Default duration of this weather event in ticks. */ /** Default duration of this weather event in ticks. */
public float duration = 9f * Time.toMinutes; public float duration = 10f * Time.toMinutes;
public float opacityMultiplier = 1f; public float opacityMultiplier = 1f;
public Attributes attrs = new Attributes(); public Attributes attrs = new Attributes();
public Sound sound = Sounds.none; public Sound sound = Sounds.none;
@@ -23,6 +23,7 @@ import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.graphics.g3d.*; import mindustry.graphics.g3d.*;
import mindustry.input.*; import mindustry.input.*;
import mindustry.io.legacy.*;
import mindustry.maps.*; import mindustry.maps.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.ui.*; import mindustry.ui.*;
@@ -140,6 +141,13 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
return this; return this;
} }
//load legacy research
if(Core.settings.has("unlocks") && !Core.settings.has("junction-unlocked")){
Core.app.post(() -> {
ui.showCustomConfirm("@research", "@research.legacy", "@research.load", "@research.discard", LegacyIO::readResearch, () -> Core.settings.remove("unlocks"));
});
}
rebuildButtons(); rebuildButtons();
mode = look; mode = look;
selected = hovered = launchSector = null; selected = hovered = launchSector = null;
@@ -554,7 +562,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{
if(t.getChildren().any()){ if(t.getChildren().any()){
c.add(name).left().row(); c.add(name).left().row();
c.add(t).padLeft(10f).row(); c.add(t).padLeft(10f).left().row();
} }
}; };
+22
View File
@@ -103,6 +103,28 @@ public class Tile implements Position, QuadTreeObject, Displayable{
return -1; return -1;
} }
/**
* Returns the flammability of the Used for fire calculations.
* Takes flammability of floor liquid into account.
*/
public float getFlammability(){
if(!block.hasItems){
if(floor.liquidDrop != null && !block.solid){
return floor.liquidDrop.flammability;
}
return 0;
}else if(build != null){
float result = build.items.sum((item, amount) -> item.flammability * amount);
if(block.hasLiquids){
result += build.liquids.sum((liquid, amount) -> liquid.flammability * amount / 3f);
}
return result;
}
return 0;
}
/** Convenience method that returns the building of this tile with a cast. /** Convenience method that returns the building of this tile with a cast.
* Method name is shortened to prevent conflict. */ * Method name is shortened to prevent conflict. */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -56,6 +56,11 @@ public class LaunchPad extends Block{
bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity)); bars.add("items", entity -> new Bar(() -> Core.bundle.format("bar.items", entity.items.total()), () -> Pal.items, () -> (float)entity.items.total() / itemCapacity));
} }
@Override
public boolean outputsItems(){
return false;
}
public class LaunchPadBuild extends Building{ public class LaunchPadBuild extends Building{
@Override @Override
@@ -54,6 +54,7 @@ public class LaserTurret extends PowerTurret{
super.updateTile(); super.updateTile();
if(bulletLife > 0 && bullet != null){ if(bulletLife > 0 && bullet != null){
wasShooting = true;
tr.trns(rotation, size * tilesize / 2f, 0f); tr.trns(rotation, size * tilesize / 2f, 0f);
bullet.rotation(rotation); bullet.rotation(rotation);
bullet.set(x + tr.x, y + tr.y); bullet.set(x + tr.x, y + tr.y);
@@ -65,6 +66,7 @@ public class LaserTurret extends PowerTurret{
bullet = null; bullet = null;
} }
}else if(reload > 0){ }else if(reload > 0){
wasShooting = true;
Liquid liquid = liquids.current(); Liquid liquid = liquids.current();
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount; float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
@@ -76,7 +78,6 @@ public class LaserTurret extends PowerTurret{
coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f)); coolEffect.at(x + Mathf.range(size * tilesize / 2f), y + Mathf.range(size * tilesize / 2f));
} }
} }
} }
@Override @Override
@@ -205,7 +205,7 @@ public abstract class Turret extends ReloadTurret{
} }
public boolean isActive(){ public boolean isActive(){
return target != null || (logicControlled() && logicShooting) || (isControlled() && unit.isShooting()); return target != null || wasShooting;
} }
public void targetPosition(Posc pos){ public void targetPosition(Posc pos){
@@ -229,12 +229,12 @@ public class CoreBlock extends StorageBlock{
@Override @Override
public boolean acceptItem(Building source, Item item){ public boolean acceptItem(Building source, Item item){
return items.get(item) < getMaximumAccepted(item) || incinerate(); return items.get(item) < getMaximumAccepted(item);
} }
@Override @Override
public int getMaximumAccepted(Item item){ public int getMaximumAccepted(Item item){
return storageCapacity; return incinerate() ? storageCapacity * 2 : storageCapacity;
} }
@Override @Override
@@ -270,10 +270,15 @@ public class CoreBlock extends StorageBlock{
@Override @Override
public void handleStack(Item item, int amount, Teamc source){ public void handleStack(Item item, int amount, Teamc source){
super.handleStack(item, amount, source); int realAmount = Math.min(amount, storageCapacity - items.get(item));
super.handleStack(item, realAmount, source);
if(team == state.rules.defaultTeam && state.isCampaign()){ if(team == state.rules.defaultTeam && state.isCampaign()){
state.rules.sector.info.handleCoreItem(item, amount); state.rules.sector.info.handleCoreItem(item, amount);
if(realAmount == 0){
Fx.coreBurn.at(x, y);
}
} }
} }
@@ -377,7 +382,7 @@ public class CoreBlock extends StorageBlock{
state.rules.sector.info.handleCoreItem(item, 1); state.rules.sector.info.handleCoreItem(item, 1);
} }
if(items.get(item) >= getMaximumAccepted(item)){ if(items.get(item) >= storageCapacity){
//create item incineration effect at random intervals //create item incineration effect at random intervals
if(!noEffect){ if(!noEffect){
incinerateEffect(this, source); incinerateEffect(this, source);