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.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;
|
||||
|
||||
if (KnockdownsUtils.allTeammatesKnocked(server, player)) {
|
||||
return EventResult.pass();
|
||||
}
|
||||
|
||||
if (knockable.is_KnockedDown()) {
|
||||
knockable.set_KnockedDown(false);
|
||||
knockable.set_ReviverCount(0);
|
||||
knockable.set_ReviveTimer(KnockdownsCommon.REVIVE_WAIT_TIME);
|
||||
knockable.set_KnockedAge(0);
|
||||
if (knockable.is_KnockedDown() || KnockdownsUtils.allTeammatesKnocked(server, player)) {
|
||||
KnockdownsUtils.resetKnockedState(knockable);
|
||||
|
||||
return EventResult.pass();
|
||||
}
|
||||
|
@ -101,10 +94,7 @@ public class KnockdownsEvents {
|
|||
knockable.set_ReviveTimer(knockable.get_ReviveTimer() - knockable.get_ReviverCount());
|
||||
|
||||
if (knockable.get_ReviveTimer() <= 0) {
|
||||
knockable.set_KnockedDown(false);
|
||||
knockable.set_ReviverCount(0);
|
||||
knockable.set_ReviveTimer(KnockdownsCommon.REVIVE_WAIT_TIME);
|
||||
knockable.set_KnockedAge(0);
|
||||
KnockdownsUtils.resetKnockedState(knockable);
|
||||
|
||||
player.setInvulnerable(false);
|
||||
player.setGlowing(false);
|
||||
|
|
Loading…
Reference in a new issue