Revenant sprite / Training mode / Mine transfer range / Drone heal buff

This commit is contained in:
Anuken
2018-09-16 14:05:43 -04:00
parent 7d8782f3dc
commit 097228066a
22 changed files with 109 additions and 54 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

+2
View File
@@ -93,6 +93,7 @@ text.server.kicked.customClient=This server does not support custom builds. Down
text.host.info=The [accent]host[] button hosts a server on port [scarlet]6567[]. \nAnybody on the same [LIGHT_GRAY]wifi or local network[] should be able to see your server in their server list.\n\nIf you want people to be able to connect from anywhere by IP, [accent]port forwarding[] is required.\n\n[LIGHT_GRAY]Note: If someone is experiencing trouble connecting to your LAN game, make sure you have allowed Mindustry access to your local network in your firewall settings. text.host.info=The [accent]host[] button hosts a server on port [scarlet]6567[]. \nAnybody on the same [LIGHT_GRAY]wifi or local network[] should be able to see your server in their server list.\n\nIf you want people to be able to connect from anywhere by IP, [accent]port forwarding[] is required.\n\n[LIGHT_GRAY]Note: If someone is experiencing trouble connecting to your LAN game, make sure you have allowed Mindustry access to your local network in your firewall settings.
text.join.info=Here, you can enter a [accent]server IP[] to connect to, or discover [accent]local network[] servers to connect to.\nBoth LAN and WAN multiplayer is supported.\n\n[LIGHT_GRAY]Note: There is no automatic global server list; if you want to connect to someone by IP, you would need to ask the host for their IP. text.join.info=Here, you can enter a [accent]server IP[] to connect to, or discover [accent]local network[] servers to connect to.\nBoth LAN and WAN multiplayer is supported.\n\n[LIGHT_GRAY]Note: There is no automatic global server list; if you want to connect to someone by IP, you would need to ask the host for their IP.
text.hostserver=Host Server text.hostserver=Host Server
text.hostserver.mobile=Host\nServer
text.host=Host text.host=Host
text.hosting=[accent]Opening server... text.hosting=[accent]Opening server...
text.hosts.refresh=Refresh text.hosts.refresh=Refresh
@@ -340,6 +341,7 @@ text.category.shooting=Shooting
setting.fpscap.name=Max FPS setting.fpscap.name=Max FPS
setting.fpscap.none=None setting.fpscap.none=None
setting.fpscap.text={0} FPS setting.fpscap.text={0} FPS
setting.difficulty.training=training
setting.difficulty.easy=easy setting.difficulty.easy=easy
setting.difficulty.normal=normal setting.difficulty.normal=normal
setting.difficulty.hard=hard setting.difficulty.hard=hard
+2
View File
@@ -35,6 +35,8 @@ public class Vars{
public static final String crashReportURL = "http://mindustry.us.to/report"; public static final String crashReportURL = "http://mindustry.us.to/report";
//time between waves in frames (on normal mode) //time between waves in frames (on normal mode)
public static final float wavespace = 60 * 60 * 1.5f; public static final float wavespace = 60 * 60 * 1.5f;
public static final float mineTransferRange = 300f;
//set ridiculously high for now //set ridiculously high for now
public static final float coreBuildRange = 999999f; public static final float coreBuildRange = 999999f;
//team of the player by default //team of the player by default
@@ -35,7 +35,7 @@ public class Recipes implements ContentList{
new Recipe(defense, DefenseBlocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4)); new Recipe(defense, DefenseBlocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
//projectors //projectors
new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 250)); new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 180));
new Recipe(defense, DefenseBlocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250)); new Recipe(defense, DefenseBlocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(defense, DefenseBlocks.forceProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250)); new Recipe(defense, DefenseBlocks.forceProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
@@ -54,8 +54,8 @@ public class Recipes implements ContentList{
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.densealloy, 220), new ItemStack(Items.thorium, 120)); new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.densealloy, 220), new ItemStack(Items.thorium, 120));
new Recipe(weapon, TurretBlocks.cyclone, new ItemStack(Items.copper, 400), new ItemStack(Items.densealloy, 400), new ItemStack(Items.surgealloy, 200), new ItemStack(Items.plastanium, 150)); new Recipe(weapon, TurretBlocks.cyclone, new ItemStack(Items.copper, 400), new ItemStack(Items.densealloy, 400), new ItemStack(Items.surgealloy, 200), new ItemStack(Items.plastanium, 150));
new Recipe(weapon, TurretBlocks.fuse, new ItemStack(Items.copper, 450), new ItemStack(Items.densealloy, 450), new ItemStack(Items.surgealloy, 250)); new Recipe(weapon, TurretBlocks.fuse, new ItemStack(Items.copper, 450), new ItemStack(Items.densealloy, 450), new ItemStack(Items.surgealloy, 250));
new Recipe(weapon, TurretBlocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 400), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 400)); new Recipe(weapon, TurretBlocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 500), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 500));
new Recipe(weapon, TurretBlocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.densealloy, 500), new ItemStack(Items.surgealloy, 600), new ItemStack(Items.silicon, 550)); new Recipe(weapon, TurretBlocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.densealloy, 600), new ItemStack(Items.surgealloy, 650), new ItemStack(Items.silicon, 650));
//DISTRIBUTION //DISTRIBUTION
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1)); new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1));
@@ -8,7 +8,7 @@ import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType; import io.anuke.mindustry.type.ContentType;
public class UnitTypes implements ContentList{ public class UnitTypes implements ContentList{
public static UnitType drone, alphaDrone, dagger, interceptor, monsoon, titan, fortress, fabricator; public static UnitType drone, alphaDrone, dagger, wraith, monsoon, revenant, titan, fortress, fabricator;
@Override @Override
public void load(){ public void load(){
@@ -18,7 +18,7 @@ public class UnitTypes implements ContentList{
speed = 0.2f; speed = 0.2f;
maxVelocity = 0.8f; maxVelocity = 0.8f;
range = 50f; range = 50f;
healSpeed = 0.05f; healSpeed = 0.25f;
health = 60; health = 60;
}}; }};
@@ -46,7 +46,7 @@ public class UnitTypes implements ContentList{
drag = 0.4f; drag = 0.4f;
range = 40f; range = 40f;
weapon = Weapons.chainBlaster; weapon = Weapons.chainBlaster;
health = 180; health = 150;
}}; }};
titan = new UnitType("titan", Titan.class, Titan::new){{ titan = new UnitType("titan", Titan.class, Titan::new){{
@@ -55,7 +55,7 @@ public class UnitTypes implements ContentList{
drag = 0.4f; drag = 0.4f;
range = 10f; range = 10f;
weapon = Weapons.flamethrower; weapon = Weapons.flamethrower;
health = 500; health = 440;
}}; }};
fortress = new UnitType("fortress", Fortress.class, Fortress::new){{ fortress = new UnitType("fortress", Fortress.class, Fortress::new){{
@@ -63,11 +63,11 @@ public class UnitTypes implements ContentList{
speed = 0.18f; speed = 0.18f;
drag = 0.4f; drag = 0.4f;
range = 10f; range = 10f;
weapon = Weapons.flamethrower; weapon = Weapons.artillery;
health = 500; health = 500;
}}; }};
interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{ wraith = new UnitType("wraith", Wraith.class, Wraith::new){{
speed = 0.3f; speed = 0.3f;
maxVelocity = 1.9f; maxVelocity = 1.9f;
drag = 0.01f; drag = 0.01f;
@@ -85,6 +85,15 @@ public class UnitTypes implements ContentList{
weapon = Weapons.bomber; weapon = Weapons.bomber;
}}; }};
revenant = new UnitType("revenant", Revenant.class, Revenant::new){{
health = 250;
speed = 0.2f;
maxVelocity = 1.4f;
drag = 0.01f;
isFlying = true;
weapon = Weapons.bomber;
}};
fabricator = new UnitType("fabricator", Fabricator.class, Fabricator::new){{ fabricator = new UnitType("fabricator", Fabricator.class, Fabricator::new){{
isFlying = true; isFlying = true;
drag = 0.01f; drag = 0.01f;
@@ -95,7 +104,7 @@ public class UnitTypes implements ContentList{
health = 220; health = 220;
buildPower = 0.9f; buildPower = 0.9f;
minePower = 1.1f; minePower = 1.1f;
healSpeed = 0.09f; healSpeed = 0.55f;
toMine = ObjectSet.with(Items.lead, Items.copper, Items.titanium); toMine = ObjectSet.with(Items.lead, Items.copper, Items.titanium);
}}; }};
} }
@@ -7,7 +7,8 @@ import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Weapon; import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList{ public class Weapons implements ContentList{
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, chainBlaster, shockgun, sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles; public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, chainBlaster, shockgun,
sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery;
@Override @Override
public void load(){ public void load(){
@@ -119,6 +120,15 @@ public class Weapons implements ContentList{
ammo = AmmoTypes.flamerThermite; ammo = AmmoTypes.flamerThermite;
}}; }};
artillery = new Weapon("artillery"){{
length = 1f;
reload = 60f;
roundrobin = true;
recoil = 1f;
ejectEffect = ShootFx.shellEjectMedium;
ammo = AmmoTypes.artilleryExplosive;
}};
sapper = new Weapon("sapper"){{ sapper = new Weapon("sapper"){{
length = 1.5f; length = 1.5f;
reload = 12f; reload = 12f;
@@ -12,7 +12,7 @@ public class StorageBlocks extends BlockList implements ContentList{
@Override @Override
public void load(){ public void load(){
core = new CoreBlock("core"){{ core = new CoreBlock("core"){{
health = 800; health = 1400;
}}; }};
vault = new Vault("vault"){{ vault = new Vault("vault"){{
@@ -30,8 +30,8 @@ public class UnitBlocks extends BlockList implements ContentList{
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)}); consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});
}}; }};
interceptorPad = new UnitPad("interceptor-pad"){{ interceptorPad = new UnitPad("wraith-pad"){{
type = UnitTypes.interceptor; type = UnitTypes.wraith;
produceTime = 1800; produceTime = 1800;
size = 2; size = 2;
consumes.power(0.1f); consumes.power(0.1f);
-1
View File
@@ -169,7 +169,6 @@ public class UI extends SceneModule{
content = new ContentInfoDialog(); content = new ContentInfoDialog();
sectors = new SectorsDialog(); sectors = new SectorsDialog();
missions = new MissionDialog(); missions = new MissionDialog();
graph = new UnlockGraphDialog();
Group group = Core.scene.getRoot(); Group group = Core.scene.getRoot();
@@ -24,10 +24,7 @@ import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill; import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.graphics.Lines; import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.graphics.Shapes; import io.anuke.ucore.graphics.Shapes;
import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.*;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Translator;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
@@ -246,12 +243,18 @@ public interface BuilderTrait extends Entity{
Item item = tile.floor().drops.item; Item item = tile.floor().drops.item;
unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(tile.worldx(), tile.worldy()), 0.4f); unit.rotation = Mathf.slerpDelta(unit.rotation, unit.angleTo(tile.worldx(), tile.worldy()), 0.4f);
if(core.items.get(item) < core.tile.block().getMaximumAccepted(core.tile, item) && if(Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){
Mathf.chance(Timers.delta() * (0.06 - item.hardness * 0.01) * getMinePower())){
Call.transferItemTo(item, 1, if(unit.distanceTo(core) < mineTransferRange && core.items.get(item) < core.tile.block().getMaximumAccepted(core.tile, item)){
tile.worldx() + Mathf.range(tilesize / 2f), Call.transferItemTo(item, 1,
tile.worldy() + Mathf.range(tilesize / 2f), core.tile); tile.worldx() + Mathf.range(tilesize / 2f),
tile.worldy() + Mathf.range(tilesize / 2f), core.tile);
}else if(unit.inventory.canAcceptItem(item)){
Call.transferItemToUnit(item,
tile.worldx() + Mathf.range(tilesize / 2f),
tile.worldy() + Mathf.range(tilesize / 2f),
unit);
}
} }
if(Mathf.chance(0.06 * Timers.delta())){ if(Mathf.chance(0.06 * Timers.delta())){
@@ -41,7 +41,7 @@ public class UnitType extends UnlockableContent{
public float carryWeight = 1f; public float carryWeight = 1f;
public int itemCapacity = 30; public int itemCapacity = 30;
public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper); public ObjectSet<Item> toMine = ObjectSet.with(Items.lead, Items.copper);
public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 0.1f; public float buildPower = 0.3f, minePower = 0.7f, healSpeed = 2f;
public Weapon weapon = Weapons.blaster; public Weapon weapon = Weapons.blaster;
public float weaponOffsetX, weaponOffsetY; public float weaponOffsetX, weaponOffsetY;
public Color trailColor = Color.valueOf("ffa665"); public Color trailColor = Color.valueOf("ffa665");
@@ -3,6 +3,7 @@ package io.anuke.mindustry.entities.units.types;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Queue; import com.badlogic.gdx.utils.Queue;
import io.anuke.mindustry.content.blocks.Blocks; import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.ItemDrop; import io.anuke.mindustry.entities.effect.ItemDrop;
@@ -23,6 +24,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.BuildBlock; import io.anuke.mindustry.world.blocks.BuildBlock;
import io.anuke.mindustry.world.blocks.BuildBlock.BuildEntity; import io.anuke.mindustry.world.blocks.BuildBlock.BuildEntity;
import io.anuke.mindustry.world.meta.BlockFlag; import io.anuke.mindustry.world.meta.BlockFlag;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Events; import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.entities.EntityGroup;
@@ -43,6 +45,7 @@ import static io.anuke.mindustry.Vars.*;
public class Drone extends FlyingUnit implements BuilderTrait{ public class Drone extends FlyingUnit implements BuilderTrait{
protected static float discoverRange = 120f; protected static float discoverRange = 120f;
protected static boolean initialized; protected static boolean initialized;
protected static int timerRepairEffect = timerIndex++;
protected Item targetItem; protected Item targetItem;
protected Tile mineTile; protected Tile mineTile;
@@ -116,8 +119,11 @@ public class Drone extends FlyingUnit implements BuilderTrait{
circle(type.range); circle(type.range);
}else{ }else{
TileEntity entity = (TileEntity) target; TileEntity entity = (TileEntity) target;
entity.health += type.healSpeed * Timers.delta(); entity.healBy(type.healSpeed * entity.tile.block().health / 100f * Timers.delta());
entity.health = Mathf.clamp(entity.health, 0, entity.tile.block().health);
if(timer.get(timerRepairEffect, 30)){
Effects.effect(BlockFx.healBlockFull, Palette.heal, entity.x, entity.y, entity.tile.block().size);
}
} }
} }
}, },
@@ -0,0 +1,6 @@
package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnit;
public class Revenant extends FlyingUnit{
}
@@ -2,6 +2,6 @@ package io.anuke.mindustry.entities.units.types;
import io.anuke.mindustry.entities.units.FlyingUnit; import io.anuke.mindustry.entities.units.FlyingUnit;
public class Interceptor extends FlyingUnit{ public class Wraith extends FlyingUnit{
} }
@@ -3,7 +3,8 @@ package io.anuke.mindustry.game;
import io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Bundles;
public enum Difficulty{ public enum Difficulty{
easy(1.2f, 1.5f), training(3f, 3f),
easy(1.4f, 1.5f),
normal(1f, 1f), normal(1f, 1f),
hard(0.5f, 0.75f), hard(0.5f, 0.75f),
insane(0.25f, 0.5f); insane(0.25f, 0.5f);
+3 -3
View File
@@ -16,7 +16,7 @@ public class Waves{
unitScaling = 1; unitScaling = 1;
}}, }},
new SpawnGroup(UnitTypes.interceptor){{ new SpawnGroup(UnitTypes.wraith){{
begin = 12; begin = 12;
end = 14; end = 14;
}}, }},
@@ -69,7 +69,7 @@ public class Waves{
effect = StatusEffects.overdrive; effect = StatusEffects.overdrive;
}}, }},
new SpawnGroup(UnitTypes.interceptor){{ new SpawnGroup(UnitTypes.wraith){{
begin = 16; begin = 16;
unitScaling = 2; unitScaling = 2;
spacing = 2; spacing = 2;
@@ -124,7 +124,7 @@ public class Waves{
max = 8; max = 8;
}}, }},
new SpawnGroup(UnitTypes.interceptor){{ new SpawnGroup(UnitTypes.wraith){{
begin = 50; begin = 50;
unitAmount = 4; unitAmount = 4;
unitScaling = 3; unitScaling = 3;
@@ -106,7 +106,7 @@ public class PausedDialog extends FloatingDialog{
content().row(); content().row();
content().addRowImageTextButton("$text.load", "icon-load", isize, load::show).disabled(b -> Net.active()); content().addRowImageTextButton("$text.load", "icon-load", isize, load::show).disabled(b -> Net.active());
content().addRowImageTextButton("$text.host", "icon-host", isize, ui.host::show).disabled(b -> Net.active()); content().addRowImageTextButton("$text.hostserver.mobile", "icon-host", isize, ui.host::show).disabled(b -> Net.active());
content().addRowImageTextButton("$text.quit", "icon-quit", isize, () -> { content().addRowImageTextButton("$text.quit", "icon-quit", isize, () -> {
ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> { ui.showConfirm("$text.confirm", "$text.quit.confirm", () -> {
if(Net.client()) netClient.disconnectQuietly(); if(Net.client()) netClient.disconnectQuietly();
@@ -128,7 +128,7 @@ public class MenuFragment extends Fragment{
out.add(new MenuButton("icon-menu", "$text.changelog.title", ui.changelog::show)); out.add(new MenuButton("icon-menu", "$text.changelog.title", ui.changelog::show));
out.add(new MenuButton("icon-unlocks", "$text.unlocks", ui.graph::show)); out.add(new MenuButton("icon-unlocks", "$text.unlocks", ui.unlocks::show));
out.row(); out.row();
@@ -16,6 +16,10 @@ import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.graphics.Lines; import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import static io.anuke.mindustry.Vars.tilesize; import static io.anuke.mindustry.Vars.tilesize;
import static io.anuke.mindustry.Vars.world; import static io.anuke.mindustry.Vars.world;
@@ -126,5 +130,17 @@ public class MendProjector extends Block{
float heat; float heat;
float charge; float charge;
float phaseHeat; float phaseHeat;
@Override
public void write(DataOutputStream stream) throws IOException{
stream.writeFloat(heat);
stream.writeFloat(phaseHeat);
}
@Override
public void read(DataInputStream stream) throws IOException{
heat = stream.readFloat();
phaseHeat = stream.readFloat();
}
} }
} }
@@ -16,6 +16,10 @@ import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.graphics.Lines; import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import static io.anuke.mindustry.Vars.tilesize; import static io.anuke.mindustry.Vars.tilesize;
import static io.anuke.mindustry.Vars.world; import static io.anuke.mindustry.Vars.world;
@@ -127,5 +131,17 @@ public class OverdriveProjector extends Block{
float heat; float heat;
float charge; float charge;
float phaseHeat; float phaseHeat;
@Override
public void write(DataOutputStream stream) throws IOException{
stream.writeFloat(heat);
stream.writeFloat(phaseHeat);
}
@Override
public void read(DataInputStream stream) throws IOException{
heat = stream.readFloat();
phaseHeat = stream.readFloat();
}
} }
} }
@@ -185,24 +185,16 @@ public class Conveyor extends Block{
float centerDstScl = 3f; float centerDstScl = 3f;
float tx = Geometry.d4[tile.getRotation()].x, ty = Geometry.d4[tile.getRotation()].y; float tx = Geometry.d4[tile.getRotation()].x, ty = Geometry.d4[tile.getRotation()].y;
float min;
float centerx = 0f, centery = 0f; float centerx = 0f, centery = 0f;
if(Math.abs(tx) > Math.abs(ty)){ if(Math.abs(tx) > Math.abs(ty)){
float rx = tile.worldx() - tx / 2f * tilesize;
min = Mathf.clamp((unit.x - rx) * tx / tilesize);
centery = Mathf.clamp((tile.worldy() - unit.y) / centerDstScl, -centerSpeed, centerSpeed); centery = Mathf.clamp((tile.worldy() - unit.y) / centerDstScl, -centerSpeed, centerSpeed);
if(Math.abs(tile.worldy() - unit.y) < 1f) centery = 0f; if(Math.abs(tile.worldy() - unit.y) < 1f) centery = 0f;
}else{ }else{
float ry = tile.worldy() - ty / 2f * tilesize;
min = Mathf.clamp((unit.y - ry) * ty / tilesize);
centerx = Mathf.clamp((tile.worldx() - unit.x) / centerDstScl, -centerSpeed, centerSpeed); centerx = Mathf.clamp((tile.worldx() - unit.x) / centerDstScl, -centerSpeed, centerSpeed);
if(Math.abs(tile.worldx() - unit.x) < 1f) centerx = 0f; if(Math.abs(tile.worldx() - unit.x) < 1f) centerx = 0f;
} }
entity.minCarry = Math.min(entity.minCarry, min);
entity.carrying += unit.getMass();
if(entity.convey.size * itemSpace < 0.9f){ if(entity.convey.size * itemSpace < 0.9f){
unit.getVelocity().add((tx * speed + centerx) * entity.delta(), (ty * speed + centery) * entity.delta()); unit.getVelocity().add((tx * speed + centerx) * entity.delta(), (ty * speed + centery) * entity.delta());
} }
@@ -215,7 +207,6 @@ public class Conveyor extends Block{
entity.minitem = 1f; entity.minitem = 1f;
int minremove = Integer.MAX_VALUE; int minremove = Integer.MAX_VALUE;
float speed = Math.max(this.speed - (1f - (carryCapacity - entity.carrying) / carryCapacity), 0f);
for(int i = entity.convey.size - 1; i >= 0; i--){ for(int i = entity.convey.size - 1; i >= 0; i--){
long value = entity.convey.get(i); long value = entity.convey.get(i);
@@ -228,9 +219,6 @@ public class Conveyor extends Block{
} }
float nextpos = (i == entity.convey.size - 1 ? 100f : pos2.set(entity.convey.get(i + 1), ItemPos.updateShorts).y) - itemSpace; float nextpos = (i == entity.convey.size - 1 ? 100f : pos2.set(entity.convey.get(i + 1), ItemPos.updateShorts).y) - itemSpace;
if(entity.minCarry >= pos.y && entity.minCarry <= nextpos){
nextpos = entity.minCarry;
}
float maxmove = Math.min(nextpos - pos.y, speed * entity.delta()); float maxmove = Math.min(nextpos - pos.y, speed * entity.delta());
if(maxmove > minmove){ if(maxmove > minmove){
@@ -260,9 +248,6 @@ public class Conveyor extends Block{
entity.clogHeat = Mathf.lerpDelta(entity.clogHeat, 0f, 1f); entity.clogHeat = Mathf.lerpDelta(entity.clogHeat, 0f, 1f);
} }
entity.carrying = 0f;
entity.minCarry = 2f;
if(entity.items.total() == 0){ if(entity.items.total() == 0){
entity.sleep(); entity.sleep();
}else{ }else{
@@ -366,9 +351,6 @@ public class Conveyor extends Block{
ConveyorEntity entity = tile.entity(); ConveyorEntity entity = tile.entity();
Array<Object> arr = super.getDebugInfo(tile); Array<Object> arr = super.getDebugInfo(tile);
arr.addAll(Array.with( arr.addAll(Array.with(
"mincarry", entity.minCarry,
"minitem", entity.minCarry,
"carrying", entity.carrying,
"clogHeat", entity.clogHeat, "clogHeat", entity.clogHeat,
"sleeping", entity.isSleeping() "sleeping", entity.isSleeping()
)); ));
@@ -384,8 +366,6 @@ public class Conveyor extends Block{
LongArray convey = new LongArray(); LongArray convey = new LongArray();
float minitem = 1; float minitem = 1;
float carrying;
float minCarry = 2f;
int blendshadowrot = -1; int blendshadowrot = -1;
int blendbits; int blendbits;
@@ -162,6 +162,11 @@ public class CoreBlock extends StorageBlock{
} }
} }
@Override
public int getMaximumAccepted(Tile tile, Item item){
return itemCapacity;
}
@Override @Override
public boolean acceptItem(Item item, Tile tile, Tile source){ public boolean acceptItem(Item item, Tile tile, Tile source){
return tile.entity.items.get(item) < itemCapacity && item.type == ItemType.material; return tile.entity.items.get(item) < itemCapacity && item.type == ItemType.material;