Implemented various suggestions
- Pathfinding weighs walls more - C disables all HUD - Unloader doesn't store items - Some bugfixes
This commit is contained in:
@@ -58,6 +58,7 @@ Clarence "Sparr" Risher
|
|||||||
bei2
|
bei2
|
||||||
AceEllysium
|
AceEllysium
|
||||||
Cedric L'homme
|
Cedric L'homme
|
||||||
|
Michał “Neoqueto”
|
||||||
indielm
|
indielm
|
||||||
Ameb
|
Ameb
|
||||||
player20033
|
player20033
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class Pathfinder implements Runnable{
|
|||||||
|
|
||||||
/** Packs a tile into its internal representation. */
|
/** Packs a tile into its internal representation. */
|
||||||
private int packTile(Tile tile){
|
private int packTile(Tile tile){
|
||||||
return PathTile.get(tile.cost, tile.getTeamID(), (byte)0, !tile.solid() && tile.floor().drownTime <= 0f);
|
return PathTile.get(tile.cost, tile.getTeamID(), !tile.solid() && tile.floor().drownTime <= 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Starts or restarts the pathfinding thread. */
|
/** Starts or restarts the pathfinding thread. */
|
||||||
@@ -360,11 +360,11 @@ public class Pathfinder implements Runnable{
|
|||||||
@Struct
|
@Struct
|
||||||
class PathTileStruct{
|
class PathTileStruct{
|
||||||
//traversal cost
|
//traversal cost
|
||||||
byte cost;
|
short cost;
|
||||||
//team of block, if applicable (0 by default)
|
//team of block, if applicable (0 by default)
|
||||||
byte team;
|
byte team;
|
||||||
//type of target; TODO remove
|
//type of target; TODO remove
|
||||||
byte type;
|
//byte type;
|
||||||
//whether it's viable to pass this block
|
//whether it's viable to pass this block
|
||||||
boolean passable;
|
boolean passable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -489,6 +489,7 @@ public class Bullets implements ContentList{
|
|||||||
despawnEffect = Fx.none;
|
despawnEffect = Fx.none;
|
||||||
hitSize = 4;
|
hitSize = 4;
|
||||||
lifetime = 16f;
|
lifetime = 16f;
|
||||||
|
drawSize = 400f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
meltdownLaser = new BulletType(0.001f, 70){
|
meltdownLaser = new BulletType(0.001f, 70){
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
|||||||
* Tries to put this item into a nearby container, if there are no available
|
* Tries to put this item into a nearby container, if there are no available
|
||||||
* containers, it gets added to the block's inventory.
|
* containers, it gets added to the block's inventory.
|
||||||
*/
|
*/
|
||||||
public void offloadNear(Item item){
|
public void offload(Item item){
|
||||||
Array<Tilec> proximity = proximity();
|
Array<Tilec> proximity = proximity();
|
||||||
int dump = rotation() / block.dumpIncrement;
|
int dump = rotation() / block.dumpIncrement;
|
||||||
useContent(item);
|
useContent(item);
|
||||||
@@ -494,6 +494,26 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
|
|||||||
handleItem(this, item);
|
handleItem(this, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to put this item into a nearby container. Returns success. Unlike #offload(), this method does not change the block inventory.
|
||||||
|
*/
|
||||||
|
public boolean put(Item item){
|
||||||
|
Array<Tilec> proximity = proximity();
|
||||||
|
int dump = rotation() / block.dumpIncrement;
|
||||||
|
useContent(item);
|
||||||
|
|
||||||
|
for(int i = 0; i < proximity.size; i++){
|
||||||
|
incrementDump(proximity.size);
|
||||||
|
Tilec other = proximity.get((i + dump) % proximity.size);
|
||||||
|
if(other.team() == team() && other.acceptItem(this, item) && canDump(other, item)){
|
||||||
|
other.handleItem(this, item);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/** Try dumping any item near the */
|
/** Try dumping any item near the */
|
||||||
public boolean dump(){
|
public boolean dump(){
|
||||||
return dump(null);
|
return dump(null);
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ public class LoadRenderer implements Disposable{
|
|||||||
private long lastFrameTime;
|
private long lastFrameTime;
|
||||||
|
|
||||||
{
|
{
|
||||||
fx.addEffect(new VignettingFilter(false));
|
//vignetting is probably too much
|
||||||
|
//fx.addEffect(new VignettingFilter(false));
|
||||||
fx.addEffect(new BloomFilter());
|
fx.addEffect(new BloomFilter());
|
||||||
|
|
||||||
bars = new Bar[]{
|
bars = new Bar[]{
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
float rawHeight(Vec3 position){
|
float rawHeight(Vec3 position){
|
||||||
position = Tmp.v33.set(position).scl(scl);
|
position = Tmp.v33.set(position).scl(scl);
|
||||||
return Mathf.pow((float)noise.octaveNoise3D(7, 0.48f, 1f/3f, position.x, position.y, position.z), 2.3f);
|
return Mathf.pow((float)noise.octaveNoise3D(7, 0.48f, 1f/3f, position.x, position.y, position.z), 2.3f) + 0.05f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
graphics.checkPref("linear", !mobile, b -> {
|
graphics.checkPref("linear", true, b -> {
|
||||||
for(Texture tex : Core.atlas.getTextures()){
|
for(Texture tex : Core.atlas.getTextures()){
|
||||||
TextureFilter filter = b ? TextureFilter.Linear : TextureFilter.Nearest;
|
TextureFilter filter = b ? TextureFilter.Linear : TextureFilter.Nearest;
|
||||||
tex.setFilter(filter, filter);
|
tex.setFilter(filter, filter);
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
//fps display
|
//fps display
|
||||||
cont.table(info -> {
|
cont.table(info -> {
|
||||||
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps"));
|
info.top().left().margin(4).visible(() -> Core.settings.getBool("fps") && shown);
|
||||||
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -Scl.scl(dsize * 4 + 3), 0));
|
info.update(() -> info.setTranslation(state.rules.waves || state.isEditor() ? 0f : -Scl.scl(dsize * 4 + 3), 0));
|
||||||
IntFormat fps = new IntFormat("fps");
|
IntFormat fps = new IntFormat("fps");
|
||||||
IntFormat ping = new IntFormat("ping");
|
IntFormat ping = new IntFormat("ping");
|
||||||
@@ -193,7 +193,7 @@ public class HudFragment extends Fragment{
|
|||||||
});
|
});
|
||||||
|
|
||||||
parent.fill(t -> {
|
parent.fill(t -> {
|
||||||
t.visible(() -> Core.settings.getBool("minimap") && !state.rules.tutorial);
|
t.visible(() -> Core.settings.getBool("minimap") && !state.rules.tutorial && shown);
|
||||||
//minimap
|
//minimap
|
||||||
t.add(new Minimap());
|
t.add(new Minimap());
|
||||||
t.row();
|
t.row();
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ public class Block extends UnlockableContent{
|
|||||||
|
|
||||||
// Note: Power stats are added by the consumers.
|
// Note: Power stats are added by the consumers.
|
||||||
if(hasLiquids) stats.add(BlockStat.liquidCapacity, liquidCapacity, StatUnit.liquidUnits);
|
if(hasLiquids) stats.add(BlockStat.liquidCapacity, liquidCapacity, StatUnit.liquidUnits);
|
||||||
if(hasItems) stats.add(BlockStat.itemCapacity, itemCapacity, StatUnit.items);
|
if(hasItems && itemCapacity > 0) stats.add(BlockStat.itemCapacity, itemCapacity, StatUnit.items);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBars(){
|
public void setBars(){
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class Tile implements Position, QuadTreeObject{
|
|||||||
static final ObjectSet<Tilec> tileSet = new ObjectSet<>();
|
static final ObjectSet<Tilec> tileSet = new ObjectSet<>();
|
||||||
|
|
||||||
/** Tile traversal cost. */
|
/** Tile traversal cost. */
|
||||||
public byte cost = 1;
|
public short cost = 1;
|
||||||
/** Tile entity, usually null. */
|
/** Tile entity, usually null. */
|
||||||
public @Nullable Tilec entity;
|
public @Nullable Tilec entity;
|
||||||
public short x, y;
|
public short x, y;
|
||||||
@@ -452,32 +452,22 @@ public class Tile implements Position, QuadTreeObject{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//+24
|
|
||||||
|
|
||||||
if(occluded){
|
if(occluded){
|
||||||
cost += 2;
|
cost += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//+26
|
|
||||||
|
|
||||||
if(block.synthetic() && solid()){
|
if(block.synthetic() && solid()){
|
||||||
cost += Mathf.clamp(block.health / 10f, 0, 20);
|
cost += Mathf.clamp(block.health / 6f, 0, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
//+46
|
|
||||||
|
|
||||||
if(floor.isLiquid){
|
if(floor.isLiquid){
|
||||||
cost += 10;
|
cost += 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
//+56
|
|
||||||
|
|
||||||
if(floor.drownTime > 0){
|
if(floor.drownTime > 0){
|
||||||
cost += 70;
|
cost += 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
//+126
|
|
||||||
|
|
||||||
if(cost < 0){
|
if(cost < 0){
|
||||||
cost = Byte.MAX_VALUE;
|
cost = Byte.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ public class Drill extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(dominantItems > 0 && progress >= drillTime + hardnessDrillMultiplier * dominantItem.hardness && items.total() < itemCapacity){
|
if(dominantItems > 0 && progress >= drillTime + hardnessDrillMultiplier * dominantItem.hardness && items.total() < itemCapacity){
|
||||||
offloadNear(dominantItem);
|
offload(dominantItem);
|
||||||
useContent(dominantItem);
|
useContent(dominantItem);
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public class GenericCrafter extends Block{
|
|||||||
if(outputItem != null){
|
if(outputItem != null){
|
||||||
useContent(outputItem.item);
|
useContent(outputItem.item);
|
||||||
for(int i = 0; i < outputItem.amount; i++){
|
for(int i = 0; i < outputItem.amount; i++){
|
||||||
offloadNear(outputItem.item);
|
offload(outputItem.item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class Separator extends Block{
|
|||||||
consume();
|
consume();
|
||||||
|
|
||||||
if(item != null && items.get(item) < itemCapacity){
|
if(item != null && items.get(item) < itemCapacity){
|
||||||
offloadNear(item);
|
offload(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class Unloader extends Block{
|
|||||||
hasItems = true;
|
hasItems = true;
|
||||||
configurable = true;
|
configurable = true;
|
||||||
saveConfig = true;
|
saveConfig = true;
|
||||||
|
itemCapacity = 0;
|
||||||
|
|
||||||
config(Item.class, (tile, item) -> {
|
config(Item.class, (tile, item) -> {
|
||||||
tile.items().clear();
|
tile.items().clear();
|
||||||
@@ -47,40 +48,31 @@ public class Unloader extends Block{
|
|||||||
|
|
||||||
public class UnloaderEntity extends TileEntity{
|
public class UnloaderEntity extends TileEntity{
|
||||||
public Item sortItem = null;
|
public Item sortItem = null;
|
||||||
|
public Tilec dumpingTo;
|
||||||
private Item removeItem(Tilec tile, Item item){
|
|
||||||
if(item == null){
|
|
||||||
return tile.items().take();
|
|
||||||
}else{
|
|
||||||
if(tile.items().has(item)){
|
|
||||||
tile.items().remove(item, 1);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasItem(Tilec tile, Item item){
|
|
||||||
if(item == null){
|
|
||||||
return tile.items().total() > 0;
|
|
||||||
}else{
|
|
||||||
return tile.items().has(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
if(timer(timerUnload, speed / timeScale()) && items.total() == 0){
|
if(timer(timerUnload, speed / timeScale())){
|
||||||
for(Tilec other : proximity){
|
for(Tilec other : proximity){
|
||||||
if(other.interactable(team) && other.block().unloadable && other.block().hasItems && items.total() == 0 &&
|
if(other.interactable(team) && other.block().unloadable && other.block().hasItems
|
||||||
((sortItem == null && items.total() > 0) || hasItem(other, sortItem))){
|
&& ((sortItem == null && other.items().total() > 0) || (sortItem != null && other.items().has(sortItem)))){
|
||||||
offloadNear(removeItem(other, sortItem));
|
//make sure the item can't be dumped back into this block
|
||||||
|
dumpingTo = other;
|
||||||
|
|
||||||
|
//get item to be taken
|
||||||
|
Item item = sortItem == null ? other.items().beginTake() : sortItem;
|
||||||
|
|
||||||
|
//remove item if it's dumped correctly
|
||||||
|
if(put(item)){
|
||||||
|
if(sortItem == null){
|
||||||
|
other.items().endTake(item);
|
||||||
|
}else{
|
||||||
|
other.items().remove(item, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dump();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -110,7 +102,7 @@ public class Unloader extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDump(Tilec to, Item item){
|
public boolean canDump(Tilec to, Item item){
|
||||||
return !(to.block() instanceof StorageBlock);
|
return !(to.block() instanceof StorageBlock) && to != dumpingTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -160,6 +160,25 @@ public class ItemModule extends BlockModule{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Begins a speculative take operation. This returns the item that would be returned by #take(), but does not change state. */
|
||||||
|
public Item beginTake(){
|
||||||
|
for(int i = 0; i < items.length; i++){
|
||||||
|
int index = (i + takeRotation);
|
||||||
|
if(index >= items.length) index -= items.length;
|
||||||
|
if(items[index] > 0){
|
||||||
|
return content.item(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Finishes a take operation. Updates take state, removes the item. */
|
||||||
|
public void endTake(Item item){
|
||||||
|
items[item.id] --;
|
||||||
|
total --;
|
||||||
|
takeRotation = item.id + 1;
|
||||||
|
}
|
||||||
|
|
||||||
public int get(int id){
|
public int get(int id){
|
||||||
return items[id];
|
return items[id];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=3bba9d6264dc329066068b1bd6fadd6632d2e7b9
|
archash=7a43c29eca25a472f966f48fe9df213b61e9f18c
|
||||||
|
|||||||
Reference in New Issue
Block a user