mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-23 19:25:16 +00:00
Added custom disable settings (#593)
## Description: I will write an issue later as I don't have time.  <img width="735" alt="スクリーンショット 2025-04-23 22 04 40" src="https://github.com/user-attachments/assets/24bb3461-8e05-418c-8dbf-2ba1a624fe27" /> <img width="790" alt="スクリーンショット 2025-04-23 22 04 47" src="https://github.com/user-attachments/assets/33387200-d0af-4394-9d60-af1f88a036e9" /> ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: aotumuri
This commit is contained in:
@@ -709,6 +709,12 @@ export class PlayerImpl implements Player {
|
||||
spawnTile: TileRef,
|
||||
unitSpecificInfos: UnitSpecificInfos = {},
|
||||
): UnitImpl {
|
||||
if (this.mg.config().isUnitDisabled(type)) {
|
||||
throw new Error(
|
||||
`Attempted to build disabled unit ${type} at tile ${spawnTile} by player ${this.name()}`,
|
||||
);
|
||||
}
|
||||
|
||||
const cost = this.mg.unitInfo(type).cost(this);
|
||||
const b = new UnitImpl(
|
||||
type,
|
||||
@@ -746,19 +752,8 @@ export class PlayerImpl implements Player {
|
||||
targetTile: TileRef,
|
||||
validTiles: TileRef[] | null = null,
|
||||
): TileRef | false {
|
||||
// prevent the building of nukes and nuke related buildings
|
||||
if (this.mg.config().disableNukes()) {
|
||||
if (
|
||||
unitType === UnitType.MissileSilo ||
|
||||
unitType === UnitType.MIRV ||
|
||||
unitType === UnitType.AtomBomb ||
|
||||
unitType === UnitType.HydrogenBomb ||
|
||||
unitType === UnitType.SAMLauncher ||
|
||||
unitType === UnitType.SAMMissile ||
|
||||
unitType === UnitType.MIRVWarhead
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (this.mg.config().isUnitDisabled(unitType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const cost = this.mg.unitInfo(unitType).cost(this);
|
||||
|
||||
Reference in New Issue
Block a user