Merge
This commit is contained in:
@@ -9,7 +9,6 @@ import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.effect.Puddle;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
@@ -29,12 +28,15 @@ import io.anuke.ucore.util.Translator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class Vars{
|
||||
public static final String discordURL = "https://discord.gg/mindustry";
|
||||
public static final String releasesURL = "https://api.github.com/repos/Anuken/Mindustry/releases";
|
||||
public static final String crashReportURL = "http://mindustry.us.to/report";
|
||||
//time between waves in frames (on normal mode)
|
||||
public static final float wavespace = 60 * 60 * 1.5f;
|
||||
|
||||
public static final float mineTransferRange = 310f;
|
||||
//set ridiculously high for now
|
||||
public static final float coreBuildRange = 999999f;
|
||||
//team of the player by default
|
||||
@@ -115,7 +117,6 @@ public class Vars{
|
||||
public static EntityGroup<Bullet> bulletGroup;
|
||||
public static EntityGroup<EffectEntity> effectGroup;
|
||||
public static EntityGroup<DrawTrait> groundEffectGroup;
|
||||
public static EntityGroup<ItemDrop> itemGroup;
|
||||
public static EntityGroup<ShieldEntity> shieldGroup;
|
||||
public static EntityGroup<Puddle> puddleGroup;
|
||||
public static EntityGroup<Fire> fireGroup;
|
||||
@@ -139,7 +140,6 @@ public class Vars{
|
||||
}
|
||||
|
||||
Arrays.sort(locales, (l1, l2) -> Platform.instance.getLocaleName(l1).compareTo(Platform.instance.getLocaleName(l2)));
|
||||
|
||||
Version.init();
|
||||
|
||||
content = new ContentLoader();
|
||||
@@ -150,7 +150,6 @@ public class Vars{
|
||||
effectGroup = Entities.addGroup(EffectEntity.class, false);
|
||||
groundEffectGroup = Entities.addGroup(DrawTrait.class, false);
|
||||
puddleGroup = Entities.addGroup(Puddle.class).enableMapping();
|
||||
itemGroup = Entities.addGroup(ItemDrop.class).enableMapping();
|
||||
shieldGroup = Entities.addGroup(ShieldEntity.class, false);
|
||||
fireGroup = Entities.addGroup(Fire.class).enableMapping();
|
||||
unitGroups = new EntityGroup[Team.all.length];
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.anuke.mindustry.type.ContentType;
|
||||
|
||||
public class AmmoTypes implements ContentList{
|
||||
public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
|
||||
bulletDenseBig, bulletPyratiteBig, bulletThoriumBig,
|
||||
shock, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, weaponMissileSwarm, bulletMech,
|
||||
healBlaster, bulletGlaive,
|
||||
flakExplosive, flakPlastic, flakSurge,
|
||||
@@ -115,6 +116,22 @@ public class AmmoTypes implements ContentList{
|
||||
inaccuracy = 3f;
|
||||
}};
|
||||
|
||||
bulletDenseBig = new AmmoType(Items.densealloy, StandardBullets.denseBig, 1){{
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
}};
|
||||
|
||||
bulletThoriumBig = new AmmoType(Items.thorium, StandardBullets.thoriumBig, 1){{
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
}};
|
||||
|
||||
bulletPyratiteBig = new AmmoType(Items.pyratite, StandardBullets.tracerBig, 2){{
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
inaccuracy = 3f;
|
||||
}};
|
||||
|
||||
//flak
|
||||
|
||||
flakExplosive = new AmmoType(Items.blastCompound, FlakBullets.explosive, 5){{
|
||||
@@ -200,7 +217,7 @@ public class AmmoTypes implements ContentList{
|
||||
|
||||
spectreLaser = new AmmoType(TurretBullets.lancerLaser);
|
||||
|
||||
meltdownLaser = new AmmoType(TurretBullets.lancerLaser);
|
||||
meltdownLaser = new AmmoType(TurretBullets.meltdownLaser);
|
||||
|
||||
fuseShotgun = new AmmoType(Items.densealloy, TurretBullets.fuseShot, 1f){{
|
||||
shootEffect = Fx.none;
|
||||
|
||||
@@ -19,8 +19,8 @@ public class Recipes implements ContentList{
|
||||
new Recipe(defense, DefenseBlocks.copperWall, new ItemStack(Items.copper, 12));
|
||||
new Recipe(defense, DefenseBlocks.copperWallLarge, new ItemStack(Items.copper, 12 * 4));
|
||||
|
||||
new Recipe(defense, DefenseBlocks.compositeWall, new ItemStack(Items.densealloy, 12));
|
||||
new Recipe(defense, DefenseBlocks.compositeWallLarge, new ItemStack(Items.densealloy, 12 * 4));
|
||||
new Recipe(defense, DefenseBlocks.denseAlloyWall, new ItemStack(Items.densealloy, 12));
|
||||
new Recipe(defense, DefenseBlocks.denseAlloyWallLarge, new ItemStack(Items.densealloy, 12 * 4));
|
||||
|
||||
new Recipe(defense, DefenseBlocks.door, new ItemStack(Items.densealloy, 12), new ItemStack(Items.silicon, 8));
|
||||
new Recipe(defense, DefenseBlocks.doorLarge, new ItemStack(Items.densealloy, 12 * 4), new ItemStack(Items.silicon, 8 * 4));
|
||||
@@ -35,7 +35,7 @@ public class Recipes implements ContentList{
|
||||
new Recipe(defense, DefenseBlocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
|
||||
|
||||
//projectors
|
||||
new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
|
||||
new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 180));
|
||||
new Recipe(defense, DefenseBlocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
|
||||
new Recipe(defense, DefenseBlocks.forceProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
|
||||
|
||||
@@ -54,6 +54,8 @@ public class Recipes implements ContentList{
|
||||
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.densealloy, 220), new ItemStack(Items.thorium, 120));
|
||||
new Recipe(weapon, TurretBlocks.cyclone, new ItemStack(Items.copper, 400), new ItemStack(Items.densealloy, 400), new ItemStack(Items.surgealloy, 200), new ItemStack(Items.plastanium, 150));
|
||||
new Recipe(weapon, TurretBlocks.fuse, new ItemStack(Items.copper, 450), new ItemStack(Items.densealloy, 450), new ItemStack(Items.surgealloy, 250));
|
||||
new Recipe(weapon, TurretBlocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 500), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 500));
|
||||
new Recipe(weapon, TurretBlocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 650), new ItemStack(Items.silicon, 650));
|
||||
|
||||
//DISTRIBUTION
|
||||
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1));
|
||||
@@ -143,24 +145,25 @@ public class Recipes implements ContentList{
|
||||
//UNITS
|
||||
|
||||
//bodies
|
||||
new Recipe(units, UpgradeBlocks.dartFactory, new ItemStack(Items.lead, 150), new ItemStack(Items.copper, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setDesktop(); //dart is desktop only, because it's the starter mobile ship
|
||||
new Recipe(units, UpgradeBlocks.tridentFactory, new ItemStack(Items.lead, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
|
||||
new Recipe(units, UpgradeBlocks.javelinFactory, new ItemStack(Items.lead, 350), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasematter, 200));
|
||||
new Recipe(units, UpgradeBlocks.glaiveFactory, new ItemStack(Items.lead, 450), new ItemStack(Items.silicon, 650), new ItemStack(Items.titanium, 700), new ItemStack(Items.plastanium, 600), new ItemStack(Items.surgealloy, 200));
|
||||
new Recipe(units, UpgradeBlocks.dartPad, new ItemStack(Items.lead, 150), new ItemStack(Items.copper, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setDesktop(); //dart is desktop only, because it's the starter mobile ship
|
||||
new Recipe(units, UpgradeBlocks.tridentPad, new ItemStack(Items.lead, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
|
||||
new Recipe(units, UpgradeBlocks.javelinPad, new ItemStack(Items.lead, 350), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasematter, 200));
|
||||
new Recipe(units, UpgradeBlocks.glaivePad, new ItemStack(Items.lead, 450), new ItemStack(Items.silicon, 650), new ItemStack(Items.titanium, 700), new ItemStack(Items.plastanium, 600), new ItemStack(Items.surgealloy, 200));
|
||||
|
||||
new Recipe(units, UpgradeBlocks.tauFactory, new ItemStack(Items.lead, 250), new ItemStack(Items.densealloy, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250)).setDesktop();
|
||||
new Recipe(units, UpgradeBlocks.deltaFactory, new ItemStack(Items.lead, 350), new ItemStack(Items.densealloy, 350), new ItemStack(Items.copper, 400), new ItemStack(Items.silicon, 450), new ItemStack(Items.thorium, 300)).setDesktop();
|
||||
new Recipe(units, UpgradeBlocks.omegaFactory, new ItemStack(Items.lead, 450), new ItemStack(Items.densealloy, 550), new ItemStack(Items.silicon, 650), new ItemStack(Items.thorium, 600), new ItemStack(Items.surgealloy, 240)).setDesktop();
|
||||
new Recipe(units, UpgradeBlocks.tauPad, new ItemStack(Items.lead, 250), new ItemStack(Items.densealloy, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250)).setDesktop();
|
||||
new Recipe(units, UpgradeBlocks.deltaPad, new ItemStack(Items.lead, 350), new ItemStack(Items.densealloy, 350), new ItemStack(Items.copper, 400), new ItemStack(Items.silicon, 450), new ItemStack(Items.thorium, 300)).setDesktop();
|
||||
new Recipe(units, UpgradeBlocks.omegaPad, new ItemStack(Items.lead, 450), new ItemStack(Items.densealloy, 550), new ItemStack(Items.silicon, 650), new ItemStack(Items.thorium, 600), new ItemStack(Items.surgealloy, 240)).setDesktop();
|
||||
|
||||
//actual unit related stuff
|
||||
new Recipe(units, UnitBlocks.dronePad, new ItemStack(Items.copper, 70), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 130));
|
||||
new Recipe(units, UnitBlocks.fabricatorPad, new ItemStack(Items.densealloy, 90), new ItemStack(Items.thorium, 80), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 210));
|
||||
new Recipe(units, UnitBlocks.spiritFactory, new ItemStack(Items.copper, 70), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 130));
|
||||
new Recipe(units, UnitBlocks.phantomFactory, new ItemStack(Items.densealloy, 90), new ItemStack(Items.thorium, 80), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 210));
|
||||
|
||||
new Recipe(units, UnitBlocks.daggerPad, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70));
|
||||
new Recipe(units, UnitBlocks.titanPad, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
|
||||
new Recipe(units, UnitBlocks.daggerFactory, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70));
|
||||
new Recipe(units, UnitBlocks.titanFactory, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
|
||||
|
||||
new Recipe(units, UnitBlocks.interceptorPad, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
|
||||
new Recipe(units, UnitBlocks.monsoonPad, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
|
||||
new Recipe(units, UnitBlocks.wraithFactory, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
|
||||
new Recipe(units, UnitBlocks.ghoulFactory, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
|
||||
new Recipe(units, UnitBlocks.revenantFactory, new ItemStack(Items.plastanium, 300), new ItemStack(Items.titanium, 400), new ItemStack(Items.lead, 300), new ItemStack(Items.silicon, 400), new ItemStack(Items.surgealloy, 100));
|
||||
|
||||
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.copper, 30), new ItemStack(Items.silicon, 30));
|
||||
new Recipe(units, UnitBlocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.densealloy, 100), new ItemStack(Items.silicon, 200));
|
||||
|
||||
@@ -8,20 +8,14 @@ import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.type.ContentType;
|
||||
|
||||
public class UnitTypes implements ContentList{
|
||||
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fortress, fabricator;
|
||||
public static UnitType
|
||||
spirit, phantom,
|
||||
alphaDrone,
|
||||
wraith, ghoul, revenant,
|
||||
dagger, titan, fortress;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
drone = new UnitType("drone", Drone.class, Drone::new){{
|
||||
isFlying = true;
|
||||
drag = 0.01f;
|
||||
speed = 0.2f;
|
||||
maxVelocity = 0.8f;
|
||||
range = 50f;
|
||||
healSpeed = 0.05f;
|
||||
health = 60;
|
||||
}};
|
||||
|
||||
alphaDrone = new UnitType("alpha-drone", AlphaDrone.class, AlphaDrone::new){
|
||||
{
|
||||
isFlying = true;
|
||||
@@ -40,13 +34,23 @@ public class UnitTypes implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
spirit = new UnitType("spirit", Spirit.class, Spirit::new){{
|
||||
isFlying = true;
|
||||
drag = 0.01f;
|
||||
speed = 0.2f;
|
||||
maxVelocity = 0.8f;
|
||||
range = 50f;
|
||||
healSpeed = 0.25f;
|
||||
health = 60;
|
||||
}};
|
||||
|
||||
dagger = new UnitType("dagger", Dagger.class, Dagger::new){{
|
||||
maxVelocity = 1.1f;
|
||||
speed = 0.2f;
|
||||
drag = 0.4f;
|
||||
range = 40f;
|
||||
weapon = Weapons.chainBlaster;
|
||||
health = 180;
|
||||
health = 150;
|
||||
}};
|
||||
|
||||
titan = new UnitType("titan", Titan.class, Titan::new){{
|
||||
@@ -55,7 +59,7 @@ public class UnitTypes implements ContentList{
|
||||
drag = 0.4f;
|
||||
range = 10f;
|
||||
weapon = Weapons.flamethrower;
|
||||
health = 500;
|
||||
health = 440;
|
||||
}};
|
||||
|
||||
fortress = new UnitType("fortress", Fortress.class, Fortress::new){{
|
||||
@@ -63,11 +67,11 @@ public class UnitTypes implements ContentList{
|
||||
speed = 0.18f;
|
||||
drag = 0.4f;
|
||||
range = 10f;
|
||||
weapon = Weapons.flamethrower;
|
||||
weapon = Weapons.artillery;
|
||||
health = 500;
|
||||
}};
|
||||
|
||||
interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{
|
||||
wraith = new UnitType("wraith", Wraith.class, Wraith::new){{
|
||||
speed = 0.3f;
|
||||
maxVelocity = 1.9f;
|
||||
drag = 0.01f;
|
||||
@@ -76,7 +80,7 @@ public class UnitTypes implements ContentList{
|
||||
health = 70;
|
||||
}};
|
||||
|
||||
monsoon = new UnitType("monsoon", Monsoon.class, Monsoon::new){{
|
||||
ghoul = new UnitType("ghoul", Ghoul.class, Ghoul::new){{
|
||||
health = 250;
|
||||
speed = 0.2f;
|
||||
maxVelocity = 1.4f;
|
||||
@@ -85,7 +89,16 @@ public class UnitTypes implements ContentList{
|
||||
weapon = Weapons.bomber;
|
||||
}};
|
||||
|
||||
fabricator = new UnitType("fabricator", Fabricator.class, Fabricator::new){{
|
||||
revenant = new UnitType("revenant", Revenant.class, Revenant::new){{
|
||||
health = 250;
|
||||
speed = 0.2f;
|
||||
maxVelocity = 1.4f;
|
||||
drag = 0.01f;
|
||||
isFlying = true;
|
||||
weapon = Weapons.bomber;
|
||||
}};
|
||||
|
||||
phantom = new UnitType("phantom", Phantom.class, Phantom::new){{
|
||||
isFlying = true;
|
||||
drag = 0.01f;
|
||||
speed = 0.2f;
|
||||
@@ -95,7 +108,7 @@ public class UnitTypes implements ContentList{
|
||||
health = 220;
|
||||
buildPower = 0.9f;
|
||||
minePower = 1.1f;
|
||||
healSpeed = 0.09f;
|
||||
healSpeed = 0.55f;
|
||||
toMine = ObjectSet.with(Items.lead, Items.copper, Items.titanium);
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ import io.anuke.mindustry.type.ContentType;
|
||||
import io.anuke.mindustry.type.Weapon;
|
||||
|
||||
public class Weapons implements ContentList{
|
||||
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, chainBlaster, shockgun, sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles;
|
||||
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, chainBlaster, shockgun,
|
||||
sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -119,6 +120,15 @@ public class Weapons implements ContentList{
|
||||
ammo = AmmoTypes.flamerThermite;
|
||||
}};
|
||||
|
||||
artillery = new Weapon("artillery"){{
|
||||
length = 1f;
|
||||
reload = 60f;
|
||||
roundrobin = true;
|
||||
recoil = 1f;
|
||||
ejectEffect = ShootFx.shellEjectMedium;
|
||||
ammo = AmmoTypes.artilleryExplosive;
|
||||
}};
|
||||
|
||||
sapper = new Weapon("sapper"){{
|
||||
length = 1.5f;
|
||||
reload = 12f;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class CraftingBlocks extends BlockList implements ContentList{
|
||||
plastaniumCompressor = new PlastaniumCompressor("plastanium-compressor"){{
|
||||
hasItems = true;
|
||||
liquidCapacity = 60f;
|
||||
craftTime = 80f;
|
||||
craftTime = 60f;
|
||||
output = Items.plastanium;
|
||||
itemCapacity = 30;
|
||||
size = 2;
|
||||
@@ -67,7 +67,7 @@ public class CraftingBlocks extends BlockList implements ContentList{
|
||||
updateEffect = BlockFx.plasticburn;
|
||||
|
||||
consumes.liquid(Liquids.oil, 0.25f);
|
||||
consumes.power(0.25f);
|
||||
consumes.power(0.3f);
|
||||
consumes.item(Items.titanium, 2);
|
||||
}};
|
||||
|
||||
|
||||
@@ -61,6 +61,11 @@ public class DebugBlocks extends BlockList implements ContentList{
|
||||
hasItems = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean outputsItems(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
SorterEntity entity = tile.entity();
|
||||
@@ -81,6 +86,7 @@ public class DebugBlocks extends BlockList implements ContentList{
|
||||
hasLiquids = true;
|
||||
liquidCapacity = 100f;
|
||||
configurable = true;
|
||||
outputsLiquid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,10 +120,9 @@ public class DebugBlocks extends BlockList implements ContentList{
|
||||
for(int i = 0; i < items.size; i++){
|
||||
if(i == 0) continue;
|
||||
final int f = i;
|
||||
ImageButton button = cont.addImageButton("white", "toggle", 24, () -> {
|
||||
ImageButton button = cont.addImageButton("liquid-icon-" + items.get(i).name, "toggle", 24, () -> {
|
||||
Call.setLiquidSourceLiquid(null, tile, items.get(f));
|
||||
}).size(38, 42).padBottom(-5.1f).group(group).get();
|
||||
button.getStyle().imageUpColor = items.get(i).color;
|
||||
button.setChecked(entity.source.id == f);
|
||||
|
||||
if(i % 4 == 3){
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.defense.*;
|
||||
|
||||
public class DefenseBlocks extends BlockList implements ContentList{
|
||||
public static Block copperWall, copperWallLarge, compositeWall, compositeWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
||||
public static Block copperWall, copperWallLarge, denseAlloyWall, denseAlloyWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
|
||||
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector, overdriveProjector, forceProjector, shockMine;
|
||||
|
||||
@Override
|
||||
@@ -23,11 +23,11 @@ public class DefenseBlocks extends BlockList implements ContentList{
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
compositeWall = new Wall("composite-wall"){{
|
||||
denseAlloyWall = new Wall("dense-alloy-wall"){{
|
||||
health = 110 * wallHealthMultiplier;
|
||||
}};
|
||||
|
||||
compositeWallLarge = new Wall("composite-wall-large"){{
|
||||
denseAlloyWallLarge = new Wall("dense-alloy-wall-large"){{
|
||||
health = 110 * wallHealthMultiplier * 4;
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
@@ -19,7 +19,7 @@ public class LiquidBlocks extends BlockList implements ContentList{
|
||||
|
||||
rotaryPump = new Pump("rotary-pump"){{
|
||||
shadow = "shadow-rounded-2";
|
||||
pumpAmount = 0.25f;
|
||||
pumpAmount = 0.2f;
|
||||
consumes.power(0.015f);
|
||||
liquidCapacity = 30f;
|
||||
powerCapacity = 20f;
|
||||
@@ -30,7 +30,7 @@ public class LiquidBlocks extends BlockList implements ContentList{
|
||||
|
||||
thermalPump = new Pump("thermal-pump"){{
|
||||
shadow = "shadow-rounded-2";
|
||||
pumpAmount = 0.55f;
|
||||
pumpAmount = 0.3f;
|
||||
consumes.power(0.03f);
|
||||
liquidCapacity = 40f;
|
||||
hasPower = true;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class PowerBlocks extends BlockList implements ContentList{
|
||||
thermalGenerator = new LiquidHeatGenerator("thermal-generator"){{
|
||||
maxLiquidGenerate = 0.5f;
|
||||
powerCapacity = 40f;
|
||||
powerPerLiquid = 1.5f;
|
||||
powerPerLiquid = 1f;
|
||||
generateEffect = BlockFx.redgeneratespark;
|
||||
size = 2;
|
||||
}};
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StorageBlocks extends BlockList implements ContentList{
|
||||
@Override
|
||||
public void load(){
|
||||
core = new CoreBlock("core"){{
|
||||
health = 800;
|
||||
health = 1400;
|
||||
}};
|
||||
|
||||
vault = new Vault("vault"){{
|
||||
|
||||
@@ -82,7 +82,7 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
};
|
||||
}};
|
||||
|
||||
lancer = new LaserTurret("lancer"){{
|
||||
lancer = new ChargeTurret("lancer"){{
|
||||
range = 90f;
|
||||
chargeTime = 60f;
|
||||
chargeMaxDelay = 30f;
|
||||
@@ -105,7 +105,7 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
|
||||
arc = new PowerTurret("arc"){{
|
||||
shootType = AmmoTypes.arc;
|
||||
reload = 30f;
|
||||
reload = 40f;
|
||||
shootShake = 1f;
|
||||
powerUsed = 5f;
|
||||
powerCapacity = 30f;
|
||||
@@ -197,6 +197,8 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
rotatespeed = 10f;
|
||||
inaccuracy = 13f;
|
||||
shootCone = 30f;
|
||||
|
||||
health = 145 * size * size;
|
||||
}};
|
||||
|
||||
fuse = new ItemTurret("fuse"){{
|
||||
@@ -208,19 +210,45 @@ public class TurretBlocks extends BlockList implements ContentList{
|
||||
recoil = 5f;
|
||||
restitution = 0.1f;
|
||||
size = 3;
|
||||
|
||||
health = 155 * size * size;
|
||||
}};
|
||||
|
||||
spectre = new ItemTurret("spectre"){{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.bulletCopper, AmmoTypes.bulletDense, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
|
||||
reload = 25f;
|
||||
restitution = 0.03f;
|
||||
ammoUseEffect = ShootFx.shellEjectSmall;
|
||||
spectre = new DoubleTurret("spectre"){{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.bulletDenseBig, AmmoTypes.bulletPyratiteBig, AmmoTypes.bulletThoriumBig};
|
||||
reload = 6f;
|
||||
coolantMultiplier = 0.5f;
|
||||
maxCoolantUsed = 1.5f;
|
||||
restitution = 0.1f;
|
||||
ammoUseEffect = ShootFx.shellEjectBig;
|
||||
range = 200f;
|
||||
inaccuracy = 3f;
|
||||
recoil = 3f;
|
||||
xRand = 3f;
|
||||
shotWidth = 4f;
|
||||
shootShake = 2f;
|
||||
shots = 2;
|
||||
size = 4;
|
||||
shootCone = 24f;
|
||||
|
||||
health = 155 * size * size;
|
||||
}};
|
||||
|
||||
meltdown = new PowerTurret("meltdown"){{
|
||||
meltdown = new LaserTurret("meltdown"){{
|
||||
shootType = AmmoTypes.meltdownLaser;
|
||||
shootEffect = ShootFx.shootBigSmoke2;
|
||||
shootCone = 40f;
|
||||
recoil = 4f;
|
||||
size = 4;
|
||||
shootShake = 2f;
|
||||
powerUsed = 60f;
|
||||
powerCapacity = 120f;
|
||||
range = 160f;
|
||||
reload = 200f;
|
||||
firingMoveFract = 0.1f;
|
||||
shootDuration = 220f;
|
||||
|
||||
health = 165 * size * size;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,38 +8,40 @@ import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.units.*;
|
||||
|
||||
public class UnitBlocks extends BlockList implements ContentList{
|
||||
public static Block repairPoint, dronePad,
|
||||
fabricatorPad, interceptorPad, monsoonPad, daggerPad, titanPad,
|
||||
reconstructor, commandCenter;
|
||||
public static Block
|
||||
spiritFactory, phantomFactory,
|
||||
wraithFactory, ghoulFactory, revenantFactory,
|
||||
daggerFactory, titanFactory,
|
||||
reconstructor, repairPoint, commandCenter;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
dronePad = new UnitPad("drone-pad"){{
|
||||
type = UnitTypes.drone;
|
||||
spiritFactory = new UnitFactory("spirit-factory"){{
|
||||
type = UnitTypes.spirit;
|
||||
produceTime = 5700;
|
||||
size = 2;
|
||||
consumes.power(0.08f);
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30)});
|
||||
}};
|
||||
|
||||
fabricatorPad = new UnitPad("fabricator-pad"){{
|
||||
type = UnitTypes.fabricator;
|
||||
phantomFactory = new UnitFactory("phantom-factory"){{
|
||||
type = UnitTypes.phantom;
|
||||
produceTime = 7300;
|
||||
size = 2;
|
||||
consumes.power(0.2f);
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
|
||||
}};
|
||||
|
||||
interceptorPad = new UnitPad("interceptor-pad"){{
|
||||
type = UnitTypes.interceptor;
|
||||
wraithFactory = new UnitFactory("wraith-factory"){{
|
||||
type = UnitTypes.wraith;
|
||||
produceTime = 1800;
|
||||
size = 2;
|
||||
consumes.power(0.1f);
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 10), new ItemStack(Items.titanium, 10)});
|
||||
}};
|
||||
|
||||
monsoonPad = new UnitPad("monsoon-pad"){{
|
||||
type = UnitTypes.monsoon;
|
||||
ghoulFactory = new UnitFactory("ghoul-factory"){{
|
||||
type = UnitTypes.ghoul;
|
||||
produceTime = 3600;
|
||||
size = 3;
|
||||
consumes.power(0.2f);
|
||||
@@ -47,7 +49,16 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 30), new ItemStack(Items.plastanium, 20)});
|
||||
}};
|
||||
|
||||
daggerPad = new UnitPad("dagger-pad"){{
|
||||
revenantFactory = new UnitFactory("revenant-factory"){{
|
||||
type = UnitTypes.revenant;
|
||||
produceTime = 8000;
|
||||
size = 4;
|
||||
consumes.power(0.3f);
|
||||
shadow = "shadow-round-3";
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 80), new ItemStack(Items.titanium, 80), new ItemStack(Items.plastanium, 50)});
|
||||
}};
|
||||
|
||||
daggerFactory = new UnitFactory("dagger-factory"){{
|
||||
type = UnitTypes.dagger;
|
||||
produceTime = 1700;
|
||||
size = 2;
|
||||
@@ -55,7 +66,7 @@ public class UnitBlocks extends BlockList implements ContentList{
|
||||
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 10), new ItemStack(Items.copper, 10)});
|
||||
}};
|
||||
|
||||
titanPad = new UnitPad("titan-pad"){{
|
||||
titanFactory = new UnitFactory("titan-factory"){{
|
||||
type = UnitTypes.titan;
|
||||
produceTime = 3400;
|
||||
size = 3;
|
||||
|
||||
@@ -2,53 +2,53 @@ package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.units.MechFactory;
|
||||
import io.anuke.mindustry.world.blocks.units.MechPad;
|
||||
|
||||
public class UpgradeBlocks extends BlockList{
|
||||
public static Block deltaFactory, tauFactory, omegaFactory, dartFactory, javelinFactory, tridentFactory, glaiveFactory;
|
||||
public static Block deltaPad, tauPad, omegaPad, dartPad, javelinPad, tridentPad, glaivePad;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
deltaFactory = new MechFactory("delta-mech-factory"){{
|
||||
deltaPad = new MechPad("delta-mech-pad"){{
|
||||
mech = Mechs.delta;
|
||||
size = 2;
|
||||
powerCapacity = 70f;
|
||||
}};
|
||||
|
||||
tauFactory = new MechFactory("tau-mech-factory"){{
|
||||
tauPad = new MechPad("tau-mech-pad"){{
|
||||
mech = Mechs.tau;
|
||||
size = 2;
|
||||
powerCapacity = 100f;
|
||||
}};
|
||||
|
||||
omegaFactory = new MechFactory("omega-mech-factory"){{
|
||||
omegaPad = new MechPad("omega-mech-pad"){{
|
||||
mech = Mechs.omega;
|
||||
size = 3;
|
||||
powerCapacity = 120f;
|
||||
}};
|
||||
|
||||
dartFactory = new MechFactory("dart-ship-factory"){{
|
||||
dartPad = new MechPad("dart-ship-pad"){{
|
||||
mech = Mechs.dart;
|
||||
size = 2;
|
||||
powerCapacity = 50f;
|
||||
shadow = "shadow-rounded-2";
|
||||
}};
|
||||
|
||||
javelinFactory = new MechFactory("javelin-ship-factory"){{
|
||||
javelinPad = new MechPad("javelin-ship-pad"){{
|
||||
mech = Mechs.javelin;
|
||||
size = 2;
|
||||
powerCapacity = 80f;
|
||||
shadow = "shadow-rounded-2";
|
||||
}};
|
||||
|
||||
tridentFactory = new MechFactory("trident-ship-factory"){{
|
||||
tridentPad = new MechPad("trident-ship-pad"){{
|
||||
mech = Mechs.trident;
|
||||
size = 2;
|
||||
powerCapacity = 100f;
|
||||
shadow = "shadow-rounded-2";
|
||||
}};
|
||||
|
||||
glaiveFactory = new MechFactory("glaive-ship-factory"){{
|
||||
glaivePad = new MechPad("glaive-ship-pad"){{
|
||||
mech = Mechs.glaive;
|
||||
size = 3;
|
||||
powerCapacity = 120f;
|
||||
|
||||
@@ -8,7 +8,7 @@ import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
|
||||
public class StandardBullets extends BulletList implements ContentList{
|
||||
public static BulletType copper, dense, thorium, homing, tracer, mechSmall, glaive;
|
||||
public static BulletType copper, dense, thorium, homing, tracer, mechSmall, glaive, denseBig, thoriumBig, tracerBig;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -76,5 +76,33 @@ public class StandardBullets extends BulletList implements ContentList{
|
||||
despawneffect = BulletFx.hitBulletSmall;
|
||||
}
|
||||
};
|
||||
|
||||
denseBig = new BasicBulletType(7f, 42, "bullet"){
|
||||
{
|
||||
bulletWidth = 15f;
|
||||
bulletHeight = 21f;
|
||||
armorPierce = 0.2f;
|
||||
}
|
||||
};
|
||||
|
||||
thoriumBig = new BasicBulletType(8f, 65, "bullet"){
|
||||
{
|
||||
bulletWidth = 16f;
|
||||
bulletHeight = 23f;
|
||||
armorPierce = 0.5f;
|
||||
}
|
||||
};
|
||||
|
||||
tracerBig = new BasicBulletType(7f, 38, "bullet"){
|
||||
{
|
||||
bulletWidth = 16f;
|
||||
bulletHeight = 21f;
|
||||
frontColor = Palette.lightishOrange;
|
||||
backColor = Palette.lightOrange;
|
||||
incendSpread = 3f;
|
||||
incendAmount = 2;
|
||||
incendChance = 0.3f;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
import io.anuke.mindustry.entities.bullet.LiquidBulletType;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.effect.Lightning;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
@@ -20,10 +19,7 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.distribution.MassDriver.DriverBulletData;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.graphics.Shapes;
|
||||
import io.anuke.ucore.graphics.*;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
@@ -31,7 +27,7 @@ import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class TurretBullets extends BulletList implements ContentList{
|
||||
public static BulletType fireball, basicFlame, lancerLaser, fuseShot, waterShot, cryoShot, lavaShot, oilShot, lightning, driverBolt, healBullet, arc;
|
||||
public static BulletType fireball, basicFlame, lancerLaser, meltdownLaser, fuseShot, waterShot, cryoShot, lavaShot, oilShot, lightning, driverBolt, healBullet, arc;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -161,6 +157,56 @@ public class TurretBullets extends BulletList implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
meltdownLaser = new BulletType(0.001f, 26){
|
||||
Color tmpColor = new Color();
|
||||
Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
|
||||
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
||||
float[] strokes = {2f, 1.5f, 1f, 0.3f};
|
||||
float[] lenscales = {1f, 1.12f, 1.15f, 1.17f};
|
||||
float length = 200f;
|
||||
|
||||
{
|
||||
hiteffect = BulletFx.hitMeltdown;
|
||||
despawneffect = Fx.none;
|
||||
hitsize = 4;
|
||||
drawSize = 420f;
|
||||
lifetime = 16f;
|
||||
pierce = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Bullet b){
|
||||
if(b.timer.get(1, 5f)){
|
||||
Damage.collideLine(b, b.getTeam(), hiteffect, b.x, b.y, b.angle(), length);
|
||||
}
|
||||
Effects.shake(1f, 1f, b.x, b.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hit(Bullet b, float hitx, float hity){
|
||||
Effects.effect(hiteffect, colors[2], hitx, hity);
|
||||
if(Mathf.chance(0.4)){
|
||||
Fire.create(world.tileWorld(hitx+Mathf.range(5f), hity+Mathf.range(5f)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b){
|
||||
float baseLen = (length) * b.fout();
|
||||
|
||||
Lines.lineAngle(b.x, b.y, b.angle(), baseLen);
|
||||
for(int s = 0; s < colors.length; s++){
|
||||
Draw.color(tmpColor.set(colors[s]).mul(1f + Mathf.absin(Timers.time(), 1f, 0.1f)));
|
||||
for(int i = 0; i < tscales.length; i++){
|
||||
vector.trns(b.angle() + 180f, (lenscales[i] - 1f) * 35f);
|
||||
Lines.stroke((9f + Mathf.absin(Timers.time(), 0.8f, 1.5f)) * b.fout() * strokes[s] * tscales[i]);
|
||||
Lines.lineAngle(b.x + vector.x, b.y + vector.y, b.angle(), baseLen * lenscales[i], CapStyle.none);
|
||||
}
|
||||
}
|
||||
Draw.reset();
|
||||
}
|
||||
};
|
||||
|
||||
fuseShot = new BulletType(0.01f, 70){
|
||||
int rays = 3;
|
||||
float raySpace = 2f;
|
||||
@@ -345,8 +391,7 @@ public class TurretBullets extends BulletList implements ContentList{
|
||||
int amountDropped = Mathf.random(0, data.items[i]);
|
||||
if(amountDropped > 0){
|
||||
float angle = b.angle() + Mathf.range(100f);
|
||||
float vs = Mathf.random(0f, 4f);
|
||||
ItemDrop.create(content.item(i), amountDropped, b.x, b.y, Angles.trnsx(angle, vs), Angles.trnsy(angle, vs));
|
||||
Effects.effect(EnvironmentFx.dropItem, Color.WHITE, b.x, b.y, angle, content.item(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class BulletFx extends FxList implements ContentList{
|
||||
public static Effect hitBulletSmall, hitFuse, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion,
|
||||
public static Effect hitBulletSmall, hitFuse, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, hitMeltdown, despawn, flakExplosion, blastExplosion, plasticExplosion,
|
||||
artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig, plasticExplosionFlak;
|
||||
|
||||
@Override
|
||||
@@ -101,6 +101,18 @@ public class BulletFx extends FxList implements ContentList{
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
hitMeltdown = new Effect(12, e -> {
|
||||
Draw.color(Palette.meltdownHit);
|
||||
Lines.stroke(e.fout() * 2f);
|
||||
|
||||
Angles.randLenVectors(e.id, 6, e.finpow() * 18f, e.rotation, 360f, (x, y) -> {
|
||||
float ang = Mathf.atan2(x, y);
|
||||
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
|
||||
});
|
||||
|
||||
Draw.reset();
|
||||
});
|
||||
|
||||
hitLaser = new Effect(8, e -> {
|
||||
Draw.color(Color.WHITE, Palette.heal, e.fin());
|
||||
Lines.stroke(0.5f + e.fout());
|
||||
|
||||
@@ -2,8 +2,9 @@ package io.anuke.mindustry.content.fx;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
@@ -11,7 +12,7 @@ import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class EnvironmentFx extends FxList implements ContentList{
|
||||
public static Effect burning, fire, smoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily, overdriven;
|
||||
public static Effect burning, fire, smoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily, overdriven, dropItem;
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
@@ -125,5 +126,12 @@ public class EnvironmentFx extends FxList implements ContentList{
|
||||
|
||||
Draw.color();
|
||||
});
|
||||
|
||||
dropItem = new Effect(20f, e -> {
|
||||
float length = 20f * e.finpow();
|
||||
float size = 7f * e.fout();
|
||||
|
||||
Draw.rect(((Item) e.data).region, e.x + Angles.trnsx(e.rotation, length), e.y + Angles.trnsy(e.rotation, length), size, size);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.effect.Lightning;
|
||||
import io.anuke.mindustry.entities.effect.Puddle;
|
||||
import io.anuke.mindustry.entities.traits.TypeTrait;
|
||||
@@ -202,6 +201,9 @@ public class ContentLoader{
|
||||
if(id < 0) id += 256;
|
||||
|
||||
if(temporaryMapper != null && temporaryMapper[type.ordinal()] != null && temporaryMapper[type.ordinal()].length != 0){
|
||||
if(temporaryMapper[type.ordinal()][id] == null){
|
||||
return getByID(type, 0); //default value is always ID 0
|
||||
}
|
||||
return (T)temporaryMapper[type.ordinal()][id];
|
||||
}
|
||||
|
||||
@@ -263,7 +265,6 @@ public class ContentLoader{
|
||||
*/
|
||||
private void registerTypes(){
|
||||
TypeTrait.registerType(Player.class, Player::new);
|
||||
TypeTrait.registerType(ItemDrop.class, ItemDrop::new);
|
||||
TypeTrait.registerType(Fire.class, Fire::new);
|
||||
TypeTrait.registerType(Puddle.class, Puddle::new);
|
||||
TypeTrait.registerType(Bullet.class, Bullet::new);
|
||||
|
||||
@@ -131,7 +131,6 @@ public class Logic extends Module{
|
||||
Entities.update(bulletGroup);
|
||||
Entities.update(fireGroup);
|
||||
Entities.update(playerGroup);
|
||||
Entities.update(itemGroup);
|
||||
|
||||
//effect group only contains item drops in the headless version, update it!
|
||||
if(headless){
|
||||
@@ -145,7 +144,6 @@ public class Logic extends Module{
|
||||
}
|
||||
|
||||
EntityPhysics.collideGroups(bulletGroup, playerGroup);
|
||||
EntityPhysics.collideGroups(itemGroup, playerGroup);
|
||||
|
||||
world.pathfinder().update();
|
||||
}
|
||||
|
||||
@@ -246,17 +246,6 @@ public class Renderer extends RendererModule{
|
||||
|
||||
blocks.drawBlocks(Layer.overlay);
|
||||
|
||||
if(itemGroup.size() > 0){
|
||||
Graphics.surface(effectSurface);
|
||||
drawAndInterpolate(itemGroup);
|
||||
Graphics.surface();
|
||||
|
||||
Draw.color(0, 0, 0, 0.2f);
|
||||
Draw.rect(effectSurface, -1, -1);
|
||||
Draw.color();
|
||||
Draw.rect(effectSurface, 0, 0);
|
||||
}
|
||||
|
||||
drawAllTeams(false);
|
||||
|
||||
blocks.skipLayer(Layer.turret);
|
||||
@@ -301,10 +290,6 @@ public class Renderer extends RendererModule{
|
||||
|
||||
float trnsX = -12, trnsY = -13;
|
||||
|
||||
//Graphics.end();
|
||||
//Core.batch.getTransformMatrix().translate(trnsX, trnsY, 0);
|
||||
//Graphics.begin();
|
||||
|
||||
for(EntityGroup<? extends BaseUnit> group : unitGroups){
|
||||
if(!group.isEmpty()){
|
||||
drawAndInterpolate(group, unit -> unit.isFlying() && !unit.isDead(), baseUnit -> baseUnit.drawShadow(trnsX, trnsY));
|
||||
@@ -315,11 +300,6 @@ public class Renderer extends RendererModule{
|
||||
drawAndInterpolate(playerGroup, unit -> unit.isFlying() && !unit.isDead(), player -> player.drawShadow(trnsX, trnsY));
|
||||
}
|
||||
|
||||
//Graphics.end();
|
||||
//Core.batch.getTransformMatrix().translate(-trnsX, -trnsY, 0);
|
||||
//Graphics.begin();
|
||||
|
||||
//TODO this actually isn't necessary
|
||||
Draw.color(0, 0, 0, 0.15f);
|
||||
Graphics.flushSurface();
|
||||
Draw.color();
|
||||
|
||||
@@ -117,7 +117,7 @@ public class UI extends SceneModule{
|
||||
font.getData().setScale(Vars.fontScale);
|
||||
font.getData().down += Unit.dp.scl(4f);
|
||||
font.getData().lineHeight -= Unit.dp.scl(4.3f);
|
||||
}, skin.font(), skin.getFont("default-font-chat"), skin.getFont("korean"), skin.getFont("trad-chinese"), skin.getFont("simp-chinese"));
|
||||
}, skin.font(), skin.getFont("default-font-chat"), skin.getFont("trad-chinese"), skin.getFont("simp-chinese"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -572,10 +572,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(Recipe.getByResult(block) != null){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(Recipe.getByResult(block) != null && Recipe.getByResult(block).desktopOnly && mobile){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class Damage{
|
||||
Tile tile = world.tile(cx, cy);
|
||||
if(tile != null && tile.entity != null && tile.target().getTeamID() != team.ordinal() && tile.entity.collide(hitter)){
|
||||
tile.entity.collision(hitter);
|
||||
Effects.effect(effect, tile.worldx(), tile.worldy());
|
||||
hitter.getBulletType().hit(hitter, tile.worldx(), tile.worldy());
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -10,7 +10,6 @@ import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.content.fx.UnitFx;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.effect.ScorchDecal;
|
||||
import io.anuke.mindustry.entities.traits.*;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
@@ -102,6 +101,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
player.onDeath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDrag(){
|
||||
return mech.drag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Timer getTimer(){
|
||||
return timer;
|
||||
@@ -217,11 +221,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collides(SolidTrait other){
|
||||
return super.collides(other) || other instanceof ItemDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(float x, float y){
|
||||
this.x = x;
|
||||
@@ -431,6 +430,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
//region update methods
|
||||
|
||||
float lastx, lasty;
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
hitTime -= Timers.delta();
|
||||
|
||||
@@ -53,7 +53,9 @@ public class Predict{
|
||||
* See {@link #intercept(float, float, float, float, float, float, float)}.
|
||||
*/
|
||||
public static Vector2 intercept(TargetTrait src, TargetTrait dst, float v){
|
||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), dst.getVelocity().x - src.getVelocity().x, dst.getVelocity().x - src.getVelocity().y, v);
|
||||
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(),
|
||||
dst.getTargetVelocityX() - src.getTargetVelocityX(),
|
||||
dst.getTargetVelocityY() - src.getTargetVelocityY(), v);
|
||||
}
|
||||
|
||||
private static Vector2 quad(float a, float b, float c){
|
||||
|
||||
@@ -207,13 +207,15 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
|
||||
/**Updates velocity and status effects.*/
|
||||
public void updateVelocityStatus(float drag, float maxVelocity){
|
||||
Floor floor = getFloorOn();
|
||||
|
||||
|
||||
if(isCarried()){ //carried units do not take into account velocity normally
|
||||
set(carrier.getX(), carrier.getY());
|
||||
velocity.set(carrier.getVelocity());
|
||||
return;
|
||||
}
|
||||
|
||||
Floor floor = getFloorOn();
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
status.update(this);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.utils.TimeUtils;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.traits.AbsorbTrait;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.entities.traits.TeamTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
@@ -15,6 +16,7 @@ import io.anuke.ucore.entities.impl.BulletEntity;
|
||||
import io.anuke.ucore.entities.trait.Entity;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.entities.trait.VelocityTrait;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Pooling;
|
||||
import io.anuke.ucore.util.Timer;
|
||||
|
||||
@@ -22,13 +24,12 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncTrait{
|
||||
public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncTrait, AbsorbTrait{
|
||||
private static Vector2 vector = new Vector2();
|
||||
public Timer timer = new Timer(3);
|
||||
private float lifeScl;
|
||||
private Team team;
|
||||
private Object data;
|
||||
private boolean supressCollision, supressOnce, initialized;
|
||||
@@ -37,23 +38,23 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
public Bullet(){
|
||||
}
|
||||
|
||||
public static void create(BulletType type, TeamTrait owner, float x, float y, float angle){
|
||||
create(type, owner, owner.getTeam(), x, y, angle);
|
||||
public static Bullet create(BulletType type, TeamTrait owner, float x, float y, float angle){
|
||||
return create(type, owner, owner.getTeam(), x, y, angle);
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle){
|
||||
create(type, owner, team, x, y, angle, 1f);
|
||||
public static Bullet create(BulletType type, Entity owner, Team team, float x, float y, float angle){
|
||||
return create(type, owner, team, x, y, angle, 1f);
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl){
|
||||
create(type, owner, team, x, y, angle, velocityScl, 1f, null);
|
||||
public static Bullet create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl){
|
||||
return create(type, owner, team, x, y, angle, velocityScl, 1f, null);
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl){
|
||||
create(type, owner, team, x, y, angle, velocityScl, lifetimeScl, null);
|
||||
public static Bullet create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl){
|
||||
return create(type, owner, team, x, y, angle, velocityScl, lifetimeScl, null);
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl, Object data){
|
||||
public static Bullet create(BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, float lifetimeScl, Object data){
|
||||
Bullet bullet = Pooling.obtain(Bullet.class, Bullet::new);
|
||||
bullet.type = type;
|
||||
bullet.owner = owner;
|
||||
@@ -67,7 +68,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
|
||||
bullet.team = team;
|
||||
bullet.type = type;
|
||||
bullet.time(type.lifetime() * (1f - lifetimeScl));
|
||||
bullet.lifeScl = lifetimeScl;
|
||||
|
||||
//translate bullets backwards, purely for visual reasons
|
||||
float backDelta = Timers.delta();
|
||||
@@ -78,14 +79,15 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
bullet.set(x, y);
|
||||
|
||||
bullet.add();
|
||||
return bullet;
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Bullet parent, float x, float y, float angle){
|
||||
create(type, parent.owner, parent.team, x, y, angle);
|
||||
public static Bullet create(BulletType type, Bullet parent, float x, float y, float angle){
|
||||
return create(type, parent.owner, parent.team, x, y, angle);
|
||||
}
|
||||
|
||||
public static void create(BulletType type, Bullet parent, float x, float y, float angle, float velocityScl){
|
||||
create(type, parent.owner, parent.team, x, y, angle, velocityScl);
|
||||
public static Bullet create(BulletType type, Bullet parent, float x, float y, float angle, float velocityScl){
|
||||
return create(type, parent.owner, parent.team, x, y, angle, velocityScl);
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
@@ -107,6 +109,10 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
remove();
|
||||
}
|
||||
|
||||
public BulletType getBulletType(){
|
||||
return type;
|
||||
}
|
||||
|
||||
public void resetOwner(Entity entity, Team team){
|
||||
this.owner = entity;
|
||||
this.team = team;
|
||||
@@ -124,6 +130,11 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float drawSize(){
|
||||
return type.drawSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamage(){
|
||||
if(owner instanceof Unit){
|
||||
@@ -168,11 +179,6 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
type.draw(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float drawSize(){
|
||||
return 8;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collides(SolidTrait other){
|
||||
return type.collides && super.collides(other) && !supressCollision;
|
||||
@@ -225,6 +231,9 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
|
||||
@Override
|
||||
protected void updateLife(){
|
||||
time += Timers.delta() * 1f/(lifeScl);
|
||||
time = Mathf.clamp(time, 0, type.lifetime());
|
||||
|
||||
if(time >= type.lifetime){
|
||||
if(!supressCollision) type.despawned(this);
|
||||
remove();
|
||||
@@ -235,6 +244,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
|
||||
public void reset(){
|
||||
super.reset();
|
||||
timer.clear();
|
||||
lifeScl = 1f;
|
||||
team = null;
|
||||
data = null;
|
||||
supressCollision = false;
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
package io.anuke.mindustry.entities.effect;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.fx.UnitFx;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Unit;
|
||||
import io.anuke.mindustry.entities.traits.SaveTrait;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.net.Interpolator;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.impl.SolidEntity;
|
||||
import io.anuke.ucore.entities.trait.DrawTrait;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.entities.trait.TimeTrait;
|
||||
import io.anuke.ucore.entities.trait.VelocityTrait;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawTrait, VelocityTrait, TimeTrait, TargetTrait, Poolable{
|
||||
private static final float sinkLifetime = 80f;
|
||||
|
||||
private Interpolator interpolator = new Interpolator();
|
||||
private Item item;
|
||||
private int amount;
|
||||
|
||||
private Vector2 velocity = new Vector2();
|
||||
private float time;
|
||||
private float sinktime;
|
||||
|
||||
/**
|
||||
* Internal use only!
|
||||
*/
|
||||
public ItemDrop(){
|
||||
hitbox.setSize(5f);
|
||||
hitboxTile.setSize(5f);
|
||||
}
|
||||
|
||||
public static ItemDrop create(Item item, int amount, float x, float y, float angle){
|
||||
ItemDrop drop = new ItemDrop();
|
||||
drop.item = item;
|
||||
drop.amount = amount;
|
||||
drop.velocity.set(4f, 0f).rotate(angle);
|
||||
drop.setNet(x, y);
|
||||
drop.add();
|
||||
|
||||
return drop;
|
||||
}
|
||||
|
||||
public static void create(Item item, int amount, float x, float y, float velocityX, float velocityY){
|
||||
create(item, amount, x, y, 0).getVelocity().set(velocityX, velocityY);
|
||||
}
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void onPickup(int itemid){
|
||||
ItemDrop drop = itemGroup.getByID(itemid);
|
||||
if(drop != null){
|
||||
Effects.effect(UnitFx.pickup, drop);
|
||||
}
|
||||
itemGroup.removeByID(itemid);
|
||||
if(Net.client()){
|
||||
netClient.addRemovedEntity(itemid);
|
||||
}
|
||||
}
|
||||
|
||||
public Item getItem(){
|
||||
return item;
|
||||
}
|
||||
|
||||
public int getAmount(){
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDead(){
|
||||
return !isAdded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Team getTeam(){
|
||||
return Team.none;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float lifetime(){
|
||||
return 60 * 60;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void time(float time){
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float time(){
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector2 getVelocity(){
|
||||
return velocity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collides(SolidTrait other){
|
||||
return other instanceof Player && time > 20f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collision(SolidTrait other, float x, float y){
|
||||
Unit player = (Unit) other;
|
||||
if(player.inventory.canAcceptItem(item, 1)){
|
||||
int used = Math.min(amount, player.inventory.capacity() - player.inventory.getItem().amount);
|
||||
player.inventory.addItem(item, used);
|
||||
amount -= used;
|
||||
|
||||
if(amount <= 0){
|
||||
Call.onPickup(getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
float size = itemSize * (1f - sinktime / sinkLifetime) * (1f - Mathf.curve(fin(), 0.98f));
|
||||
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
Draw.color(Color.WHITE, tile == null || !tile.floor().isLiquid ? Color.WHITE : tile.floor().liquidColor, sinktime / sinkLifetime);
|
||||
Draw.rect(item.region, x, y, size, size);
|
||||
|
||||
int stored = Mathf.clamp(amount / 6, 1, 8);
|
||||
|
||||
for(int i = 0; i < stored; i++){
|
||||
float px = stored == 1 ? 0 : (int)Mathf.randomSeedRange(i + 1, 4f);
|
||||
float py = stored == 1 ? 0 : (int)Mathf.randomSeedRange(i + 2, 4f);
|
||||
Draw.rect(item.region, x + px, y + py, size, size);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(Net.client()){
|
||||
interpolate();
|
||||
}else{
|
||||
updateVelocity(0.2f);
|
||||
updateTime();
|
||||
if(time >= lifetime()){
|
||||
Call.onPickup(getID());
|
||||
}
|
||||
}
|
||||
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
|
||||
if(tile != null && tile.solid()){
|
||||
Call.onPickup(getID());
|
||||
}
|
||||
|
||||
if(tile != null && tile.floor().isLiquid){
|
||||
sinktime += Timers.delta();
|
||||
|
||||
if(Mathf.chance(0.04 * Timers.delta())){
|
||||
Effects.effect(tile.floor().drownUpdateEffect, tile.floor().liquidColor, x, y);
|
||||
}
|
||||
|
||||
if(sinktime >= sinkLifetime){
|
||||
remove();
|
||||
}
|
||||
}else{
|
||||
sinktime = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(){
|
||||
time = 0f;
|
||||
interpolator.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Interpolator getInterpolator(){
|
||||
return interpolator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float drawSize(){
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float fin() {
|
||||
return time()/lifetime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityGroup targetGroup(){
|
||||
return itemGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSave(DataOutput data) throws IOException{
|
||||
data.writeFloat(x);
|
||||
data.writeFloat(y);
|
||||
data.writeByte(item.id);
|
||||
data.writeShort(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSave(DataInput data) throws IOException{
|
||||
x = data.readFloat();
|
||||
y = data.readFloat();
|
||||
item = content.item(data.readByte());
|
||||
amount = data.readShort();
|
||||
add();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutput data) throws IOException{
|
||||
data.writeFloat(x);
|
||||
data.writeFloat(y);
|
||||
data.writeByte(item.id);
|
||||
data.writeShort(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{
|
||||
interpolator.read(x, y, data.readFloat(), data.readFloat(), time);
|
||||
item = content.item(data.readByte());
|
||||
amount = data.readShort();
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,9 @@ import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.StatusEffects;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.traits.AbsorbTrait;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.entities.traits.TeamTrait;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
@@ -17,9 +19,10 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.impl.TimedEntity;
|
||||
import io.anuke.ucore.entities.impl.SolidEntity;
|
||||
import io.anuke.ucore.entities.trait.DrawTrait;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.entities.trait.TimeTrait;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
@@ -34,17 +37,24 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncTrait{
|
||||
private static Array<SolidTrait> entities = new Array<>();
|
||||
private static Rectangle rect = new Rectangle();
|
||||
private static Rectangle hitrect = new Rectangle();
|
||||
public class Lightning extends SolidEntity implements Poolable, DrawTrait, SyncTrait, AbsorbTrait, TeamTrait, TimeTrait{
|
||||
private static final Array<SolidTrait> entities = new Array<>();
|
||||
private static final Rectangle rect = new Rectangle();
|
||||
private static final Rectangle hitrect = new Rectangle();
|
||||
private static final float wetDamageMultiplier = 2;
|
||||
private static final float step = 4f, range = 6f, attractRange = 20f;
|
||||
|
||||
private static int lastSeed = 0;
|
||||
private static float angle;
|
||||
private static float wetDamageMultiplier = 2;
|
||||
|
||||
private Array<Vector2> lines = new Array<>();
|
||||
private Color color = Palette.lancerLaser;
|
||||
private Lightning parent;
|
||||
private SeedRandom random = new SeedRandom();
|
||||
private float damage, time;
|
||||
private int activeFrame;
|
||||
private Effect effect;
|
||||
private Team team;
|
||||
|
||||
/**For pooling use only. Do not call directly!*/
|
||||
public Lightning(){
|
||||
@@ -57,18 +67,17 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
|
||||
/**Do not invoke!*/
|
||||
@Remote(called = Loc.server)
|
||||
public static void createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
|
||||
public static Lightning createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
|
||||
Lightning l = Pooling.obtain(Lightning.class, Lightning::new);
|
||||
|
||||
l.x = x;
|
||||
l.y = y;
|
||||
l.damage = damage;
|
||||
l.effect = effect;
|
||||
l.team = team;
|
||||
l.random.setSeed(seed);
|
||||
l.color = color;
|
||||
|
||||
float step = 4f;
|
||||
float range = 6f;
|
||||
float attractRange = 20f;
|
||||
|
||||
angle = targetAngle;
|
||||
entities.clear();
|
||||
|
||||
@@ -77,10 +86,8 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
for(int i = 0; i < length; i++){
|
||||
l.lines.add(new Vector2(x, y));
|
||||
|
||||
float fx = x, fy = y;
|
||||
float x2 = x + Angles.trnsx(angle, step);
|
||||
float y2 = y + Angles.trnsy(angle, step);
|
||||
float fangle = angle;
|
||||
|
||||
angle += Mathf.range(15f);
|
||||
rect.setSize(attractRange).setCenter(x, y);
|
||||
@@ -90,32 +97,11 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
if(dst < attractRange){
|
||||
angle = Mathf.slerp(angle, Angles.angle(x2, y2, entity.x, entity.y), (attractRange - dst) / attractRange / 4f);
|
||||
}
|
||||
|
||||
entity.getHitbox(hitrect);
|
||||
hitrect.x -= range / 2f;
|
||||
hitrect.y -= range / 2f;
|
||||
hitrect.width += range / 2f;
|
||||
hitrect.height += range / 2f;
|
||||
|
||||
if(hitrect.contains(x2, y2) || hitrect.contains(fx, fy)){
|
||||
float result = damage;
|
||||
|
||||
if(entity.hasEffect(StatusEffects.wet))
|
||||
result = (result * wetDamageMultiplier);
|
||||
|
||||
entity.damage(result);
|
||||
Effects.effect(effect, x2, y2, fangle);
|
||||
}
|
||||
});
|
||||
|
||||
if(l.random.chance(0.1f)){
|
||||
createLighting(l.random.nextInt(), team, effect, color, damage, x2, y2, angle + l.random.range(30f), length / 3);
|
||||
}
|
||||
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
if(tile != null && tile.entity != null && tile.getTeamID() != team.ordinal()){
|
||||
Effects.effect(effect, x, y, fangle);
|
||||
tile.entity.damage(damage/4f);
|
||||
createLighting(l.random.nextInt(), team, effect, color, damage, x2, y2, angle + l.random.range(30f), length / 3)
|
||||
.parent = l;
|
||||
}
|
||||
|
||||
x = x2;
|
||||
@@ -124,6 +110,41 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
|
||||
l.lines.add(new Vector2(x, y));
|
||||
l.add();
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void absorb(){
|
||||
activeFrame = 99;
|
||||
if(parent != null){
|
||||
parent.absorb();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collides(SolidTrait other){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void time(float time){
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeAbsorbed(){
|
||||
return activeFrame < 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float time(){
|
||||
return time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float fin(){
|
||||
return time/lifetime();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,11 +167,45 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Team getTeam(){
|
||||
return team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
updateTime();
|
||||
|
||||
if(activeFrame == 2){
|
||||
for(Vector2 vec : lines){
|
||||
rect.setSize(range).setCenter(x, y);
|
||||
|
||||
Units.getNearbyEnemies(team, rect, unit -> {
|
||||
unit.getHitbox(hitrect);
|
||||
if(rect.overlaps(hitrect)){
|
||||
unit.damage(damage * (unit.hasEffect(StatusEffects.wet) ? 2f : 1f));
|
||||
Effects.effect(effect, vec.x, vec.y, 0f);
|
||||
}
|
||||
});
|
||||
|
||||
Tile tile = world.tileWorld(vec.x, vec.y);
|
||||
if(tile != null && tile.entity != null && tile.getTeamID() != team.ordinal()){
|
||||
Effects.effect(effect, vec.x, vec.y, 0f);
|
||||
tile.entity.damage(damage/4f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
activeFrame ++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset(){
|
||||
super.reset();
|
||||
time = 0f;
|
||||
color = Palette.lancerLaser;
|
||||
lines.clear();
|
||||
parent = null;
|
||||
activeFrame = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,6 +214,11 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
||||
Pooling.free(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamage(){
|
||||
return damage/10f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
float lx = x, ly = y;
|
||||
|
||||
12
core/src/io/anuke/mindustry/entities/traits/AbsorbTrait.java
Normal file
12
core/src/io/anuke/mindustry/entities/traits/AbsorbTrait.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package io.anuke.mindustry.entities.traits;
|
||||
|
||||
import io.anuke.ucore.entities.trait.DamageTrait;
|
||||
import io.anuke.ucore.entities.trait.Entity;
|
||||
|
||||
public interface AbsorbTrait extends Entity, TeamTrait, DamageTrait{
|
||||
void absorb();
|
||||
|
||||
default boolean canBeAbsorbed(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,7 @@ import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.graphics.Shapes;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Geometry;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Translator;
|
||||
import io.anuke.ucore.util.*;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -184,12 +181,7 @@ public interface BuilderTrait extends Entity{
|
||||
setMineTile(null);
|
||||
}
|
||||
|
||||
TileEntity core = unit.getClosestCore();
|
||||
|
||||
//if there is no core to build with, stop building!
|
||||
if(core == null){
|
||||
return;
|
||||
}
|
||||
|
||||
Tile tile = world.tile(current.x, current.y);
|
||||
|
||||
@@ -208,6 +200,13 @@ public interface BuilderTrait extends Entity{
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity core = unit.getClosestCore();
|
||||
|
||||
//if there is no core to build with, stop building!
|
||||
if(core == null){
|
||||
return;
|
||||
}
|
||||
|
||||
//otherwise, update it.
|
||||
BuildEntity entity = tile.entity();
|
||||
|
||||
@@ -238,19 +237,26 @@ public interface BuilderTrait extends Entity{
|
||||
/**Do not call directly.*/
|
||||
default void updateMining(Unit unit){
|
||||
Tile tile = getMineTile();
|
||||
TileEntity core = unit.getClosestCore();
|
||||
|
||||
if(tile.block() != Blocks.air || unit.distanceTo(tile.worldx(), tile.worldy()) > mineDistance || !unit.inventory.canAcceptItem(tile.floor().drops.item)){
|
||||
if(core == null || tile.block() != Blocks.air || unit.distanceTo(tile.worldx(), tile.worldy()) > mineDistance || !unit.inventory.canAcceptItem(tile.floor().drops.item)){
|
||||
setMineTile(null);
|
||||
}else{
|
||||
Item item = tile.floor().drops.item;
|
||||
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(tile.worldx(), tile.worldy()), 0.4f);
|
||||
|
||||
if(unit.inventory.canAcceptItem(item) &&
|
||||
Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){
|
||||
Call.transferItemToUnit(item,
|
||||
if(Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){
|
||||
|
||||
if(unit.distanceTo(core) < mineTransferRange && core.items.get(item) < core.tile.block().getMaximumAccepted(core.tile, item)){
|
||||
Call.transferItemTo(item, 1,
|
||||
tile.worldx() + Mathf.range(tilesize / 2f),
|
||||
tile.worldy() + Mathf.range(tilesize / 2f), core.tile);
|
||||
}else if(unit.inventory.canAcceptItem(item)){
|
||||
Call.transferItemToUnit(item,
|
||||
tile.worldx() + Mathf.range(tilesize / 2f),
|
||||
tile.worldy() + Mathf.range(tilesize / 2f),
|
||||
unit);
|
||||
}
|
||||
}
|
||||
|
||||
if(Mathf.chance(0.06 * Timers.delta())){
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.entities.traits;
|
||||
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.ucore.entities.trait.PosTrait;
|
||||
import io.anuke.ucore.entities.trait.SolidTrait;
|
||||
import io.anuke.ucore.entities.trait.VelocityTrait;
|
||||
|
||||
/**
|
||||
@@ -13,6 +14,22 @@ public interface TargetTrait extends PosTrait, VelocityTrait{
|
||||
|
||||
Team getTeam();
|
||||
|
||||
default float getTargetVelocityX(){
|
||||
if(this instanceof SolidTrait){
|
||||
return getX() - ((SolidTrait) this).lastPosition().x;
|
||||
}else{
|
||||
return getVelocity().x;
|
||||
}
|
||||
}
|
||||
|
||||
default float getTargetVelocityY(){
|
||||
if(this instanceof SolidTrait){
|
||||
return getY() - ((SolidTrait) this).lastPosition().y;
|
||||
}else{
|
||||
return getVelocity().y;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this entity is a valid target.
|
||||
*/
|
||||
|
||||
@@ -82,6 +82,11 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
threads.runDelay(unit::remove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDrag(){
|
||||
return type.drag;
|
||||
}
|
||||
|
||||
/**Called when a command is recieved from the command center.*/
|
||||
public abstract void onCommand(UnitCommand command);
|
||||
|
||||
|
||||
@@ -136,11 +136,13 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
||||
public void update(){
|
||||
super.update();
|
||||
|
||||
updateRotation();
|
||||
if(!Net.client()){
|
||||
updateRotation();
|
||||
wobble();
|
||||
}
|
||||
|
||||
trail.update(x + Angles.trnsx(rotation + 180f, 6f) + Mathf.range(wobblyness),
|
||||
y + Angles.trnsy(rotation + 180f, 6f) + Mathf.range(wobblyness));
|
||||
|
||||
wobble();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,11 +187,11 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
||||
protected void wobble(){
|
||||
if(Net.client()) return;
|
||||
|
||||
x += Mathf.sin(Timers.time() + id * 999, 25f, 0.07f)*Timers.delta();
|
||||
y += Mathf.cos(Timers.time() + id * 999, 25f, 0.07f)*Timers.delta();
|
||||
x += Mathf.sin(Timers.time() + id * 999, 25f, 0.08f)*Timers.delta();
|
||||
y += Mathf.cos(Timers.time() + id * 999, 25f, 0.08f)*Timers.delta();
|
||||
|
||||
if(velocity.len() <= 0.05f){
|
||||
rotation += Mathf.sin(Timers.time() + id * 99, 10f, 5f)*Timers.delta();
|
||||
rotation += Mathf.sin(Timers.time() + id * 99, 10f, 2.5f)*Timers.delta();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,30 +2,40 @@ package io.anuke.mindustry.entities.units;
|
||||
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.game.Team;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
public class UnitDrops{
|
||||
private static final int maxItems = 200;
|
||||
private static Item[] dropTable;
|
||||
|
||||
public static void dropItems(BaseUnit unit){
|
||||
if(Vars.itemGroup.size() > maxItems || unit.getTeam() != Team.red){
|
||||
//items only dropped in waves for enemy team
|
||||
if(unit.getTeam() != Vars.waveTeam || Vars.state.mode.disableWaves){
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity core = unit.getClosestEnemyCore();
|
||||
|
||||
if(core == null){
|
||||
return;
|
||||
}
|
||||
|
||||
if(dropTable == null){
|
||||
dropTable = new Item[]{Items.densealloy, Items.lead, Items.copper};
|
||||
dropTable = new Item[]{Items.densealloy, Items.silicon, Items.lead, Items.copper};
|
||||
}
|
||||
|
||||
for(int i = 0; i < 3; i++){
|
||||
for(Item item : dropTable){
|
||||
//only drop unlocked items
|
||||
if(!Vars.headless && !Vars.control.database().isUnlocked(item)){
|
||||
continue;
|
||||
}
|
||||
|
||||
if(Mathf.chance(0.03)){
|
||||
int amount = Mathf.random(20, 40);
|
||||
ItemDrop.create(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f),
|
||||
unit.getVelocity().x + Mathf.range(3f), unit.getVelocity().y + Mathf.range(3f));
|
||||
Call.transferItemTo(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f), core.tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class UnitType extends UnlockableContent{
|
||||
public float carryWeight = 1f;
|
||||
public int itemCapacity = 30;
|
||||
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
|
||||
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 0.1f;
|
||||
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 2f;
|
||||
public Weapon weapon = Weapons.blaster;
|
||||
public float weaponOffsetX, weaponOffsetY;
|
||||
public Color trailColor = Color.valueOf("ffa665");
|
||||
|
||||
@@ -3,9 +3,9 @@ package io.anuke.mindustry.entities.units.types;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.utils.Queue;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||
import io.anuke.mindustry.entities.traits.TargetTrait;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
@@ -23,10 +23,10 @@ import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.BuildBlock;
|
||||
import io.anuke.mindustry.world.blocks.BuildBlock.BuildEntity;
|
||||
import io.anuke.mindustry.world.meta.BlockFlag;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Events;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.entities.EntityGroup;
|
||||
import io.anuke.ucore.entities.EntityPhysics;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Shapes;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
@@ -43,6 +43,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
protected static float discoverRange = 120f;
|
||||
protected static boolean initialized;
|
||||
protected static int timerRepairEffect = timerIndex++;
|
||||
|
||||
protected Item targetItem;
|
||||
protected Tile mineTile;
|
||||
@@ -116,8 +117,11 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
circle(type.range);
|
||||
}else{
|
||||
TileEntity entity = (TileEntity) target;
|
||||
entity.health += type.healSpeed * Timers.delta();
|
||||
entity.health = Mathf.clamp(entity.health, 0, entity.tile.block().health);
|
||||
entity.healBy(type.healSpeed * entity.tile.block().health / 100f * Timers.delta());
|
||||
|
||||
if(timer.get(timerRepairEffect, 30)){
|
||||
Effects.effect(BlockFx.healBlockFull, Palette.heal, entity.x, entity.y, entity.tile.block().size);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -152,10 +156,6 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
}
|
||||
|
||||
retarget(() -> {
|
||||
if(findItemDrop()){
|
||||
return;
|
||||
}
|
||||
|
||||
if(getMineTile() == null){
|
||||
findItem();
|
||||
}
|
||||
@@ -183,33 +183,6 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
setMineTile(null);
|
||||
}
|
||||
},
|
||||
pickup = new UnitState(){
|
||||
public void entered(){
|
||||
target = null;
|
||||
}
|
||||
|
||||
public void update(){
|
||||
ItemDrop item = (ItemDrop) target;
|
||||
|
||||
if(item == null || inventory.isFull() || item.getItem().type != ItemType.material || !inventory.canAcceptItem(item.getItem(), 1)){
|
||||
setState(drop);
|
||||
return;
|
||||
}
|
||||
|
||||
if(distanceTo(item) < 4){
|
||||
item.collision(Drone.this, x, y);
|
||||
}
|
||||
|
||||
//item has been picked up
|
||||
if(item.getAmount() == 0){
|
||||
if(!findItemDrop()){
|
||||
setState(drop);
|
||||
}
|
||||
}
|
||||
|
||||
moveTo(0f);
|
||||
}
|
||||
},
|
||||
drop = new UnitState(){
|
||||
public void entered(){
|
||||
target = null;
|
||||
@@ -403,23 +376,6 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
targetItem = Mathf.findMin(type.toMine, (a, b) -> -Integer.compare(entity.items.get(a), entity.items.get(b)));
|
||||
}
|
||||
|
||||
protected boolean findItemDrop(){
|
||||
TileEntity core = getClosestCore();
|
||||
|
||||
if(core == null) return false;
|
||||
|
||||
//find nearby dropped items to pick up if applicable
|
||||
ItemDrop drop = EntityPhysics.getClosest(itemGroup, x, y, 60f,
|
||||
item -> core.tile.block().acceptStack(item.getItem(), item.getAmount(), core.tile, Drone.this) == item.getAmount() &&
|
||||
inventory.canAcceptItem(item.getItem(), 1));
|
||||
if(drop != null){
|
||||
setState(pickup);
|
||||
target = drop;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreateBlocks(){
|
||||
return false;
|
||||
|
||||
@@ -2,6 +2,6 @@ package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||
|
||||
public class Monsoon extends FlyingUnit{
|
||||
public class Ghoul extends FlyingUnit{
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
public class Fabricator extends Drone{
|
||||
public class Phantom extends Drone{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||
|
||||
public class Revenant extends FlyingUnit{
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
public class Spirit extends Drone{
|
||||
}
|
||||
@@ -2,6 +2,6 @@ package io.anuke.mindustry.entities.units.types;
|
||||
|
||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||
|
||||
public class Interceptor extends FlyingUnit{
|
||||
public class Wraith extends FlyingUnit{
|
||||
|
||||
}
|
||||
@@ -3,7 +3,8 @@ package io.anuke.mindustry.game;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
|
||||
public enum Difficulty{
|
||||
easy(1.2f, 1.5f),
|
||||
training(3f, 3f),
|
||||
easy(1.4f, 1.5f),
|
||||
normal(1f, 1f),
|
||||
hard(0.5f, 0.75f),
|
||||
insane(0.25f, 0.5f);
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Waves{
|
||||
unitScaling = 1;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.interceptor){{
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 12;
|
||||
end = 14;
|
||||
}},
|
||||
@@ -69,7 +69,7 @@ public class Waves{
|
||||
effect = StatusEffects.overdrive;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.interceptor){{
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 16;
|
||||
unitScaling = 2;
|
||||
spacing = 2;
|
||||
@@ -116,7 +116,7 @@ public class Waves{
|
||||
end = 130;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 40;
|
||||
unitAmount = 2;
|
||||
spacing = 2;
|
||||
@@ -124,7 +124,7 @@ public class Waves{
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.interceptor){{
|
||||
new SpawnGroup(UnitTypes.wraith){{
|
||||
begin = 50;
|
||||
unitAmount = 4;
|
||||
unitScaling = 3;
|
||||
@@ -134,7 +134,7 @@ public class Waves{
|
||||
max = 8;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 53;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
@@ -143,7 +143,7 @@ public class Waves{
|
||||
end = 74;
|
||||
}},
|
||||
|
||||
new SpawnGroup(UnitTypes.monsoon){{
|
||||
new SpawnGroup(UnitTypes.ghoul){{
|
||||
begin = 53;
|
||||
unitAmount = 2;
|
||||
unitScaling = 3;
|
||||
|
||||
@@ -13,6 +13,8 @@ public class Palette{
|
||||
missileYellow = Color.valueOf("ffd2ae"),
|
||||
missileYellowBack = Color.valueOf("e58956"),
|
||||
|
||||
meltdownHit = Color.valueOf("ffb98b"),
|
||||
|
||||
plastaniumBack = Color.valueOf("d8d97f"),
|
||||
plastaniumFront = Color.valueOf("fffac6"),
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package io.anuke.mindustry.input;
|
||||
|
||||
import com.badlogic.gdx.InputAdapter;
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
import io.anuke.mindustry.content.fx.EnvironmentFx;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.entities.effect.ItemTransfer;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
@@ -19,10 +20,7 @@ import io.anuke.mindustry.ui.fragments.OverlayFragment;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Build;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Graphics;
|
||||
import io.anuke.ucore.core.Inputs;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.core.*;
|
||||
import io.anuke.ucore.scene.Group;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
@@ -61,7 +59,7 @@ public abstract class InputHandler extends InputAdapter{
|
||||
throw new ValidateException(player, "Player cannot drop an item.");
|
||||
}
|
||||
|
||||
ItemDrop.create(player.inventory.getItem().item, player.inventory.getItem().amount, player.x, player.y, angle);
|
||||
Effects.effect(EnvironmentFx.dropItem, Color.WHITE, player.x, player.y, angle, player.inventory.getItem().item);
|
||||
player.inventory.clearItem();
|
||||
}
|
||||
|
||||
|
||||
@@ -293,10 +293,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
@Override
|
||||
public void drawOutlined(){
|
||||
|
||||
//Draw.color(Palette.placing);
|
||||
//Lines.poly(player.x, player.y, 100, Player.placeDistance);
|
||||
//Draw.color();
|
||||
Lines.stroke(1f);
|
||||
|
||||
Shaders.mix.color.set(Palette.accent);
|
||||
Graphics.shader(Shaders.mix);
|
||||
@@ -549,14 +546,14 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
|
||||
float worldx = Graphics.world(x, y).x, worldy = Graphics.world(x, y).y;
|
||||
|
||||
checkTargets(worldx, worldy);
|
||||
|
||||
//get tile on cursor
|
||||
Tile cursor = tileAt(x, y);
|
||||
|
||||
//ignore off-screen taps
|
||||
if(cursor == null || ui.hasMouse(x, y)) return false;
|
||||
|
||||
checkTargets(worldx, worldy);
|
||||
|
||||
//remove if request present
|
||||
if(hasRequest(cursor)){
|
||||
removeRequest(getRequest(cursor));
|
||||
|
||||
@@ -27,7 +27,7 @@ import io.anuke.mindustry.world.blocks.production.Drill;
|
||||
import io.anuke.mindustry.world.blocks.production.Pump;
|
||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
||||
import io.anuke.mindustry.world.blocks.storage.StorageBlock;
|
||||
import io.anuke.mindustry.world.blocks.units.UnitPad;
|
||||
import io.anuke.mindustry.world.blocks.units.UnitFactory;
|
||||
import io.anuke.mindustry.world.consumers.ConsumePower;
|
||||
import io.anuke.ucore.function.BiFunction;
|
||||
import io.anuke.ucore.function.IntPositionConsumer;
|
||||
@@ -169,16 +169,16 @@ public class FortressGenerator{
|
||||
seeder.get(DefenseBlocks.mendProjector, tile -> tile.block() instanceof PowerGenerator && gen.random.chance(0.03)),
|
||||
|
||||
//unit pads (assorted)
|
||||
seeder.get(UnitBlocks.daggerPad, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.3)),
|
||||
seeder.get(UnitBlocks.daggerFactory, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.3)),
|
||||
|
||||
//unit pads (assorted)
|
||||
seeder.get(UnitBlocks.interceptorPad, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.3)),
|
||||
seeder.get(UnitBlocks.wraithFactory, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.3)),
|
||||
|
||||
//unit pads (assorted)
|
||||
seeder.get(UnitBlocks.titanPad, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.23)),
|
||||
seeder.get(UnitBlocks.titanFactory, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.23)),
|
||||
|
||||
//unit pads (assorted)
|
||||
seeder.get(UnitBlocks.monsoonPad, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.23)),
|
||||
seeder.get(UnitBlocks.ghoulFactory, tile -> tile.block() instanceof MendProjector && gen.random.chance(0.23)),
|
||||
|
||||
//power turrets
|
||||
seeder.get(powerTurret, tile -> tile.block() instanceof PowerGenerator && gen.random.chance(0.04)),
|
||||
@@ -206,7 +206,7 @@ public class FortressGenerator{
|
||||
Tile tile = gen.tile(x + point.x, y + point.y);
|
||||
if(tile != null){
|
||||
tile = tile.target();
|
||||
if(tile.getTeamID() == team.ordinal() && !(tile.block() instanceof Wall) && !(tile.block() instanceof UnitPad)){
|
||||
if(tile.getTeamID() == team.ordinal() && !(tile.block() instanceof Wall) && !(tile.block() instanceof UnitFactory)){
|
||||
gen.setBlock(x, y, wall, team);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class WorldGenerator{
|
||||
int pos = multiblocks.get(i);
|
||||
|
||||
int x = pos % tiles.length;
|
||||
int y = pos / tiles[0].length;
|
||||
int y = pos / tiles.length;
|
||||
|
||||
Block result = tiles[x][y].block();
|
||||
Team team = tiles[x][y].getTeam();
|
||||
|
||||
@@ -106,7 +106,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
content().row();
|
||||
|
||||
content().addRowImageTextButton("$text.load", "icon-load", isize, load::show).disabled(b -> Net.active());
|
||||
content().addRowImageTextButton("$text.host", "icon-host", isize, ui.host::show).disabled(b -> Net.active());
|
||||
content().addRowImageTextButton("$text.hostserver.mobile", "icon-host", isize, ui.host::show).disabled(b -> Net.active());
|
||||
content().addRowImageTextButton("$text.quit", "icon-quit", isize, () -> {
|
||||
ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
|
||||
if(Net.client()) netClient.disconnectQuietly();
|
||||
|
||||
@@ -60,6 +60,10 @@ public class SectorsDialog extends FloatingDialog{
|
||||
selected = sector;
|
||||
}
|
||||
|
||||
public Sector getSelected(){
|
||||
return selected;
|
||||
}
|
||||
|
||||
class SectorView extends Element{
|
||||
float lastX, lastY;
|
||||
float sectorSize = Unit.dp.scl(32*4);
|
||||
|
||||
@@ -5,8 +5,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
||||
import io.anuke.mindustry.entities.traits.AbsorbTrait;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
@@ -24,7 +23,9 @@ import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
@@ -127,13 +128,14 @@ public class ForceProjector extends Block {
|
||||
|
||||
if(!entity.broken){
|
||||
EntityPhysics.getNearby(bulletGroup, tile.drawx(), tile.drawy(), realRadius*2f, bullet -> {
|
||||
if(bullet instanceof Bullet && ((Bullet) bullet).getTeam() != tile.getTeam() && isInsideHexagon(bullet.getX(), bullet.getY(), realRadius * 2f, tile.drawx(), tile.drawy())){
|
||||
((Bullet) bullet).absorb();
|
||||
Effects.effect(BulletFx.absorb, bullet);
|
||||
float hit = ((Bullet) bullet).getDamage()*powerDamage;
|
||||
AbsorbTrait trait = (AbsorbTrait)bullet;
|
||||
if(trait.canBeAbsorbed() && trait.getTeam() != tile.getTeam() && isInsideHexagon(trait.getX(), trait.getY(), realRadius * 2f, tile.drawx(), tile.drawy())){
|
||||
trait.absorb();
|
||||
Effects.effect(BulletFx.absorb, trait);
|
||||
float hit = trait.getDamage()*powerDamage;
|
||||
entity.hit = 1f;
|
||||
entity.power.amount -= Math.min(hit, entity.power.amount);
|
||||
entity.buildup += ((Bullet) bullet).getDamage() * entity.warmup;
|
||||
entity.buildup += trait.getDamage() * entity.warmup;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -199,7 +201,7 @@ public class ForceProjector extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public class ShieldEntity extends BaseEntity implements DrawTrait, SyncTrait{
|
||||
public class ShieldEntity extends BaseEntity implements DrawTrait{
|
||||
final ForceEntity entity;
|
||||
|
||||
public ShieldEntity(Tile tile){
|
||||
@@ -239,16 +241,5 @@ public class ForceProjector extends Block {
|
||||
public EntityGroup targetGroup(){
|
||||
return shieldGroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSyncing(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(DataOutput data) throws IOException{}
|
||||
|
||||
@Override
|
||||
public void read(DataInput data, long time) throws IOException{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
@@ -126,5 +130,17 @@ public class MendProjector extends Block{
|
||||
float heat;
|
||||
float charge;
|
||||
float phaseHeat;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException{
|
||||
stream.writeFloat(heat);
|
||||
stream.writeFloat(phaseHeat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream stream) throws IOException{
|
||||
heat = stream.readFloat();
|
||||
phaseHeat = stream.readFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ import io.anuke.ucore.graphics.Hue;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
@@ -127,5 +131,17 @@ public class OverdriveProjector extends Block{
|
||||
float heat;
|
||||
float charge;
|
||||
float phaseHeat;
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException{
|
||||
stream.writeFloat(heat);
|
||||
stream.writeFloat(phaseHeat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream stream) throws IOException{
|
||||
heat = stream.readFloat();
|
||||
phaseHeat = stream.readFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class ArtilleryTurret extends ItemTurret{
|
||||
|
||||
for(int i = 0; i < shots; i++){
|
||||
Bullet.create(ammo.bullet, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y,
|
||||
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), Mathf.clamp(dst / maxTraveled));
|
||||
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), 1f + Mathf.range(velocityInaccuracy), (dst / maxTraveled));
|
||||
}
|
||||
|
||||
effects(tile);
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package io.anuke.mindustry.world.blocks.defense.turrets;
|
||||
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.AmmoType;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class ChargeTurret extends PowerTurret{
|
||||
|
||||
protected float chargeTime = 30f;
|
||||
protected int chargeEffects = 5;
|
||||
protected float chargeMaxDelay = 10f;
|
||||
protected Effect chargeEffect = Fx.none;
|
||||
protected Effect chargeBeginEffect = Fx.none;
|
||||
|
||||
public ChargeTurret(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shoot(Tile tile, AmmoType ammo){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
|
||||
useAmmo(tile);
|
||||
|
||||
tr.trns(entity.rotation, size * tilesize / 2);
|
||||
Effects.effect(chargeBeginEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
|
||||
for(int i = 0; i < chargeEffects; i++){
|
||||
Timers.run(Mathf.random(chargeMaxDelay), () -> {
|
||||
if(!isTurret(tile)) return;
|
||||
tr.trns(entity.rotation, size * tilesize / 2);
|
||||
Effects.effect(chargeEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
});
|
||||
}
|
||||
|
||||
entity.shooting = true;
|
||||
|
||||
Timers.run(chargeTime, () -> {
|
||||
if(!isTurret(tile)) return;
|
||||
tr.trns(entity.rotation, size * tilesize / 2);
|
||||
entity.recoil = recoil;
|
||||
entity.heat = 1f;
|
||||
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
|
||||
effects(tile);
|
||||
entity.shooting = false;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldTurn(Tile tile){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
return !entity.shooting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity(){
|
||||
return new LaserTurretEntity();
|
||||
}
|
||||
|
||||
public class LaserTurretEntity extends TurretEntity{
|
||||
public boolean shooting;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.defense.turrets;
|
||||
|
||||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeLiquidFilter;
|
||||
@@ -13,14 +12,10 @@ import io.anuke.ucore.util.Mathf;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class CooledTurret extends Turret{
|
||||
/**
|
||||
* How much reload is lowered by for each unit of liquid of heat capacity 1.
|
||||
*/
|
||||
/**How much reload is lowered by for each unit of liquid of heat capacity 1.*/
|
||||
protected float coolantMultiplier = 1f;
|
||||
/**
|
||||
* Max coolant used per tick.
|
||||
*/
|
||||
protected float maxUsed = 1f;
|
||||
/**Max coolant used per tick.*/
|
||||
protected float maxCoolantUsed = 1f;
|
||||
protected Effect coolEffect = BlockFx.fuelburn;
|
||||
|
||||
public CooledTurret(String name){
|
||||
@@ -28,7 +23,7 @@ public class CooledTurret extends Turret{
|
||||
hasLiquids = true;
|
||||
liquidCapacity = 20f;
|
||||
|
||||
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f, 0.01f)).update(false).optional(true);
|
||||
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.01f)).update(false).optional(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,18 +33,13 @@ public class CooledTurret extends Turret{
|
||||
TurretEntity entity = tile.entity();
|
||||
Liquid liquid = entity.liquids.current();
|
||||
|
||||
float used = Math.min(Math.min(entity.liquids.get(liquid), maxUsed * Timers.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / liquid.heatCapacity));
|
||||
float used = Math.min(Math.min(entity.liquids.get(liquid), maxCoolantUsed * Timers.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / liquid.heatCapacity));
|
||||
entity.reload += (used * liquid.heatCapacity) / liquid.heatCapacity;
|
||||
entity.liquids.remove(liquid, used);
|
||||
|
||||
if(Mathf.chance(0.04 * used)){
|
||||
if(Mathf.chance(0.06 * used)){
|
||||
Effects.effect(coolEffect, tile.drawx() + Mathf.range(size * tilesize / 2f), tile.drawy() + Mathf.range(size * tilesize / 2f));
|
||||
}
|
||||
|
||||
//don't use oil as coolant, thanks
|
||||
if(Mathf.chance(liquid.flammability / 10f * used)){
|
||||
Fire.create(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,62 +1,91 @@
|
||||
package io.anuke.mindustry.world.blocks.defense.turrets;
|
||||
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
import io.anuke.mindustry.type.AmmoType;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeLiquidFilter;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.util.Angles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class LaserTurret extends PowerTurret{
|
||||
|
||||
protected float chargeTime = 30f;
|
||||
protected int chargeEffects = 5;
|
||||
protected float chargeMaxDelay = 10f;
|
||||
protected Effect chargeEffect = Fx.none;
|
||||
protected Effect chargeBeginEffect = Fx.none;
|
||||
protected float firingMoveFract = 0.25f;
|
||||
protected float shootDuration = 100f;
|
||||
|
||||
public LaserTurret(String name){
|
||||
super(name);
|
||||
canOverdrive = false;
|
||||
|
||||
consumes.remove(ConsumeLiquidFilter.class);
|
||||
consumes.add(new ConsumeLiquidFilter(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.1f, 0.01f)).update(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shoot(Tile tile, AmmoType ammo){
|
||||
public void update(Tile tile) {
|
||||
super.update(tile);
|
||||
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
|
||||
useAmmo(tile);
|
||||
if(entity.bulletLife > 0 && entity.bullet != null){
|
||||
tr.trns(entity.rotation, size * tilesize / 2, 0f);
|
||||
entity.bullet.setRotation(entity.rotation);
|
||||
entity.bullet.set(tile.drawx() + tr.x, tile.drawy() + tr.y);
|
||||
entity.bullet.time(0f);
|
||||
entity.heat = 1f;
|
||||
entity.recoil = recoil;
|
||||
entity.bulletLife -= Timers.delta();
|
||||
if(entity.bulletLife <= 0f){
|
||||
entity.bullet = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tr.trns(entity.rotation, size * tilesize / 2);
|
||||
Effects.effect(chargeBeginEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
@Override
|
||||
protected void updateShooting(Tile tile){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
|
||||
for(int i = 0; i < chargeEffects; i++){
|
||||
Timers.run(Mathf.random(chargeMaxDelay), () -> {
|
||||
if(!isTurret(tile)) return;
|
||||
tr.trns(entity.rotation, size * tilesize / 2);
|
||||
Effects.effect(chargeEffect, tile.drawx() + tr.x, tile.drawy() + tr.y, entity.rotation);
|
||||
});
|
||||
if(entity.bulletLife > 0 && entity.bullet != null){
|
||||
return;
|
||||
}
|
||||
|
||||
entity.shooting = true;
|
||||
if(entity.reload >= reload && entity.cons.valid()){
|
||||
AmmoType type = peekAmmo(tile);
|
||||
|
||||
Timers.run(chargeTime, () -> {
|
||||
if(!isTurret(tile)) return;
|
||||
tr.trns(entity.rotation, size * tilesize / 2);
|
||||
entity.recoil = recoil;
|
||||
entity.heat = 1f;
|
||||
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
|
||||
effects(tile);
|
||||
entity.shooting = false;
|
||||
});
|
||||
shoot(tile, type);
|
||||
|
||||
entity.reload = 0f;
|
||||
}else{
|
||||
Liquid liquid = entity.liquids.current();
|
||||
|
||||
float used = Math.min(Math.min(entity.liquids.get(liquid), maxCoolantUsed * Timers.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / liquid.heatCapacity));
|
||||
entity.reload += (used * liquid.heatCapacity) / liquid.heatCapacity;
|
||||
entity.liquids.remove(liquid, used);
|
||||
|
||||
if(Mathf.chance(0.06 * used)){
|
||||
Effects.effect(coolEffect, tile.drawx() + Mathf.range(size * tilesize / 2f), tile.drawy() + Mathf.range(size * tilesize / 2f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldTurn(Tile tile){
|
||||
protected void turnToTarget(Tile tile, float targetRot){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
return !entity.shooting;
|
||||
|
||||
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * entity.delta() * (entity.bulletLife > 0f ? firingMoveFract : 1f));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bullet(Tile tile, BulletType type, float angle){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
|
||||
entity.bullet = Bullet.create(type, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
|
||||
entity.bulletLife = shootDuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,7 +93,8 @@ public class LaserTurret extends PowerTurret{
|
||||
return new LaserTurretEntity();
|
||||
}
|
||||
|
||||
public class LaserTurretEntity extends TurretEntity{
|
||||
public boolean shooting;
|
||||
class LaserTurretEntity extends TurretEntity{
|
||||
Bullet bullet;
|
||||
float bulletLife;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
if(shouldTurn(tile)){
|
||||
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * entity.delta());
|
||||
turnToTarget(tile, targetRot);
|
||||
}
|
||||
|
||||
if(Angles.angleDist(entity.rotation, targetRot) < shootCone){
|
||||
@@ -235,6 +235,12 @@ public abstract class Turret extends Block{
|
||||
tile.drawx(), tile.drawy(), range, e -> !e.isDead() && (!e.isFlying() || targetAir));
|
||||
}
|
||||
|
||||
protected void turnToTarget(Tile tile, float targetRot){
|
||||
TurretEntity entity = tile.entity();
|
||||
|
||||
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * entity.delta());
|
||||
}
|
||||
|
||||
public boolean shouldTurn(Tile tile){
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -185,24 +185,16 @@ public class Conveyor extends Block{
|
||||
float centerDstScl = 3f;
|
||||
float tx = Geometry.d4[tile.getRotation()].x, ty = Geometry.d4[tile.getRotation()].y;
|
||||
|
||||
float min;
|
||||
float centerx = 0f, centery = 0f;
|
||||
|
||||
if(Math.abs(tx) > Math.abs(ty)){
|
||||
float rx = tile.worldx() - tx / 2f * tilesize;
|
||||
min = Mathf.clamp((unit.x - rx) * tx / tilesize);
|
||||
centery = Mathf.clamp((tile.worldy() - unit.y) / centerDstScl, -centerSpeed, centerSpeed);
|
||||
if(Math.abs(tile.worldy() - unit.y) < 1f) centery = 0f;
|
||||
}else{
|
||||
float ry = tile.worldy() - ty / 2f * tilesize;
|
||||
min = Mathf.clamp((unit.y - ry) * ty / tilesize);
|
||||
centerx = Mathf.clamp((tile.worldx() - unit.x) / centerDstScl, -centerSpeed, centerSpeed);
|
||||
if(Math.abs(tile.worldx() - unit.x) < 1f) centerx = 0f;
|
||||
}
|
||||
|
||||
entity.minCarry = Math.min(entity.minCarry, min);
|
||||
entity.carrying += unit.getMass();
|
||||
|
||||
if(entity.convey.size * itemSpace < 0.9f){
|
||||
unit.getVelocity().add((tx * speed + centerx) * entity.delta(), (ty * speed + centery) * entity.delta());
|
||||
}
|
||||
@@ -215,7 +207,6 @@ public class Conveyor extends Block{
|
||||
entity.minitem = 1f;
|
||||
|
||||
int minremove = Integer.MAX_VALUE;
|
||||
float speed = Math.max(this.speed - (1f - (carryCapacity - entity.carrying) / carryCapacity), 0f);
|
||||
|
||||
for(int i = entity.convey.size - 1; i >= 0; i--){
|
||||
long value = entity.convey.get(i);
|
||||
@@ -228,9 +219,6 @@ public class Conveyor extends Block{
|
||||
}
|
||||
|
||||
float nextpos = (i == entity.convey.size - 1 ? 100f : pos2.set(entity.convey.get(i + 1), ItemPos.updateShorts).y) - itemSpace;
|
||||
if(entity.minCarry >= pos.y && entity.minCarry <= nextpos){
|
||||
nextpos = entity.minCarry;
|
||||
}
|
||||
float maxmove = Math.min(nextpos - pos.y, speed * entity.delta());
|
||||
|
||||
if(maxmove > minmove){
|
||||
@@ -260,9 +248,6 @@ public class Conveyor extends Block{
|
||||
entity.clogHeat = Mathf.lerpDelta(entity.clogHeat, 0f, 1f);
|
||||
}
|
||||
|
||||
entity.carrying = 0f;
|
||||
entity.minCarry = 2f;
|
||||
|
||||
if(entity.items.total() == 0){
|
||||
entity.sleep();
|
||||
}else{
|
||||
@@ -366,11 +351,8 @@ public class Conveyor extends Block{
|
||||
ConveyorEntity entity = tile.entity();
|
||||
Array<Object> arr = super.getDebugInfo(tile);
|
||||
arr.addAll(Array.with(
|
||||
"mincarry", entity.minCarry,
|
||||
"minitem", entity.minCarry,
|
||||
"carrying", entity.carrying,
|
||||
"clogHeat", entity.clogHeat,
|
||||
"sleeping", entity.isSleeping()
|
||||
"clogHeat", entity.clogHeat,
|
||||
"sleeping", entity.isSleeping()
|
||||
));
|
||||
return arr;
|
||||
}
|
||||
@@ -384,8 +366,6 @@ public class Conveyor extends Block{
|
||||
|
||||
LongArray convey = new LongArray();
|
||||
float minitem = 1;
|
||||
float carrying;
|
||||
float minCarry = 2f;
|
||||
|
||||
int blendshadowrot = -1;
|
||||
int blendbits;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.ObjectSet;
|
||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
@@ -7,11 +8,11 @@ import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.mindustry.content.bullets.TurretBullets;
|
||||
import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.content.fx.EnvironmentFx;
|
||||
import io.anuke.mindustry.content.fx.ShootFx;
|
||||
import io.anuke.mindustry.entities.Player;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.graphics.Layer;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
@@ -289,7 +290,7 @@ public class MassDriver extends Block{
|
||||
if(amountDropped > 0){
|
||||
float angle = Mathf.range(180f);
|
||||
float vs = Mathf.random(0f, 4f);
|
||||
ItemDrop.create(content.item(i), amountDropped, bullet.x, bullet.y, Angles.trnsx(angle, vs), Angles.trnsy(angle, vs));
|
||||
Effects.effect(EnvironmentFx.dropItem, Color.WHITE, bullet.x, bullet.y, angle, content.item(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import static io.anuke.mindustry.Vars.unitGroups;
|
||||
|
||||
public class CoreBlock extends StorageBlock{
|
||||
protected float droneRespawnDuration = 60 * 6;
|
||||
protected UnitType droneType = UnitTypes.drone;
|
||||
protected UnitType droneType = UnitTypes.spirit;
|
||||
|
||||
protected TextureRegion openRegion;
|
||||
protected TextureRegion topRegion;
|
||||
@@ -162,6 +162,11 @@ public class CoreBlock extends StorageBlock{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaximumAccepted(Tile tile, Item item){
|
||||
return itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
return tile.entity.items.get(item) < itemCapacity && item.type == ItemType.material;
|
||||
|
||||
@@ -34,13 +34,13 @@ import java.io.IOException;
|
||||
import static io.anuke.mindustry.Vars.mobile;
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
|
||||
public class MechFactory extends Block{
|
||||
public class MechPad extends Block{
|
||||
protected Mech mech;
|
||||
protected float buildTime = 60 * 5;
|
||||
|
||||
protected TextureRegion openRegion;
|
||||
|
||||
public MechFactory(String name){
|
||||
public MechPad(String name){
|
||||
super(name);
|
||||
update = true;
|
||||
solidifes = true;
|
||||
@@ -83,7 +83,7 @@ public class MechFactory extends Block{
|
||||
|
||||
if(entity.player == null) return;
|
||||
|
||||
Mech result = ((MechFactory) tile.block()).mech;
|
||||
Mech result = ((MechPad) tile.block()).mech;
|
||||
|
||||
if(entity.player.mech == result){
|
||||
entity.player.mech = (entity.player.isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
@@ -34,7 +34,7 @@ import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class UnitPad extends Block{
|
||||
public class UnitFactory extends Block{
|
||||
protected float gracePeriodMultiplier = 23f;
|
||||
protected float speedupTime = 60f * 60f * 20;
|
||||
protected float maxSpeedup = 2f;
|
||||
@@ -44,7 +44,7 @@ public class UnitPad extends Block{
|
||||
protected float launchVelocity = 0f;
|
||||
protected TextureRegion topRegion;
|
||||
|
||||
public UnitPad(String name){
|
||||
public UnitFactory(String name){
|
||||
super(name);
|
||||
update = true;
|
||||
hasPower = true;
|
||||
@@ -58,10 +58,10 @@ public class UnitPad extends Block{
|
||||
|
||||
@Remote(called = Loc.server)
|
||||
public static void onUnitFactorySpawn(Tile tile){
|
||||
if(!(tile.entity instanceof UnitFactoryEntity) || !(tile.block() instanceof UnitPad)) return;
|
||||
if(!(tile.entity instanceof UnitFactoryEntity) || !(tile.block() instanceof UnitFactory)) return;
|
||||
|
||||
UnitFactoryEntity entity = tile.entity();
|
||||
UnitPad factory = (UnitPad) tile.block();
|
||||
UnitFactory factory = (UnitFactory) tile.block();
|
||||
|
||||
entity.buildTime = 0f;
|
||||
|
||||
Reference in New Issue
Block a user