mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-03-11 09:20:51 -07:00
Bugfix: shieldarc unit removal on multiplayer (#11634)
* Bugfix: shieldarc unit removal on multiplayer * update description * Update core/src/mindustry/entities/Units.java Co-authored-by: Jason <131086642+JasonP01@users.noreply.github.com> --------- Co-authored-by: Jason <131086642+JasonP01@users.noreply.github.com>
This commit is contained in:
parent
88f1e0c4af
commit
b2aefdd4cf
2 changed files with 17 additions and 8 deletions
|
|
@ -100,6 +100,17 @@ public class Units{
|
|||
unit.remove();
|
||||
}
|
||||
|
||||
/** Removes a unit after spawning the death effects. */
|
||||
@Remote(called = Loc.server)
|
||||
public static void unitSafeDeath(Unit unit){
|
||||
if(unit == null) return;
|
||||
unit.type.deathExplosionEffect.at(unit.x, unit.y, unit.hitSize / 8f);
|
||||
float shake = unit.type.deathShake < 0 ? unit.hitSize / 3f : unit.type.deathShake;
|
||||
Effect.shake(shake, shake, unit);
|
||||
unit.type.deathSound.at(unit, 1f, unit.type.deathSoundVolume);
|
||||
unit.remove();
|
||||
}
|
||||
|
||||
/** @return whether a new instance of a unit of this team can be created. */
|
||||
public static boolean canCreate(Team team, UnitType type){
|
||||
return !type.useUnitCap || (team.data().countType(type) < getCap(team) && !type.isBanned());
|
||||
|
|
|
|||
|
|
@ -80,13 +80,10 @@ public class ShieldArcAbility extends Ability{
|
|||
(Tmp.v1.set(unit).add(unit.deltaX, unit.deltaY).within(paramPos, paramField.radius + paramField.width) || unit.within(paramPos, paramField.radius + paramField.width)) &&
|
||||
(Angles.within(paramPos.angleTo(unit), paramUnit.rotation + paramField.angleOffset, paramField.angle / 2f) || Angles.within(paramPos.angleTo(unit.x + unit.deltaX, unit.y + unit.deltaY), paramUnit.rotation + paramField.angleOffset, paramField.angle / 2f))){
|
||||
|
||||
if(unit.isMissile() && unit.killable() && paramField.missileUnitMultiplier >= 0f){
|
||||
|
||||
unit.remove();
|
||||
unit.type.deathSound.at(unit);
|
||||
unit.type.deathExplosionEffect.at(unit);
|
||||
if(unit.isMissile() && paramField.missileUnitMultiplier >= 0f){
|
||||
Call.unitSafeDeath(unit);
|
||||
Fx.absorb.at(unit);
|
||||
Fx.circleColorSpark.at(unit.x, unit.y,paramUnit.team.color);
|
||||
paramField.pushEffect.at(unit.x, unit.y,paramUnit.team.color);
|
||||
|
||||
// consider missile hp and gamerule to damage the shield
|
||||
paramField.data -= unit.health() * paramField.missileUnitMultiplier * Vars.state.rules.unitDamage(unit.team);
|
||||
|
|
@ -103,8 +100,8 @@ public class ShieldArcAbility extends Ability{
|
|||
// get out
|
||||
unit.move(Tmp.v1.set(unit).sub(paramUnit).setLength(overlapDst + 0.01f));
|
||||
|
||||
if(Mathf.chanceDelta(0.5f*Time.delta)){
|
||||
Fx.circleColorSpark.at(unit.x,unit.y,paramUnit.team.color);
|
||||
if(Mathf.chanceDelta(0.3f * Time.delta)){
|
||||
paramField.pushEffect.at(unit.x, unit.y, paramUnit.team.color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -153,6 +150,7 @@ public class ShieldArcAbility extends Ability{
|
|||
public boolean offsetRegion = false;
|
||||
/** If true, enemy units are pushed out. */
|
||||
public boolean pushUnits = true;
|
||||
public Effect pushEffect = Fx.circleColorSpark;
|
||||
|
||||
/** State. */
|
||||
protected float widthScale, alpha;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue