Skip to content

Commit

Permalink
lumen resprite/rework
Browse files Browse the repository at this point in the history
  • Loading branch information
stabu-dev committed Feb 26, 2025
1 parent 8a512be commit affa3dc
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 116 deletions.
Binary file modified assets/sprites/items/carborundum.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/sprites/units/lumen-cell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/sprites/units/lumen-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/units/lumen-outline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/units/lumen-sprayer-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/sprites/units/lumen-sprayer-liquid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/sprites/units/lumen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 34 additions & 26 deletions src/omaloon/content/OlUnitTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,13 @@ public static void load(){
accel = 0.08f;
drag = 0.04f;
flying = true;
health = 210;
range = 6 * 8f;
maxRange = range;
health = 160;
range = 140f;
faceTarget = false;
circleTarget = true;
forceMultiTarget = true;
rotateMoveFirst = true;
rotateSpeed = 5f;
rotateSpeed = 8f;
fallDriftScl = 60f;

blades.addAll(new Blade(name + "-blade"){{
Expand All @@ -263,31 +263,25 @@ public static void load(){
}});
hitSize = 8;

weapons.add(
new Weapon(){{
x = 0;
y = 4;

shootY = 0;

mirror = false;
weapons.add(
new Weapon(){{
x = 0; y = 4;
shootY = 0;
mirror = false;

reload = 30;
ignoreRotation = true;
shootCone = 180f;
reload = 30;

rotate = true;
rotateSpeed = 360f;
rotationLimit = 60f;
controllable = true;
targetInterval = targetSwitchInterval = 0f;

controllable = false;
autoTarget = true;
targetInterval = targetSwitchInterval = 0f;

bullet = new BulletType(1f, 10){{
lifetime = 2;
hitSize = 2;
}};
}}
);
bullet = new BulletType(1f, 10){{
lifetime = 2;
hitSize = 2;
}};
}}
);
}};

