Merge branch 'master' of https://github.com/Anuken/Mindustry into 7.0-features

 Conflicts:
	core/src/mindustry/content/Planets.java
	tools/src/mindustry/tools/Generators.java
This commit is contained in:
Anuken
2021-10-20 10:45:51 -04:00
78 changed files with 585 additions and 156 deletions
@@ -18,7 +18,7 @@ abstract class BlockUnitComp implements Unitc{
//sets up block stats
maxHealth(tile.block.health);
health(tile.health());
health(tile.health);
hitSize(tile.block.size * tilesize * 0.7f);
set(tile);
}
@@ -291,7 +291,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
public byte relativeTo(Building tile){
return relativeTo(tile.tile());
return relativeTo(tile.tile);
}
public byte relativeToEdge(Tile other){
@@ -413,25 +413,28 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
public void handleUnitPayload(Unit player, Cons<Payload> grabber){
Fx.spawn.at(player);
public void handleUnitPayload(Unit unit, Cons<Payload> grabber){
Fx.spawn.at(unit);
if(player.isPlayer()){
player.getPlayer().clearUnit();
if(unit.isPlayer()){
unit.getPlayer().clearUnit();
}
player.remove();
grabber.get(new UnitPayload(player));
Fx.unitDrop.at(player);
if(Vars.net.client()){
Vars.netClient.clearRemovedEntity(player.id);
}
unit.remove();
//needs new ID as it is now a payload
unit.id = EntityGroup.nextId();
grabber.get(new UnitPayload(unit));
Fx.unitDrop.at(unit);
}
public boolean canUnload(){
return block.unloadable;
}
public boolean payloadCheck(int conveyorRotation){
return block.rotate && (rotation + 2) % 4 == conveyorRotation;
}
/** Called when an unloader takes an item. */
public void itemTaken(Item item){
@@ -920,6 +923,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
drawTeamTop();
}
public void payloadDraw(){
draw();
}
public void drawTeamTop(){
if(block.teamRegion.found()){
if(block.teamRegions[team.id] == block.teamRegion) Draw.color(team.color);
@@ -971,6 +978,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
}
}
/** @return whether this building is in a payload */
public boolean isPayload(){
return tile == emptyTile;
}
/**
* Called when a block is placed over some other blocks. This seq will always have at least one item.
* Should load some previous state, if necessary. */
@@ -1059,7 +1071,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
for(int i = 0; i < Mathf.clamp(amount / 5, 0, 30); i++){
Time.run(i / 2f, () -> {
Tile other = world.tile(tileX() + Mathf.range(block.size / 2), tileY() + Mathf.range(block.size / 2));
Tile other = world.tileWorld(x + Mathf.range(block.size * tilesize / 2), y + Mathf.range(block.size * tilesize / 2));
if(other != null){
Puddles.deposit(other, liquid, splash);
}
@@ -36,7 +36,7 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{
@Override
@Replace
public int pathType(){
return type.allowLegStep ? Pathfinder.costGround : Pathfinder.costLegs;
return type.allowLegStep ? Pathfinder.costLegs : Pathfinder.costGround;
}
@Override
@@ -61,6 +61,7 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
void pickup(Building tile){
tile.pickedUp();
tile.tile.remove();
tile.tile = Vars.emptyTile;
payloads.add(new BuildPayload(tile));
Fx.unitPickup.at(tile);
Events.fire(new PickupEvent(self(), tile));