mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-17 19:39:17 +00:00
MissileSilo cooldown (#309)
changed the sam cooldown to be a general cooldown function and added a missilesilo cooldown The function either adds the current tick as the starting point of the cooldown or sets the cooldown to null and updates the unit. That way getcooldown function can be used to get back the tick the cooldown was started and can be compared to the cooldown set in the config. changed the sam test / added a missilesilo test --------- Co-authored-by: evanpelle <evanpelle@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import anchorIcon from "../../../../resources/images/buildings/port1.png";
|
||||
import missileSiloIcon from "../../../../resources/images/buildings/silo1.png";
|
||||
import SAMMissileIcon from "../../../../resources/images/buildings/silo4.png";
|
||||
import SAMMissileReloadingIcon from "../../../../resources/images/buildings/silo4-reloading.png";
|
||||
import MissileSiloReloadingIcon from "../../../../resources/images/buildings/silo1-reloading.png";
|
||||
import shieldIcon from "../../../../resources/images/buildings/fortAlt2.png";
|
||||
import cityIcon from "../../../../resources/images/buildings/cityAlt1.png";
|
||||
import { GameView, UnitView } from "../../../core/game/GameView";
|
||||
@@ -90,6 +91,12 @@ export class StructureLayer implements Layer {
|
||||
territoryRadius: 6.525,
|
||||
borderType: UnitBorderType.Square,
|
||||
});
|
||||
this.loadIcon("reloadingSilo", {
|
||||
icon: MissileSiloReloadingIcon,
|
||||
borderRadius: 8.525,
|
||||
territoryRadius: 6.525,
|
||||
borderType: UnitBorderType.Square,
|
||||
});
|
||||
}
|
||||
|
||||
private loadIcon(unitType: string, config: UnitRenderConfig) {
|
||||
@@ -215,12 +222,18 @@ export class StructureLayer implements Layer {
|
||||
const config = this.unitConfigs[unitType];
|
||||
let icon: ImageData;
|
||||
|
||||
if (unitType == UnitType.SAMLauncher && unit.isSamCooldown()) {
|
||||
if (unitType == UnitType.SAMLauncher && unit.isCooldown()) {
|
||||
icon = this.unitIcons.get("reloadingSam");
|
||||
} else {
|
||||
icon = this.unitIcons.get(iconType);
|
||||
}
|
||||
|
||||
if (unitType == UnitType.MissileSilo && unit.isCooldown()) {
|
||||
icon = this.unitIcons.get("reloadingSilo");
|
||||
} else {
|
||||
icon = this.unitIcons.get(iconType);
|
||||
}
|
||||
|
||||
if (!config || !icon) return;
|
||||
|
||||
const drawFunction = this.getDrawFN(config.borderType);
|
||||
@@ -235,7 +248,13 @@ export class StructureLayer implements Layer {
|
||||
if (!unit.isActive()) return;
|
||||
|
||||
let borderColor = this.theme.borderColor(unit.owner());
|
||||
if (unitType == UnitType.SAMLauncher && unit.isSamCooldown()) {
|
||||
if (unitType == UnitType.SAMLauncher && unit.isCooldown()) {
|
||||
borderColor = reloadingColor;
|
||||
} else if (unit.type() == UnitType.Construction) {
|
||||
borderColor = underConstructionColor;
|
||||
}
|
||||
|
||||
if (unitType == UnitType.MissileSilo && unit.isCooldown()) {
|
||||
borderColor = reloadingColor;
|
||||
} else if (unit.type() == UnitType.Construction) {
|
||||
borderColor = underConstructionColor;
|
||||
|
||||
Reference in New Issue
Block a user