mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-22 04:28:27 +07:00
Moved bullet FX to ammo type, beginning of weapon rework
This commit is contained in:
parent
19d058a644
commit
8581213126
BIN
core/assets-raw/sprites/units/vtol-booster-1.png
Normal file
BIN
core/assets-raw/sprites/units/vtol-booster-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 203 B |
BIN
core/assets-raw/sprites/units/vtol-booster-2.png
Normal file
BIN
core/assets-raw/sprites/units/vtol-booster-2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 191 B |
BIN
core/assets-raw/sprites/units/vtol.png
Normal file
BIN
core/assets-raw/sprites/units/vtol.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 242 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 106 KiB |
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Sun Apr 22 16:19:48 EDT 2018
|
||||
#Mon Apr 23 21:27:41 EDT 2018
|
||||
version=pre-alpha
|
||||
androidBuildCode=1087
|
||||
androidBuildCode=1090
|
||||
name=Mindustry
|
||||
code=4.0
|
||||
build=custom build
|
||||
|
@ -1,28 +1,40 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.content.bullets.TurretBullets;
|
||||
import io.anuke.mindustry.content.fx.ShootFx;
|
||||
import io.anuke.mindustry.resource.AmmoType;
|
||||
|
||||
public class AmmoTypes {
|
||||
public static final AmmoType
|
||||
|
||||
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5, 0.9f),
|
||||
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
basicSteel = new AmmoType(Items.steel, TurretBullets.basicSteel, 5, 0.8f),
|
||||
basicSteel = new AmmoType(Items.steel, TurretBullets.basicSteel, 5){{
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
}},
|
||||
|
||||
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f, 0.9f),
|
||||
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f){{
|
||||
shootEffect = ShootFx.shootSmallFlame;
|
||||
}},
|
||||
|
||||
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1, 0.8f),
|
||||
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
lancerLaser = new AmmoType(TurretBullets.lancerLaser),
|
||||
|
||||
lightning = new AmmoType(TurretBullets.lightning),
|
||||
|
||||
oil = new AmmoType(Liquids.oil, TurretBullets.oilShot, 0.3f, 1f),
|
||||
oil = new AmmoType(Liquids.oil, TurretBullets.oilShot, 0.3f),
|
||||
|
||||
water = new AmmoType(Liquids.water, TurretBullets.waterShot, 0.3f, 1f),
|
||||
water = new AmmoType(Liquids.water, TurretBullets.waterShot, 0.3f),
|
||||
|
||||
lava = new AmmoType(Liquids.lava, TurretBullets.lavaShot, 0.3f, 1f),
|
||||
lava = new AmmoType(Liquids.lava, TurretBullets.lavaShot, 0.3f),
|
||||
|
||||
cryofluid = new AmmoType(Liquids.cryofluid, TurretBullets.cryoShot, 0.3f, 1f);
|
||||
cryofluid = new AmmoType(Liquids.cryofluid, TurretBullets.cryoShot, 0.3f);
|
||||
}
|
||||
|
@ -114,11 +114,11 @@ public class Recipes {
|
||||
new Recipe(liquid, LiquidBlocks.pump, stack(Items.steel, 10)),
|
||||
new Recipe(liquid, LiquidBlocks.fluxpump, stack(Items.steel, 10), stack(Items.densealloy, 5)),
|
||||
|
||||
new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
|
||||
new Recipe(units, UnitBlocks.vtolFactory, stack(Items.steel, 10)),
|
||||
new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
|
||||
new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
|
||||
new Recipe(units, UnitBlocks.walkerFactory, stack(Items.steel, 10)),
|
||||
//new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
|
||||
//new Recipe(units, UnitBlocks.vtolFactory, stack(Items.steel, 10)),
|
||||
//new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
|
||||
//new Recipe(units, UnitBlocks.droneFactory, stack(Items.steel, 10)),
|
||||
//new Recipe(units, UnitBlocks.walkerFactory, stack(Items.steel, 10)),
|
||||
|
||||
new Recipe(units, DebugBlocks.itemSource, stack(Items.steel, 10)).setDebug(),
|
||||
new Recipe(units, DebugBlocks.itemVoid, stack(Items.steel, 10)).setDebug(),
|
||||
|
@ -19,8 +19,6 @@ public class WeaponBlocks{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.basicIron};
|
||||
reload = 25f;
|
||||
restitution = 0.03f;
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
ammoUseEffect = ShootFx.shellEjectSmall;
|
||||
}},
|
||||
|
||||
@ -32,8 +30,6 @@ public class WeaponBlocks{
|
||||
restitution = 0.03f;
|
||||
recoil = 1.5f;
|
||||
burstSpacing = 6f;
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
ammoUseEffect = ShootFx.shellEjectSmall;
|
||||
}},
|
||||
|
||||
@ -42,7 +38,6 @@ public class WeaponBlocks{
|
||||
recoil = 0f;
|
||||
reload = 5f;
|
||||
shootCone = 50f;
|
||||
shootEffect = ShootFx.shootSmallFlame;
|
||||
ammoUseEffect = ShootFx.shellEjectSmall;
|
||||
|
||||
drawer = (tile, entity) -> {
|
||||
@ -58,8 +53,6 @@ public class WeaponBlocks{
|
||||
ammoEjectBack = 2f;
|
||||
recoil = 3f;
|
||||
shootShake = 2f;
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
ammoUseEffect = ShootFx.shellEjectMedium;
|
||||
}},
|
||||
|
||||
@ -73,8 +66,6 @@ public class WeaponBlocks{
|
||||
cooldown = 0.03f;
|
||||
recoil = 3f;
|
||||
shootShake = 2f;
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
ammoUseEffect = ShootFx.shellEjectBig;
|
||||
|
||||
drawer = (tile, entity) -> {
|
||||
|
@ -2,9 +2,10 @@ package io.anuke.mindustry.entities.units;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import io.anuke.mindustry.content.bullets.TurretBullets;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
@ -21,7 +22,7 @@ public class FlyingUnitType extends UnitType {
|
||||
public FlyingUnitType(String name) {
|
||||
super(name);
|
||||
speed = 0.2f;
|
||||
maxVelocity = 4f;
|
||||
maxVelocity = 2f;
|
||||
drag = 0.01f;
|
||||
isFlying = true;
|
||||
}
|
||||
@ -65,7 +66,7 @@ public class FlyingUnitType extends UnitType {
|
||||
unit.velocity.add(vec); //TODO clamp it so it doesn't glitch out at low fps
|
||||
|
||||
if(unit.timer.get(timerReload, reload) && len < range){
|
||||
//shoot(unit, BulletType.shot, ang, 4f);
|
||||
shoot(unit, TurretBullets.basicIron, unit.rotation, 4f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,9 @@ package io.anuke.mindustry.entities.units.types;
|
||||
import io.anuke.mindustry.entities.units.GroundUnitType;
|
||||
|
||||
public class Brute extends GroundUnitType {
|
||||
|
||||
public Brute(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.entities.units.FlyingUnitType;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class Vtol extends FlyingUnitType {
|
||||
|
||||
@ -16,6 +17,10 @@ public class Vtol extends FlyingUnitType {
|
||||
Draw.alpha(unit.hitTime / Unit.hitDuration);
|
||||
|
||||
Draw.rect(name, unit.x, unit.y, unit.rotation - 90);
|
||||
for(int i : Mathf.signs){
|
||||
Draw.rect(name + "-booster-1", unit.x, unit.y, 12*i, 12, unit.rotation - 90);
|
||||
Draw.rect(name + "-booster-2", unit.x, unit.y, 12*i, 12, unit.rotation - 90);
|
||||
}
|
||||
|
||||
Draw.alpha(1f);
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
|
||||
public class AmmoType {
|
||||
private static int lastID = 0;
|
||||
@ -17,8 +19,12 @@ public class AmmoType {
|
||||
/**For item ammo, this is amount given per ammo item.
|
||||
* For liquid ammo, this is amount used per shot.*/
|
||||
public final float quantityMultiplier;
|
||||
/**Turret shoot speed multiplier.*/
|
||||
public final float speedMultiplier;
|
||||
/**Reload speed multiplier.*/
|
||||
public float speedMultiplier = 1f;
|
||||
/**Effect created when shooting.*/
|
||||
public Effect shootEffect = Fx.none;
|
||||
/**Extra smoke effect created when shooting.*/
|
||||
public Effect smokeEffect = Fx.none;
|
||||
|
||||
{
|
||||
this.id = (byte)(lastID++);
|
||||
@ -33,20 +39,18 @@ public class AmmoType {
|
||||
this.speedMultiplier = 1f;
|
||||
}
|
||||
|
||||
public AmmoType(Item item, BulletType result, float multiplier, float speedMultiplier){
|
||||
public AmmoType(Item item, BulletType result, float multiplier){
|
||||
this.item = item;
|
||||
this.liquid = null;
|
||||
this.bullet = result;
|
||||
this.quantityMultiplier = multiplier;
|
||||
this.speedMultiplier = speedMultiplier;
|
||||
}
|
||||
|
||||
public AmmoType(Liquid liquid, BulletType result, float multiplier, float speedMultiplier){
|
||||
public AmmoType(Liquid liquid, BulletType result, float multiplier){
|
||||
this.item = null;
|
||||
this.liquid = liquid;
|
||||
this.bullet = result;
|
||||
this.quantityMultiplier = multiplier;
|
||||
this.speedMultiplier = speedMultiplier;
|
||||
}
|
||||
|
||||
public static Array<AmmoType> getAllTypes() {
|
||||
|
@ -1,8 +1,6 @@
|
||||
package io.anuke.mindustry.resource;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.entities.Bullet;
|
||||
import io.anuke.mindustry.entities.BulletType;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
@ -16,8 +14,6 @@ import io.anuke.ucore.util.Translator;
|
||||
public class Weapon extends Upgrade{
|
||||
/**weapon reload in frames*/
|
||||
protected float reload;
|
||||
/**type of bullet shot*/
|
||||
protected BulletType type;
|
||||
/**sound made when shooting*/
|
||||
protected String shootsound = "shoot";
|
||||
/**amount of shots per fire*/
|
||||
@ -37,10 +33,9 @@ public class Weapon extends Upgrade{
|
||||
/**translator for vector calulations*/
|
||||
protected Translator tr = new Translator();
|
||||
|
||||
protected Weapon(String name, float reload, BulletType type){
|
||||
protected Weapon(String name, float reload){
|
||||
super(name);
|
||||
this.reload = reload;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void update(Player p, boolean left){
|
||||
@ -78,7 +73,7 @@ public class Weapon extends Upgrade{
|
||||
|
||||
void bullet(Unit owner, float x, float y, float angle){
|
||||
tr.trns(angle, 3f);
|
||||
|
||||
Bullet.create(type, owner, x + tr.x, y + tr.y, angle);
|
||||
//TODO implement!
|
||||
//Bullet.create(type, owner, x + tr.x, y + tr.y, angle);
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,9 @@ public class DebugFragment implements Fragment {
|
||||
row();
|
||||
new button("death", () -> player.damage(99999, false));
|
||||
row();
|
||||
new button("spawn", () -> new BaseUnit(UnitTypes.scout, Team.red).set(player.x, player.y).add());
|
||||
new button("spawn1", () -> new BaseUnit(UnitTypes.vtol, Team.red).set(player.x, player.y).add());
|
||||
row();
|
||||
new button("spawn2", () -> new BaseUnit(UnitTypes.scout, Team.red).set(player.x, player.y).add());
|
||||
row();
|
||||
}}.end();
|
||||
|
||||
|
@ -225,6 +225,9 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
protected void effects(Tile tile){
|
||||
Effect shootEffect = this.shootEffect == Fx.none ? peekAmmo(tile).shootEffect : this.shootEffect;
|
||||
Effect smokeEffect = this.smokeEffect == Fx.none ? peekAmmo(tile).smokeEffect : this.smokeEffect;
|
||||
|
||||
TurretEntity entity = tile.entity();
|
||||
|
||||
Effects.effect(shootEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
|
Loading…
Reference in New Issue
Block a user