fix: reset knocked state when dying & all teammates are knocked
This commit is contained in:
parent
4e02f61903
commit
6194487c49
2 changed files with 10 additions and 13 deletions
|
@ -28,4 +28,11 @@ public class KnockdownsUtils {
|
||||||
player.damage(/*Objects.requireNonNullElse(recent, */player.getDamageSources().generic()/*)*/, damage);
|
player.damage(/*Objects.requireNonNullElse(recent, */player.getDamageSources().generic()/*)*/, damage);
|
||||||
player.velocityModified = false;
|
player.velocityModified = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void resetKnockedState(IKnockableDown knockable) {
|
||||||
|
knockable.set_KnockedDown(false);
|
||||||
|
knockable.set_ReviverCount(0);
|
||||||
|
knockable.set_ReviveTimer(KnockdownsCommon.REVIVE_WAIT_TIME);
|
||||||
|
knockable.set_KnockedAge(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,15 +41,8 @@ public class KnockdownsEvents {
|
||||||
|
|
||||||
ServerPlayerEntity player = (ServerPlayerEntity) entity;
|
ServerPlayerEntity player = (ServerPlayerEntity) entity;
|
||||||
|
|
||||||
if (KnockdownsUtils.allTeammatesKnocked(server, player)) {
|
if (knockable.is_KnockedDown() || KnockdownsUtils.allTeammatesKnocked(server, player)) {
|
||||||
return EventResult.pass();
|
KnockdownsUtils.resetKnockedState(knockable);
|
||||||
}
|
|
||||||
|
|
||||||
if (knockable.is_KnockedDown()) {
|
|
||||||
knockable.set_KnockedDown(false);
|
|
||||||
knockable.set_ReviverCount(0);
|
|
||||||
knockable.set_ReviveTimer(KnockdownsCommon.REVIVE_WAIT_TIME);
|
|
||||||
knockable.set_KnockedAge(0);
|
|
||||||
|
|
||||||
return EventResult.pass();
|
return EventResult.pass();
|
||||||
}
|
}
|
||||||
|
@ -101,10 +94,7 @@ public class KnockdownsEvents {
|
||||||
knockable.set_ReviveTimer(knockable.get_ReviveTimer() - knockable.get_ReviverCount());
|
knockable.set_ReviveTimer(knockable.get_ReviveTimer() - knockable.get_ReviverCount());
|
||||||
|
|
||||||
if (knockable.get_ReviveTimer() <= 0) {
|
if (knockable.get_ReviveTimer() <= 0) {
|
||||||
knockable.set_KnockedDown(false);
|
KnockdownsUtils.resetKnockedState(knockable);
|
||||||
knockable.set_ReviverCount(0);
|
|
||||||
knockable.set_ReviveTimer(KnockdownsCommon.REVIVE_WAIT_TIME);
|
|
||||||
knockable.set_KnockedAge(0);
|
|
||||||
|
|
||||||
player.setInvulnerable(false);
|
player.setInvulnerable(false);
|
||||||
player.setGlowing(false);
|
player.setGlowing(false);
|
||||||
|
|
Loading…
Reference in a new issue