New system for Serpulo sector loss (WIP)

This commit is contained in:
Anuken
2025-09-07 14:14:24 -04:00
parent a20cfcf9ea
commit 8cb528264b
20 changed files with 176 additions and 98 deletions

View File

@@ -92,26 +92,21 @@ public class Build{
//repair derelict tile
if(tile.team() == Team.derelict && team != Team.derelict && tile.block == result && tile.build != null && tile.block.allowDerelictRepair && state.rules.derelictRepair){
float healthf = tile.build.healthf();
var config = tile.build.config();
tile.setBlock(result, team, rotation);
tile.build.rotation = rotation;
tile.build.changeTeam(team);
tile.build.enabled = true;
tile.build.checkAllowUpdate();
tile.build.onRepaired();
if(unit != null && unit.getControllerName() != null) tile.build.lastAccessed = unit.getControllerName();
if(config != null){
tile.build.configured(unit, config);
}
//keep health
tile.build.health = result.health * healthf;
if(fogControl.isVisibleTile(team, tile.x, tile.y)){
result.placeEffect.at(tile.drawx(), tile.drawy(), result.size);
Fx.rotateBlock.at(tile.build.x, tile.build.y, tile.build.block.size);
//doesn't play a sound
}
Events.fire(new BlockBuildEndEvent(tile, unit, team, false, config));
Events.fire(new BlockBuildEndEvent(tile, unit, team, false, tile.build.config()));
return;
}
@@ -168,8 +163,8 @@ public class Build{
}
/** @return whether a tile can be placed at this location by this team. */
public static boolean validPlace(Block type, Team team, int x, int y, int rotation, boolean checkVisible, boolean ignoreCoreRadius){
return validPlaceIgnoreUnits(type, team, x, y, rotation, checkVisible, ignoreCoreRadius) && checkNoUnitOverlap(type, x, y);
public static boolean validPlace(Block type, Team team, int x, int y, int rotation, boolean checkVisible, boolean checkCoreRadius){
return validPlaceIgnoreUnits(type, team, x, y, rotation, checkVisible, checkCoreRadius) && checkNoUnitOverlap(type, x, y);
}
/** @return whether a tile can be placed at this location by this team. */

View File

@@ -0,0 +1,11 @@
package mindustry.world;
/** Parameters for loading or generating a world. */
public class WorldParams{
/** For sectors: World generator seed offset. */
public int seedOffset;
/** For sectors: Whether to save the info once the map is generated. A value of 'false' is used for editor generation. */
public boolean saveInfo = true;
/** Position in packed x/y format - not array format. Overrides the core position when generating with a FileMapGenerator. 0 to disable. */
public int corePositionOverride;
}

View File

@@ -283,6 +283,12 @@ public class Turret extends ReloadTurret{
}
}
//overridden so that the rotation isn't affected during repairs (standard placed() code isn't called)
@Override
public void onRepaired(){
super.placed();
}
@Override
public void remove(){
super.remove();
@@ -519,7 +525,7 @@ public class Turret extends ReloadTurret{
}
if(validateTarget()){
boolean canShoot = true;
boolean canShoot;
if(isControlled()){ //player behavior
targetPos.set(unit.aimX(), unit.aimY());