This commit is contained in:
Anuken
2019-06-20 09:14:47 -04:00
parent 478d86677d
commit 1676ad5f1b
9 changed files with 19 additions and 32 deletions

View File

@@ -837,6 +837,7 @@ team.none.name = gray
team.green.name = green team.green.name = green
team.purple.name = purple team.purple.name = purple
unit.spirit.name = Spirit Repair Drone unit.spirit.name = Spirit Repair Drone
unit.draug.name = Draug Miner Drone
unit.spirit.description = Automatically repairs blocks. unit.spirit.description = Automatically repairs blocks.
unit.phantom.name = Phantom Builder Drone unit.phantom.name = Phantom Builder Drone
unit.phantom.description = An advanced drone unit. Helps players build blocks unit.phantom.description = An advanced drone unit. Helps players build blocks

View File

@@ -1687,7 +1687,7 @@ public class Blocks implements ContentList{
repairPoint = new RepairPoint("repair-point"){{ repairPoint = new RepairPoint("repair-point"){{
requirements(Category.units, ItemStack.with(Items.lead, 30, Items.copper, 30, Items.silicon, 30)); requirements(Category.units, ItemStack.with(Items.lead, 30, Items.copper, 30, Items.silicon, 30));
repairSpeed = 0.1f; repairSpeed = 0.3f;
powerUse = 1f; powerUse = 1f;
}}; }};

View File

@@ -261,7 +261,7 @@ public class TechTree implements ContentList{
}); });
node(wraithFactory, () -> { node(wraithFactory, () -> {
node(spiritFactory, () -> { node(ghoulFactory, () -> {
node(revenantFactory, () -> { node(revenantFactory, () -> {
}); });

View File

@@ -436,12 +436,16 @@ public class MapEditorDialog extends Dialog implements Disposable{
table.update(() -> { table.update(() -> {
Vector2 v = button.localToStageCoordinates(Tmp.v1.setZero()); Vector2 v = button.localToStageCoordinates(Tmp.v1.setZero());
table.setPosition(v.x, v.y, Align.topLeft); table.setPosition(v.x, v.y, Align.topLeft);
if(!isShown()){
table.remove();
lastTable[0] = null;
}
}); });
table.pack(); table.pack();
table.act(Core.graphics.getDeltaTime()); table.act(Core.graphics.getDeltaTime());
Core.scene.add(table); addChild(table);
lastTable[0] = table; lastTable[0] = table;
}); });
} }

View File

@@ -46,8 +46,6 @@ public abstract class BulletType extends Content{
public StatusEffect status = StatusEffects.none; public StatusEffect status = StatusEffects.none;
/** Intensity of applied status effect in terms of duration. */ /** Intensity of applied status effect in terms of duration. */
public float statusDuration = 60 * 1f; public float statusDuration = 60 * 1f;
/** Whether to sync this bullet to clients. */
public boolean syncable;
/** Whether this bullet type collides with tiles. */ /** Whether this bullet type collides with tiles. */
public boolean collidesTiles = true; public boolean collidesTiles = true;
/** Whether this bullet type collides with tiles that are of the same team. */ /** Whether this bullet type collides with tiles that are of the same team. */

View File

@@ -105,7 +105,8 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
} }
public boolean targetHasFlag(BlockFlag flag){ public boolean targetHasFlag(BlockFlag flag){
return target instanceof TileEntity && ((TileEntity)target).tile.block().flags.contains(flag); return (target instanceof TileEntity && ((TileEntity)target).tile.block().flags.contains(flag)) ||
(target instanceof Tile && ((Tile)target).block().flags.contains(flag));
} }
public void setState(UnitState state){ public void setState(UnitState state){

View File

@@ -17,7 +17,7 @@ public abstract class BaseDrone extends FlyingUnit{
public void update(){ public void update(){
if(health >= maxHealth()){ if(health >= maxHealth()){
state.set(attack); state.set(getStartState());
}else if(!targetHasFlag(BlockFlag.repair)){ }else if(!targetHasFlag(BlockFlag.repair)){
if(retarget()){ if(retarget()){
Tile repairPoint = Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair)); Tile repairPoint = Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair));
@@ -44,7 +44,7 @@ public abstract class BaseDrone extends FlyingUnit{
@Override @Override
public void behavior(){ public void behavior(){
if(health <= health * type.retreatPercent){ if(health <= maxHealth() * type.retreatPercent && !state.is(retreat) && Geometry.findClosest(x, y, world.indexer.getAllied(team, BlockFlag.repair)) != null){
setState(retreat); setState(retreat);
} }
} }

View File

@@ -33,32 +33,21 @@ public class MinerDrone extends BaseDrone implements MinerTrait{
if(entity == null) return; if(entity == null) return;
if(targetItem == null){ findItem();
findItem();
}
//core full //core full of the target item, do nothing
if(targetItem != null && entity.block.acceptStack(targetItem, 1, entity.tile, MinerDrone.this) == 0){ if(targetItem != null && entity.block.acceptStack(targetItem, 1, entity.tile, MinerDrone.this) == 0){
MinerDrone.this.clearItem(); MinerDrone.this.clearItem();
return; return;
} }
//if inventory is full, drop it off. //if inventory is full, drop it off.
if(item.amount >= getItemCapacity()){ if(item.amount >= getItemCapacity() || (targetItem != null && !acceptsItem(targetItem))){
setState(drop); setState(drop);
}else{ }else{
if(targetItem != null && !acceptsItem(targetItem)){ if(retarget() && targetItem != null){
setState(drop);
return;
}
if(retarget()){
findItem();
if(targetItem == null) return;
target = world.indexer.findClosestOre(x, y, targetItem); target = world.indexer.findClosestOre(x, y, targetItem);
}; }
if(target instanceof Tile){ if(target instanceof Tile){
moveTo(type.range / 1.5f); moveTo(type.range / 1.5f);
@@ -92,13 +81,7 @@ public class MinerDrone extends BaseDrone implements MinerTrait{
} }
public void update(){ public void update(){
if(item.amount == 0){ if(item.amount == 0 || item.item.type != ItemType.material){
setState(mine);
return;
}
if(item.item.type != ItemType.material){
item.amount = 0;
setState(mine); setState(mine);
return; return;
} }

View File

@@ -204,7 +204,7 @@ public class MassDriver extends Block{
if(entity.link == other.pos()){ if(entity.link == other.pos()){
Call.linkMassDriver(null, tile, -1); Call.linkMassDriver(null, tile, -1);
return false; return false;
}else if(other.block() instanceof MassDriver && other.dst(tile) <= range){ }else if(other.block() instanceof MassDriver && other.dst(tile) <= range && other.getTeam() == tile.getTeam()){
Call.linkMassDriver(null, tile, other.pos()); Call.linkMassDriver(null, tile, other.pos());
return false; return false;
} }