Anuken/Mindustry-Suggestions/issues/1808 / Less fire in rain

This commit is contained in:
Anuken
2021-01-17 15:54:43 -05:00
parent 634d9d1a40
commit 6a63956b71
4 changed files with 18 additions and 6 deletions

View File

@@ -92,8 +92,8 @@ public class Vars implements Loadable{
public static final float turnDuration = 2 * Time.toMinutes;
/** chance of an invasion per turn, 1 = 100% */
public static final float baseInvasionChance = 1f / 100f;
/** how many turns have to pass before invasions start */
public static final int invasionGracePeriod = 20;
/** how many minutes have to pass before invasions in a *captured* sector start */
public static final float invasionGracePeriod = 20;
/** min armor fraction damage; e.g. 0.05 = at least 5% damage */
public static final float minArmorDamage = 0.1f;
/** launch animation duration */

View File

@@ -10,6 +10,7 @@ import mindustry.entities.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@@ -38,13 +39,15 @@ abstract class FireComp implements Timedc, Posc, Firec, Syncc{
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()){
return;
}
if(time >= lifetime() || tile == null){
if(time >= lifetime || tile == null){
remove();
return;
}

View File

@@ -63,6 +63,8 @@ public class SectorInfo{
public int spawnPosition;
/** How long the player has been playing elsewhere. */
public float secondsPassed;
/** How many minutes this sector has been captured. */
public float minutesCaptured;
/** Display name. */
public @Nullable String name;
/** Displayed icon. */

View File

@@ -148,6 +148,13 @@ public class Universe{
for(Sector sector : planet.sectors){
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
if(!sector.isBeingPlayed()){
@@ -216,11 +223,11 @@ public class Universe{
}
//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);
//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;
//assign invasion-related things