Fixed unit drowning effects

This commit is contained in:
Anuken 2020-02-15 12:39:13 -05:00
parent 024f2d62e2
commit 1f65ba185a
6 changed files with 29 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import arc.util.*;
import mindustry.content.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.world.*;
import static mindustry.Vars.*;
@ -69,6 +70,9 @@ public class Effects{
public static void scorch(float x, float y, int size){
if(headless) return;
Tile tile = world.tileWorld(x, y);
if(tile == null || tile.floor().isLiquid) return;
size = Mathf.clamp(size, 0, 9);
TextureRegion region = Core.atlas.find("scorch-" + size + "-" + Mathf.random(2));
@ -79,6 +83,9 @@ public class Effects{
public static void rubble(float x, float y, int blockSize){
if(headless) return;
Tile tile = world.tileWorld(x, y);
if(tile == null || tile.floor().isLiquid) return;
TextureRegion region = Core.atlas.find("rubble-" + blockSize + "-" + (Core.atlas.has("rubble-" + blockSize + "-1") ? Mathf.random(0, 1) : "0"));
decal(region, x, y, Mathf.random(4) * 90, 3600, Pal.rubble);
}

View File

@ -39,7 +39,6 @@ public class Planet extends UnlockableContent{
sectors = new Array<>(grid.tiles.length);
for(int i = 0; i < grid.tiles.length; i++){
//TODO load sector data
sectors.add(new Sector(this, grid.tiles[i], new SectorData()));
}

View File

@ -122,6 +122,7 @@ public class UnitType extends UnlockableContent{
}
public void drawItems(Unitc unit){
applyColor(unit);
//draw back items
if(unit.hasItem() && unit.itemTime() > 0.01f){
@ -154,7 +155,7 @@ public class UnitType extends UnlockableContent{
}
public void drawWeapons(Unitc unit){
Draw.mixcol(Color.white, unit.hitTime());
applyColor(unit);
for(WeaponMount mount : unit.mounts()){
Weapon weapon = mount.weapon;
@ -179,7 +180,7 @@ public class UnitType extends UnlockableContent{
}
public void drawBody(Unitc unit){
Draw.mixcol(Color.white, unit.hitTime());
applyColor(unit);
Draw.rect(region, unit, unit.rotation() - 90);
@ -187,9 +188,11 @@ public class UnitType extends UnlockableContent{
}
public void drawCell(Unitc unit){
applyColor(unit);
Draw.color(Color.black, unit.team().color, unit.healthf() + Mathf.absin(Time.time(), Math.max(unit.healthf() * 5f, 1f), 1f - unit.healthf()));
Draw.rect(cellRegion, unit, unit.rotation() - 90);
Draw.color();
Draw.reset();
}
public void drawLight(Unitc unit){
@ -227,5 +230,12 @@ public class UnitType extends UnlockableContent{
Draw.mixcol();
}
public void applyColor(Unitc unit){
Draw.mixcol(Color.white, unit.hitTime());
if(unit.drownTime() > 0 && unit.floorOn().isDeep()){
Draw.mixcol(unit.floorOn().color, unit.drownTime() * 0.8f);
}
}
//endregion
}

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=899ab293f6f7bab4deadec06fac7a666028edf15
archash=f1178ca09b4d0b29e23f6443e73f8daf4a4b7329

View File

@ -351,6 +351,9 @@ task genSectorData(dependsOn: classes, type: JavaExec){
workingDir = "../core/assets/"
}
task updateCache(dependsOn: [genSectorData]){
}
task updateBundles(dependsOn: classes, type: JavaExec){
file(genFolder).mkdirs()

View File

@ -7,6 +7,7 @@ import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.content.*;
import mindustry.core.*;
import mindustry.ctype.*;
import mindustry.net.Net;
@ -58,6 +59,9 @@ public class SectorDataGenerator{
if(!tile.block().isStatic()){
floors.increment(tile.floor());
if(tile.overlay() != Blocks.air){
floors.increment(tile.overlay());
}
}
}
@ -76,7 +80,7 @@ public class SectorDataGenerator{
data.resources = content.asArray().sort(Structs.comps(Structs.comparing(Content::getContentType), Structs.comparingInt(c -> c.id))).toArray(Content.class);
if(count[0]++ % 5 == 0){
if(count[0]++ % 10 == 0){
Log.info("&lyDone with sector &lm{0}/{1}", count[0], planet.sectors.size);
}