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

 Conflicts:
	tools/src/mindustry/tools/Generators.java
This commit is contained in:
Anuken
2021-10-14 19:15:59 -04:00
29 changed files with 435 additions and 360 deletions

View File

@@ -404,25 +404,27 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
//region handler methods
/** @return whether the player can select (but not actually control) this building. */
public boolean canControlSelect(Player player){
public boolean canControlSelect(Unit player){
return false;
}
/** Called when a player control-selects this building - not called for ControlBlock subclasses. */
public void onControlSelect(Player player){
public void onControlSelect(Unit player){
}
public void acceptPlayerPayload(Player player, Cons<Payload> grabber){
public void handleUnitPayload(Unit player, Cons<Payload> grabber){
Fx.spawn.at(player);
var unit = player.unit();
player.clearUnit();
//player.deathTimer = Player.deathDelay + 1f; //for instant respawn
unit.remove();
grabber.get(new UnitPayload(unit));
Fx.unitDrop.at(unit);
if(player.isPlayer()){
player.getPlayer().clearUnit();
}
player.remove();
grabber.get(new UnitPayload(player));
Fx.unitDrop.at(player);
if(Vars.net.client()){
Vars.netClient.clearRemovedEntity(unit.id);
Vars.netClient.clearRemovedEntity(player.id);
}
}

View File

@@ -38,6 +38,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
@Import int id;
@Import @Nullable Tile mineTile;
@Import Vec2 vel;
@Import WeaponMount[] mounts;
private UnitController controller;
UnitType type;
@@ -502,6 +503,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
Events.fire(Trigger.suicideBomb);
}
for(WeaponMount mount : mounts){
if(mount.weapon.shootOnDeath && !(mount.weapon.bullet.killShooter && mount.shoot)){
mount.reload = 0f;
mount.shoot = true;
mount.weapon.update(self(), mount);
}
}
//if this unit crash landed (was flying), damage stuff in a radius
if(type.flying && !spawnedByCore){
Damage.damage(team, x, y, Mathf.pow(hitSize, 0.94f) * 1.25f, Mathf.pow(hitSize, 0.75f) * type.crashDamageMultiplier * 5f, true, false, true);