mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-10 07:07:03 +07:00
Cleanup & bugfixes
This commit is contained in:
parent
593a7b060c
commit
a342a7d638
@ -81,13 +81,6 @@ public class Logic implements ApplicationListener{
|
||||
state.wavetime = state.rules.waveSpacing;
|
||||
|
||||
SectorDamage.applyCalculatedDamage();
|
||||
|
||||
//make sure damaged buildings are counted
|
||||
for(Tile tile : world.tiles){
|
||||
if(tile.build != null && tile.build.damaged()){
|
||||
indexer.notifyTileDamaged(tile.build);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//reset values
|
||||
|
@ -569,7 +569,7 @@ public class LExecutor{
|
||||
int address = exec.numi(position);
|
||||
Building from = exec.building(target);
|
||||
|
||||
if(from instanceof MemoryBuild mem){
|
||||
if(from instanceof MemoryBuild mem && from.team == exec.team){
|
||||
|
||||
exec.setnum(output, address < 0 || address >= mem.memory.length ? 0 : mem.memory[address]);
|
||||
}
|
||||
@ -593,7 +593,7 @@ public class LExecutor{
|
||||
int address = exec.numi(position);
|
||||
Building from = exec.building(target);
|
||||
|
||||
if(from instanceof MemoryBuild mem){
|
||||
if(from instanceof MemoryBuild mem && from.team == exec.team){
|
||||
|
||||
if(address >= 0 && address < mem.memory.length){
|
||||
mem.memory[address] = exec.num(value);
|
||||
@ -620,7 +620,7 @@ public class LExecutor{
|
||||
Object target = exec.obj(from);
|
||||
Object sense = exec.obj(type);
|
||||
|
||||
//TODO should remote enemy buildings be senseable?
|
||||
//note that remote units/buildings can be sensed as well
|
||||
if(target instanceof Senseable se){
|
||||
if(sense instanceof Content){
|
||||
exec.setnum(to, se.sense(((Content)sense)));
|
||||
@ -857,8 +857,7 @@ public class LExecutor{
|
||||
//graphics on headless servers are useless.
|
||||
if(Vars.headless) return;
|
||||
|
||||
Building build = exec.building(target);
|
||||
if(build instanceof LogicDisplayBuild d){
|
||||
if(exec.building(target) instanceof LogicDisplayBuild d && d.team == exec.team){
|
||||
if(d.commands.size + exec.graphicsBuffer.size < maxDisplayBuffer){
|
||||
for(int i = 0; i < exec.graphicsBuffer.size; i++){
|
||||
d.commands.addLast(exec.graphicsBuffer.items[i]);
|
||||
@ -920,8 +919,7 @@ public class LExecutor{
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
|
||||
Building build = exec.building(target);
|
||||
if(build instanceof MessageBuild d){
|
||||
if(exec.building(target) instanceof MessageBuild d && d.team == exec.team){
|
||||
|
||||
d.message.setLength(0);
|
||||
d.message.append(exec.textBuffer, 0, Math.min(exec.textBuffer.length(), maxTextBuffer));
|
||||
|
@ -24,7 +24,7 @@ public class SectorDamage{
|
||||
public static final int maxRetWave = 40, maxWavesSimulated = 50;
|
||||
|
||||
//direct damage is for testing only
|
||||
private static final boolean direct = false, rubble = true;
|
||||
private static final boolean rubble = true;
|
||||
|
||||
/** @return calculated capture progress of the enemy */
|
||||
public static float getDamage(SectorInfo info){
|
||||
@ -225,7 +225,6 @@ public class SectorDamage{
|
||||
|
||||
//create sparse tile array for fast range query
|
||||
int sparseSkip = 5, sparseSkip2 = 3;
|
||||
//TODO if this is slow, use a quadtree
|
||||
Seq<Tile> sparse = new Seq<>(path.size / sparseSkip + 1);
|
||||
Seq<Tile> sparse2 = new Seq<>(path.size / sparseSkip2 + 1);
|
||||
|
||||
@ -485,23 +484,21 @@ public class SectorDamage{
|
||||
if(other.build != null && other.team() != state.rules.waveTeam){
|
||||
resultDamage -= other.build.health();
|
||||
|
||||
if(direct){
|
||||
other.build.damage(currDamage);
|
||||
}else{ //indirect damage happens at game load time
|
||||
other.build.health -= currDamage;
|
||||
//don't kill the core!
|
||||
if(other.block() instanceof CoreBlock) other.build.health = Math.max(other.build.health, 1f);
|
||||
other.build.health -= currDamage;
|
||||
//don't kill the core!
|
||||
if(other.block() instanceof CoreBlock) other.build.health = Math.max(other.build.health, 1f);
|
||||
|
||||
//remove the block when destroyed
|
||||
if(other.build.health < 0){
|
||||
//rubble
|
||||
if(rubble && !other.floor().solid && !other.floor().isLiquid && Mathf.chance(0.4)){
|
||||
Effect.rubble(other.build.x, other.build.y, other.block().size);
|
||||
}
|
||||
|
||||
other.build.addPlan(false);
|
||||
other.remove();
|
||||
//remove the block when destroyed
|
||||
if(other.build.health < 0){
|
||||
//rubble
|
||||
if(rubble && !other.floor().solid && !other.floor().isLiquid && Mathf.chance(0.4)){
|
||||
Effect.rubble(other.build.x, other.build.y, other.block().size);
|
||||
}
|
||||
|
||||
other.build.addPlan(false);
|
||||
other.remove();
|
||||
}else{
|
||||
indexer.notifyTileDamaged(other.build);
|
||||
}
|
||||
|
||||
}else if(other.solid() && !other.synthetic()){ //skip damage propagation through solid blocks
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=f89e6a465fe9d139bd192960c2ebdff33c2af86a
|
||||
archash=25dcd2f7664f3c5a669447fdf8dffaea7e65fe0d
|
||||
|
Loading…
Reference in New Issue
Block a user