mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 06:51:30 -08:00
Cleanup, re-implementations
This commit is contained in:
parent
018fe5dea2
commit
1b2e10d355
7 changed files with 63 additions and 97 deletions
|
|
@ -29,14 +29,14 @@ void main() {
|
|||
vec4 color = texture2D(u_texture, T);
|
||||
vec2 v = vec2(1.0/u_texsize.x, 1.0/u_texsize.y);
|
||||
|
||||
if(texture2D(u_texture, T).a < 0.1 &&
|
||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.1 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.1 ||
|
||||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.1 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.1)){
|
||||
if(texture2D(u_texture, T).a < 0.2 &&
|
||||
(texture2D(u_texture, T + vec2(0, step) * v).a > 0.0 || texture2D(u_texture, T + vec2(0, -step) * v).a > 0.0 ||
|
||||
texture2D(u_texture, T + vec2(step, 0) * v).a > 0.0 || texture2D(u_texture, T + vec2(-step, 0) * v).a > 0.0)){
|
||||
|
||||
gl_FragColor = mix(v_color, vec4(1.0), si);
|
||||
}else{
|
||||
|
||||
if(color.a > 0.1){
|
||||
if(color.a > 0.0){
|
||||
if(mod(coords.x / u_dp + coords.y / u_dp + sin(floor(coords.x / u_dp) / 5.0) * 3.0 + sin(floor(coords.y / u_dp) / 5.0) * 3.0 + u_time / 4.0, 10.0) < 2.0){
|
||||
color *= 1.65;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,6 +221,19 @@ public class Renderer implements ApplicationListener{
|
|||
}
|
||||
|
||||
Draw.draw(Layer.plans, overlays::drawBottom);
|
||||
|
||||
if(settings.getBool("animatedshields")){
|
||||
Draw.drawRange(Layer.shields, 1f, () -> effectBuffer.begin(Color.clear), () -> {
|
||||
effectBuffer.end();
|
||||
|
||||
Draw.shader(Shaders.shield);
|
||||
Draw.color(Pal.accent);
|
||||
Draw.rect(effectBuffer);
|
||||
Draw.color();
|
||||
Draw.shader();
|
||||
});
|
||||
}
|
||||
|
||||
Draw.draw(Layer.overlayUI, overlays::drawTop);
|
||||
Draw.draw(Layer.space, this::drawLanding);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ public enum Gamemode{
|
|||
survival(rules -> {
|
||||
rules.waveTimer = true;
|
||||
rules.waves = true;
|
||||
rules.unitDrops = true;
|
||||
}, map -> map.spawns > 0),
|
||||
sandbox(rules -> {
|
||||
rules.infiniteResources = true;
|
||||
|
|
@ -20,7 +19,6 @@ public enum Gamemode{
|
|||
rules.respawnTime = 0f;
|
||||
}),
|
||||
attack(rules -> {
|
||||
rules.unitDrops = true;
|
||||
rules.attackMode = true;
|
||||
}, map -> map.teams.contains((int)state.rules.waveTeam.id)),
|
||||
pvp(rules -> {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ public class Rules{
|
|||
public boolean enemyCheat;
|
||||
/** Whether the game objective is PvP. Note that this enables automatic hosting. */
|
||||
public boolean pvp;
|
||||
/** Whether enemy units drop random items on death. */
|
||||
public boolean unitDrops = true;
|
||||
/** Whether reactors can explode and damage other blocks. */
|
||||
public boolean reactorExplosions = true;
|
||||
/** How fast unit pads build units. */
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ public class Layer{
|
|||
//overlaied UI, like block config guides
|
||||
overlayUI = 120,
|
||||
|
||||
//shield effects
|
||||
shields = 125,
|
||||
|
||||
//weather effects, e.g. rain and snow TODO draw before overlay UI?
|
||||
weather = 130,
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ public class CustomRulesDialog extends FloatingDialog{
|
|||
number("$rules.playerdamagemultiplier", f -> rules.playerDamageMultiplier = f, () -> rules.playerDamageMultiplier);
|
||||
|
||||
title("$rules.title.unit");
|
||||
check("$rules.unitdrops", b -> rules.unitDrops = b, () -> rules.unitDrops, () -> true);
|
||||
number("$rules.unithealthmultiplier", f -> rules.unitHealthMultiplier = f, () -> rules.unitHealthMultiplier);
|
||||
number("$rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
|
||||
number("$rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import arc.func.*;
|
|||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import arc.util.io.*;
|
||||
import mindustry.content.*;
|
||||
|
|
@ -29,18 +30,14 @@ public class ForceProjector extends Block{
|
|||
public float basePowerDraw = 0.2f;
|
||||
public TextureRegion topRegion;
|
||||
|
||||
private static Tile paramTile;
|
||||
private static ForceProjector paramBlock;
|
||||
private static ForceProjectorEntity paramEntity;
|
||||
private static Cons<Shielderc> shieldConsumer = trait -> {
|
||||
//TODO implement
|
||||
/*
|
||||
if(trait.team() != paramteam && Intersector.isInsideHexagon(trait.x(), trait.y(), paramEntity.realRadius() * 2f, paramx, paramy)){
|
||||
if(trait.team() != paramEntity.team() && Intersector.isInsideHexagon(paramEntity.x(), paramEntity.y(), paramEntity.realRadius() * 2f, trait.x(), trait.y())){
|
||||
trait.absorb();
|
||||
Fx.absorb.at(trait);
|
||||
paramhit = 1f;
|
||||
parambuildup += trait.damage() * paramwarmup;
|
||||
}*/
|
||||
paramEntity.hit = 1f;
|
||||
paramEntity.buildup += trait.damage() * paramEntity.warmup;
|
||||
}
|
||||
};
|
||||
|
||||
public ForceProjector(String name){
|
||||
|
|
@ -84,7 +81,6 @@ public class ForceProjector extends Block{
|
|||
}
|
||||
|
||||
public class ForceProjectorEntity extends TileEntity{
|
||||
ShieldEntity shield;
|
||||
boolean broken = true;
|
||||
float buildup = 0f;
|
||||
float radscl = 0f;
|
||||
|
|
@ -94,12 +90,6 @@ public class ForceProjector extends Block{
|
|||
|
||||
@Override
|
||||
public void updateTile(){
|
||||
if(shield == null){
|
||||
//TODO implement
|
||||
//shield = new ShieldEntity(tile);
|
||||
//shield.add();
|
||||
}
|
||||
|
||||
boolean phaseValid = consumes.get(ConsumeType.item).valid(tile.entity);
|
||||
|
||||
phaseHeat = Mathf.lerpDelta(phaseHeat, Mathf.num(phaseValid), 0.1f);
|
||||
|
|
@ -143,10 +133,10 @@ public class ForceProjector extends Block{
|
|||
|
||||
float realRadius = realRadius();
|
||||
|
||||
paramTile = tile;
|
||||
paramEntity = this;
|
||||
paramBlock = ForceProjector.this;
|
||||
Groups.bullet.intersect(x - realRadius, y - realRadius, realRadius*2f, realRadius * 2f, shieldConsumer);
|
||||
if(realRadius > 0 && !broken){
|
||||
paramEntity = this;
|
||||
Groups.bullet.intersect(x - realRadius, y - realRadius, realRadius * 2f, realRadius * 2f, shieldConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
float realRadius(){
|
||||
|
|
@ -157,11 +147,40 @@ public class ForceProjector extends Block{
|
|||
public void draw(){
|
||||
super.draw();
|
||||
|
||||
if(buildup <= 0f) return;
|
||||
Draw.alpha(buildup / breakage * 0.75f);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(topRegion, x, y);
|
||||
Draw.blend();
|
||||
if(buildup > 0f){
|
||||
Draw.alpha(buildup / breakage * 0.75f);
|
||||
Draw.blend(Blending.additive);
|
||||
Draw.rect(topRegion, x, y);
|
||||
Draw.blend();
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
if(!broken){
|
||||
float radius = realRadius();
|
||||
|
||||
Draw.z(Layer.shields);
|
||||
|
||||
Draw.color(Pal.accent);
|
||||
|
||||
if(Core.settings.getBool("animatedshields")){
|
||||
Fill.poly(x, y, 6, radius);
|
||||
|
||||
Draw.z(Layer.shields + 0.1f);
|
||||
|
||||
Draw.color(Color.white);
|
||||
Draw.alpha(hit);
|
||||
Fill.poly(x, y, 6, radius);
|
||||
Draw.color();
|
||||
}else{
|
||||
Lines.stroke(1.5f);
|
||||
Draw.alpha(0.09f + 0.08f * hit);
|
||||
Fill.poly(x, y, 6, radius);
|
||||
Draw.alpha(1f);
|
||||
Lines.poly(x, y, 6, radius);
|
||||
Draw.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
|
|
@ -185,68 +204,4 @@ public class ForceProjector extends Block{
|
|||
phaseHeat = read.f();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO fix
|
||||
class ShieldEntity{
|
||||
|
||||
}
|
||||
/*
|
||||
//@EntityDef({Drawc.class})
|
||||
//class ShieldDef{}
|
||||
|
||||
public class ShieldEntity extends BaseEntity implements DrawTrait{
|
||||
final ForceEntity entity;
|
||||
|
||||
public ShieldEntity(){
|
||||
this.entity = tile.ent();
|
||||
set(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(isDead() || !isAdded()){
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float drawSize(){
|
||||
return realRadius(entity) * 2f + 2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Draw.color(Pal.accent);
|
||||
Fill.poly(x, y, 6, realRadius(entity));
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawOver(){
|
||||
if(hit <= 0f) return;
|
||||
|
||||
Draw.color(Color.white);
|
||||
Draw.alpha(hit);
|
||||
Fill.poly(x, y, 6, realRadius(entity));
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawSimple(){
|
||||
if(realRadius(entity) < 0.5f) return;
|
||||
|
||||
float rad = realRadius(entity);
|
||||
|
||||
Draw.color(Pal.accent);
|
||||
Lines.stroke(1.5f);
|
||||
Draw.alpha(0.09f + 0.08f * hit);
|
||||
Fill.poly(x, y, 6, rad);
|
||||
Draw.alpha(1f);
|
||||
Lines.poly(x, y, 6, rad);
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityGroup targetGroup(){
|
||||
return shieldGroup;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue