Anuken/Mindustry-Suggestions/issues/1808 / Less fire in rain
This commit is contained in:
@@ -92,8 +92,8 @@ public class Vars implements Loadable{
|
|||||||
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 / 100f;
|
public static final float baseInvasionChance = 1f / 100f;
|
||||||
/** how many turns have to pass before invasions start */
|
/** how many minutes have to pass before invasions in a *captured* sector start */
|
||||||
public static final int invasionGracePeriod = 20;
|
public static final float 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 */
|
||||||
public static final float minArmorDamage = 0.1f;
|
public static final float minArmorDamage = 0.1f;
|
||||||
/** launch animation duration */
|
/** launch animation duration */
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import mindustry.entities.*;
|
|||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@@ -38,13 +39,15 @@ abstract class FireComp implements Timedc, Posc, Firec, Syncc{
|
|||||||
control.sound.loop(Sounds.fire, this, 0.07f);
|
control.sound.loop(Sounds.fire, this, 0.07f);
|
||||||
}
|
}
|
||||||
|
|
||||||
time = Mathf.clamp(time + Time.delta, 0, lifetime());
|
//faster updates -> disappears more quickly
|
||||||
|
float speedMultiplier = 1f + Math.max(state.envAttrs.get(Attribute.water) * 10f, 0);
|
||||||
|
time = Mathf.clamp(time + Time.delta * speedMultiplier, 0, lifetime);
|
||||||
|
|
||||||
if(Vars.net.client()){
|
if(Vars.net.client()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(time >= lifetime() || tile == null){
|
if(time >= lifetime || tile == null){
|
||||||
remove();
|
remove();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ public class SectorInfo{
|
|||||||
public int spawnPosition;
|
public int spawnPosition;
|
||||||
/** How long the player has been playing elsewhere. */
|
/** How long the player has been playing elsewhere. */
|
||||||
public float secondsPassed;
|
public float secondsPassed;
|
||||||
|
/** How many minutes this sector has been captured. */
|
||||||
|
public float minutesCaptured;
|
||||||
/** Display name. */
|
/** Display name. */
|
||||||
public @Nullable String name;
|
public @Nullable String name;
|
||||||
/** Displayed icon. */
|
/** Displayed icon. */
|
||||||
|
|||||||
@@ -148,6 +148,13 @@ public class Universe{
|
|||||||
for(Sector sector : planet.sectors){
|
for(Sector sector : planet.sectors){
|
||||||
if(sector.hasSave() && sector.hasBase()){
|
if(sector.hasSave() && sector.hasBase()){
|
||||||
|
|
||||||
|
//if it is being attacked, capture time is 0; otherwise, increment the timer
|
||||||
|
if(sector.isAttacked()){
|
||||||
|
sector.info.minutesCaptured = 0;
|
||||||
|
}else{
|
||||||
|
sector.info.minutesCaptured += turnDuration / 60 / 60;
|
||||||
|
}
|
||||||
|
|
||||||
//increment seconds passed for this sector by the time that just passed with this turn
|
//increment seconds passed for this sector by the time that just passed with this turn
|
||||||
if(!sector.isBeingPlayed()){
|
if(!sector.isBeingPlayed()){
|
||||||
|
|
||||||
@@ -216,11 +223,11 @@ public class Universe{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//queue random invasions
|
//queue random invasions
|
||||||
if(!sector.isAttacked() && turn > invasionGracePeriod && sector.info.hasSpawns){
|
if(!sector.isAttacked() && sector.info.minutesCaptured > invasionGracePeriod && sector.info.hasSpawns){
|
||||||
int count = sector.near().count(Sector::hasEnemyBase);
|
int count = sector.near().count(Sector::hasEnemyBase);
|
||||||
|
|
||||||
//invasion chance depends on # of nearby bases
|
//invasion chance depends on # of nearby bases
|
||||||
if(count > 0 && Mathf.chance(baseInvasionChance * (0.75f + (count - 1) * 0.3f))){
|
if(count > 0 && Mathf.chance(baseInvasionChance * (0.8f + (count - 1) * 0.3f))){
|
||||||
int waveMax = Math.max(sector.info.winWave, sector.isBeingPlayed() ? state.wave : sector.info.wave + sector.info.wavesPassed) + Mathf.random(2, 4) * 5;
|
int waveMax = Math.max(sector.info.winWave, sector.isBeingPlayed() ? state.wave : sector.info.wave + sector.info.wavesPassed) + Mathf.random(2, 4) * 5;
|
||||||
|
|
||||||
//assign invasion-related things
|
//assign invasion-related things
|
||||||
|
|||||||
Reference in New Issue
Block a user