lumen = new GlassmoreUnitType("lumen"){{
Expand All @@ -303,16 +297,23 @@ public static void load(){
range = 5f;
health = 70;

outlineRegion = atlas.find("omaloon-lumen-outline");
alwaysCreateOutline = true;

weapons.add(new FilterWeapon(){{
name = "omaloon-lumen-sprayer";
mirror = false;
x = 0;
y = 4f;
rotate = false;
layerOffset = -0.01f;

shootSound = Sounds.release;
shoot = new ShootSpread(30, 1);
inaccuracy = 12f;
velocityRnd = 0.8f;
reload = 30f;
recoil = 0f;

shootCone = 20f;

Expand Down Expand Up @@ -380,6 +381,13 @@ public static void load(){
"omaloon-filled-with-slag",
"omaloon-filled-with-oil"
};
tint = unit -> {
if(!unit.dead() && unit.hasEffect(OlStatusEffects.filledWithGlacium)) return OlLiquids.glacium;
if(!unit.dead() && unit.hasEffect(OlStatusEffects.filledWithWater)) return Liquids.water;
if(!unit.dead() && unit.hasEffect(OlStatusEffects.filledWithSlag)) return Liquids.slag;
if(!unit.dead() && unit.hasEffect(OlStatusEffects.filledWithOil)) return Liquids.oil;
return null;
};
bulletFilter = unit -> {
if(unit.hasEffect(OlStatusEffects.filledWithGlacium)) return bullets[0];
if(unit.hasEffect(OlStatusEffects.filledWithWater)) return bullets[1];
Expand Down
181 changes: 91 additions & 90 deletions src/omaloon/type/FilterWeapon.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import arc.*;
import arc.func.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.scene.ui.layout.*;
Expand All @@ -12,6 +11,7 @@
import mindustry.entities.bullet.*;
import mindustry.entities.units.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.meta.*;
Expand All @@ -23,92 +23,93 @@
* @author Liz
*/
public class FilterWeapon extends Weapon {
/**
* separate from bulletFilter for stats
*/
public BulletType[] bullets = new BulletType[]{Bullets.placeholder};
public Func<Unit, BulletType> bulletFilter = unit -> bullets[0];

public float tintLayerOffset = 0;

public Func<Unit, Color> tint = unit -> Color.white;

public String[] icons = new String[]{""};

public TextureRegion liquidRegion;
public TextureRegion[] iconRegions;

@Override
public void addStats(UnitType u, Table t) {
if (inaccuracy > 0) {
t.row();
t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int) inaccuracy + " " + StatUnit.degrees.localized());
}
if (!alwaysContinuous && reload > 0) {
t.row();
t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shoot.shots, 2) + " " + StatUnit.perSecond.localized());
}

t.row();
t.table(Styles.grayPanel, weapon -> {
for (int i = 0; i < bullets.length; i++) {
int finalI = i;
weapon.table(Tex.underline, b -> {
b.left();
if (iconRegions[finalI].found()) b.image(iconRegions[finalI]).padRight(10).center();
StatValues.ammo(ObjectMap.of(u, bullets[finalI])).display(b.add(new Table()).get());
}).growX().row();
}
}).margin(10f);
}

@Override
public void draw(Unit unit, WeaponMount mount) {
super.draw(unit, mount);
float z = Draw.z();
Draw.z(z + layerOffset + tintLayerOffset);

float
rotation = unit.rotation - 90,
realRecoil = Mathf.pow(mount.recoil, recoilPow) * recoil,
weaponRotation = rotation + (rotate ? mount.rotation : baseRotation),
wx = unit.x + Angles.trnsx(rotation, x, y) + Angles.trnsx(weaponRotation, 0, -realRecoil),
wy = unit.y + Angles.trnsy(rotation, x, y) + Angles.trnsy(weaponRotation, 0, -realRecoil);

if (liquidRegion.found()) {
Draw.color(tint.get(unit));
Draw.rect(liquidRegion, wx, wy, weaponRotation);
}
Draw.z(z);
}

@Override
public void init() {
super.init();

for (BulletType bullet : bullets) bullet.init();
}

@Override
public void load() {
super.load();
for (BulletType bullet : bullets) bullet.load();

liquidRegion = Core.atlas.find(name + "-liquid");

iconRegions = new TextureRegion[bullets.length];
for (int i = 0; i < iconRegions.length; i++) {
if (i < icons.length) {
iconRegions[i] = Core.atlas.find(icons[i]);
} else {
iconRegions[i] = Core.atlas.find("error");
}
}
}

@Override
protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float rotation) {
bullet = bulletFilter.get(unit);
super.shoot(unit, mount, shootX, shootY, rotation);
}
}
/**
* separate from bulletFilter for stats
*/
public BulletType[] bullets = new BulletType[]{Bullets.placeholder};
public Func<Unit, BulletType> bulletFilter = unit -> bullets[0];

public float tintLayerOffset = 0;

public Func<Unit, Liquid> tint = unit -> null;

public String[] icons = new String[]{""};

public TextureRegion liquidRegion;
public TextureRegion[] iconRegions;

@Override
public void addStats(UnitType u, Table t) {
if (inaccuracy > 0) {
t.row();
t.add("[lightgray]" + Stat.inaccuracy.localized() + ": [white]" + (int) inaccuracy + " " + StatUnit.degrees.localized());
}
if (!alwaysContinuous && reload > 0) {
t.row();
t.add("[lightgray]" + Stat.reload.localized() + ": " + (mirror ? "2x " : "") + "[white]" + Strings.autoFixed(60f / reload * shoot.shots, 2) + " " + StatUnit.perSecond.localized());
}

t.row();
t.table(Styles.grayPanel, weapon -> {
for (int i = 0; i < bullets.length; i++) {
int finalI = i;
weapon.table(Tex.underline, b -> {
b.left();
if (iconRegions[finalI].found()) b.image(iconRegions[finalI]).padRight(10).center();
StatValues.ammo(ObjectMap.of(u, bullets[finalI])).display(b.add(new Table()).get());
}).growX().row();
}
}).margin(10f);
}

@Override
public void draw(Unit unit, WeaponMount mount) {
super.draw(unit, mount);

float z = Draw.z();
Draw.z(z + layerOffset + tintLayerOffset);

float
rotation = unit.rotation - 90,
realRecoil = Mathf.pow(mount.recoil, recoilPow) * recoil,
weaponRotation = rotation + (rotate ? mount.rotation : baseRotation),
wx = unit.x + Angles.trnsx(rotation, x, y) + Angles.trnsx(weaponRotation, 0, -realRecoil),
wy = unit.y + Angles.trnsy(rotation, x, y) + Angles.trnsy(weaponRotation, 0, -realRecoil);

Liquid liquid = tint.get(unit);
if (liquidRegion.found() && liquid != null) {
Drawf.liquid(liquidRegion, wx, wy, 1f, liquid.color, weaponRotation);
}
Draw.z(z);
}

@Override
public void init() {
super.init();

for (BulletType bullet : bullets) bullet.init();
}

@Override
public void load() {
super.load();
for (BulletType bullet : bullets) bullet.load();

liquidRegion = Core.atlas.find(name + "-liquid");

iconRegions = new TextureRegion[bullets.length];
for (int i = 0; i < iconRegions.length; i++) {
if (i < icons.length) {
iconRegions[i] = Core.atlas.find(icons[i]);
} else {
iconRegions[i] = Core.atlas.find("error");
}
}
}

@Override
protected void shoot(Unit unit, WeaponMount mount, float shootX, float shootY, float rotation) {
bullet = bulletFilter.get(unit);
super.shoot(unit, mount, shootX, shootY, rotation);
}
}

0 comments on commit affa3dc

Please sign in to comment.