Support for team-only lighting

This commit is contained in:
Anuken
2020-06-15 13:54:02 -04:00
parent b5660a50ca
commit 7001ad09cb
24 changed files with 90 additions and 75 deletions

View File

@@ -110,7 +110,7 @@ public class MendProjector extends Block{
@Override
public void drawLight(){
Drawf.light(x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
Drawf.light(team, x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
}
@Override

View File

@@ -67,7 +67,7 @@ public class OverdriveProjector extends Block{
@Override
public void drawLight(){
Drawf.light(x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
Drawf.light(team, x, y, 50f * efficiency(), baseColor, 0.7f * efficiency());
}
@Override

View File

@@ -115,8 +115,7 @@ public class ImpactReactor extends PowerGenerator{
@Override
public void drawLight(){
float fract = tile.<FusionReactorEntity>ent().warmup;
Drawf.light(x, y, (110f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(plasma2).lerp(plasma1, Mathf.absin(7f, 0.2f)), 0.8f * fract);
Drawf.light(team, x, y, (110f + Mathf.absin(5, 5f)) * warmup, Tmp.c1.set(plasma2).lerp(plasma1, Mathf.absin(7f, 0.2f)), 0.8f * warmup);
}
@Override

View File

@@ -85,9 +85,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
}
public class ItemLiquidGeneratorEntity extends GeneratorEntity{
public float explosiveness;
public float heat;
public float totalTime;
public float explosiveness, heat, totalTime;
@Override
public boolean productionValid(){
@@ -100,6 +98,8 @@ public class ItemLiquidGenerator extends PowerGenerator{
//Power amount is delta'd by PowerGraph class already.
float calculationDelta = delta();
heat = Mathf.lerpDelta(heat, generateTime >= 0.001f ? 1f : 0f, 0.05f);
if(!consValid()){
productionEfficiency = 0.0f;
return;
@@ -113,7 +113,6 @@ public class ItemLiquidGenerator extends PowerGenerator{
}
}
heat = Mathf.lerpDelta(heat, generateTime >= 0.001f ? 1f : 0f, 0.05f);
totalTime += heat;
//liquid takes priority over solids
@@ -175,7 +174,7 @@ public class ItemLiquidGenerator extends PowerGenerator{
@Override
public void drawLight(){
Drawf.light(x, y, (60f + Mathf.absin(10f, 5f)) * productionEfficiency * size, Color.orange, 0.5f);
Drawf.light(team, x, y, (60f + Mathf.absin(10f, 5f)) * size, Color.orange, 0.5f * heat);
}
}
}

View File

@@ -50,7 +50,7 @@ public class LightBlock extends Block{
@Override
public void drawLight(){
Drawf.light(x, y, radius, Tmp.c1.set(color), brightness * efficiency());
Drawf.light(team, x, y, radius, Tmp.c1.set(color), brightness * efficiency());
}
@Override

View File

@@ -143,7 +143,7 @@ public class NuclearReactor extends PowerGenerator{
@Override
public void drawLight(){
float fract = productionEfficiency;
Drawf.light(x, y, (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, heat), 0.6f * fract);
Drawf.light(team, x, y, (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, heat), 0.6f * fract);
}
@Override

View File

@@ -11,6 +11,7 @@ import arc.util.ArcAnnotate.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.entities.units.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.*;
@@ -131,7 +132,7 @@ public class PowerNode extends PowerBlock{
Draw.reset();
}
protected void drawLaser(float x1, float y1, float x2, float y2, float satisfaction, int size1, int size2){
protected void drawLaser(Team team, float x1, float y1, float x2, float y2, float satisfaction, int size1, int size2){
float opacity = Core.settings.getInt("lasersopacity") / 100f;
if(Mathf.zero(opacity)) return;
@@ -148,7 +149,7 @@ public class PowerNode extends PowerBlock{
Draw.color(Color.white, Pal.powerLight, fract * 0.86f + Mathf.absin(3f, 0.1f));
Draw.alpha(opacity);
Drawf.laser(laser, laserEnd, x1, y1, x2, y2, 0.25f);
Drawf.laser(team, laser, laserEnd, x1, y1, x2, y2, 0.25f);
Draw.color();
}
@@ -213,7 +214,7 @@ public class PowerNode extends PowerBlock{
if(otherReq == null || otherReq.block == null) return;
drawLaser(req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy(), 1f, size, otherReq.block.size);
drawLaser(player.team(), req.drawx(), req.drawy(), otherReq.drawx(), otherReq.drawy(), 1f, size, otherReq.block.size);
}
}
}
@@ -386,7 +387,7 @@ public class PowerNode extends PowerBlock{
}
protected void drawLaserTo(Tilec target){
drawLaser(x, y, target.x(), target.y(), power.graph.getSatisfaction(), size, target.block().size);
drawLaser(team, x, y, target.x(), target.y(), power.graph.getSatisfaction(), size, target.block().size);
}
@Override

View File

@@ -45,7 +45,7 @@ public class ThermalGenerator extends PowerGenerator{
@Override
public void drawLight(){
Drawf.light(x, y, (40f + Mathf.absin(10f, 5f)) * productionEfficiency * size, Color.scarlet, 0.4f);
Drawf.light(team, x, y, (40f + Mathf.absin(10f, 5f)) * productionEfficiency * size, Color.scarlet, 0.4f);
}
@Override

View File

@@ -41,7 +41,7 @@ public class GenericSmelter extends GenericCrafter{
@Override
public void drawLight(){
Drawf.light(x, y, (60f + Mathf.absin(10f, 5f)) * warmup * size, flameColor, 0.65f);
Drawf.light(team, x, y, (60f + Mathf.absin(10f, 5f)) * warmup * size, flameColor, 0.65f);
}
}
}

View File

@@ -103,7 +103,7 @@ public class CoreBlock extends StorageBlock{
@Override
public void drawLight(){
Drawf.light(x, y, 30f * size, Pal.accent, 0.5f + Mathf.absin(20f, 0.1f));
Drawf.light(team, x, y, 30f * size, Pal.accent, 0.5f + Mathf.absin(20f, 0.1f));
}
@Override

View File

@@ -76,7 +76,7 @@ public class RepairPoint extends Block{
float len = 5f;
Draw.color(Color.valueOf("e8ffd7"));
Drawf.laser(laser, laserEnd,
Drawf.laser(team, laser, laserEnd,
x + Angles.trnsx(ang, len), y + Angles.trnsy(ang, len),
target.x(), target.y(), strength);
Draw.color();