Procedural scorch marks / Bugfixes
@@ -5,6 +5,7 @@ mindustry.entities.AllEntities.GenericBuilderDef=6
|
|||||||
mindustry.entities.AllEntities.BulletDef=0
|
mindustry.entities.AllEntities.BulletDef=0
|
||||||
mindustry.entities.AllEntities.PlayerDef=4
|
mindustry.entities.AllEntities.PlayerDef=4
|
||||||
mindustry.entities.AllEntities.GroundEffectDef=9
|
mindustry.entities.AllEntities.GroundEffectDef=9
|
||||||
|
mindustry.entities.AllEntities.FireDef=11
|
||||||
mindustry.entities.AllEntities.EffectDef=2
|
mindustry.entities.AllEntities.EffectDef=2
|
||||||
mindustry.entities.AllEntities.GenericUnitDef=5
|
mindustry.entities.AllEntities.GenericUnitDef=5
|
||||||
mindustry.entities.AllEntities.TileDef=3
|
mindustry.entities.AllEntities.TileDef=3
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 520 B |
|
Before Width: | Height: | Size: 870 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 207 B |
|
Before Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 266 B |
|
Before Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 266 B |
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
duplicatePadding: true,
|
||||||
|
combineSubdirectories: true,
|
||||||
|
flattenPaths: true,
|
||||||
|
maxWidth: 2048,
|
||||||
|
maxHeight: 2048,
|
||||||
|
fast: true
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 237 B After Width: | Height: | Size: 237 B |
|
Before Width: | Height: | Size: 249 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 520 B |
|
Before Width: | Height: | Size: 870 B After Width: | Height: | Size: 870 B |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 698 KiB After Width: | Height: | Size: 688 KiB |
|
Before Width: | Height: | Size: 283 KiB After Width: | Height: | Size: 128 KiB |
|
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 283 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 262 KiB |
|
Before Width: | Height: | Size: 900 KiB After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 900 KiB |
@@ -26,6 +26,9 @@ class AllEntities{
|
|||||||
@EntityDef({Unitc.class})
|
@EntityDef({Unitc.class})
|
||||||
class GenericUnitDef{}
|
class GenericUnitDef{}
|
||||||
|
|
||||||
|
@EntityDef(value = {Firec.class}, pooled = true)
|
||||||
|
class FireDef{}
|
||||||
|
|
||||||
@GroupDef(Entityc.class)
|
@GroupDef(Entityc.class)
|
||||||
void all(){
|
void all(){
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class Effects{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void decal(TextureRegion region, float x, float y, float rotation, float lifetime, Color color){
|
public static void decal(TextureRegion region, float x, float y, float rotation, float lifetime, Color color){
|
||||||
if(headless || region == null) return;
|
if(headless || region == null || !Core.atlas.isFound(region)) return;
|
||||||
|
|
||||||
Decalc decal = DecalEntity.create();
|
Decalc decal = DecalEntity.create();
|
||||||
decal.set(x, y);
|
decal.set(x, y);
|
||||||
@@ -66,12 +66,20 @@ public class Effects{
|
|||||||
decal.add();
|
decal.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void scorch(float x, float y, int size){
|
||||||
|
if(headless) return;
|
||||||
|
|
||||||
|
size = Mathf.clamp(size, 0, 9);
|
||||||
|
|
||||||
|
TextureRegion region = Core.atlas.find("scorch-" + size + "-" + Mathf.random(2));
|
||||||
|
decal(region, x, y, Mathf.random(4) * 90, 3600, Pal.rubble);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void rubble(float x, float y, int blockSize){
|
public static void rubble(float x, float y, int blockSize){
|
||||||
if(headless) return;
|
if(headless) return;
|
||||||
|
|
||||||
TextureRegion region = Core.atlas.find("rubble-" + blockSize + "-" + Mathf.random(0, 1));
|
TextureRegion region = Core.atlas.find("rubble-" + blockSize + "-" + (Core.atlas.has("rubble-" + blockSize + "-1") ? Mathf.random(0, 1) : "0"));
|
||||||
if(!Core.atlas.isFound(region)) return;
|
decal(region, x, y, Mathf.random(4) * 90, 3600, Pal.rubble);
|
||||||
|
|
||||||
decal(region, x, y, Mathf.random(0, 4) * 90, 3600, Pal.rubble);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package mindustry.entities.def;
|
||||||
|
|
||||||
|
import mindustry.annotations.Annotations.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
abstract class FireComp implements Timedc{
|
||||||
|
}
|
||||||
@@ -34,8 +34,12 @@ abstract class HealthComp implements Entityc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void kill(){
|
void kill(){
|
||||||
|
if(dead) return;
|
||||||
|
|
||||||
health = 0;
|
health = 0;
|
||||||
dead = true;
|
dead = true;
|
||||||
|
killed();
|
||||||
|
remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
void heal(){
|
void heal(){
|
||||||
@@ -50,8 +54,7 @@ abstract class HealthComp implements Entityc{
|
|||||||
void damage(float amount){
|
void damage(float amount){
|
||||||
health -= amount;
|
health -= amount;
|
||||||
if(health <= 0 && !dead){
|
if(health <= 0 && !dead){
|
||||||
dead = true;
|
kill();
|
||||||
killed();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
|
if(unit.dead()){
|
||||||
|
clearUnit();
|
||||||
|
}
|
||||||
|
|
||||||
if(!dead()){
|
if(!dead()){
|
||||||
x(unit.x());
|
x(unit.x());
|
||||||
y(unit.y());
|
y(unit.y());
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
|||||||
|
|
||||||
//TODO cleanup
|
//TODO cleanup
|
||||||
//ScorchDecal.create(getX(), getY());
|
//ScorchDecal.create(getX(), getY());
|
||||||
|
Effects.scorch(x, y, (int)(hitSize() / 5));
|
||||||
Fx.explosion.at(this);
|
Fx.explosion.at(this);
|
||||||
Effects.shake(2f, 2f, this);
|
Effects.shake(2f, 2f, this);
|
||||||
type.deathSound.at(this);
|
type.deathSound.at(this);
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package mindustry.graphics;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
|
import arc.math.*;
|
||||||
|
import arc.util.noise.*;
|
||||||
|
|
||||||
|
/** Generates a scorch pixmap based on parameters. Thread safe, unless multiple scorch generators are running in parallel. */
|
||||||
|
public class ScorchGenerator{
|
||||||
|
private static final Simplex sim = new Simplex();
|
||||||
|
|
||||||
|
public int size = 80, seed = 0, color = Color.white.rgba();
|
||||||
|
public double scale = 18, pow = 2, octaves = 4, pers = 0.4, add = 2, nscl = 4.5f;
|
||||||
|
|
||||||
|
public Pixmap generate(){
|
||||||
|
Pixmap pix = new Pixmap(size, size);
|
||||||
|
sim.setSeed(seed);
|
||||||
|
|
||||||
|
pix.each((x, y) -> {
|
||||||
|
double dst = Mathf.dst(x, y, size/2, size/2) / (size / 2f);
|
||||||
|
double scaled = Math.abs(dst - 0.5f) * 5f + add;
|
||||||
|
scaled -= noise(Angles.angle(x, y, size/2, size/2))*nscl;
|
||||||
|
boolean present = scaled < 1.5f;
|
||||||
|
|
||||||
|
if(present) pix.draw(x, y, color);
|
||||||
|
});
|
||||||
|
|
||||||
|
return pix;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double noise(float angle){
|
||||||
|
return Math.pow(sim.octaveNoise2D(octaves, pers, 1 / scale, Angles.trnsx(angle, size/2f) + size/2f, Angles.trnsy(angle, size/2f) + size/2f), pow);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,7 @@ import arc.util.*;
|
|||||||
import arc.util.noise.*;
|
import arc.util.noise.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
|
import mindustry.graphics.*;
|
||||||
import mindustry.tools.ImagePacker.*;
|
import mindustry.tools.ImagePacker.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
@@ -275,6 +276,33 @@ public class Generators{
|
|||||||
}catch(Exception ignored){}
|
}catch(Exception ignored){}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ImagePacker.generate("scorches", () -> {
|
||||||
|
for(int size = 0; size < 10; size++){
|
||||||
|
for(int i = 0; i < 3; i++){
|
||||||
|
ScorchGenerator gen = new ScorchGenerator();
|
||||||
|
double multiplier = 30;
|
||||||
|
double ss = size * multiplier / 20.0;
|
||||||
|
|
||||||
|
gen.seed = Mathf.random(100000);
|
||||||
|
gen.size += size*multiplier;
|
||||||
|
gen.scale = gen.size / 80f * 18f;
|
||||||
|
//gen.nscl -= size * 0.2f;
|
||||||
|
gen.octaves += ss/3.0;
|
||||||
|
gen.pers += ss/10.0/5.0;
|
||||||
|
|
||||||
|
gen.scale += Mathf.range(3f);
|
||||||
|
gen.scale -= ss*2f;
|
||||||
|
gen.nscl -= Mathf.random(1f);
|
||||||
|
|
||||||
|
Pixmap out = gen.generate();
|
||||||
|
Pixmap median = Pixmaps.median(out, 2, 0.75);
|
||||||
|
Fi.get("../rubble/scorch-" + size + "-" + i + ".png").writePNG(median);
|
||||||
|
out.dispose();
|
||||||
|
median.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class ImagePacker{
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception{
|
public static void main(String[] args) throws Exception{
|
||||||
Vars.headless = true;
|
Vars.headless = true;
|
||||||
|
ArcNativesLoader.load();
|
||||||
|
|
||||||
Log.setLogger(new NoopLogHandler());
|
Log.setLogger(new NoopLogHandler());
|
||||||
Vars.content = new ContentLoader();
|
Vars.content = new ContentLoader();
|
||||||
|
|||||||