From f0a8c6e281d9a112f72a46457fa1f674afa46439 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 20 Aug 2021 10:06:16 -0400 Subject: [PATCH] Oyxgen env --- core/src/mindustry/entities/Fires.java | 3 ++- core/src/mindustry/game/Rules.java | 6 +++++- core/src/mindustry/world/meta/Env.java | 10 ++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/entities/Fires.java b/core/src/mindustry/entities/Fires.java index 2ae2253356..7c84258bf8 100644 --- a/core/src/mindustry/entities/Fires.java +++ b/core/src/mindustry/entities/Fires.java @@ -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()); diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index 3354f223f4..51d9b86f72 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -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; } diff --git a/core/src/mindustry/world/meta/Env.java b/core/src/mindustry/world/meta/Env.java index 6ebe3a6227..1355087484 100644 --- a/core/src/mindustry/world/meta/Env.java +++ b/core/src/mindustry/world/meta/Env.java @@ -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; }