Support for weather in rules / Sector weather
This commit is contained in:
@@ -7,6 +7,7 @@ import arc.graphics.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.io.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.type.Weather.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
/**
|
||||
@@ -82,6 +83,8 @@ public class Rules{
|
||||
public boolean drawDarkness = true;
|
||||
/** Starting items put in cores */
|
||||
public Array<ItemStack> loadout = Array.with(ItemStack.with(Items.copper, 100));
|
||||
/** Weather events that occur here. */
|
||||
public Array<WeatherEntry> weather = new Array<>(1);
|
||||
/** Blocks that cannot be placed. */
|
||||
public ObjectSet<Block> bannedBlocks = new ObjectSet<>();
|
||||
/** Whether everything is dark. Enables lights. Experimental. */
|
||||
|
||||
@@ -6,8 +6,9 @@ import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
import static mindustry.Vars.state;
|
||||
|
||||
/** Updates the campaign universe. Has no relevance to other gamemodes. */
|
||||
public class Universe{
|
||||
private long seconds;
|
||||
private float secondCounter;
|
||||
@@ -48,6 +49,7 @@ public class Universe{
|
||||
//update sector light
|
||||
float light = state.getSector().getLight();
|
||||
float alpha = Mathf.clamp(Mathf.map(light, 0f, 0.8f, 0.1f, 1f));
|
||||
|
||||
//assign and map so darkness is not 100% dark
|
||||
state.rules.ambientLight.a = 1f - alpha;
|
||||
state.rules.lighting = !Mathf.equal(alpha, 1f);
|
||||
|
||||
Reference in New Issue
Block a user