Separate ambient light and solar panel efficiency (#1593)

* new branch

* Separate ambient light and solar panel efficiency

* Made ambient light -> solar efficiency default
This commit is contained in:
DeltaNedas
2020-02-21 16:38:56 +00:00
committed by GitHub
parent de560ac6f8
commit fe22d334dc
4 changed files with 6 additions and 1 deletions

View File

@@ -788,6 +788,7 @@ rules.title.unit = Units
rules.title.experimental = Experimental rules.title.experimental = Experimental
rules.lighting = Lighting rules.lighting = Lighting
rules.ambientlight = Ambient Light rules.ambientlight = Ambient Light
rules.solarpowermultiplier = Solar Power Multiplier
content.item.name = Items content.item.name = Items
content.liquid.name = Liquids content.liquid.name = Liquids

View File

@@ -82,6 +82,9 @@ public class Rules{
public boolean lighting = false; public boolean lighting = false;
/** Ambient light color, used when lighting is enabled. */ /** Ambient light color, used when lighting is enabled. */
public Color ambientLight = new Color(0.01f, 0.01f, 0.04f, 0.99f); public Color ambientLight = new Color(0.01f, 0.01f, 0.04f, 0.99f);
/** Multiplier for solar panel power output.
negative = use ambient light if lighting is enabled. */
public float solarPowerMultiplier = -1f;
/** team of the player by default */ /** team of the player by default */
public Team defaultTeam = Team.sharded; public Team defaultTeam = Team.sharded;
/** team of the enemy in waves/sectors */ /** team of the enemy in waves/sectors */

View File

@@ -172,6 +172,7 @@ public class CustomRulesDialog extends FloatingDialog{
number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200)); number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200));
title("$rules.title.experimental"); title("$rules.title.experimental");
number("$rules.solarpowermultiplier", f -> rules.solarPowerMultiplier = f, () -> rules.solarPowerMultiplier);
check("$rules.lighting", b -> rules.lighting = b, () -> rules.lighting); check("$rules.lighting", b -> rules.lighting = b, () -> rules.lighting);
main.addButton(b -> { main.addButton(b -> {

View File

@@ -17,7 +17,7 @@ public class SolarGenerator extends PowerGenerator{
@Override @Override
public void update(Tile tile){ public void update(Tile tile){
tile.<GeneratorEntity>ent().productionEfficiency = state.rules.lighting ? 1f - state.rules.ambientLight.a : 1f; tile.<GeneratorEntity>ent().productionEfficiency = state.rules.solarPowerMultiplier < 0 ? (state.rules.lighting ? 1f - state.rules.ambientLight.a : 1f) : state.rules.solarPowerMultiplier;
} }
@Override @Override