Alpha stuff

This commit is contained in:
Anuken
2019-10-16 18:57:19 -04:00
23 changed files with 1701 additions and 1296 deletions

View File

@@ -67,7 +67,7 @@ public class Mechs implements ContentList{
alpha = new Mech("alpha-mech", false){
{
drillPower = -1;
speed = 0.7f;
speed = 0.5f;
boostSpeed = 0.95f;
itemCapacity = 15;
mass = 0.9f;
@@ -75,14 +75,15 @@ public class Mechs implements ContentList{
buildPower = 0.9f;
weaponOffsetX = 1;
weaponOffsetY = -1;
engineColor = Color.valueOf("d3ddff");
engineColor = Pal.heal;
weapon = new Weapon("shockgun"){{
shake = 2f;
length = 1f;
reload = 60f;
reload = 70f;
roundrobin = true;
bullet = Bullets.lancerLaser;
recoil = 4f;
shootSound = Sounds.spark;
bullet = new LaserBulletType(20f){{

View File

@@ -307,7 +307,10 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
float boostTrnsX = boostHeat * 3f;
float boostAng = boostHeat * 40f;
float light = 0.2f;
for(int i : Mathf.signs){
Draw.colorl(1f-light + Mathf.clamp(ft * i, 0, 1) *light);
Draw.rect(mech.legRegion,
x + Angles.trnsx(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
y + Angles.trnsy(baseRotation, ft * i + boostTrnsY, -boostTrnsX * i),
@@ -315,6 +318,7 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
(mech.legRegion.getHeight() - Mathf.clamp(ft * i, 0, 2)) * Draw.scl,
baseRotation - 90 + boostAng * i);
}
Draw.color();
Draw.rect(mech.baseRegion, x, y, baseRotation - 90);
}

View File

@@ -34,12 +34,14 @@ public class ContentParser{
private static final boolean ignoreUnknownFields = true;
private ObjectMap<Class<?>, ContentType> contentTypes = new ObjectMap<>();
private ObjectMap<Class<?>, FieldParser> classParsers = new ObjectMap<Class<?>, FieldParser>(){{
put(BulletType.class, (type, data) -> field(Bullets.class, data));
put(Effect.class, (type, data) -> field(Fx.class, data));
put(StatusEffect.class, (type, data) -> field(StatusEffects.class, data));
put(Loadout.class, (type, data) -> field(Loadouts.class, data));
put(Color.class, (type, data) -> Color.valueOf(data.asString()));
put(BulletType.class, (type, data) -> {
if(data.isString()){
return field(Bullets.class, data);
}
Class<? extends BulletType> bc = data.has("type") ? resolve(data.getString("type"), "io.anuke.mindustry.entities.bullets") : BasicBulletType.class;
data.remove("type");
BulletType result = make(bc);

View File

@@ -48,6 +48,7 @@ public class LoadoutDialog extends FloatingDialog{
buttons.addImageTextButton("$settings.reset", Icon.refreshSmall, () -> {
resetter.run();
reseed();
updater.run();
setup();
}).size(210f, 64f);
@@ -55,10 +56,7 @@ public class LoadoutDialog extends FloatingDialog{
public void show(int capacity, Array<ItemStack> stacks, Runnable reseter, Runnable updater, Runnable hider){
this.originalStacks = stacks;
this.stacks = stacks.map(ItemStack::copy);
this.stacks.addAll(content.items().select(i -> i.type == ItemType.material &&
!stacks.contains(stack -> stack.item == i)).map(i -> new ItemStack(i, 0)));
this.stacks.sort(Structs.comparingInt(s -> s.item.id));
reseed();
this.resetter = reseter;
this.updater = updater;
this.capacity = capacity;
@@ -110,6 +108,13 @@ public class LoadoutDialog extends FloatingDialog{
}
}
private void reseed(){
this.stacks = originalStacks.map(ItemStack::copy);
this.stacks.addAll(content.items().select(i -> i.type == ItemType.material &&
!stacks.contains(stack -> stack.item == i)).map(i -> new ItemStack(i, 0)));
this.stacks.sort(Structs.comparingInt(s -> s.item.id));
}
private int step(int amount){
if(amount < 1000){
return 100;