Upgradeable cores

This commit is contained in:
Anuken
2020-06-27 19:16:39 -04:00
parent 313cadb763
commit 80332e37d5
63 changed files with 365 additions and 290 deletions

View File

@@ -47,16 +47,16 @@ public class SectorDamage{
float resultDamage = currDamage;
//damage the tile if it's not friendly
if(other.entity != null && other.team() != state.rules.waveTeam){
resultDamage -= other.entity.health();
if(other.build != null && other.team() != state.rules.waveTeam){
resultDamage -= other.build.health();
if(direct){
other.entity.damage(currDamage);
other.build.damage(currDamage);
}else{ //indirect damage happens at game load time
other.entity.health(other.entity.health() - currDamage);
other.build.health(other.build.health() - currDamage);
//remove the block when destroyed
if(other.entity.health() < 0){
if(other.build.health() < 0){
//rubble currently disabled
//if(!other.floor().solid && !other.floor().isLiquid && Mathf.chance(0.4)){
// Effects.rubble(other.entity.x(), other.entity.y(), other.block().size);

View File

@@ -21,7 +21,7 @@ public class RandomItemFilter extends GenerateFilter{
if(tile.block() instanceof StorageBlock && !(tile.block() instanceof CoreBlock)){
for(ItemStack stack : drops){
if(Mathf.chance(chance)){
tile.entity.items.add(stack.item, Math.min(Mathf.random(stack.amount), tile.block().itemCapacity));
tile.build.items.add(stack.item, Math.min(Mathf.random(stack.amount), tile.block().itemCapacity));
}
}
}

View File

@@ -63,7 +63,7 @@ public class BaseGenerator{
Schematics.placeLoadout(coreschem.schematic, tile.x, tile.y, team, coreschem.required instanceof Item ? ores.get((Item)coreschem.required) : Blocks.oreCopper);
//fill core with every type of item (even non-material)
Building entity = tile.entity;
Building entity = tile.build;
for(Item item : content.items()){
entity.items.add(item, entity.block().itemCapacity);
}
@@ -130,9 +130,11 @@ public class BaseGenerator{
}
public void postGenerate(){
if(tiles == null) return;
for(Tile tile : tiles){
if(tile.isCenter() && tile.block() instanceof PowerNode){
tile.entity.placed();
tile.build.placed();
}
}
}

View File

@@ -34,7 +34,7 @@ public class FileMapGenerator implements WorldGenerator{
if(tile.block() instanceof StorageBlock && !(tile.block() instanceof CoreBlock) && state.hasSector()){
for(Content content : state.getSector().data.resources){
if(content instanceof Item && Mathf.chance(0.3)){
tile.entity.items.add((Item)content, Math.min(Mathf.random(500), tile.block().itemCapacity));
tile.build.items.add((Item)content, Math.min(Mathf.random(500), tile.block().itemCapacity));
}
}
}

View File

@@ -293,6 +293,8 @@ public class TODOPlanetGenerator extends PlanetGenerator{
@Override
public void postGenerate(Tiles tiles){
basegen.postGenerate();
if(sector.hasEnemyBase()){
basegen.postGenerate();
}
}
}