Coal centrifuge / In-game chat / Player health rule / Bugfixes

This commit is contained in:
Anuken
2019-04-08 22:11:06 -04:00
parent 39fb2ae5ab
commit b4fb687c4f
26 changed files with 2908 additions and 2758 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -453,6 +453,8 @@ setting.mutemusic.name = Mute Music
setting.sfxvol.name = SFX Volume setting.sfxvol.name = SFX Volume
setting.mutesound.name = Mute Sound setting.mutesound.name = Mute Sound
setting.crashreport.name = Send Anonymous Crash Reports setting.crashreport.name = Send Anonymous Crash Reports
setting.chatopacity.name = Chat Opacity
setting.playerchat.name = Display In-Game Chat
keybind.title = Rebind Keys keybind.title = Rebind Keys
category.general.name = General category.general.name = General
category.view.name = View category.view.name = View
@@ -509,6 +511,7 @@ rules.pvp = PvP
rules.unitdrops = Unit Drops rules.unitdrops = Unit Drops
rules.unitbuildspeedmultiplier = Unit Creation Speed Multiplier rules.unitbuildspeedmultiplier = Unit Creation Speed Multiplier
rules.unithealthmultiplier = Unit Health Multiplier rules.unithealthmultiplier = Unit Health Multiplier
rules.playerhealthmultiplier = Player Health Multiplier
rules.playerdamagemultiplier = Player Damage Multiplier rules.playerdamagemultiplier = Player Damage Multiplier
rules.unitdamagemultiplier = Unit Damage Multiplier rules.unitdamagemultiplier = Unit Damage Multiplier
rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles) rules.enemycorebuildradius = Enemy Core No-Build Radius:[LIGHT_GRAY] (tiles)
@@ -693,6 +696,7 @@ block.melter.name = Melter
block.incinerator.name = Incinerator block.incinerator.name = Incinerator
block.spore-press.name = Spore Press block.spore-press.name = Spore Press
block.separator.name = Separator block.separator.name = Separator
block.coal-centrifuge.name = Coal Centrifuge
block.power-node.name = Power Node block.power-node.name = Power Node
block.power-node-large.name = Large Power Node block.power-node-large.name = Large Power Node
block.surge-tower.name = Surge Tower block.surge-tower.name = Surge Tower

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 506 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 KiB

After

Width:  |  Height:  |  Size: 247 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 535 KiB

After

Width:  |  Height:  |  Size: 510 KiB

View File

