Removed team light drawing

This commit is contained in:
Anuken 2022-04-06 17:17:47 -04:00
parent 047c284e48
commit 7268ac98f8
32 changed files with 53 additions and 63 deletions

View File

@ -1087,7 +1087,6 @@ rules.title.environment = Environment
rules.title.teams = Teams
rules.title.planet = Planet
rules.lighting = Lighting
rules.enemyLights = Enemy Lights
rules.fire = Fire
rules.explosions = Block/Unit Explosion Damage
rules.ambientlight = Ambient Light

View File

@ -8,7 +8,6 @@ import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.entities.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
@ -155,7 +154,7 @@ public class Fx{
Draw.color(e.color, e.fout());
Lines.stroke(1.5f);
Lines.line(e.x, e.y, pos.getX(), pos.getY());
Drawf.light(null, e.x, e.y, pos.getX(), pos.getY(), 20f, e.color, 0.6f * e.fout());
Drawf.light(e.x, e.y, pos.getX(), pos.getY(), 20f, e.color, 0.6f * e.fout());
}),
pointHit = new Effect(8f, e -> {
@ -1038,7 +1037,7 @@ public class Fx{
color();
Drawf.light(Team.derelict, e.x, e.y, 20f * e.fslope(), Pal.lightFlame, 0.5f);
Drawf.light(e.x, e.y, 20f * e.fslope(), Pal.lightFlame, 0.5f);
}),
fireHit = new Effect(35f, e -> {

View File

@ -128,10 +128,12 @@ public class Items{
fissileMatter = new Item("fissile-matter", Color.valueOf("5e988d")){{
radioactivity = 1.5f;
hidden = true;
}};
dormantCyst = new Item("dormant-cyst", Color.valueOf("df824d")){{
flammability = 0.1f;
hidden = true;
}};
serpuloItems.addAll(

View File

@ -3149,7 +3149,6 @@ public class UnitTypes{
itemCapacity = 0;
setEnginesMirror(
//new UnitEngine(34 / 4f, 31 / 4f, 3f, 45f),
new UnitEngine(35 / 4f, -38 / 4f, 3f, 315f),
new UnitEngine(39 / 4f, -16 / 4f, 3f, 315f)
);

View File

@ -382,7 +382,7 @@ public class BulletType extends Content implements Cloneable{
public void drawLight(Bullet b){
if(lightOpacity <= 0f || lightRadius <= 0f) return;
Drawf.light(b.team, b, lightRadius, lightColor, lightOpacity);
Drawf.light(b, lightRadius, lightColor, lightOpacity);
}
public void init(Bullet b){

View File

@ -87,7 +87,7 @@ public class ContinuousFlameBulletType extends ContinuousBulletType{
}
}
Drawf.light(b.team, b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, lightStroke, lightColor, 0.7f);
Drawf.light(b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, lightStroke, lightColor, 0.7f);
Draw.reset();
}

View File

@ -58,7 +58,7 @@ public class ContinuousLaserBulletType extends ContinuousBulletType{
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
Drawf.light(b.team, b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, lightStroke, lightColor, 0.7f);
Drawf.light(b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, lightStroke, lightColor, 0.7f);
Draw.reset();
}

View File

@ -116,7 +116,7 @@ public class LaserBulletType extends BulletType{
Draw.reset();
Tmp.v1.trns(b.rotation(), baseLen * 1.1f);
Drawf.light(b.team, b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f);
Drawf.light(b.x, b.y, b.x + Tmp.v1.x, b.y + Tmp.v1.y, width * 1.4f * b.fout(), colors[0], 0.6f);
}
@Override

View File

@ -37,12 +37,12 @@ public class SapBulletType extends BulletType{
Tmp.v1.set(data).lerp(b, b.fin());
Draw.color(color);
Drawf.laser(b.team, Core.atlas.find("laser"), Core.atlas.find("laser-end"),
Drawf.laser(Core.atlas.find("laser"), Core.atlas.find("laser-end"),
b.x, b.y, Tmp.v1.x, Tmp.v1.y, width * b.fout());
Draw.reset();
Drawf.light(b.team, b.x, b.y, Tmp.v1.x, Tmp.v1.y, 15f * b.fout(), lightColor, lightOpacity);
Drawf.light(b.x, b.y, Tmp.v1.x, Tmp.v1.y, 15f * b.fout(), lightColor, lightOpacity);
}
}

View File

@ -66,6 +66,6 @@ public class ShrapnelBulletType extends BulletType{
Drawf.tri(b.x, b.y, width * b.fout(), 10f, b.rotation() + 180f);
Draw.reset();
Drawf.light(b.team, b.x, b.y, b.x + Angles.trnsx(rot, realLength), b.y + Angles.trnsy(rot, realLength), width * 2.5f * b.fout(), toColor, lightOpacity);
Drawf.light(b.x, b.y, b.x + Angles.trnsx(rot, realLength), b.y + Angles.trnsy(rot, realLength), width * 2.5f * b.fout(), toColor, lightOpacity);
}
}

View File

@ -1157,7 +1157,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
float fract = 1f;
float opacity = color.a * fract;
if(opacity > 0.001f){
Drawf.light(team, x, y, block.size * 30f * fract, color, opacity);
Drawf.light(x, y, block.size * 30f * fract, color, opacity);
}
}
}

View File

@ -141,7 +141,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
Draw.color(Color.lightGray, Color.white, 1f - flashScl + Mathf.absin(Time.time, 0.5f, flashScl));
Drawf.laser(team(), Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), px, py, ex, ey, 0.75f);
Drawf.laser(Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), px, py, ex, ey, 0.75f);
if(isLocal()){
Lines.stroke(1f, Pal.accent);

View File

@ -123,9 +123,6 @@ public class Rules{
public Color dynamicColor = new Color(0f, 0f, 0f, 0.5f);
/** Whether ambient lighting is enabled. */
public boolean lighting = false;
/** Whether enemy lighting is visible.
* If lighting is enabled and this is false, a fog-of-war effect is partially achieved. */
public boolean enemyLights = true;
/** Ambient light color, used when lighting is enabled. */
public Color ambientLight = new Color(0.01f, 0.01f, 0.04f, 0.99f);
/** team of the player by default. */

View File

@ -6,9 +6,7 @@ import arc.math.*;
import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import mindustry.*;
import mindustry.ctype.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.world.*;
@ -210,28 +208,20 @@ public class Drawf{
renderer.lights.add(x, y, radius, color, opacity);
}
public static void light(Team team, float x, float y, float radius, Color color, float opacity){
if(allowLight(team)) renderer.lights.add(x, y, radius, color, opacity);
public static void light(Position pos, float radius, Color color, float opacity){
light(pos.getX(), pos.getY(), radius, color, opacity);
}
public static void light(Team team, Position pos, float radius, Color color, float opacity){
light(team, pos.getX(), pos.getY(), radius, color, opacity);
public static void light(float x, float y, TextureRegion region, Color color, float opacity){
renderer.lights.add(x, y, region, color, opacity);
}
public static void light(Team team, float x, float y, TextureRegion region, Color color, float opacity){
if(allowLight(team)) renderer.lights.add(x, y, region, color, opacity);
public static void light(float x, float y, float x2, float y2){
renderer.lights.line(x, y, x2, y2, 30, Color.orange, 0.3f);
}
public static void light(Team team, float x, float y, float x2, float y2){
if(allowLight(team)) renderer.lights.line(x, y, x2, y2, 30, Color.orange, 0.3f);
}
public static void light(Team team, float x, float y, float x2, float y2, float stroke, Color tint, float alpha){
if(allowLight(team)) renderer.lights.line(x, y, x2, y2, stroke, tint, alpha);
}
private static boolean allowLight(Team team){
return renderer != null && (team == Team.derelict || team == Vars.player.team() || state.rules.enemyLights);
public static void light(float x, float y, float x2, float y2, float stroke, Color tint, float alpha){
renderer.lights.line(x, y, x2, y2, stroke, tint, alpha);
}
public static void selected(Building tile, Color color){
@ -365,19 +355,19 @@ public class Drawf{
Draw.color();
}
public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2){
laser(team, line, edge, edge, x, y, x2, y2, 1f);
public static void laser(TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2){
laser(line, edge, edge, x, y, x2, y2, 1f);
}
public static void laser(Team team, TextureRegion line, TextureRegion start, TextureRegion end, float x, float y, float x2, float y2){
laser(team, line, start, end, x, y, x2, y2, 1f);
public static void laser(TextureRegion line, TextureRegion start, TextureRegion end, float x, float y, float x2, float y2){
laser(line, start, end, x, y, x2, y2, 1f);
}
public static void laser(Team team, TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float scale){
laser(team, line, edge, edge, x, y, x2, y2, scale);
public static void laser(TextureRegion line, TextureRegion edge, float x, float y, float x2, float y2, float scale){
laser(line, edge, edge, x, y, x2, y2, scale);
}
public static void laser(Team team, TextureRegion line, TextureRegion start, TextureRegion end, float x, float y, float x2, float y2, float scale){
public static void laser(TextureRegion line, TextureRegion start, TextureRegion end, float x, float y, float x2, float y2, float scale){
float scl = 8f * scale * Draw.scl, rot = Mathf.angle(x2 - x, y2 - y);
float vx = Mathf.cosDeg(rot) * scl, vy = Mathf.sinDeg(rot) * scl;
@ -388,7 +378,7 @@ public class Drawf{
Lines.line(line, x + vx, y + vy, x2 - vx, y2 - vy, false);
Lines.stroke(1f);
light(team, x, y, x2, y2);
light(x, y, x2, y2);
}
public static void tri(float x, float y, float width, float length, float rotation){

View File

@ -46,6 +46,7 @@ public class Item extends UnlockableContent implements Senseable{
public float frameTime = 5f;
/** If true, this material is used by buildings. If false, this material will be incinerated in certain cores. */
public boolean buildable = true;
public boolean hidden = false;
public Item(String name, Color color){
super(name);
@ -56,6 +57,11 @@ public class Item extends UnlockableContent implements Senseable{
this(name, new Color(Color.black));
}
@Override
public boolean isHidden(){
return hidden;
}
@Override
public void loadIcon(){
super.loadIcon();

View File

@ -7,7 +7,6 @@ import arc.util.*;
import mindustry.content.*;
import mindustry.ctype.*;
import mindustry.entities.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.logic.*;
@ -137,7 +136,7 @@ public class Liquid extends UnlockableContent implements Senseable{
Draw.color();
if(lightColor.a > 0.001f && f > 0){
Drawf.light(Team.derelict, x, y, 30f * f, lightColor, color.a * f * 0.8f);
Drawf.light(x, y, 30f * f, lightColor, color.a * f * 0.8f);
}
}

View File

@ -1104,7 +1104,7 @@ public class UnitType extends UnlockableContent{
public void drawLight(Unit unit){
if(lightRadius > 0){
Drawf.light(unit.team, unit.x, unit.y, lightRadius, lightColor, lightOpacity);
Drawf.light(unit.x, unit.y, lightRadius, lightColor, lightOpacity);
}
}

View File

@ -191,7 +191,6 @@ public class CustomRulesDialog extends BaseDialog{
check("@rules.explosions", b -> rules.damageExplosions = b, () -> rules.damageExplosions);
check("@rules.fire", b -> rules.fire = b, () -> rules.fire);
check("@rules.lighting", b -> rules.lighting = b, () -> rules.lighting);
check("@rules.enemyLights", b -> rules.enemyLights = b, () -> rules.enemyLights);
if(experimental){
check("@rules.limitarea", b -> rules.limitMapArea = b, () -> rules.limitMapArea);

View File

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

View File

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

View File

@ -150,7 +150,7 @@ public class TractorBeamTurret extends BaseTurret{
Draw.mixcol(laserColor, Mathf.absin(4f, 0.6f));
Drawf.laser(team, laser, laserStart, laserEnd,
Drawf.laser(laser, laserStart, laserEnd,
x + Angles.trnsx(ang, shootLength), y + Angles.trnsy(ang, shootLength),
lastX, lastY, strength * efficiency * laserWidth);

View File

@ -122,7 +122,7 @@ public class BeamNode extends PowerBlock{
if(dst > 1 + size/2){
var point = Geometry.d4[i];
float poff = tilesize/2f;
Drawf.laser(team, laser, laserEnd, x + poff*size*point.x, y + poff*size*point.y, dests[i].worldx() - poff*point.x, dests[i].worldy() - poff*point.y, w);
Drawf.laser(laser, laserEnd, x + poff*size*point.x, y + poff*size*point.y, dests[i].worldx() - poff*point.x, dests[i].worldy() - poff*point.y, w);
}
}
}

View File

@ -133,7 +133,7 @@ public class ConsumeGenerator extends PowerGenerator{
//???
drawer.drawLight(this);
//TODO hard coded
Drawf.light(team, x, y, (60f + Mathf.absin(10f, 5f)) * size, Color.orange, 0.5f * warmup);
Drawf.light(x, y, (60f + Mathf.absin(10f, 5f)) * size, Color.orange, 0.5f * warmup);
}
}
}

View File

@ -133,7 +133,7 @@ public class ImpactReactor extends PowerGenerator{
@Override
public void drawLight(){
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);
Drawf.light(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

@ -94,7 +94,7 @@ public class LightBlock extends Block{
@Override
public void drawLight(){
Drawf.light(team, x, y, lightRadius * Math.min(smoothTime, 2f), Tmp.c1.set(color), brightness * efficiency);
Drawf.light(x, y, lightRadius * Math.min(smoothTime, 2f), 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(team, x, y, (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, heat), 0.6f * fract);
Drawf.light(x, y, (90f + Mathf.absin(5, 5f)) * fract, Tmp.c1.set(lightColor).lerp(Color.scarlet, heat), 0.6f * fract);
}
@Override

View File

@ -182,7 +182,7 @@ public class PowerNode extends PowerBlock{
vx = Mathf.cosDeg(angle1), vy = Mathf.sinDeg(angle1),
len1 = size1 * tilesize / 2f - 1.5f, len2 = size2 * tilesize / 2f - 1.5f;
Drawf.laser(team, laser, laserEnd, x1 + vx*len1, y1 + vy*len1, x2 - vx*len2, y2 - vy*len2, laserScale);
Drawf.laser(laser, laserEnd, x1 + vx*len1, y1 + vy*len1, x2 - vx*len2, y2 - vy*len2, laserScale);
}
protected boolean overlaps(float srcx, float srcy, Tile other, Block otherBlock, float range){

View File

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

View File

@ -313,12 +313,12 @@ public class BeamDrill extends Block{
if(boostWarmup < 0.99f){
Draw.alpha(1f - boostWarmup);
Drawf.laser(team, laser, laserEnd, lsx, lsy, lx, ly, width);
Drawf.laser(laser, laserEnd, lsx, lsy, lx, ly, width);
}
if(boostWarmup > 0.001f){
Draw.alpha(boostWarmup);
Drawf.laser(team, laserBoost, laserEndBoost, lsx, lsy, lx, ly, width);
Drawf.laser(laserBoost, laserEndBoost, lsx, lsy, lx, ly, width);
}
}
Draw.color();

View File

@ -340,7 +340,7 @@ public class CoreBlock extends StorageBlock{
@Override
public void drawLight(){
Drawf.light(team, x, y, lightRadius, Pal.accent, 0.65f + Mathf.absin(20f, 0.1f));
Drawf.light(x, y, lightRadius, Pal.accent, 0.65f + Mathf.absin(20f, 0.1f));
}
@Override

View File

@ -137,10 +137,10 @@ public class RepairPoint extends Block{
Lines.circle(lastEnd.x, lastEnd.y, 1f + f * pulseRadius);
Draw.color(laserColor);
Drawf.laser(team, laser, laserEnd, originX, originY, lastEnd.x, lastEnd.y, strength * beamWidth);
Drawf.laser(laser, laserEnd, originX, originY, lastEnd.x, lastEnd.y, strength * beamWidth);
Draw.z(Layer.flyingUnit + 1.1f);
Draw.color(laserTopColor);
Drawf.laser(team, laserTop, laserTopEnd, originX, originY, lastEnd.x, lastEnd.y, strength * beamWidth);
Drawf.laser(laserTop, laserTopEnd, originX, originY, lastEnd.x, lastEnd.y, strength * beamWidth);
Draw.color();
}
}

View File

@ -54,6 +54,6 @@ public class DrawFlame extends DrawBlock{
@Override
public void drawLight(Building build){
Drawf.light(build.team, build.x, build.y, (lightRadius + Mathf.absin(lightSinScl, lightSinMag)) * build.warmup() * build.block.size, flameColor, lightAlpha);
Drawf.light(build.x, build.y, (lightRadius + Mathf.absin(lightSinScl, lightSinMag)) * build.warmup() * build.block.size, flameColor, lightAlpha);
}
}