Added dart as default starter

This commit is contained in:
Anuken
2020-05-22 14:35:25 -04:00
parent 795bd84d06
commit 12d9479184
21 changed files with 818 additions and 772 deletions

View File

@@ -12,17 +12,23 @@ import mindustry.type.*;
public class UnitTypes implements ContentList{
//ground
public static @EntityDef({Unitc.class, Legsc.class}) UnitType titan, dagger, crawler, fortress, eruptor, chaosArray, eradicator, alpha;
public static @EntityDef({Unitc.class, Legsc.class}) UnitType titan, dagger, crawler, fortress, eruptor, chaosArray, eradicator;
//ground + builder
public static @EntityDef({Unitc.class, Legsc.class, Builderc.class}) UnitType alpha;
//air
public static @EntityDef({Unitc.class}) UnitType wraith, reaper, ghoul, revenant, lich;
//mining
//air + mining
public static @EntityDef({Unitc.class, Minerc.class}) UnitType draug;
//building
//air + building
public static @EntityDef({Unitc.class, Builderc.class}) UnitType phantom, spirit;
//air + building + mining
public static @EntityDef({Unitc.class, Builderc.class, Minerc.class}) UnitType dart;
//water
public static @EntityDef({Unitc.class, WaterMovec.class, Commanderc.class}) UnitType vanguard;
@@ -245,7 +251,32 @@ public class UnitTypes implements ContentList{
recoil = 2f;
bullet = Bullets.healBulletBig;
shootSound = Sounds.pew;
}});
}};
dart = new UnitType("dart"){{
flying = true;
mineSpeed = 2f;
drag = 0.05f;
mass = 2f;
speed = 2.9f;
rotateSpeed = 15f;
accel = 0.15f;
range = 70f;
itemCapacity = 70;
health = 400;
buildSpeed = 0.85f;
engineOffset = 6f;
hitsize = 8f;
weapons.add(new Weapon("small-heal-weapon"){{
reload = 14f;
x = -1f;
y = -1f;
shootX = 3.5f;
alternate = true;
ejectEffect = Fx.none;
bullet = Bullets.healBullet;
}});
}};

View File

@@ -4,6 +4,7 @@ import arc.*;
import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.*;
@@ -174,7 +175,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
controller.update();
//remove units spawned by the core
if(spawnedByCore && !(controller instanceof Playerc)){
if(spawnedByCore && !isPlayer()){
Fx.unitDespawn.at(x, y, 0, this);
remove();
}
@@ -195,6 +196,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
return controller instanceof Playerc;
}
@Nullable
public Playerc getPlayer(){
return isPlayer() ? (Playerc)controller : null;
}

View File

@@ -560,7 +560,9 @@ public class DesktopInput extends InputHandler{
protected void updateMovement(Unitc unit){
boolean omni = !(unit instanceof WaterMovec);
boolean legs = unit.isGrounded();
float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation());
float strafePenalty = legs ? 1f : Mathf.lerp(1f, unit.type().strafePenalty, Angles.angleDist(unit.vel().angle(), unit.rotation()) / 180f);
float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation()) * strafePenalty;
float xa = Core.input.axis(Binding.move_x);
float ya = Core.input.axis(Binding.move_y);
@@ -572,11 +574,7 @@ public class DesktopInput extends InputHandler{
unit.lookAt(mouseAngle);
}else{
if(!unit.vel().isZero(0.01f)){
if(unit.type().flying){
unit.rotation(unit.vel().angle());
}else{
unit.lookAt(unit.vel().angle());
}
unit.lookAt(unit.vel().angle());
}
}

View File

@@ -1,8 +1,6 @@
package mindustry.maps.generators;
import arc.math.geom.*;
import arc.struct.*;
import mindustry.content.*;
import mindustry.game.*;
import mindustry.type.*;
import mindustry.world.*;
@@ -10,8 +8,8 @@ import mindustry.world.*;
public class BaseGenerator{
public void generate(Tiles tiles, Array<Tile> cores, Tile spawn, Team team, Sector sector){
//algorithm idea: make it spawn prefab turret setups and route resources to them with conveyors from chunks of ore drill setups
/*
GridBits used = new GridBits(tiles.width, tiles.height);
Queue<Tile> frontier = new Queue<>();
for(Tile tile : cores){
@@ -44,7 +42,7 @@ public class BaseGenerator{
tile.clearOverlay();
tile.setBlock(Blocks.coreShard, team);
}
}*/
}

View File

@@ -45,6 +45,7 @@ public class UnitType extends UnlockableContent{
public Color engineColor = Pal.engine;
public float engineOffset = 5f, engineSize = 2.5f;
public float strafePenalty = 0.5f;
public float hitsize = 6f;
public float itemOffsetY = 3f;
public float lightRadius = 60f, lightOpacity = 0.6f;
@@ -147,7 +148,7 @@ public class UnitType extends UnlockableContent{
unit.trns(legOffset.x, legOffset.y);
}
Draw.z(z - 0.01f);
Draw.z(Math.min(z - 0.01f, Layer.bullet - 1f));
drawOcclusion(unit);
Draw.z(z);

View File

@@ -21,7 +21,7 @@ import mindustry.world.modules.*;
import static mindustry.Vars.*;
public class CoreBlock extends StorageBlock{
public UnitType unitType = UnitTypes.phantom;
public UnitType unitType = UnitTypes.dart;
public CoreBlock(String name){
super(name);