@@ -40,7 +40,7 @@ public class Blocks implements ContentList{
//crafting //crafting
siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer, siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
melter, separator, sporePress, pulverizer, incinerator, melter, separator, sporePress, pulverizer, incinerator, coalCentrifuge,
//sandbox //sandbox
powerVoid, powerSource, itemSource, liquidSource, itemVoid, powerVoid, powerSource, itemSource, liquidSource, itemVoid,
@@ -593,10 +593,10 @@ public class Blocks implements ContentList{
separator = new Separator("separator"){{ separator = new Separator("separator"){{
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.titanium, 50)); requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.titanium, 50));
results = ItemStack.with( results = ItemStack.with(
Items.copper, 5, Items.copper, 5,
Items.lead, 3, Items.lead, 3,
Items.graphite, 2, Items.graphite, 2,
Items.titanium, 2 Items.titanium, 2
); );
hasPower = true; hasPower = true;
craftTime = 35f; craftTime = 35f;
@@ -669,6 +669,18 @@ public class Blocks implements ContentList{
}; };
}}; }};
coalCentrifuge = new GenericCrafter("coal-centrifuge"){{
requirements(Category.crafting, ItemStack.with(Items.titanium, 40, Items.graphite, 80, Items.lead, 60));
craftEffect = Fx.smeltsmoke;
outputItem = new ItemStack(Items.coal, 1);
craftTime = 30f;
size = 2;
hasPower = hasItems = hasLiquids = true;
consumes.liquid(Liquids.oil, 3f);
consumes.power(0.5f);
}};
incinerator = new Incinerator("incinerator"){{ incinerator = new Incinerator("incinerator"){{
requirements(Category.crafting, ItemStack.with(Items.graphite, 10, Items.lead, 30)); requirements(Category.crafting, ItemStack.with(Items.graphite, 10, Items.lead, 30));
health = 90; health = 90;
@@ -1244,10 +1256,10 @@ public class Blocks implements ContentList{
duo = new DoubleTurret("duo"){{ duo = new DoubleTurret("duo"){{
requirements(Category.turret, ItemStack.with(Items.copper, 70), true); requirements(Category.turret, ItemStack.with(Items.copper, 70), true);
ammo( ammo(
Items.copper, Bullets.standardCopper, Items.copper, Bullets.standardCopper,
Items.graphite, Bullets.standardDense, Items.graphite, Bullets.standardDense,
Items.pyratite, Bullets.standardIncendiary, Items.pyratite, Bullets.standardIncendiary,
Items.silicon, Bullets.standardHoming Items.silicon, Bullets.standardHoming
); );
reload = 20f; reload = 20f;
restitution = 0.03f; restitution = 0.03f;
@@ -1262,8 +1274,8 @@ public class Blocks implements ContentList{
scatter = new BurstTurret("scatter"){{ scatter = new BurstTurret("scatter"){{
requirements(Category.turret, ItemStack.with(Items.copper, 170, Items.lead, 90)); requirements(Category.turret, ItemStack.with(Items.copper, 170, Items.lead, 90));
ammo( ammo(
Items.scrap, Bullets.flakScrap, Items.scrap, Bullets.flakScrap,
Items.lead, Bullets.flakLead Items.lead, Bullets.flakLead
); );
reload = 15f; reload = 15f;
range = 180f; range = 180f;
@@ -1283,8 +1295,8 @@ public class Blocks implements ContentList{
scorch = new ItemTurret("scorch"){{ scorch = new ItemTurret("scorch"){{
requirements(Category.turret, ItemStack.with(Items.copper, 50, Items.graphite, 45)); requirements(Category.turret, ItemStack.with(Items.copper, 50, Items.graphite, 45));
ammo( ammo(
Items.coal, Bullets.basicFlame, Items.coal, Bullets.basicFlame,
Items.pyratite, Bullets.pyraFlame Items.pyratite, Bullets.pyraFlame
); );
recoil = 0f; recoil = 0f;
reload = 4f; reload = 4f;
@@ -1298,9 +1310,9 @@ public class Blocks implements ContentList{
hail = new ArtilleryTurret("hail"){{ hail = new ArtilleryTurret("hail"){{
requirements(Category.turret, ItemStack.with(Items.copper, 80, Items.graphite, 35)); requirements(Category.turret, ItemStack.with(Items.copper, 80, Items.graphite, 35));
ammo( ammo(
Items.graphite, Bullets.artilleryDense, Items.graphite, Bullets.artilleryDense,
Items.silicon, Bullets.artilleryHoming, Items.silicon, Bullets.artilleryHoming,
Items.pyratite, Bullets.artlleryIncendiary Items.pyratite, Bullets.artlleryIncendiary
); );
reload = 60f; reload = 60f;
recoil = 2f; recoil = 2f;
@@ -1313,10 +1325,10 @@ public class Blocks implements ContentList{
wave = new LiquidTurret("wave"){{ wave = new LiquidTurret("wave"){{
requirements(Category.turret, ItemStack.with(Items.metaglass, 90, Items.lead, 150)); requirements(Category.turret, ItemStack.with(Items.metaglass, 90, Items.lead, 150));
ammo( ammo(
Liquids.water, Bullets.waterShot, Liquids.water, Bullets.waterShot,
Liquids.slag, Bullets.slagShot, Liquids.slag, Bullets.slagShot,
Liquids.cryofluid, Bullets.cryoShot, Liquids.cryofluid, Bullets.cryoShot,
Liquids.oil, Bullets.oilShot Liquids.oil, Bullets.oilShot
); );
size = 2; size = 2;
recoil = 0f; recoil = 0f;
@@ -1380,9 +1392,9 @@ public class Blocks implements ContentList{
swarmer = new BurstTurret("swarmer"){{ swarmer = new BurstTurret("swarmer"){{
requirements(Category.turret, ItemStack.with(Items.graphite, 70, Items.titanium, 70, Items.plastanium, 90, Items.silicon, 60)); requirements(Category.turret, ItemStack.with(Items.graphite, 70, Items.titanium, 70, Items.plastanium, 90, Items.silicon, 60));
ammo( ammo(
Items.blastCompound, Bullets.missileExplosive, Items.blastCompound, Bullets.missileExplosive,
Items.pyratite, Bullets.missileIncendiary, Items.pyratite, Bullets.missileIncendiary,
Items.surgealloy, Bullets.missileSurge Items.surgealloy, Bullets.missileSurge
); );
reload = 50f; reload = 50f;
shots = 4; shots = 4;
@@ -1397,11 +1409,11 @@ public class Blocks implements ContentList{
salvo = new BurstTurret("salvo"){{ salvo = new BurstTurret("salvo"){{
requirements(Category.turret, ItemStack.with(Items.copper, 210, Items.graphite, 190, Items.titanium, 120)); requirements(Category.turret, ItemStack.with(Items.copper, 210, Items.graphite, 190, Items.titanium, 120));
ammo( ammo(
Items.copper, Bullets.standardCopper, Items.copper, Bullets.standardCopper,
Items.graphite, Bullets.standardDense, Items.graphite, Bullets.standardDense,
Items.pyratite, Bullets.standardIncendiary, Items.pyratite, Bullets.standardIncendiary,
Items.silicon, Bullets.standardHoming, Items.silicon, Bullets.standardHoming,
Items.thorium, Bullets.standardThorium Items.thorium, Bullets.standardThorium
); );
size = 2; size = 2;
@@ -1421,11 +1433,11 @@ public class Blocks implements ContentList{
ripple = new ArtilleryTurret("ripple"){{ ripple = new ArtilleryTurret("ripple"){{
requirements(Category.turret, ItemStack.with(Items.copper, 300, Items.graphite, 270, Items.titanium, 120)); requirements(Category.turret, ItemStack.with(Items.copper, 300, Items.graphite, 270, Items.titanium, 120));
ammo( ammo(
Items.graphite, Bullets.artilleryDense, Items.graphite, Bullets.artilleryDense,
Items.silicon, Bullets.artilleryHoming, Items.silicon, Bullets.artilleryHoming,
Items.pyratite, Bullets.artlleryIncendiary, Items.pyratite, Bullets.artlleryIncendiary,
Items.blastCompound, Bullets.artilleryExplosive, Items.blastCompound, Bullets.artilleryExplosive,
Items.plastanium, Bullets.arilleryPlastic Items.plastanium, Bullets.arilleryPlastic
); );
size = 3; size = 3;
shots = 4; shots = 4;
@@ -1446,9 +1458,9 @@ public class Blocks implements ContentList{
cyclone = new ItemTurret("cyclone"){{ cyclone = new ItemTurret("cyclone"){{
requirements(Category.turret, ItemStack.with(Items.copper, 400, Items.titanium, 250, Items.plastanium, 160)); requirements(Category.turret, ItemStack.with(Items.copper, 400, Items.titanium, 250, Items.plastanium, 160));
ammo( ammo(
Items.blastCompound, Bullets.flakExplosive, Items.blastCompound, Bullets.flakExplosive,
Items.plastanium, Bullets.flakPlastic, Items.plastanium, Bullets.flakPlastic,
Items.surgealloy, Bullets.flakSurge Items.surgealloy, Bullets.flakSurge
); );
xRand = 4f; xRand = 4f;
reload = 6f; reload = 6f;
@@ -1478,9 +1490,9 @@ public class Blocks implements ContentList{
spectre = new DoubleTurret("spectre"){{ spectre = new DoubleTurret("spectre"){{
requirements(Category.turret, ItemStack.with(Items.copper, 700, Items.graphite, 600, Items.surgealloy, 500, Items.plastanium, 350, Items.thorium, 500)); requirements(Category.turret, ItemStack.with(Items.copper, 700, Items.graphite, 600, Items.surgealloy, 500, Items.plastanium, 350, Items.thorium, 500));
ammo( ammo(
Items.graphite, Bullets.standardDenseBig, Items.graphite, Bullets.standardDenseBig,
Items.pyratite, Bullets.standardIncendiaryBig, Items.pyratite, Bullets.standardIncendiaryBig,
Items.thorium, Bullets.standardThoriumBig Items.thorium, Bullets.standardThoriumBig
); );
reload = 6f; reload = 6f;
coolantMultiplier = 0.5f; coolantMultiplier = 0.5f;

View File

@@ -80,7 +80,7 @@ public class Mechs implements ContentList{
reload = 40f; reload = 40f;
shotDelay = 3f; shotDelay = 3f;
roundrobin = true; roundrobin = true;
shots = 3; shots = 2;
inaccuracy = 0f; inaccuracy = 0f;
ejectEffect = Fx.none; ejectEffect = Fx.none;
bullet = Bullets.lightning; bullet = Bullets.lightning;

View File

@@ -137,6 +137,9 @@ public class TechTree implements ContentList{
node(siliconSmelter, () -> { node(siliconSmelter, () -> {
node(sporePress, () -> { node(sporePress, () -> {
node(coalCentrifuge, () -> {
});
node(multiPress, () -> { node(multiPress, () -> {
}); });

View File

@@ -2,13 +2,17 @@ package io.anuke.mindustry.content;
import io.anuke.mindustry.game.ContentList; import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.Rules;
import io.anuke.mindustry.maps.generators.DesertThingGenerator;
import io.anuke.mindustry.maps.generators.MapGenerator; import io.anuke.mindustry.maps.generators.MapGenerator;
import io.anuke.mindustry.maps.generators.MapGenerator.Decoration; import io.anuke.mindustry.maps.generators.MapGenerator.Decoration;
import io.anuke.mindustry.type.*; import io.anuke.mindustry.type.*;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
public class Zones implements ContentList{ public class Zones implements ContentList{
public static Zone groundZero, craters, frozenForest, ruinousShores, stainedMountains, public static Zone
groundZero, desertThing,
craters, frozenForest, ruinousShores, stainedMountains,
overgrowth, infestedIslands,
desolateRift, nuclearComplex; desolateRift, nuclearComplex;
@Override @Override
@@ -28,6 +32,19 @@ public class Zones implements ContentList{
}}; }};
}}; }};
desertThing = new Zone("desertThing", new DesertThingGenerator(240, 240)){{
startingItems = ItemStack.list(Items.copper, 200);
alwaysUnlocked = true;
conditionWave = 5;
launchPeriod = 5;
resources = new Item[]{Items.copper, Items.scrap, Items.lead};
rules = () -> new Rules(){{
waves = true;
waveTimer = true;
waveSpacing = 60 * 60 * 2;
}};
}};
craters = new Zone("craters", new MapGenerator("craters", 1).dist(0).decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01))){{ craters = new Zone("craters", new MapGenerator("craters", 1).dist(0).decor(new Decoration(Blocks.snow, Blocks.sporeCluster, 0.01))){{
startingItems = ItemStack.list(Items.copper, 200); startingItems = ItemStack.list(Items.copper, 200);
conditionWave = 10; conditionWave = 10;

View File

@@ -117,10 +117,15 @@ public class NetClient implements ApplicationListener{
//called on all clients //called on all clients
@Remote(called = Loc.server, targets = Loc.server) @Remote(called = Loc.server, targets = Loc.server)
public static void sendMessage(String message, String sender){ public static void sendMessage(String message, String sender, Player playersender){
if(Vars.ui != null){ if(Vars.ui != null){
Vars.ui.chatfrag.addMessage(message, sender); Vars.ui.chatfrag.addMessage(message, sender);
} }
if(playersender != null){
playersender.lastText = message;
playersender.textFadeTime = 1f;
}
} }
//equivalent to above method but there's no sender and no console log //equivalent to above method but there's no sender and no console log
@@ -143,7 +148,7 @@ public class NetClient implements ApplicationListener{
//invoke event for all clients but also locally //invoke event for all clients but also locally
//this is required so other clients get the correct name even if they don't know who's sending it yet //this is required so other clients get the correct name even if they don't know who's sending it yet
Call.sendMessage(message, colorizeName(player.id, player.name)); Call.sendMessage(message, colorizeName(player.id, player.name), player);
} }
private static String colorizeName(int id, String name){ private static String colorizeName(int id, String name){

View File

@@ -61,6 +61,9 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
public TargetTrait target; public TargetTrait target;
public TargetTrait moveTarget; public TargetTrait moveTarget;
public String lastText;
public float textFadeTime;
private float walktime; private float walktime;
private Queue<BuildRequest> placeQueue = new Queue<>(); private Queue<BuildRequest> placeQueue = new Queue<>();
private Tile mining; private Tile mining;
@@ -172,7 +175,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
@Override @Override
public float maxHealth(){ public float maxHealth(){
return mech.health; return mech.health * state.rules.playerHealthMultiplier;
} }
@Override @Override
@@ -376,24 +379,41 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
public void drawName(){ public void drawName(){
BitmapFont font = Core.scene.skin.getFont("default-font"); BitmapFont font = Core.scene.skin.getFont("default-font");
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new); GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
final float nameHeight = 11;
final float textHeight = 15;
boolean ints = font.usesIntegerPositions(); boolean ints = font.usesIntegerPositions();
font.setUseIntegerPositions(false); font.setUseIntegerPositions(false);
font.getData().setScale(0.25f / io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f)); font.getData().setScale(0.25f / io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f));
layout.setText(font, name); layout.setText(font, name);
Draw.color(0f, 0f, 0f, 0.3f); Draw.color(0f, 0f, 0f, 0.3f);
Fill.rect(x, y + 8 - layout.height / 2, layout.width + 2, layout.height + 3); Fill.rect(x, y + nameHeight - layout.height / 2, layout.width + 2, layout.height + 3);
Draw.color(); Draw.color();
font.setColor(color); font.setColor(color);
font.draw(name, x, y + 8, 0, Align.center, false); font.draw(name, x, y + nameHeight, 0, Align.center, false);
if(isAdmin){ if(isAdmin){
float s = 3f; float s = 3f;
Draw.color(color.r * 0.5f, color.g * 0.5f, color.b * 0.5f, 1f); Draw.color(color.r * 0.5f, color.g * 0.5f, color.b * 0.5f, 1f);
Draw.rect(Core.atlas.find("icon-admin-small"), x + layout.width / 2f + 2 + 1, y + 6.5f, s, s); Draw.rect(Core.atlas.find("icon-admin-small"), x + layout.width / 2f + 2 + 1, y + nameHeight - 1.5f, s, s);
Draw.color(color); Draw.color(color);
Draw.rect(Core.atlas.find("icon-admin-small"), x + layout.width / 2f + 2 + 1, y + 7f, s, s); Draw.rect(Core.atlas.find("icon-admin-small"), x + layout.width / 2f + 2 + 1, y + nameHeight - 1f, s, s);
}
if(Core.settings.getBool("playerchat") && ((textFadeTime > 0 && lastText != null) || isTyping)){
String text = textFadeTime <= 0 || lastText == null ? "[LIGHT_GRAY]" + Strings.animated(Time.time(), 4, 15f, ".") : lastText;
float width = 100f;
float visualFadeTime = 1f - Mathf.curve(1f - textFadeTime, 0.9f);
font.setColor(1f, 1f, 1f, textFadeTime <= 0 || lastText == null ? 1f : visualFadeTime);
layout.setText(font, text, Color.WHITE, width, Align.bottom, true);
Draw.color(0f, 0f, 0f, 0.3f * (textFadeTime <= 0 || lastText == null ? 1f : visualFadeTime));
Fill.rect(x, y + textHeight + layout.height - layout.height/2f, layout.width + 2, layout.height + 3);
font.draw(text, x - width/2f, y + textHeight + layout.height, width, Align.center, true);
textFadeTime -= Time.delta() / (60 * 5);
} }
Draw.reset(); Draw.reset();
@@ -546,6 +566,8 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
updateMech(); updateMech();
} }
isTyping = ui.chatfrag.chatOpen();
updateBuilding(); updateBuilding();
if(!mech.flying){ if(!mech.flying){
@@ -754,10 +776,14 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
spawner = lastSpawner = null; spawner = lastSpawner = null;
health = maxHealth(); health = maxHealth();
boostHeat = drownTime = hitTime = 0f; boostHeat = drownTime = hitTime = 0f;
mech = (isMobile ? Mechs.starterMobile : Mechs.starterDesktop); mech = getStarterMech();
placeQueue.clear(); placeQueue.clear();
} }
public Mech getStarterMech(){
return (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
}
public boolean isShooting(){ public boolean isShooting(){
return isShooting && (!isBoosting || mech.flying); return isShooting && (!isBoosting || mech.flying);
} }

View File

@@ -28,7 +28,8 @@ public enum RulePreset{
respawnTime = 60 * 10; respawnTime = 60 * 10;
buildCostMultiplier = 0.5f; buildCostMultiplier = 0.5f;
buildSpeedMultiplier = 2f; buildSpeedMultiplier = 2f;
playerDamageMultiplier = 0.5f; playerDamageMultiplier = 0.45f;
playerHealthMultiplier = 0.8f;
unitBuildSpeedMultiplier = 3f; unitBuildSpeedMultiplier = 3f;
unitHealthMultiplier = 2f; unitHealthMultiplier = 2f;
}}); }});

View File

@@ -25,6 +25,8 @@ public class Rules{
public float unitBuildSpeedMultiplier = 1f; public float unitBuildSpeedMultiplier = 1f;
/** How much health units start with. */ /** How much health units start with. */
public float unitHealthMultiplier = 1f; public float unitHealthMultiplier = 1f;
/** How much health players start with. */
public float playerHealthMultiplier = 1f;
/** How much damage player mechs deal. */ /** How much damage player mechs deal. */
public float playerDamageMultiplier = 1f; public float playerDamageMultiplier = 1f;
/** How much damage any other units deal. */ /** How much damage any other units deal. */

View File

@@ -0,0 +1,13 @@
package io.anuke.mindustry.maps.generators;
public class DesertThingGenerator extends RandomGenerator{
public DesertThingGenerator(int width, int height){
super(width, height);
}
@Override
public void generate(int x, int y){
}
}

View File

@@ -14,7 +14,6 @@ import io.anuke.mindustry.game.EventType.ZoneRequireCompleteEvent;
import io.anuke.mindustry.game.Rules; import io.anuke.mindustry.game.Rules;
import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.maps.generators.Generator; import io.anuke.mindustry.maps.generators.Generator;
import io.anuke.mindustry.maps.generators.MapGenerator;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import java.util.Arrays; import java.util.Arrays;
@@ -38,7 +37,7 @@ public class Zone extends UnlockableContent{
protected Array<ItemStack> startingItems = new Array<>(); protected Array<ItemStack> startingItems = new Array<>();
protected ItemStack[] launchCost = null; protected ItemStack[] launchCost = null;
public Zone(String name, MapGenerator generator){ public Zone(String name, Generator generator){
super(name); super(name);
this.generator = generator; this.generator = generator;
} }

View File

@@ -45,6 +45,7 @@ public class CustomRulesDialog extends FloatingDialog{
number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier); number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
number("$rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier); number("$rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier);
number("$rules.unithealthmultiplier", f -> rules.unitHealthMultiplier = f, () -> rules.unitHealthMultiplier); number("$rules.unithealthmultiplier", f -> rules.unitHealthMultiplier = f, () -> rules.unitHealthMultiplier);
number("$rules.playerhealthmultiplier", f -> rules.playerHealthMultiplier = f, () -> rules.playerHealthMultiplier);
number("$rules.playerdamagemultiplier", f -> rules.playerDamageMultiplier = f, () -> rules.playerDamageMultiplier); number("$rules.playerdamagemultiplier", f -> rules.playerDamageMultiplier = f, () -> rules.playerDamageMultiplier);
number("$rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier); number("$rules.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200)); number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200));

View File

@@ -178,6 +178,8 @@ public class SettingsMenuDialog extends SettingsDialog{
}); });
graphics.sliderPref("fpscap", 125, 5, 125, 5, s -> (s > 120 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s))); graphics.sliderPref("fpscap", 125, 5, 125, 5, s -> (s > 120 ? Core.bundle.get("setting.fpscap.none") : Core.bundle.format("setting.fpscap.text", s)));
graphics.sliderPref("chatopacity", 100, 0, 100, 5, s -> s + "%");
if(!mobile){ if(!mobile){
graphics.sliderPref("antialias", 0, 0, 5, 1, s -> (s == 0 ? 0 : (1 << s)) + "x"); graphics.sliderPref("antialias", 0, 0, 5, 1, s -> (s == 0 ? 0 : (1 << s)) + "x");
@@ -209,6 +211,7 @@ public class SettingsMenuDialog extends SettingsDialog{
} }
} }
graphics.checkPref("playerchat", true);
graphics.checkPref("minimap", !mobile); graphics.checkPref("minimap", !mobile);
graphics.checkPref("fps", false); graphics.checkPref("fps", false);
graphics.checkPref("indicators", true); graphics.checkPref("indicators", true);

View File

@@ -123,6 +123,7 @@ public class ChatFragment extends Table{
@Override @Override
public void draw(){ public void draw(){
float opacity = Core.settings.getInt("chatopacity") / 100f;
Draw.color(shadowColor); Draw.color(shadowColor);
@@ -138,6 +139,7 @@ public class ChatFragment extends Table{
fieldlabel.visible(chatOpen); fieldlabel.visible(chatOpen);
Draw.color(shadowColor); Draw.color(shadowColor);
Draw.alpha(shadowColor.a * opacity);
float theight = offsety + spacing + getMarginBottom(); float theight = offsety + spacing + getMarginBottom();
for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos && (i < fadetime || chatOpen); i++){ for(int i = scrollPos; i < messages.size && i < messagesShown + scrollPos && (i < fadetime || chatOpen); i++){
@@ -150,12 +152,15 @@ public class ChatFragment extends Table{
font.getCache().addText(messages.get(i).formattedMessage, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true); font.getCache().addText(messages.get(i).formattedMessage, fontoffsetx + offsetx, offsety + theight, textWidth, Align.bottomLeft, true);
if(!chatOpen && fadetime - i < 1f && fadetime - i >= 0f){ if(!chatOpen && fadetime - i < 1f && fadetime - i >= 0f){
font.getCache().setAlphas(fadetime - i); font.getCache().setAlphas((fadetime - i) * opacity);
Draw.color(0, 0, 0, shadowColor.a * (fadetime - i)); Draw.color(0, 0, 0, shadowColor.a * (fadetime - i) * opacity);
}else{
font.getCache().setAlphas(opacity);
} }
Fill.crect(offsetx, theight - layout.height - 2, textWidth + Unit.dp.scl(4f), layout.height + textspacing); Fill.crect(offsetx, theight - layout.height - 2, textWidth + Unit.dp.scl(4f), layout.height + textspacing);
Draw.color(shadowColor); Draw.color(shadowColor);
Draw.alpha(opacity * shadowColor.a);
font.getCache().draw(); font.getCache().draw();
} }

View File

@@ -70,8 +70,8 @@ public class LaserTurret extends PowerTurret{
Liquid liquid = entity.liquids.current(); Liquid liquid = entity.liquids.current();
float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount; float maxUsed = consumes.<ConsumeLiquidBase>get(ConsumeType.liquid).amount;
float used = Math.min(Math.min(entity.liquids.get(liquid), maxUsed * Time.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / liquid.heatCapacity)); float used = Math.min(entity.liquids.get(liquid), maxUsed * Time.delta());
entity.reload += (used * liquid.heatCapacity) / liquid.heatCapacity; entity.reload += used;
entity.liquids.remove(liquid, used); entity.liquids.remove(liquid, used);
if(Mathf.chance(0.06 * used)){ if(Mathf.chance(0.06 * used)){

View File

@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.sandbox;
import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote; import io.anuke.annotations.Annotations.Remote;
import io.anuke.arc.Core;
import io.anuke.arc.collection.Array; import io.anuke.arc.collection.Array;
import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.scene.style.TextureRegionDrawable; import io.anuke.arc.scene.style.TextureRegionDrawable;
@@ -22,6 +23,7 @@ import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.control; import static io.anuke.mindustry.Vars.control;
public class LiquidSource extends Block{ public class LiquidSource extends Block{
private static Liquid lastLiquid;
public LiquidSource(String name){ public LiquidSource(String name){
super(name); super(name);
@@ -33,6 +35,11 @@ public class LiquidSource extends Block{
outputsLiquid = true; outputsLiquid = true;
} }
@Override
public void playerPlaced(Tile tile){
if(lastLiquid != null) Core.app.post(() -> Call.setLiquidSourceLiquid(null, tile, lastLiquid));
}
@Override @Override
public void setBars(){ public void setBars(){
super.setBars(); super.setBars();
@@ -73,6 +80,7 @@ public class LiquidSource extends Block{
ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, () -> { ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, () -> {
Call.setLiquidSourceLiquid(null, tile, items.get(f)); Call.setLiquidSourceLiquid(null, tile, items.get(f));
control.input().frag.config.hideConfig(); control.input().frag.config.hideConfig();
lastLiquid = items.get(f);
}).size(38).group(group).get(); }).size(38).group(group).get();
button.getStyle().imageUp = new TextureRegionDrawable(items.get(i).iconRegion); button.getStyle().imageUp = new TextureRegionDrawable(items.get(i).iconRegion);
button.setChecked(entity.source.id == f); button.setChecked(entity.source.id == f);

View File

@@ -172,11 +172,12 @@ public class CoreBlock extends StorageBlock{
float heat; float heat;
@Override @Override
public void updateSpawning(Player unit){ public void updateSpawning(Player player){
if(!netServer.isWaitingForPlayers() && currentUnit == null){ if(!netServer.isWaitingForPlayers() && currentUnit == null){
currentUnit = unit; currentUnit = player;
progress = 0f; progress = 0f;
unit.set(tile.drawx(), tile.drawy()); player.mech = player.getStarterMech();
player.set(tile.drawx(), tile.drawy());
} }
} }
} }

View File

@@ -11,7 +11,6 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.Fx; import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.content.Mechs; import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.entities.Effects; import io.anuke.mindustry.entities.Effects;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.traits.SpawnerTrait; import io.anuke.mindustry.entities.traits.SpawnerTrait;
import io.anuke.mindustry.entities.type.Player; import io.anuke.mindustry.entities.type.Player;
import io.anuke.mindustry.entities.type.TileEntity; import io.anuke.mindustry.entities.type.TileEntity;
@@ -39,7 +38,7 @@ public class MechPad extends Block{
public MechPad(String name){ public MechPad(String name){
super(name); super(name);
update = true; update = true;
solidifes = true; solid = false;
hasPower = true; hasPower = true;
} }
@@ -99,7 +98,6 @@ public class MechPad extends Block{
entity.progress = 0; entity.progress = 0;
entity.player.heal(); entity.player.heal();
entity.player.endRespawning(); entity.player.endRespawning();
entity.open = true;
entity.player.setDead(false); entity.player.setDead(false);
entity.player.clearItem(); entity.player.clearItem();
entity.player = null; entity.player = null;
@@ -121,18 +119,13 @@ public class MechPad extends Block{
Draw.color(); Draw.color();
} }
@Override
public boolean isSolidFor(Tile tile){
MechFactoryEntity entity = tile.entity();
return !entity.open;
}
@Override @Override
public void tapped(Tile tile, Player player){ public void tapped(Tile tile, Player player){
MechFactoryEntity entity = tile.entity();
if(checkValidTap(tile, player)){ if(checkValidTap(tile, player)){
Call.onMechFactoryTap(player, tile); Call.onMechFactoryTap(player, tile);
}else if(player.isLocal && mobile && !player.isDead()){ }else if(player.isLocal && mobile && !player.isDead() && entity.cons.valid() && entity.player == null){
player.moveTarget = tile.entity; player.moveTarget = tile.entity;
} }
} }
@@ -147,7 +140,7 @@ public class MechPad extends Block{
public void draw(Tile tile){ public void draw(Tile tile){
MechFactoryEntity entity = tile.entity(); MechFactoryEntity entity = tile.entity();
Draw.rect(Core.atlas.find(name), tile.drawx(), tile.drawy(), entity.open ? 180f : 0f); Draw.rect(Core.atlas.find(name), tile.drawx(), tile.drawy());
if(entity.player != null){ if(entity.player != null){
TextureRegion region = mech.iconRegion; TextureRegion region = mech.iconRegion;
@@ -181,14 +174,6 @@ public class MechPad extends Block{
public void update(Tile tile){ public void update(Tile tile){
MechFactoryEntity entity = tile.entity(); MechFactoryEntity entity = tile.entity();
if(entity.open){
if(!Units.anyEntities(tile)){
entity.open = false;
}else{
entity.heat = Mathf.lerpDelta(entity.heat, 0f, 0.1f);
}
}
if(entity.player != null){ if(entity.player != null){
entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.1f); entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.1f);
entity.progress += 1f / buildTime * entity.delta(); entity.progress += 1f / buildTime * entity.delta();
@@ -199,10 +184,6 @@ public class MechPad extends Block{
Call.onMechFactoryDone(tile); Call.onMechFactoryDone(tile);
} }
}else{ }else{
if(entity.cons.valid() && Units.anyEntities(tile, 4f, unit -> unit.getTeam() == entity.getTeam() && unit instanceof Player)){
entity.open = true;
}
entity.heat = Mathf.lerpDelta(entity.heat, 0f, 0.1f); entity.heat = Mathf.lerpDelta(entity.heat, 0f, 0.1f);
} }
} }
@@ -217,7 +198,6 @@ public class MechPad extends Block{
float progress; float progress;
float time; float time;
float heat; float heat;
boolean open;
@Override @Override
public void updateSpawning(Player unit){ public void updateSpawning(Player unit){