Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bf7031e6a | ||
|
|
503fc980f4 | ||
|
|
efed11eb97 | ||
|
|
330820062f | ||
|
|
45d157fe3f |
@@ -200,6 +200,7 @@ project(":core"){
|
|||||||
|
|
||||||
compile arcModule("arc-core")
|
compile arcModule("arc-core")
|
||||||
compile arcModule("extensions:freetype")
|
compile arcModule("extensions:freetype")
|
||||||
|
//compile arcModule("extensions:postprocessing")
|
||||||
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
if(localArc() && debugged()) compile arcModule("extensions:recorder")
|
||||||
|
|
||||||
compileOnly project(":annotations")
|
compileOnly project(":annotations")
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ setting.borderless.name = Borderless Window
|
|||||||
setting.fps.name = Show FPS
|
setting.fps.name = Show FPS
|
||||||
setting.vsync.name = VSync
|
setting.vsync.name = VSync
|
||||||
setting.lasers.name = Show Power Lasers
|
setting.lasers.name = Show Power Lasers
|
||||||
setting.pixelate.name = Pixelate [LIGHT_GRAY](may decrease performance)
|
setting.pixelate.name = Pixelate [LIGHT_GRAY](may decrease performance, disables animations)
|
||||||
setting.minimap.name = Show Minimap
|
setting.minimap.name = Show Minimap
|
||||||
setting.musicvol.name = Music Volume
|
setting.musicvol.name = Music Volume
|
||||||
setting.mutemusic.name = Mute Music
|
setting.mutemusic.name = Mute Music
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ editor.description = Description:
|
|||||||
editor.waves = Vagues:
|
editor.waves = Vagues:
|
||||||
waves.title = Vagues
|
waves.title = Vagues
|
||||||
waves.remove = Remove
|
waves.remove = Remove
|
||||||
waves.never = <jamais>
|
waves.never = jamais
|
||||||
waves.every = tous les
|
waves.every = tous les
|
||||||
waves.waves = vague(s)
|
waves.waves = vague(s)
|
||||||
waves.perspawn = par apparition
|
waves.perspawn = par apparition
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 506 B After Width: | Height: | Size: 505 B |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 277 KiB After Width: | Height: | Size: 283 KiB |
|
Before Width: | Height: | Size: 542 KiB After Width: | Height: | Size: 535 KiB |
@@ -517,10 +517,10 @@ public class Blocks implements ContentList{
|
|||||||
consumes.items(new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3));
|
consumes.items(new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cryofluidMixer = new GenericCrafter("cryofluidmixer"){{
|
cryofluidMixer = new LiquidConverter("cryofluidmixer"){{
|
||||||
requirements(Category.crafting, ItemStack.with(Items.lead, 130, Items.silicon, 80, Items.thorium, 90));
|
requirements(Category.crafting, ItemStack.with(Items.lead, 130, Items.silicon, 80, Items.thorium, 90));
|
||||||
outputLiquid = new LiquidStack(Liquids.cryofluid, 0.6f);
|
outputLiquid = new LiquidStack(Liquids.cryofluid, 0.1f);
|
||||||
craftTime = 5f;
|
craftTime = 60f;
|
||||||
size = 2;
|
size = 2;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
@@ -531,7 +531,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
consumes.power(1f);
|
consumes.power(1f);
|
||||||
consumes.item(Items.titanium);
|
consumes.item(Items.titanium);
|
||||||
consumes.liquid(Liquids.water, 0.6f);
|
consumes.liquid(Liquids.water, 0.1f);
|
||||||
|
|
||||||
int liquidRegion = reg("-liquid"), topRegion = reg("-top"), bottomRegion = reg("-bottom");
|
int liquidRegion = reg("-liquid"), topRegion = reg("-top"), bottomRegion = reg("-bottom");
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ public class Blocks implements ContentList{
|
|||||||
requirements(Category.crafting, ItemStack.with(Items.lead, 70, Items.silicon, 60));
|
requirements(Category.crafting, ItemStack.with(Items.lead, 70, Items.silicon, 60));
|
||||||
liquidCapacity = 60f;
|
liquidCapacity = 60f;
|
||||||
craftTime = 20f;
|
craftTime = 20f;
|
||||||
outputLiquid = new LiquidStack(Liquids.oil, 4f);
|
outputLiquid = new LiquidStack(Liquids.oil, 6f);
|
||||||
size = 2;
|
size = 2;
|
||||||
health = 320;
|
health = 320;
|
||||||
hasLiquids = true;
|
hasLiquids = true;
|
||||||
@@ -1080,7 +1080,8 @@ public class Blocks implements ContentList{
|
|||||||
health = 700;
|
health = 700;
|
||||||
powerProduction = 14f;
|
powerProduction = 14f;
|
||||||
consumes.item(Items.thorium);
|
consumes.item(Items.thorium);
|
||||||
consumes.liquid(Liquids.cryofluid, 0.1f);
|
heating = 0.02f;
|
||||||
|
consumes.liquid(Liquids.cryofluid, 0.1f).update(false);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
impactReactor = new ImpactReactor("impact-reactor"){{
|
impactReactor = new ImpactReactor("impact-reactor"){{
|
||||||
@@ -1450,12 +1451,12 @@ public class Blocks implements ContentList{
|
|||||||
Items.surgealloy, Bullets.flakSurge
|
Items.surgealloy, Bullets.flakSurge
|
||||||
);
|
);
|
||||||
xRand = 4f;
|
xRand = 4f;
|
||||||
reload = 7f;
|
reload = 6f;
|
||||||
range = 170f;
|
range = 200f;
|
||||||
size = 3;
|
size = 3;
|
||||||
recoil = 3f;
|
recoil = 3f;
|
||||||
rotatespeed = 10f;
|
rotatespeed = 10f;
|
||||||
inaccuracy = 13f;
|
inaccuracy = 10f;
|
||||||
shootCone = 30f;
|
shootCone = 30f;
|
||||||
|
|
||||||
health = 145 * size * size;
|
health = 145 * size * size;
|
||||||
@@ -1510,8 +1511,8 @@ public class Blocks implements ContentList{
|
|||||||
powerUsed = 0.5f;
|
powerUsed = 0.5f;
|
||||||
consumes.powerBuffered(1200f);
|
consumes.powerBuffered(1200f);
|
||||||
range = 190f;
|
range = 190f;
|
||||||
reload = 170f;
|
reload = 50f;
|
||||||
firingMoveFract = 0.2f;
|
firingMoveFract = 0.5f;
|
||||||
shootDuration = 220f;
|
shootDuration = 220f;
|
||||||
|
|
||||||
health = 200 * size * size;
|
health = 200 * size * size;
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ public class Bullets implements ContentList{
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
meltdownLaser = new BulletType(0.001f, 50){
|
meltdownLaser = new BulletType(0.001f, 70){
|
||||||
Color tmpColor = new Color();
|
Color tmpColor = new Color();
|
||||||
Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
|
Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
|
||||||
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
||||||
@@ -626,7 +626,6 @@ public class Bullets implements ContentList{
|
|||||||
|
|
||||||
slagShot = new LiquidBulletType(Liquids.slag){{
|
slagShot = new LiquidBulletType(Liquids.slag){{
|
||||||
damage = 4;
|
damage = 4;
|
||||||
speed = 1.9f;
|
|
||||||
drag = 0.03f;
|
drag = 0.03f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -644,6 +643,8 @@ public class Bullets implements ContentList{
|
|||||||
lightning = new BulletType(0.001f, 12f){
|
lightning = new BulletType(0.001f, 12f){
|
||||||
{
|
{
|
||||||
lifetime = 1f;
|
lifetime = 1f;
|
||||||
|
shootEffect = Fx.hitLancer;
|
||||||
|
smokeEffect = Fx.none;
|
||||||
despawnEffect = Fx.none;
|
despawnEffect = Fx.none;
|
||||||
hitEffect = Fx.hitLancer;
|
hitEffect = Fx.hitLancer;
|
||||||
keepVelocity = false;
|
keepVelocity = false;
|
||||||
|
|||||||
@@ -75,10 +75,12 @@ public class Mechs implements ContentList{
|
|||||||
engineColor = Color.valueOf("d3ddff");
|
engineColor = Color.valueOf("d3ddff");
|
||||||
|
|
||||||
weapon = new Weapon("shockgun"){{
|
weapon = new Weapon("shockgun"){{
|
||||||
|
shake = 2f;
|
||||||
length = 1f;
|
length = 1f;
|
||||||
reload = 40f;
|
reload = 40f;
|
||||||
|
shotDelay = 3f;
|
||||||
roundrobin = true;
|
roundrobin = true;
|
||||||
shots = 1;
|
shots = 3;
|
||||||
inaccuracy = 0f;
|
inaccuracy = 0f;
|
||||||
velocityRnd = 0.2f;
|
velocityRnd = 0.2f;
|
||||||
ejectEffect = Fx.none;
|
ejectEffect = Fx.none;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.anuke.arc.graphics.GL20;
|
|||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.g2d.TextureAtlas;
|
import io.anuke.arc.graphics.g2d.TextureAtlas;
|
||||||
import io.anuke.arc.input.KeyCode;
|
import io.anuke.arc.input.KeyCode;
|
||||||
|
import io.anuke.arc.scene.ui.Dialog;
|
||||||
import io.anuke.arc.scene.ui.TextField;
|
import io.anuke.arc.scene.ui.TextField;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.mindustry.content.Mechs;
|
import io.anuke.mindustry.content.Mechs;
|
||||||
@@ -308,7 +309,7 @@ public class Control implements ApplicationListener{
|
|||||||
Time.update();
|
Time.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!scene.hasDialog() && Core.input.keyTap(KeyCode.BACK)){
|
if(!scene.hasDialog() && !(scene.root.getChildren().peek() instanceof Dialog) &&Core.input.keyTap(KeyCode.BACK)){
|
||||||
Platform.instance.hide();
|
Platform.instance.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public class NetServer implements ApplicationListener{
|
|||||||
|
|
||||||
//playing in pvp mode automatically assigns players to teams
|
//playing in pvp mode automatically assigns players to teams
|
||||||
if(state.rules.pvp){
|
if(state.rules.pvp){
|
||||||
player.setTeam(assignTeam());
|
player.setTeam(assignTeam(playerGroup.all()));
|
||||||
Log.info("Auto-assigned player {0} to team {1}.", player.name, player.getTeam());
|
Log.info("Auto-assigned player {0} to team {1}.", player.name, player.getTeam());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,12 +208,12 @@ public class NetServer implements ApplicationListener{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Team assignTeam(){
|
public Team assignTeam(Iterable<Player> players){
|
||||||
//find team with minimum amount of players and auto-assign player to that.
|
//find team with minimum amount of players and auto-assign player to that.
|
||||||
return Structs.findMin(Team.all, team -> {
|
return Structs.findMin(Team.all, team -> {
|
||||||
if(state.teams.isActive(team)){
|
if(state.teams.isActive(team)){
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for(Player other : playerGroup.all()){
|
for(Player other : players){
|
||||||
if(other.getTeam() == team){
|
if(other.getTeam() == team){
|
||||||
count ++;
|
count ++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,6 +222,8 @@ public class Damage{
|
|||||||
|
|
||||||
if(scaledDamage <= 0 || tile == null) continue;
|
if(scaledDamage <= 0 || tile == null) continue;
|
||||||
|
|
||||||
|
tile = tile.target();
|
||||||
|
|
||||||
//apply damage to entity if needed
|
//apply damage to entity if needed
|
||||||
if(tile.entity != null && tile.getTeam() != team){
|
if(tile.entity != null && tile.getTeam() != team){
|
||||||
int health = (int)tile.entity.health;
|
int health = (int)tile.entity.health;
|
||||||
|
|||||||
@@ -135,10 +135,6 @@ public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Pool
|
|||||||
if(owner instanceof Unit){
|
if(owner instanceof Unit){
|
||||||
return ((Unit) owner).getDamageMultipler();
|
return ((Unit) owner).getDamageMultipler();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(owner instanceof Lightning && data instanceof Float){
|
|
||||||
return (Float)data;
|
|
||||||
}
|
|
||||||
return 1f;
|
return 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,6 +151,9 @@ public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Pool
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float damage(){
|
public float damage(){
|
||||||
|
if(owner instanceof Lightning && data instanceof Float){
|
||||||
|
return (Float)data;
|
||||||
|
}
|
||||||
return type.damage * damageMultiplier();
|
return type.damage * damageMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,16 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
|
|
||||||
unit.onSuperDeath();
|
unit.onSuperDeath();
|
||||||
|
|
||||||
|
//visual only.
|
||||||
|
if(Net.client()){
|
||||||
|
Tile tile = world.tile(unit.spawner);
|
||||||
|
if(tile != null && !Net.client()){
|
||||||
|
tile.block().unitRemoved(tile, unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
unit.spawner = noSpawner;
|
||||||
|
}
|
||||||
|
|
||||||
//must run afterwards so the unit's group is not null when sending the removal packet
|
//must run afterwards so the unit's group is not null when sending the removal packet
|
||||||
Core.app.post(unit::remove);
|
Core.app.post(unit::remove);
|
||||||
}
|
}
|
||||||
@@ -280,7 +290,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
|||||||
public void removed(){
|
public void removed(){
|
||||||
super.removed();
|
super.removed();
|
||||||
Tile tile = world.tile(spawner);
|
Tile tile = world.tile(spawner);
|
||||||
if(tile != null){
|
if(tile != null && !Net.client()){
|
||||||
tile.block().unitRemoved(tile, this);
|
tile.block().unitRemoved(tile, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -288,6 +288,10 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
|
|||||||
if(block == previous && cons != null){
|
if(block == previous && cons != null){
|
||||||
cons.update();
|
cons.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(block == previous && power != null){
|
||||||
|
power.graph.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ import io.anuke.arc.graphics.Pixmaps;
|
|||||||
import io.anuke.arc.graphics.Texture;
|
import io.anuke.arc.graphics.Texture;
|
||||||
import io.anuke.arc.graphics.g2d.Draw;
|
import io.anuke.arc.graphics.g2d.Draw;
|
||||||
import io.anuke.arc.graphics.g2d.Fill;
|
import io.anuke.arc.graphics.g2d.Fill;
|
||||||
import io.anuke.arc.graphics.g2d.ScissorStack;
|
|
||||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
import io.anuke.arc.math.Mathf;
|
import io.anuke.arc.math.Mathf;
|
||||||
import io.anuke.arc.math.geom.Rectangle;
|
import io.anuke.arc.math.geom.Rectangle;
|
||||||
import io.anuke.arc.util.Disposable;
|
import io.anuke.arc.util.Disposable;
|
||||||
import io.anuke.mindustry.entities.type.Unit;
|
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
|
import io.anuke.mindustry.entities.type.Unit;
|
||||||
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
import io.anuke.mindustry.game.EventType.TileChangeEvent;
|
||||||
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
|
||||||
import io.anuke.mindustry.io.MapIO;
|
import io.anuke.mindustry.io.MapIO;
|
||||||
@@ -49,7 +48,11 @@ public class MinimapRenderer implements Disposable{
|
|||||||
|
|
||||||
public void zoomBy(float amount){
|
public void zoomBy(float amount){
|
||||||
zoom += amount;
|
zoom += amount;
|
||||||
zoom = Mathf.clamp(zoom, 1f, Math.min(world.width(), world.height()) / baseSize / 2f);
|
setZoom(zoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoom(float amount){
|
||||||
|
zoom = Mathf.clamp(amount, 1f, Math.min(world.width(), world.height()) / baseSize / 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getZoom(){
|
public float getZoom(){
|
||||||
@@ -75,21 +78,15 @@ public class MinimapRenderer implements Disposable{
|
|||||||
dx = Mathf.clamp(dx, sz, world.width() - sz);
|
dx = Mathf.clamp(dx, sz, world.width() - sz);
|
||||||
dy = Mathf.clamp(dy, sz, world.height() - sz);
|
dy = Mathf.clamp(dy, sz, world.height() - sz);
|
||||||
|
|
||||||
if(!ScissorStack.pushScissors(scissor.set(x, y, w, h))){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
rect.set((dx - sz) * tilesize, (dy - sz) * tilesize, sz * 2 * tilesize, sz * 2 * tilesize);
|
rect.set((dx - sz) * tilesize, (dy - sz) * tilesize, sz * 2 * tilesize, sz * 2 * tilesize);
|
||||||
|
|
||||||
for(Unit unit : units){
|
for(Unit unit : units){
|
||||||
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
|
float rx = (unit.x - rect.x) / rect.width * w, ry = (unit.y - rect.y) / rect.width * h;
|
||||||
Draw.color(unit.getTeam().color);
|
Draw.color(unit.getTeam().color);
|
||||||
Fill.crect(x + rx, y + ry, w / (sz * 2), h / (sz * 2));
|
Fill.rect(x + rx, y + ry, baseSize/2f, baseSize/2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
ScissorStack.popScissors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextureRegion getRegion(){
|
public TextureRegion getRegion(){
|
||||||
|
|||||||
@@ -48,24 +48,11 @@ public class Minimap extends Container<Element>{
|
|||||||
margin(margin);
|
margin(margin);
|
||||||
|
|
||||||
addListener(new InputListener(){
|
addListener(new InputListener(){
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean scrolled(InputEvent event, float x, float y, float amountx, float amounty){
|
public boolean scrolled(InputEvent event, float x, float y, float amountx, float amounty){
|
||||||
renderer.minimap.zoomBy(amounty);
|
renderer.minimap.zoomBy(amounty);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean touchDown(InputEvent event, float x, float y, int pointer, KeyCode button){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void touchDragged(InputEvent event, float x, float y, int pointer){
|
|
||||||
if(mobile){
|
|
||||||
renderer.minimap.zoomBy(Core.input.deltaY(pointer) / 12f / Unit.dp.scl(1f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
addListener(new ClickListener(){
|
addListener(new ClickListener(){
|
||||||
@@ -91,6 +78,11 @@ public class Minimap extends Container<Element>{
|
|||||||
invalidateTapSquare();
|
invalidateTapSquare();
|
||||||
}
|
}
|
||||||
super.touchDragged(event, x, y, pointer);
|
super.touchDragged(event, x, y, pointer);
|
||||||
|
|
||||||
|
if(mobile){
|
||||||
|
float max = Math.min(world.width(), world.height()) / 16f / 2f;
|
||||||
|
renderer.minimap.setZoom(1f + y / height * (max - 1f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
|||||||
|
|
||||||
/**Remove a stack from this inventory, and return the amount removed.*/
|
/**Remove a stack from this inventory, and return the amount removed.*/
|
||||||
public int removeStack(Tile tile, Item item, int amount){
|
public int removeStack(Tile tile, Item item, int amount){
|
||||||
|
if(tile.entity == null || tile.entity.items == null) return 0;
|
||||||
amount = Math.min(amount, tile.entity.items.get(item));
|
amount = Math.min(amount, tile.entity.items.get(item));
|
||||||
tile.entity.noSleep();
|
tile.entity.noSleep();
|
||||||
tile.entity.items.remove(item, amount);
|
tile.entity.items.remove(item, amount);
|
||||||
|
|||||||
@@ -96,9 +96,11 @@ public class ForceProjector extends Block {
|
|||||||
entity.shield.add();
|
entity.shield.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(entity.cons.optionalValid()), 0.1f);
|
boolean phaseValid = consumes.get(ConsumeType.item).valid(tile.entity);
|
||||||
|
|
||||||
if(entity.cons.optionalValid() && !entity.broken && entity.timer.get(timerUse, phaseUseTime)){
|
entity.phaseHeat = Mathf.lerpDelta(entity.phaseHeat, Mathf.num(phaseValid), 0.1f);
|
||||||
|
|
||||||
|
if(phaseValid && !entity.broken && entity.timer.get(timerUse, phaseUseTime)){
|
||||||
entity.cons.trigger();
|
entity.cons.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public abstract class LiquidTurret extends Turret{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||||
return super.acceptLiquid(tile, source, liquid, amount) && ammo.get(liquid) != null
|
return ammo.get(liquid) != null
|
||||||
&& (tile.entity.liquids.current() == liquid || (ammo.containsKey(tile.entity.liquids.current()) && tile.entity.liquids.get(tile.entity.liquids.current()) <= ammo.get(tile.entity.liquids.current()).ammoMultiplier + 0.001f));
|
&& (tile.entity.liquids.current() == liquid || (ammo.containsKey(tile.entity.liquids.current()) && tile.entity.liquids.get(tile.entity.liquids.current()) <= ammo.get(tile.entity.liquids.current()).ammoMultiplier + 0.001f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ public class LiquidExtendingBridge extends ExtendingItemBridge{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||||
|
return tile.entity.liquids.get(liquid) + amount < liquidCapacity && (tile.entity.liquids.current() == liquid || tile.entity.liquids.get(tile.entity.liquids.current()) < 0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
|
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
|
||||||
ItemBridgeEntity entity = tile.entity();
|
ItemBridgeEntity entity = tile.entity();
|
||||||
|
|||||||
@@ -84,8 +84,6 @@ public class ImpactReactor extends PowerGenerator{
|
|||||||
}
|
}
|
||||||
|
|
||||||
entity.productionEfficiency = Mathf.pow(entity.warmup, 5f);
|
entity.productionEfficiency = Mathf.pow(entity.warmup, 5f);
|
||||||
|
|
||||||
super.update(tile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -123,18 +123,6 @@ public class ItemLiquidGenerator extends PowerGenerator{
|
|||||||
entity.productionEfficiency = 0.0f;
|
entity.productionEfficiency = 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.update(tile);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
|
||||||
return hasItems && getItemEfficiency(item) >= minItemEfficiency && tile.entity.items.total() < itemCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
|
||||||
return hasLiquids && getLiquidEfficiency(liquid) >= minLiquidEfficiency && tile.entity.liquids.get(liquid) < liquidCapacity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,15 +16,11 @@ import io.anuke.mindustry.type.Item;
|
|||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.ui.Bar;
|
import io.anuke.mindustry.ui.Bar;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.consumers.ConsumeItems;
|
import io.anuke.mindustry.world.consumers.*;
|
||||||
import io.anuke.mindustry.world.consumers.ConsumeLiquid;
|
|
||||||
import io.anuke.mindustry.world.consumers.ConsumeType;
|
|
||||||
import io.anuke.mindustry.world.meta.BlockStat;
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
import io.anuke.mindustry.world.meta.StatUnit;
|
import io.anuke.mindustry.world.meta.StatUnit;
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.*;
|
||||||
import java.io.DataOutput;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
|
||||||
@@ -116,8 +112,6 @@ public class NuclearReactor extends PowerGenerator{
|
|||||||
|
|
||||||
if(entity.heat >= 0.999f){
|
if(entity.heat >= 0.999f){
|
||||||
entity.kill();
|
entity.kill();
|
||||||
}else{
|
|
||||||
super.update(tile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package io.anuke.mindustry.world.blocks.power;
|
package io.anuke.mindustry.world.blocks.power;
|
||||||
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
import io.anuke.mindustry.world.blocks.PowerBlock;
|
import io.anuke.mindustry.world.blocks.PowerBlock;
|
||||||
|
|
||||||
public class PowerDistributor extends PowerBlock{
|
public class PowerDistributor extends PowerBlock{
|
||||||
@@ -10,9 +9,4 @@ public class PowerDistributor extends PowerBlock{
|
|||||||
consumesPower = false;
|
consumesPower = false;
|
||||||
outputsPower = true;
|
outputsPower = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(Tile tile){
|
|
||||||
tile.entity.power.graph.update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ public class ThermalGenerator extends PowerGenerator{
|
|||||||
if(entity.productionEfficiency > 0.1f && Mathf.chance(0.05 * entity.delta())){
|
if(entity.productionEfficiency > 0.1f && Mathf.chance(0.05 * entity.delta())){
|
||||||
Effects.effect(generateEffect, tile.drawx() + Mathf.range(3f), tile.drawy() + Mathf.range(3f));
|
Effects.effect(generateEffect, tile.drawx() + Mathf.range(3f), tile.drawy() + Mathf.range(3f));
|
||||||
}
|
}
|
||||||
|
|
||||||
super.update(tile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -125,7 +125,10 @@ public class GenericCrafter extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProduce(Tile tile){
|
public boolean canProduce(Tile tile){
|
||||||
return super.canProduce(tile);
|
if(outputItem != null && tile.entity.items.get(outputItem.item) >= itemCapacity){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return outputLiquid == null || !(tile.entity.liquids.get(outputLiquid.liquid) >= liquidCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package io.anuke.mindustry.world.blocks.production;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.mindustry.world.consumers.ConsumeLiquidBase;
|
||||||
|
import io.anuke.mindustry.world.consumers.ConsumeType;
|
||||||
|
import io.anuke.mindustry.world.meta.BlockStat;
|
||||||
|
|
||||||
|
public class LiquidConverter extends GenericCrafter{
|
||||||
|
|
||||||
|
public LiquidConverter(String name){
|
||||||
|
super(name);
|
||||||
|
hasLiquids = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
ConsumeLiquidBase cl = consumes.get(ConsumeType.liquid);
|
||||||
|
cl.update(true);
|
||||||
|
outputLiquid.amount = cl.amount;
|
||||||
|
super.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStats(){
|
||||||
|
super.setStats();
|
||||||
|
stats.remove(BlockStat.output);
|
||||||
|
stats.add(BlockStat.output, outputLiquid.liquid, outputLiquid.amount * craftTime, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Tile tile){
|
||||||
|
GenericCrafterEntity entity = tile.entity();
|
||||||
|
ConsumeLiquidBase cl = consumes.get(ConsumeType.liquid);
|
||||||
|
|
||||||
|
if(tile.entity.cons.valid()){
|
||||||
|
float use = Math.min(cl.amount * entity.delta(), liquidCapacity - entity.liquids.get(outputLiquid.liquid));
|
||||||
|
if(hasPower){
|
||||||
|
use *= entity.power.satisfaction; // Produce less liquid if power is not maxed
|
||||||
|
}
|
||||||
|
entity.progress += use / cl.amount / craftTime;
|
||||||
|
entity.liquids.add(outputLiquid.liquid, use);
|
||||||
|
if(entity.progress >= 1f){
|
||||||
|
entity.cons.trigger();
|
||||||
|
entity.progress = 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tryDumpLiquid(tile, outputLiquid.liquid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ 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.graphics.g2d.TextureRegion;
|
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||||
|
import io.anuke.arc.util.Log;
|
||||||
import io.anuke.mindustry.graphics.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ public class UnitFactory extends Block{
|
|||||||
public void unitRemoved(Tile tile, Unit unit){
|
public void unitRemoved(Tile tile, Unit unit){
|
||||||
UnitFactoryEntity entity = tile.entity();
|
UnitFactoryEntity entity = tile.entity();
|
||||||
entity.spawned --;
|
entity.spawned --;
|
||||||
|
entity.spawned = Math.max(entity.spawned, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.anuke.mindustry.world.consumers;
|
package io.anuke.mindustry.world.consumers;
|
||||||
|
|
||||||
import io.anuke.arc.scene.ui.layout.Table;
|
import io.anuke.arc.scene.ui.layout.Table;
|
||||||
|
import io.anuke.arc.util.Log;
|
||||||
import io.anuke.mindustry.entities.type.TileEntity;
|
import io.anuke.mindustry.entities.type.TileEntity;
|
||||||
import io.anuke.mindustry.type.Liquid;
|
import io.anuke.mindustry.type.Liquid;
|
||||||
import io.anuke.mindustry.ui.ReqImage;
|
import io.anuke.mindustry.ui.ReqImage;
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ public class ConsumeModule extends BlockModule{
|
|||||||
boolean docons = entity.block.shouldConsume(entity.tile);
|
boolean docons = entity.block.shouldConsume(entity.tile);
|
||||||
|
|
||||||
for(Consume cons : entity.block.consumes.all()){
|
for(Consume cons : entity.block.consumes.all()){
|
||||||
|
if(cons.isOptional()) continue;
|
||||||
|
|
||||||
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
if(docons && cons.isUpdate() && prevValid && cons.valid(entity)){
|
||||||
cons.update(entity);
|
cons.update(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cons.isOptional()){
|
valid &= cons.valid(entity);
|
||||||
valid &= cons.valid(entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Consume cons : entity.block.consumes.optionals()){
|
for(Consume cons : entity.block.consumes.optionals()){
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import io.anuke.arc.ApplicationListener;
|
|||||||
import io.anuke.arc.Core;
|
import io.anuke.arc.Core;
|
||||||
import io.anuke.arc.Events;
|
import io.anuke.arc.Events;
|
||||||
import io.anuke.arc.collection.Array;
|
import io.anuke.arc.collection.Array;
|
||||||
|
import io.anuke.arc.collection.Array.ArrayIterable;
|
||||||
import io.anuke.arc.collection.ObjectSet;
|
import io.anuke.arc.collection.ObjectSet;
|
||||||
import io.anuke.arc.files.FileHandle;
|
import io.anuke.arc.files.FileHandle;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
@@ -663,7 +664,7 @@ public class ServerControl implements ApplicationListener{
|
|||||||
for(Player p : players){
|
for(Player p : players){
|
||||||
p.reset();
|
p.reset();
|
||||||
if(state.rules.pvp){
|
if(state.rules.pvp){
|
||||||
p.setTeam(netServer.assignTeam());
|
p.setTeam(netServer.assignTeam(new ArrayIterable<>(players)));
|
||||||
}
|
}
|
||||||
netServer.sendWorldData(p, p.con.id);
|
netServer.sendWorldData(p, p.con.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ if(!hasProperty("release")){
|
|||||||
use(':Arc:extensions', '../Arc/extensions')
|
use(':Arc:extensions', '../Arc/extensions')
|
||||||
use(':Arc:extensions:freetype', '../Arc/extensions/freetype')
|
use(':Arc:extensions:freetype', '../Arc/extensions/freetype')
|
||||||
use(':Arc:extensions:recorder', '../Arc/extensions/recorder')
|
use(':Arc:extensions:recorder', '../Arc/extensions/recorder')
|
||||||
|
//use(':Arc:extensions:postprocessing', '../Arc/extensions/postprocessing')
|
||||||
use(':Arc:backends', '../Arc/backends')
|
use(':Arc:backends', '../Arc/backends')
|
||||||
use(':Arc:backends:backend-lwjgl3', '../Arc/backends/backend-lwjgl3')
|
use(':Arc:backends:backend-lwjgl3', '../Arc/backends/backend-lwjgl3')
|
||||||
use(':Arc:backends:backend-android', '../Arc/backends/backend-android')
|
use(':Arc:backends:backend-android', '../Arc/backends/backend-android')
|
||||||
|
|||||||