Fixed core errors
This commit is contained in:
@@ -26,7 +26,7 @@ class AllDefs{
|
||||
}
|
||||
|
||||
@GroupDef(Tilec.class)
|
||||
class gtile{
|
||||
class tile{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class Damage{
|
||||
tr.trns(angle, length);
|
||||
Intc2 collider = (cx, cy) -> {
|
||||
Tilec tile = world.ent(cx, cy);
|
||||
if(tile != null && !collidedBlocks.contains(tile.pos()) && tile.entity != null && tile.team() != team && tile.collide(hitter)){
|
||||
if(tile != null && !collidedBlocks.contains(tile.pos()) && tile.team() != team && tile.collide(hitter)){
|
||||
tile.collision(hitter);
|
||||
collidedBlocks.add(tile.pos());
|
||||
hitter.type().hit(hitter, tile.x(), tile.y());
|
||||
|
||||
@@ -73,12 +73,12 @@ public class Units{
|
||||
}
|
||||
|
||||
/** Returns the neareset ally tile in a range. */
|
||||
public static Tilec findAllyTile(Team team, float x, float y, float range, Boolf<Tile> pred){
|
||||
public static Tilec findAllyTile(Team team, float x, float y, float range, Boolf<Tilec> pred){
|
||||
return indexer.findTile(team, x, y, range, pred);
|
||||
}
|
||||
|
||||
/** Returns the neareset enemy tile in a range. */
|
||||
public static Tilec findEnemyTile(Team team, float x, float y, float range, Boolf<Tile> pred){
|
||||
public static Tilec findEnemyTile(Team team, float x, float y, float range, Boolf<Tilec> pred){
|
||||
if(team == Team.derelict) return null;
|
||||
|
||||
return indexer.findEnemyTile(team, x, y, range, pred);
|
||||
@@ -95,7 +95,7 @@ public class Units{
|
||||
}
|
||||
|
||||
/** Returns the closest target enemy. First, units are checked, then tile entities. */
|
||||
public static Teamc closestTarget(Team team, float x, float y, float range, Boolf<Unitc> unitPred, Boolf<Tile> tilePred){
|
||||
public static Teamc closestTarget(Team team, float x, float y, float range, Boolf<Unitc> unitPred, Boolf<Tilec> tilePred){
|
||||
if(team == Team.derelict) return null;
|
||||
|
||||
Unitc unit = closestEnemy(team, x, y, range, unitPred);
|
||||
|
||||
@@ -107,7 +107,7 @@ abstract class BuilderComp implements Unitc, DrawLayerFlyingc{
|
||||
}else{
|
||||
if(entity.construct(this, core, 1f / entity.buildCost * Time.delta() * buildSpeed * state.rules.buildSpeedMultiplier, current.hasConfig)){
|
||||
if(current.hasConfig){
|
||||
Call.onTileConfig(null, tile, current.config);
|
||||
Call.onTileConfig(null, tile.entity, current.config);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ abstract class FireComp implements Timedc, Posc, Firec{
|
||||
}
|
||||
|
||||
if(baseFlammability < 0 || block != tile.block()){
|
||||
baseFlammability = tile.getFlammability();
|
||||
baseFlammability = tile.entity == null ? 0 : tile.entity.getFlammability();
|
||||
block = tile.block();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, DrawLayerGroundc{
|
||||
Tilec core = closestCore();
|
||||
|
||||
if(core != null && mineTile != null && mineTile.drop() != null && !acceptsItem(mineTile.drop()) && dst(core) < mineTransferRange){
|
||||
int accepted = core.tile().block().acceptStack(core.tile(), item(), stack().amount, this);
|
||||
int accepted = core.acceptStack(item(), stack().amount, this);
|
||||
if(accepted > 0){
|
||||
Call.transferItemTo(item(), accepted,
|
||||
mineTile.worldx() + Mathf.range(tilesize / 2f),
|
||||
@@ -60,7 +60,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, DrawLayerGroundc{
|
||||
if(mineTimer >= 50f + item.hardness*10f){
|
||||
mineTimer = 0;
|
||||
|
||||
if(dst(core) < mineTransferRange && core.tile().block().acceptStack(core.tile(), item, 1, this) == 1 && offloadImmediately()){
|
||||
if(dst(core) < mineTransferRange && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){
|
||||
Call.transferItemTo(item, 1,
|
||||
mineTile.worldx() + Mathf.range(tilesize / 2f),
|
||||
mineTile.worldy() + Mathf.range(tilesize / 2f), core.tile());
|
||||
|
||||
@@ -78,7 +78,7 @@ abstract class PuddleComp implements Posc, DrawLayerFloorOverc, Puddlec{
|
||||
}
|
||||
});
|
||||
|
||||
if(liquid.temperature > 0.7f && (tile.link().entity != null) && Mathf.chance(0.3 * Time.delta())){
|
||||
if(liquid.temperature > 0.7f && (tile.entity != null) && Mathf.chance(0.3 * Time.delta())){
|
||||
Fires.create(tile);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,9 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
|
||||
if(tile != null){
|
||||
//unit block update
|
||||
tile.unitOn(this);
|
||||
if(tile.entity != null){
|
||||
tile.entity.unitOn(this);
|
||||
}
|
||||
|
||||
//apply damage
|
||||
if(floor.damageTaken > 0f){
|
||||
|
||||
Reference in New Issue
Block a user