Coal centrifuge / In-game chat / Player health rule / Bugfixes
This commit is contained in:
@@ -40,7 +40,7 @@ public class Blocks implements ContentList{
|
||||
|
||||
//crafting
|
||||
siliconSmelter, kiln, graphitePress, plastaniumCompressor, multiPress, phaseWeaver, surgeSmelter, pyratiteMixer, blastMixer, cryofluidMixer,
|
||||
melter, separator, sporePress, pulverizer, incinerator,
|
||||
melter, separator, sporePress, pulverizer, incinerator, coalCentrifuge,
|
||||
|
||||
//sandbox
|
||||
powerVoid, powerSource, itemSource, liquidSource, itemVoid,
|
||||
@@ -593,10 +593,10 @@ public class Blocks implements ContentList{
|
||||
separator = new Separator("separator"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.copper, 60, Items.titanium, 50));
|
||||
results = ItemStack.with(
|
||||
Items.copper, 5,
|
||||
Items.lead, 3,
|
||||
Items.graphite, 2,
|
||||
Items.titanium, 2
|
||||
Items.copper, 5,
|
||||
Items.lead, 3,
|
||||
Items.graphite, 2,
|
||||
Items.titanium, 2
|
||||
);
|
||||
hasPower = true;
|
||||
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"){{
|
||||
requirements(Category.crafting, ItemStack.with(Items.graphite, 10, Items.lead, 30));
|
||||
health = 90;
|
||||
@@ -1244,10 +1256,10 @@ public class Blocks implements ContentList{
|
||||
duo = new DoubleTurret("duo"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 70), true);
|
||||
ammo(
|
||||
Items.copper, Bullets.standardCopper,
|
||||
Items.graphite, Bullets.standardDense,
|
||||
Items.pyratite, Bullets.standardIncendiary,
|
||||
Items.silicon, Bullets.standardHoming
|
||||
Items.copper, Bullets.standardCopper,
|
||||
Items.graphite, Bullets.standardDense,
|
||||
Items.pyratite, Bullets.standardIncendiary,
|
||||
Items.silicon, Bullets.standardHoming
|
||||
);
|
||||
reload = 20f;
|
||||
restitution = 0.03f;
|
||||
@@ -1262,8 +1274,8 @@ public class Blocks implements ContentList{
|
||||
scatter = new BurstTurret("scatter"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 170, Items.lead, 90));
|
||||
ammo(
|
||||
Items.scrap, Bullets.flakScrap,
|
||||
Items.lead, Bullets.flakLead
|
||||
Items.scrap, Bullets.flakScrap,
|
||||
Items.lead, Bullets.flakLead
|
||||
);
|
||||
reload = 15f;
|
||||
range = 180f;
|
||||
@@ -1283,8 +1295,8 @@ public class Blocks implements ContentList{
|
||||
scorch = new ItemTurret("scorch"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 50, Items.graphite, 45));
|
||||
ammo(
|
||||
Items.coal, Bullets.basicFlame,
|
||||
Items.pyratite, Bullets.pyraFlame
|
||||
Items.coal, Bullets.basicFlame,
|
||||
Items.pyratite, Bullets.pyraFlame
|
||||
);
|
||||
recoil = 0f;
|
||||
reload = 4f;
|
||||
@@ -1298,9 +1310,9 @@ public class Blocks implements ContentList{
|
||||
hail = new ArtilleryTurret("hail"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 80, Items.graphite, 35));
|
||||
ammo(
|
||||
Items.graphite, Bullets.artilleryDense,
|
||||
Items.silicon, Bullets.artilleryHoming,
|
||||
Items.pyratite, Bullets.artlleryIncendiary
|
||||
Items.graphite, Bullets.artilleryDense,
|
||||
Items.silicon, Bullets.artilleryHoming,
|
||||
Items.pyratite, Bullets.artlleryIncendiary
|
||||
);
|
||||
reload = 60f;
|
||||
recoil = 2f;
|
||||
@@ -1313,10 +1325,10 @@ public class Blocks implements ContentList{
|
||||
wave = new LiquidTurret("wave"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.metaglass, 90, Items.lead, 150));
|
||||
ammo(
|
||||
Liquids.water, Bullets.waterShot,
|
||||
Liquids.slag, Bullets.slagShot,
|
||||
Liquids.cryofluid, Bullets.cryoShot,
|
||||
Liquids.oil, Bullets.oilShot
|
||||
Liquids.water, Bullets.waterShot,
|
||||
Liquids.slag, Bullets.slagShot,
|
||||
Liquids.cryofluid, Bullets.cryoShot,
|
||||
Liquids.oil, Bullets.oilShot
|
||||
);
|
||||
size = 2;
|
||||
recoil = 0f;
|
||||
@@ -1380,9 +1392,9 @@ public class Blocks implements ContentList{
|
||||
swarmer = new BurstTurret("swarmer"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.graphite, 70, Items.titanium, 70, Items.plastanium, 90, Items.silicon, 60));
|
||||
ammo(
|
||||
Items.blastCompound, Bullets.missileExplosive,
|
||||
Items.pyratite, Bullets.missileIncendiary,
|
||||
Items.surgealloy, Bullets.missileSurge
|
||||
Items.blastCompound, Bullets.missileExplosive,
|
||||
Items.pyratite, Bullets.missileIncendiary,
|
||||
Items.surgealloy, Bullets.missileSurge
|
||||
);
|
||||
reload = 50f;
|
||||
shots = 4;
|
||||
@@ -1397,11 +1409,11 @@ public class Blocks implements ContentList{
|
||||
salvo = new BurstTurret("salvo"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 210, Items.graphite, 190, Items.titanium, 120));
|
||||
ammo(
|
||||
Items.copper, Bullets.standardCopper,
|
||||
Items.graphite, Bullets.standardDense,
|
||||
Items.pyratite, Bullets.standardIncendiary,
|
||||
Items.silicon, Bullets.standardHoming,
|
||||
Items.thorium, Bullets.standardThorium
|
||||
Items.copper, Bullets.standardCopper,
|
||||
Items.graphite, Bullets.standardDense,
|
||||
Items.pyratite, Bullets.standardIncendiary,
|
||||
Items.silicon, Bullets.standardHoming,
|
||||
Items.thorium, Bullets.standardThorium
|
||||
);
|
||||
|
||||
size = 2;
|
||||
@@ -1421,11 +1433,11 @@ public class Blocks implements ContentList{
|
||||
ripple = new ArtilleryTurret("ripple"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 300, Items.graphite, 270, Items.titanium, 120));
|
||||
ammo(
|
||||
Items.graphite, Bullets.artilleryDense,
|
||||
Items.silicon, Bullets.artilleryHoming,
|
||||
Items.pyratite, Bullets.artlleryIncendiary,
|
||||
Items.blastCompound, Bullets.artilleryExplosive,
|
||||
Items.plastanium, Bullets.arilleryPlastic
|
||||
Items.graphite, Bullets.artilleryDense,
|
||||
Items.silicon, Bullets.artilleryHoming,
|
||||
Items.pyratite, Bullets.artlleryIncendiary,
|
||||
Items.blastCompound, Bullets.artilleryExplosive,
|
||||
Items.plastanium, Bullets.arilleryPlastic
|
||||
);
|
||||
size = 3;
|
||||
shots = 4;
|
||||
@@ -1446,9 +1458,9 @@ public class Blocks implements ContentList{
|
||||
cyclone = new ItemTurret("cyclone"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 400, Items.titanium, 250, Items.plastanium, 160));
|
||||
ammo(
|
||||
Items.blastCompound, Bullets.flakExplosive,
|
||||
Items.plastanium, Bullets.flakPlastic,
|
||||
Items.surgealloy, Bullets.flakSurge
|
||||
Items.blastCompound, Bullets.flakExplosive,
|
||||
Items.plastanium, Bullets.flakPlastic,
|
||||
Items.surgealloy, Bullets.flakSurge
|
||||
);
|
||||
xRand = 4f;
|
||||
reload = 6f;
|
||||
@@ -1478,9 +1490,9 @@ public class Blocks implements ContentList{
|
||||
spectre = new DoubleTurret("spectre"){{
|
||||
requirements(Category.turret, ItemStack.with(Items.copper, 700, Items.graphite, 600, Items.surgealloy, 500, Items.plastanium, 350, Items.thorium, 500));
|
||||
ammo(
|
||||
Items.graphite, Bullets.standardDenseBig,
|
||||
Items.pyratite, Bullets.standardIncendiaryBig,
|
||||
Items.thorium, Bullets.standardThoriumBig
|
||||
Items.graphite, Bullets.standardDenseBig,
|
||||
Items.pyratite, Bullets.standardIncendiaryBig,
|
||||
Items.thorium, Bullets.standardThoriumBig
|
||||
);
|
||||
reload = 6f;
|
||||
coolantMultiplier = 0.5f;
|
||||
|
||||
@@ -80,7 +80,7 @@ public class Mechs implements ContentList{
|
||||
reload = 40f;
|
||||
shotDelay = 3f;
|
||||
roundrobin = true;
|
||||
shots = 3;
|
||||
shots = 2;
|
||||
inaccuracy = 0f;
|
||||
ejectEffect = Fx.none;
|
||||
bullet = Bullets.lightning;
|
||||
|
||||
@@ -137,6 +137,9 @@ public class TechTree implements ContentList{
|
||||
node(siliconSmelter, () -> {
|
||||
|
||||
node(sporePress, () -> {
|
||||
node(coalCentrifuge, () -> {
|
||||
|
||||
});
|
||||
node(multiPress, () -> {
|
||||
|
||||
});
|
||||
|
||||
@@ -2,13 +2,17 @@ package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.game.ContentList;
|
||||
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.Decoration;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
|
||||
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;
|
||||
|
||||
@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))){{
|
||||
startingItems = ItemStack.list(Items.copper, 200);
|
||||
conditionWave = 10;
|
||||
|
||||
@@ -117,10 +117,15 @@ public class NetClient implements ApplicationListener{
|
||||
|
||||
//called on all clients
|
||||
@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){
|
||||
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
|
||||
@@ -143,7 +148,7 @@ public class NetClient implements ApplicationListener{
|
||||
|
||||
//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
|
||||
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){
|
||||
|
||||
@@ -61,6 +61,9 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
public TargetTrait target;
|
||||
public TargetTrait moveTarget;
|
||||
|
||||
public String lastText;
|
||||
public float textFadeTime;
|
||||
|
||||
private float walktime;
|
||||
private Queue<BuildRequest> placeQueue = new Queue<>();
|
||||
private Tile mining;
|
||||
@@ -172,7 +175,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
|
||||
@Override
|
||||
public float maxHealth(){
|
||||
return mech.health;
|
||||
return mech.health * state.rules.playerHealthMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -376,24 +379,41 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
public void drawName(){
|
||||
BitmapFont font = Core.scene.skin.getFont("default-font");
|
||||
GlyphLayout layout = Pools.obtain(GlyphLayout.class, GlyphLayout::new);
|
||||
final float nameHeight = 11;
|
||||
final float textHeight = 15;
|
||||
|
||||
boolean ints = font.usesIntegerPositions();
|
||||
font.setUseIntegerPositions(false);
|
||||
font.getData().setScale(0.25f / io.anuke.arc.scene.ui.layout.Unit.dp.scl(1f));
|
||||
layout.setText(font, name);
|
||||
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();
|
||||
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){
|
||||
float s = 3f;
|
||||
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.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();
|
||||
@@ -546,6 +566,8 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
updateMech();
|
||||
}
|
||||
|
||||
isTyping = ui.chatfrag.chatOpen();
|
||||
|
||||
updateBuilding();
|
||||
|
||||
if(!mech.flying){
|
||||
@@ -754,10 +776,14 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
spawner = lastSpawner = null;
|
||||
health = maxHealth();
|
||||
boostHeat = drownTime = hitTime = 0f;
|
||||
mech = (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
mech = getStarterMech();
|
||||
placeQueue.clear();
|
||||
}
|
||||
|
||||
public Mech getStarterMech(){
|
||||
return (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
}
|
||||
|
||||
public boolean isShooting(){
|
||||
return isShooting && (!isBoosting || mech.flying);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ public enum RulePreset{
|
||||
respawnTime = 60 * 10;
|
||||
buildCostMultiplier = 0.5f;
|
||||
buildSpeedMultiplier = 2f;
|
||||
playerDamageMultiplier = 0.5f;
|
||||
playerDamageMultiplier = 0.45f;
|
||||
playerHealthMultiplier = 0.8f;
|
||||
unitBuildSpeedMultiplier = 3f;
|
||||
unitHealthMultiplier = 2f;
|
||||
}});
|
||||
|
||||
@@ -25,6 +25,8 @@ public class Rules{
|
||||
public float unitBuildSpeedMultiplier = 1f;
|
||||
/** How much health units start with. */
|
||||
public float unitHealthMultiplier = 1f;
|
||||
/** How much health players start with. */
|
||||
public float playerHealthMultiplier = 1f;
|
||||
/** How much damage player mechs deal. */
|
||||
public float playerDamageMultiplier = 1f;
|
||||
/** How much damage any other units deal. */
|
||||
|
||||
@@ -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){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import io.anuke.mindustry.game.EventType.ZoneRequireCompleteEvent;
|
||||
import io.anuke.mindustry.game.Rules;
|
||||
import io.anuke.mindustry.game.UnlockableContent;
|
||||
import io.anuke.mindustry.maps.generators.Generator;
|
||||
import io.anuke.mindustry.maps.generators.MapGenerator;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -38,7 +37,7 @@ public class Zone extends UnlockableContent{
|
||||
protected Array<ItemStack> startingItems = new Array<>();
|
||||
protected ItemStack[] launchCost = null;
|
||||
|
||||
public Zone(String name, MapGenerator generator){
|
||||
public Zone(String name, Generator generator){
|
||||
super(name);
|
||||
this.generator = generator;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public class CustomRulesDialog extends FloatingDialog{
|
||||
number("$rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
|
||||
number("$rules.unitbuildspeedmultiplier", f -> rules.unitBuildSpeedMultiplier = f, () -> rules.unitBuildSpeedMultiplier);
|
||||
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.unitdamagemultiplier", f -> rules.unitDamageMultiplier = f, () -> rules.unitDamageMultiplier);
|
||||
number("$rules.enemycorebuildradius", f -> rules.enemyCoreBuildRadius = f * tilesize, () -> Math.min(rules.enemyCoreBuildRadius / tilesize, 200));
|
||||
|
||||
@@ -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("chatopacity", 100, 0, 100, 5, s -> s + "%");
|
||||
|
||||
|
||||
if(!mobile){
|
||||
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("fps", false);
|
||||
graphics.checkPref("indicators", true);
|
||||
|
||||
@@ -123,6 +123,7 @@ public class ChatFragment extends Table{
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
float opacity = Core.settings.getInt("chatopacity") / 100f;
|
||||
|
||||
Draw.color(shadowColor);
|
||||
|
||||
@@ -138,6 +139,7 @@ public class ChatFragment extends Table{
|
||||
fieldlabel.visible(chatOpen);
|
||||
|
||||
Draw.color(shadowColor);
|
||||
Draw.alpha(shadowColor.a * opacity);
|
||||
|
||||
float theight = offsety + spacing + getMarginBottom();
|
||||
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);
|
||||
|
||||
if(!chatOpen && fadetime - i < 1f && fadetime - i >= 0f){
|
||||
font.getCache().setAlphas(fadetime - i);
|
||||
Draw.color(0, 0, 0, shadowColor.a * (fadetime - i));
|
||||
font.getCache().setAlphas((fadetime - i) * opacity);
|
||||
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);
|
||||
Draw.color(shadowColor);
|
||||
Draw.alpha(opacity * shadowColor.a);
|
||||
|
||||
font.getCache().draw();
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ public class LaserTurret extends PowerTurret{
|
||||
Liquid liquid = entity.liquids.current();
|
||||
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));
|
||||
entity.reload += (used * liquid.heatCapacity) / liquid.heatCapacity;
|
||||
float used = Math.min(entity.liquids.get(liquid), maxUsed * Time.delta());
|
||||
entity.reload += used;
|
||||
entity.liquids.remove(liquid, used);
|
||||
|
||||
if(Mathf.chance(0.06 * used)){
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.sandbox;
|
||||
|
||||
import io.anuke.annotations.Annotations.Loc;
|
||||
import io.anuke.annotations.Annotations.Remote;
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
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;
|
||||
|
||||
public class LiquidSource extends Block{
|
||||
private static Liquid lastLiquid;
|
||||
|
||||
public LiquidSource(String name){
|
||||
super(name);
|
||||
@@ -33,6 +35,11 @@ public class LiquidSource extends Block{
|
||||
outputsLiquid = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerPlaced(Tile tile){
|
||||
if(lastLiquid != null) Core.app.post(() -> Call.setLiquidSourceLiquid(null, tile, lastLiquid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBars(){
|
||||
super.setBars();
|
||||
@@ -73,6 +80,7 @@ public class LiquidSource extends Block{
|
||||
ImageButton button = cont.addImageButton("clear", "clear-toggle", 24, () -> {
|
||||
Call.setLiquidSourceLiquid(null, tile, items.get(f));
|
||||
control.input().frag.config.hideConfig();
|
||||
lastLiquid = items.get(f);
|
||||
}).size(38).group(group).get();
|
||||
button.getStyle().imageUp = new TextureRegionDrawable(items.get(i).iconRegion);
|
||||
button.setChecked(entity.source.id == f);
|
||||
|
||||
@@ -172,11 +172,12 @@ public class CoreBlock extends StorageBlock{
|
||||
float heat;
|
||||
|
||||
@Override
|
||||
public void updateSpawning(Player unit){
|
||||
public void updateSpawning(Player player){
|
||||
if(!netServer.isWaitingForPlayers() && currentUnit == null){
|
||||
currentUnit = unit;
|
||||
currentUnit = player;
|
||||
progress = 0f;
|
||||
unit.set(tile.drawx(), tile.drawy());
|
||||
player.mech = player.getStarterMech();
|
||||
player.set(tile.drawx(), tile.drawy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Fx;
|
||||
import io.anuke.mindustry.content.Mechs;
|
||||
import io.anuke.mindustry.entities.Effects;
|
||||
import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.traits.SpawnerTrait;
|
||||
import io.anuke.mindustry.entities.type.Player;
|
||||
import io.anuke.mindustry.entities.type.TileEntity;
|
||||
@@ -39,7 +38,7 @@ public class MechPad extends Block{
|
||||
public MechPad(String name){
|
||||
super(name);
|
||||
update = true;
|
||||
solidifes = true;
|
||||
solid = false;
|
||||
hasPower = true;
|
||||
}
|
||||
|
||||
@@ -99,7 +98,6 @@ public class MechPad extends Block{
|
||||
entity.progress = 0;
|
||||
entity.player.heal();
|
||||
entity.player.endRespawning();
|
||||
entity.open = true;
|
||||
entity.player.setDead(false);
|
||||
entity.player.clearItem();
|
||||
entity.player = null;
|
||||
@@ -121,18 +119,13 @@ public class MechPad extends Block{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidFor(Tile tile){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
return !entity.open;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tapped(Tile tile, Player player){
|
||||
MechFactoryEntity entity = tile.entity();
|
||||
|
||||
if(checkValidTap(tile, player)){
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -147,7 +140,7 @@ public class MechPad extends Block{
|
||||
public void draw(Tile tile){
|
||||
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){
|
||||
TextureRegion region = mech.iconRegion;
|
||||
@@ -181,14 +174,6 @@ public class MechPad extends Block{
|
||||
public void update(Tile tile){
|
||||
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){
|
||||
entity.heat = Mathf.lerpDelta(entity.heat, 1f, 0.1f);
|
||||
entity.progress += 1f / buildTime * entity.delta();
|
||||
@@ -199,10 +184,6 @@ public class MechPad extends Block{
|
||||
Call.onMechFactoryDone(tile);
|
||||
}
|
||||
}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);
|
||||
}
|
||||
}
|
||||
@@ -217,7 +198,6 @@ public class MechPad extends Block{
|
||||
float progress;
|
||||
float time;
|
||||
float heat;
|
||||
boolean open;
|
||||
|
||||
@Override
|
||||
public void updateSpawning(Player unit){
|
||||
|
||||
Reference in New Issue
Block a user