diff --git a/core/assets-raw/sprites/weapons/triblaster.png b/core/assets-raw/sprites/weapons/triblaster.png index a7702e702c..1b6e1db871 100644 Binary files a/core/assets-raw/sprites/weapons/triblaster.png and b/core/assets-raw/sprites/weapons/triblaster.png differ diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 5c4822eb88..2b3db4485d 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -166,6 +166,11 @@ text.blocks.health=Health text.blocks.inaccuracy=Health text.blocks.shots=Shots text.blocks.shotssecond=Shots/second +text.blocks.fuel=Fuel +text.blocks.fuelduration=Fuel Duration +text.blocks.maxoutputsecond=Max output/second +text.blocks.inputcapacity=Input capacity +text.blocks.outputcapacity=Output capacity text.placemode=Place Mode text.breakmode=Break Mode text.health=health @@ -267,19 +272,12 @@ mode.waves.name=waves mode.sandbox.name=sandbox mode.freebuild.name=freebuild upgrade.standard.name=standard -upgrade.standard.description=The standard mech. upgrade.blaster.name=blaster -upgrade.blaster.description=Shoots a slow, weak bullet. upgrade.triblaster.name=triblaster -upgrade.triblaster.description=Shoots 3 bullets in a spread. upgrade.multigun.name=multigun -upgrade.multigun.description=Shoots inaccurate bullets with a high\nrate of fire. upgrade.flamer.name=flamer -upgrade.flamer.description=Shoots a stream of fire. upgrade.railgun.name=railgun -upgrade.railgun.description=Shoots one long-range bullet. upgrade.mortar.name=mortar -upgrade.mortar.description=Shoots a slow, but damaging shell. item.stone.name=stone item.iron.name=iron item.coal.name=coal @@ -341,25 +339,20 @@ block.titaniumshieldwall.name=shielded wall block.titaniumshieldwall.fulldescription=A strong defensive block, with an extra built-in shield. Requires power. Uses energy to absorb enemy bullets. It is recommended to use power boosters to provide energy to this block. block.repairturret.name=repair turret block.repairturret.fulldescription=Repairs nearby damaged blocks in range at a slow rate. Uses small amounts of power. -block.repairturret.description=[powerinfo]Uses power[white]\nRepairs nearby blocks. block.megarepairturret.name=repair turret II block.megarepairturret.fulldescription=Repairs nearby damaged blocks in range at a decent rate. Uses power. -block.megarepairturret.description=[powerinfo]Uses power[white]\nRepairs nearby blocks. block.shieldgenerator.name=shield generator block.shieldgenerator.fulldescription=An advanced defensive block. Shields all the blocks in a radius from attack. Uses power at a slow rate when idle, but drains energy quickly on bullet contact. block.door.name=door block.door.fulldescription=A block than can be opened and closed by tapping it. -block.door.description=Opens and closes.\n[interact]Tap to toggle block.door-large.name=large door block.door-large.fulldescription=A block than can be opened and closed by tapping it. -block.door-large.description=Opens and closes.\n[interact]Tap to toggle block.conduit.name=conduit block.conduit.fulldescription=Basic liquid transport block. Works like a conveyor, but with liquids. Best used with pumps or other conduits. Can be used as a bridge over liquids for enemies and players. block.pulseconduit.name=pulse conduit block.pulseconduit.fulldescription=Advanced liquid transport block. Transports liquids faster and stores more than standard conduits. block.liquidrouter.name=liquid router block.liquidrouter.fulldescription=Works similarly to a router. Accepts liquid input from one side and outputs it to the other sides. Useful for splitting liquid from a single conduit into multiple other conduits. -block.liquidrouter.description=Splits input liquid into 3 directions. block.conveyor.name=conveyor block.conveyor.fulldescription=Basic item transport block. Moves items forward and automatically deposits them into turrets or crafters. Rotatable. Can be used as a bridge over liquids for enemies and players. block.steelconveyor.name=steel conveyor @@ -368,131 +361,90 @@ block.poweredconveyor.name=pulse conveyor block.poweredconveyor.fulldescription=The ultimate item transport block. Moves items faster than steel conveyors. block.router.name=router block.router.fulldescription=Accepts items from one direction and outputs them to 3 other directions. Can also store a certain amount of items.Useful for splitting the materials from one drill into multiple turrets. -block.router.description=Split input materials into 3 directions. block.junction.name=junction block.junction.fulldescription=Acts as a bridge for two crossing conveyor belts. Useful in situations with two different conveyors carrying different materials to different locations. -block.junction.description=Serves as a conveyor junction. block.conveyortunnel.name=conveyor tunnel block.conveyortunnel.fulldescription=Transports item under blocks. To use, place one tunnel leading into the block to be tunneled under, and one on the other side. Make sure both tunnels face opposite directions, which is towards the blocks they are inputting or outputting to. -block.conveyortunnel.description=Transports items under blocks. block.liquidjunction.name=liquid junction block.liquidjunction.fulldescription=Acts as a bridge for two crossing conduits. Useful in situations with two different conduits carrying different liquids to different locations. block.liquiditemjunction.name=liquid-item junction block.liquiditemjunction.fulldescription=Acts as a bridge for crossing conduits and conveyors. -block.liquiditemjunction.description=Serves as a junction for items and liquids. block.powerbooster.name=power booster block.powerbooster.fulldescription=Distributes power to all blocks within its radius. -block.powerbooster.description=Distributes power within a radius. block.powerlaser.name=power laser block.powerlaser.fulldescription=Creates a laser that transmits power to the block in front of it. Does not generate any power itself. Best used with generators or other lasers. -block.powerlaser.description=Transmits power. block.powerlaserrouter.name=laser router block.powerlaserrouter.fulldescription=Laser that distributes power to three directions at once. Useful in situations where it is required to power multiple blocks from one generator. -block.powerlaserrouter.description=Splits input power into 3 lasers. block.powerlasercorner.name=laser corner block.powerlasercorner.fulldescription=Laser that distributes power to two directions at once. Useful in situations where it is required to power multiple blocks from one generator, and a router is imprecise. -block.powerlasercorner.description=Splits input power into 2 lasers. block.teleporter.name=teleporter block.teleporter.fulldescription=Advanced item transport block. Teleporters input items to other teleporters of the same color. Does nothing if no teleporters of the same color exist. If multiple teleporters exist of the same color, a random one is selected. Tap and click the arrows to change color. -block.teleporter.description=[interact]Tap block to config[] block.sorter.name=sorter block.sorter.fulldescription=Sorts item by material type. Material to accept is indicated by the color in the block. All items that match the sort material are outputted forward, everything else is outputted to the left and right. -block.sorter.description=[interact]Tap block to config[] block.core.name=core block.pump.name=pump block.pump.fulldescription=Pumps liquids from a source block- usually water, lava or oil. Outputs liquid into nearby conduits. -block.pump.description=Pumps liquids into nearby conduits. block.fluxpump.name=fluxpump block.fluxpump.fulldescription=An advanced version of the pump. Stores more liquid and pumps liquid faster. -block.fluxpump.description=Pumps liquids into nearby conduits. block.smelter.name=smelter block.smelter.fulldescription=The essential crafting block. When inputted 1x iron and 1x coal, outputs one steel. -block.smelter.description=Converts coal + iron to steel. block.crucible.name=crucible block.crucible.fulldescription=An advanced crafting block. When inputted 1x titanium and 1x steel, outputs one dirium. -block.crucible.description=Converts steel + titanium to dirium. block.coalpurifier.name=coal extractor block.coalpurifier.fulldescription=A basic extractor block. Outputs coal when supplied with large amounts of water and stone. -block.coalpurifier.description=Converts stone + water to coal. block.titaniumpurifier.name=titanium extractor block.titaniumpurifier.fulldescription=A standard extractor block. Outputs titanium when supplied with large amounts of water and iron. -block.titaniumpurifier.description=Converts iron + water to titanium. block.oilrefinery.name=oil refinery block.oilrefinery.fulldescription=Refines large amounts of oil into coal items. Useful for fueling coal-based turrets when coal veins are scarce. -block.oilrefinery.description=Converts oil to coal. block.stoneformer.name=stone former block.stoneformer.fulldescription=Soldifies liquid lava into stone. Useful for producing massive amounts of stone for coal purifiers. -block.stoneformer.description=Converts lava to stone. block.lavasmelter.name=lava smelter block.lavasmelter.fulldescription=Uses lava to convert iron to steel. An alternative to smelteries. Useful in situations where coal is scarce. -block.lavasmelter.description=Converts iron + lava to steel. block.stonedrill.name=stone drill block.stonedrill.fulldescription=The essential drill. When placed on stone tiles, outputs stone at a slow pace indefinitely. -block.stonedrill.description=Mines 1 stone every 4 seconds. block.irondrill.name=iron drill block.irondrill.fulldescription=A basic drill. When placed on iron ore tiles, outputs iron at a slow pace indefinitely. -block.irondrill.description=Mines 1 iron every 5 seconds. block.coaldrill.name=coal drill block.coaldrill.fulldescription=A basic drill. When placed on coal ore tiles, outputs coal at a slow pace indefinitely. -block.coaldrill.description=Mines 1 coal every 5 seconds. block.uraniumdrill.name=uranium drill block.uraniumdrill.fulldescription=An advanced drill. When placed on uranium ore tiles, outputs uranium at a slow pace indefinitely. -block.uraniumdrill.description=Mines 1 uranium every 7 seconds. block.titaniumdrill.name=titanium drill block.titaniumdrill.fulldescription=An advanced drill. When placed on titanium ore tiles, outputs titanium at a slow pace indefinitely. -block.titaniumdrill.description=Mines 1 titanium every 5 seconds. block.omnidrill.name=omnidrill block.omnidrill.fulldescription=The ultimate drill. Will mine any ore it is placed on at a rapid pace. -block.omnidrill.description=Mines 1 of any resource every 3 seconds. block.coalgenerator.name=coal generator block.coalgenerator.fulldescription=The essential generator. Generates power from coal. Outputs power as lasers to its 4 sides. -block.coalgenerator.description=Generates power from coal. block.thermalgenerator.name=thermal generator block.thermalgenerator.fulldescription=Generates power from lava. Outputs power as lasers to its 4 sides. -block.thermalgenerator.description=Generates power from lava. block.combustiongenerator.name=combustion generator block.combustiongenerator.fulldescription=Generates power from oil. Outputs power as lasers to its 4 sides. -block.combustiongenerator.description=Generates power from oil. block.rtgenerator.name=RTG generator block.rtgenerator.fulldescription=Generates small amounts of power from the radioactive decay of uranium. Outputs power as lasers to its 4 sides. -block.rtgenerator.description=Generates power from uranium. block.nuclearreactor.name=nuclear reactor block.nuclearreactor.fulldescription=An advanced version of the RTG Generator, and the ultimate power generator. Generates power from uranium. Requires constant water cooling. Highly volatile; will explode violently if insufficient amounts of coolant are supplied. block.turret.name=turret block.turret.fulldescription=A basic, cheap turret. Uses stone for ammo. Has slightly more range than the double-turret. -block.turret.description=[turretinfo]Ammo: stone block.doubleturret.name=double turret block.doubleturret.fulldescription=A slightly more powerful version of the turret. Uses stone for ammo. Does significantly more damage, but has a lower range. Shoots two bullets. -block.doubleturret.description=[turretinfo]Ammo: stone block.machineturret.name=gattling turret block.machineturret.fulldescription=A standard all-around turret. Uses iron for ammo. Has a fast fire rate with decent damage. -block.machineturret.description=[turretinfo]Ammo: iron block.shotgunturret.name=splitter turret block.shotgunturret.fulldescription=A standard turret. Uses iron for ammo. Shoots a spread of 7 bullets. Lower range, but higher damage output than the gattling turret. -block.shotgunturret.description=[turretinfo]Ammo: iron block.flameturret.name=flamer turret block.flameturret.fulldescription=Advanced close-range turret. Uses coal for ammo. Has very low range, but very high damage. Good for close quarters. Recommended to be used behind walls. -block.flameturret.description=[turretinfo]Ammo: coal block.sniperturret.name=railgun turret block.sniperturret.fulldescription=Advanced long-range turret. Uses steel for ammo. Very high damage, but low fire rate. Expensive to use, but can be placed far away from enemy lines due to its range. -block.sniperturret.description=[turretinfo]Ammo: steel block.mortarturret.name=flak turret block.mortarturret.fulldescription=Advanced splash-damage turret. Uses coal for ammo. Very slow fire rate and bullets, but very high single-target and splash damage. Useful for large crowds of enemies. -block.mortarturret.description=[turretinfo]Ammo: coal block.laserturret.name=laser turret block.laserturret.fulldescription=Advanced single-target turret. Uses power. Good medium-range all-around turret. Single-target only. Never misses. -block.laserturret.description=[turretinfo]Uses power. block.waveturret.name=tesla turret block.waveturret.fulldescription=Advanced multi-target turret. Uses power. Medium range. Never misses.Average to low damage, but can hit multiple enemies simultaneously with chain lighting. -block.waveturret.description=[turretinfo]Uses power. block.plasmaturret.name=plasma turret block.plasmaturret.fulldescription=Highly advanced version of the flamer turret. Uses coal as ammo. Very high damage, low to medium range. -block.plasmaturret.description=[turretinfo]Ammo: coal block.chainturret.name=chain turret block.chainturret.fulldescription=The ultimate rapid-fire turret. Uses uranium as ammo. Shoots large slugs at a high fire rate. Medium range. Spans multiple tiles. Extremely tough. -block.chainturret.description=[turretinfo]Ammo: uranium block.titancannon.name=titan cannon block.titancannon.fulldescription=The ultimate long-range turret. Uses uranium as ammo. Shoots large splash-damage shells at a medium rate of fire. Long range. Spans multiple tiles. Extremely tough. -block.titancannon.description=[turretinfo]Ammo: uranium block.playerspawn.name=playerspawn block.enemyspawn.name=enemyspawn \ No newline at end of file diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index ddb978e49e..0e892d6b3e 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/src/io/anuke/mindustry/core/Control.java b/core/src/io/anuke/mindustry/core/Control.java index cae303d372..d91d50b7b3 100644 --- a/core/src/io/anuke/mindustry/core/Control.java +++ b/core/src/io/anuke/mindustry/core/Control.java @@ -16,6 +16,7 @@ import io.anuke.mindustry.graphics.Fx; import io.anuke.mindustry.input.AndroidInput; import io.anuke.mindustry.input.DesktopInput; import io.anuke.mindustry.input.InputHandler; +import io.anuke.mindustry.io.BundleGen; import io.anuke.mindustry.io.Saves; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.resource.Item; @@ -75,6 +76,8 @@ public class Control extends Module{ private boolean controlling; public Control(){ + BundleGen.cleanBundles(Gdx.files.internal("bundles/bundle.properties")); + if(Mindustry.args.contains("-debug", false)) Vars.debug = true; @@ -225,6 +228,11 @@ public class Control extends Module{ weapons.add(Weapon.blaster); player.weaponLeft = player.weaponRight = weapons.first(); + + if(debug){ + weapons.add(Weapon.triblaster); + player.weaponLeft = player.weaponRight = weapons.peek(); + } lastUpdated = -1; wave = 1; diff --git a/core/src/io/anuke/mindustry/entities/BulletType.java b/core/src/io/anuke/mindustry/entities/BulletType.java index 5037870f0a..e99a97ab63 100644 --- a/core/src/io/anuke/mindustry/entities/BulletType.java +++ b/core/src/io/anuke/mindustry/entities/BulletType.java @@ -282,16 +282,36 @@ public abstract class BulletType extends BaseBulletType{ Draw.reset(); } }, - shot = new BulletType(2.4f, 4){ - {lifetime = 40;} + shot = new BulletType(2.7f, 4){ + { + lifetime = 40; + } + public void draw(Bullet b){ - Draw.color(lightGold); - Draw.rect("bullet", b.x, b.y, b.angle()); + Draw.color(Color.WHITE, lightOrange, b.fract()/2f + 0.25f); + Draw.thick(1.5f); + Draw.lineAngle(b.x, b.y, b.angle(), 3f); + Draw.reset(); + } + }, + spread = new BulletType(2.4f, 6) { + { + lifetime = 50; + } + + public void draw(Bullet b) { + float size = 3f - b.ifract()*1f; + + Draw.color(Color.PURPLE, Color.WHITE, 0.8f); + Draw.thick(1f); + Draw.circle(b.x, b.y, size); Draw.reset(); } }, multishot = new BulletType(2.5f, 3){ - {lifetime=40;} + { + lifetime = 40; + } public void draw(Bullet b){ Draw.color(Color.SKY); Draw.rect("bullet", b.x, b.y, b.angle()); diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index e022641311..3419dd68d3 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -100,13 +100,13 @@ public class Player extends DestructibleEntity implements Syncable{ if(!isAndroid) { for (boolean b : new boolean[]{true, false}) { + Weapon weapon = b ? weaponLeft : weaponRight; Angles.translation(angle + Mathf.sign(b) * -50f, 3.5f); - String name = b ? weaponLeft.name : weaponRight.name; float s = 5f; if(snap){ - Draw.rect(name, (int)x + Angles.x(), (int)y + Angles.y(), s, s, angle- 90); + Draw.rect(weapon.name, (int)x + Angles.x(), (int)y + Angles.y(), s, s, angle- 90); }else{ - Draw.rect(name, x + Angles.x(), y + Angles.y(), s, s, angle - 90); + Draw.rect(weapon.name, x + Angles.x(), y + Angles.y(), s, s, angle - 90); } } } diff --git a/core/src/io/anuke/mindustry/graphics/Fx.java b/core/src/io/anuke/mindustry/graphics/Fx.java index f65230e76a..83cd29fe41 100644 --- a/core/src/io/anuke/mindustry/graphics/Fx.java +++ b/core/src/io/anuke/mindustry/graphics/Fx.java @@ -2,7 +2,6 @@ package io.anuke.mindustry.graphics; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Colors; - import io.anuke.mindustry.Vars; import io.anuke.ucore.core.Draw; import io.anuke.ucore.core.Effects.Effect; @@ -350,24 +349,16 @@ public class Fx{ Draw.reset(); }), - shoot = new Effect(8, e -> { + laserShoot = new Effect(8, e -> { Draw.thickness(1f); - Draw.color(Color.WHITE, Color.GOLD, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 2f, 2, 5); - Draw.reset(); - }), - - shoot2 = new Effect(8, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.SKY, e.ifract()); + Draw.color(Color.WHITE, lightOrange, e.ifract()); Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); Draw.reset(); }), - - shoot3 = new Effect(8, e -> { - Draw.thickness(1f); - Draw.color(Color.WHITE, Color.GOLD, e.ifract()); - Draw.spikes(e.x, e.y, e.ifract() * 2f, 1, 5); + + spreadShoot = new Effect(12, e -> { + Draw.color(Color.WHITE, Color.PURPLE, e.ifract()); + Draw.lineShot(e.x, e.y, e.rotation, 3, e.fract(), 9f, 3.5f, 0.8f); Draw.reset(); }), @@ -460,7 +451,6 @@ public class Fx{ dashsmoke = new Effect(30, e -> { Draw.color(Color.CORAL, Color.GRAY, e.ifract()); - //Draw.alpha(e.fract()); float size = e.fract()*4f; Draw.rect("circle", e.x, e.y, size, size); Draw.reset(); @@ -472,13 +462,6 @@ public class Fx{ Draw.circle(e.x, e.y, 7f - e.ifract() * 6f); Draw.reset(); }), - - ind = new Effect(100, e -> { - Draw.thickness(3f); - Draw.color(Color.ROYAL); - Draw.circle(e.x, e.y, 3); - Draw.reset(); - }), respawn = new Effect(Vars.respawnduration, e -> { Draw.tcolor(Color.SCARLET); diff --git a/core/src/io/anuke/mindustry/io/BundleGen.java b/core/src/io/anuke/mindustry/io/BundleGen.java index 2a0834c194..95c33a6996 100644 --- a/core/src/io/anuke/mindustry/io/BundleGen.java +++ b/core/src/io/anuke/mindustry/io/BundleGen.java @@ -1,5 +1,6 @@ package io.anuke.mindustry.io; +import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.Vars; @@ -21,6 +22,17 @@ import io.anuke.ucore.util.Mathf; public class BundleGen { private static FileHandle file; + public static void cleanBundles(FileHandle file){ + String[] strings = file.readString().split("\n"); + FileHandle out = Gdx.files.absolute("/home/anuke/out.properties"); + out.writeString("", false); + for(String string : strings){ + if(!string.contains(".description")){ + out.writeString(string + "\n", true); + } + } + } + public static void buildBundle(FileHandle file){ BundleGen.file = file; diff --git a/core/src/io/anuke/mindustry/resource/Weapon.java b/core/src/io/anuke/mindustry/resource/Weapon.java index b9fa162867..266bc6bf5d 100644 --- a/core/src/io/anuke/mindustry/resource/Weapon.java +++ b/core/src/io/anuke/mindustry/resource/Weapon.java @@ -16,20 +16,21 @@ import io.anuke.ucore.util.Mathf; public class Weapon extends Upgrade{ public static final Weapon - blaster = new Weapon("blaster", 15, BulletType.shot){ + blaster = new Weapon("blaster", 12, BulletType.shot){ { - effect = Fx.shoot3; + effect = Fx.laserShoot; } }, - triblaster = new Weapon("triblaster", 13, BulletType.shot){ + triblaster = new Weapon("triblaster", 18, BulletType.spread){ { shots = 3; - effect = Fx.shoot; + effect = Fx.spreadShoot; + roundrobin = true; } }, multigun = new Weapon("multigun", 6, BulletType.multishot){ { - effect = Fx.shoot2; + effect = Fx.laserShoot; inaccuracy = 6f; } }, @@ -52,14 +53,24 @@ public class Weapon extends Upgrade{ shake = 2f; } }; - + /**weapon reload in frames*/ float reload; + /**type of bullet shot*/ BulletType type; + /**sound made when shooting*/ String shootsound = "shoot"; + /**amount of shots per fire*/ int shots = 1; + /**spacing in degrees between multiple shots, if applicable*/ + float spacing = 12f; + /**inaccuracy of degrees of each shot*/ float inaccuracy = 0f; + /**intensity and duration of each shot's screen shake*/ float shake = 0f; + /**effect displayed when shooting*/ Effect effect; + /**whether to shoot the weapons in different arms one after another, rather an all at once*/ + boolean roundrobin = false; private Weapon(String name, float reload, BulletType type){ super(name); @@ -69,16 +80,19 @@ public class Weapon extends Upgrade{ public void update(Player p, boolean left){ if(Timers.get(p, "reload"+left, reload)){ + if(left && roundrobin){ + Timers.reset(p, "reload" + false, reload/2f); + } float ang = Angles.mouseAngle(p.x, p.y); - Angles.translation(ang + Mathf.sign(left) * -70f, 2f); + Angles.translation(ang + Mathf.sign(left) * -60f, 3f); shoot(p, p.x + Angles.x(), p.y + Angles.y(), Angles.mouseAngle(p.x + Angles.x(), p.y + Angles.y())); } } void shootInternal(Player p, float x, float y, float rotation){ - Angles.shotgun(shots, 12f, rotation, f -> bullet(p, x, y, f + Mathf.range(inaccuracy))); + Angles.shotgun(shots, spacing, rotation, f -> bullet(p, x, y, f + Mathf.range(inaccuracy))); Angles.translation(rotation, 3f); - if(effect != null) Effects.effect(effect, x + Angles.x(), y + Angles.y()); + if(effect != null) Effects.effect(effect, x + Angles.x(), y + Angles.y(), rotation); Effects.shake(shake, shake, x, y); Effects.sound(shootsound, x, y); } diff --git a/core/src/io/anuke/mindustry/ui/fragments/WeaponFragment.java b/core/src/io/anuke/mindustry/ui/fragments/WeaponFragment.java index 920490c6cf..73467a7695 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/WeaponFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/WeaponFragment.java @@ -1,77 +1,11 @@ package io.anuke.mindustry.ui.fragments; -import io.anuke.mindustry.Vars; -import io.anuke.mindustry.core.GameState; -import io.anuke.mindustry.core.GameState.State; -import io.anuke.mindustry.resource.Weapon; -import io.anuke.ucore.core.Core; -import io.anuke.ucore.core.Draw; -import io.anuke.ucore.core.Inputs; -import io.anuke.ucore.scene.ui.ButtonGroup; -import io.anuke.ucore.scene.ui.ImageButton; -import io.anuke.ucore.scene.ui.Tooltip; -import io.anuke.ucore.scene.ui.layout.Table; - -import static io.anuke.mindustry.Vars.*; - public class WeaponFragment implements Fragment{ - Table weapontable; - - public void build(){ - weapontable = Core.scene.table(); - weapontable.bottom().left(); - weapontable.setVisible(()-> !GameState.is(State.menu)); - - if(android){ - weapontable.remove(); - } - } - - public void update(){ - weapontable.clearChildren(); - - ButtonGroup group = new ButtonGroup<>(); - group.setMaxCheckCount(2); - - weapontable.defaults().size(58, 62); - - for(Weapon weapon : control.getWeapons()){ - ImageButton button = new ImageButton(Draw.region(weapon.name), "toggle"); - button.getImageCell().size(8*5); - - group.add(button); - - button.clicked(()->{ - //if(weapon == player.weapon) return; - if(Inputs.keyDown("weapon_alt_select")){ - player.weaponRight = weapon; - }else { - player.weaponLeft = weapon; - } - button.setChecked(true); - Vars.netClient.handleWeaponSwitch(); - }); - - button.update(() -> button.setChecked(weapon == player.weaponLeft || weapon == player.weaponRight)); //TODO - - weapontable.add(button); - - Table tiptable = new Table(); - String description = weapon.description; - - tiptable.background("button"); - tiptable.add(weapon.localized(), 0.5f).left().padBottom(3f); - - tiptable.row(); - tiptable.row(); - tiptable.add("[GRAY]" + description).left(); - tiptable.margin(14f); - - Tooltip tip = new Tooltip<>(tiptable); - - tip.setInstant(true); - button.addListener(tip); - } + @Override + public void build(){ + } + + public void update(){} }