Oyxgen env

This commit is contained in:
Anuken
2021-08-20 10:06:16 -04:00
parent cd7103e3f4
commit f0a8c6e281
3 changed files with 17 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import mindustry.content.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.meta.*;
import static mindustry.Vars.*;
@@ -17,7 +18,7 @@ public class Fires{
/** Start a fire on the tile. If there already is a fire there, refreshes its lifetime. */
public static void create(Tile tile){
if(net.client() || tile == null || !state.rules.fire) return; //not clientside.
if(net.client() || tile == null || !state.rules.fire || !state.rules.hasEnv(Env.oxygen)) return; //not clientside.
Fire fire = map.get(tile.pos());

View File

@@ -81,7 +81,7 @@ public class Rules{
/** Base unit cap. Can still be increased by blocks. */
public int unitCap = 0;
/** Environmental flags that dictate visuals & how blocks function. */
public int environment = Env.terrestrial | Env.spores | Env.groundOil | Env.groundWater;
public int environment = Env.terrestrial | Env.spores | Env.groundOil | Env.groundWater | Env.oxygen;
/** Attributes of the environment. */
public Attributes attributes = new Attributes();
/** Sector for saves that have them. */
@@ -140,6 +140,10 @@ public class Rules{
}
}
public boolean hasEnv(int env){
return (environment & env) != 0;
}
public float unitBuildSpeed(Team team){
return unitBuildSpeedMultiplier * teams.get(team).unitBuildSpeedMultiplier;
}

View File

@@ -3,12 +3,22 @@ package mindustry.world.meta;
/** Environmental flags for different types of locations. */
public class Env{
public static final int
//is on a planet
terrestrial = 1,
//is in space, no atmosphere
space = 1 << 1,
//is underwater, on a planet
underwater = 1 << 2,
//has a spores
spores = 1 << 3,
//has a scorching env effect
scorching = 1 << 4,
//has oil reservoirs
groundOil = 1 << 5,
//has water reservoirs
groundWater = 1 << 6,
//has oxygen in the atmosphere
oxygen = 1 << 7,
//all attributes combined, only used for bitmasking purposes
any = 0xffffffff;
}