mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 02:24:36 +00:00
add re-fire delay for beta testing
This commit is contained in:
@@ -139,6 +139,7 @@ export interface Config {
|
||||
safeFromPiratesCooldownMax(): number;
|
||||
defensePostRange(): number;
|
||||
SAMCooldown(): number;
|
||||
samRefireDelayTicks(): number;
|
||||
SiloCooldown(): number;
|
||||
minDistanceBetweenPlayers(): number;
|
||||
defensePostDefenseBonus(): number;
|
||||
|
||||
@@ -203,6 +203,11 @@ export class DefaultConfig implements Config {
|
||||
SAMCooldown(): number {
|
||||
return 75;
|
||||
}
|
||||
samRefireDelayTicks(): number {
|
||||
// Beta testing: adjust this constant to tune the delay before a SAM can
|
||||
// refire at a nuke whose interceptor was destroyed. 0 = instant refire.
|
||||
return 5;
|
||||
}
|
||||
SiloCooldown(): number {
|
||||
return 75;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ export class SAMMissileExecution implements Execution {
|
||||
private SAMMissile: Unit | undefined;
|
||||
private mg: Game;
|
||||
private speed: number = 0;
|
||||
private refireDelayRemaining: number | null = null;
|
||||
|
||||
constructor(
|
||||
private spawn: TileRef,
|
||||
@@ -39,8 +40,13 @@ export class SAMMissileExecution implements Execution {
|
||||
{},
|
||||
);
|
||||
if (!this.SAMMissile.isActive()) {
|
||||
// Interceptor was destroyed (e.g. by nuke blast) — allow SAMs to re-target this nuke
|
||||
// Interceptor was destroyed (e.g. by nuke blast) — allow SAMs to re-target this nuke after delay
|
||||
if (this.target.isActive()) {
|
||||
this.refireDelayRemaining ??= this.mg.config().samRefireDelayTicks();
|
||||
if (this.refireDelayRemaining > 0) {
|
||||
this.refireDelayRemaining--;
|
||||
return;
|
||||
}
|
||||
this.target.setTargetedBySAM(false);
|
||||
// Notify defender their interceptor was destroyed
|
||||
this.mg.displayMessage(
|
||||
|
||||
Reference in New Issue
Block a user