mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Add cheat option to capture bases.
Capturing bases is sometimes really annoying because of the DCS unit AI and our non-optimal ground victory heuristics. Add a cheat option to allow the player to move on without the tedium.
This commit is contained in:
@@ -148,6 +148,9 @@ class Base:
|
||||
elif self.strength <= 0:
|
||||
self.strength = BASE_MIN_STRENGTH
|
||||
|
||||
def set_strength_to_minimum(self) -> None:
|
||||
self.strength = BASE_MIN_STRENGTH
|
||||
|
||||
def scramble_count(self, multiplier: float, task: Task = None) -> int:
|
||||
if task:
|
||||
count = sum([v for k, v in self.aircraft.items() if db.unit_task(k) == task])
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
from typing import Dict, List
|
||||
from typing import Dict, List, TYPE_CHECKING
|
||||
from enum import Enum
|
||||
|
||||
from dcs.mapping import Point
|
||||
@@ -17,6 +19,9 @@ from .base import Base
|
||||
from .missiontarget import MissionTarget
|
||||
from .theatergroundobject import TheaterGroundObject
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from game import Game
|
||||
|
||||
|
||||
class ControlPointType(Enum):
|
||||
AIRBASE = 0 # An airbase with slots for everything
|
||||
@@ -207,3 +212,26 @@ class ControlPoint(MissionTarget):
|
||||
|
||||
def is_friendly(self, to_player: bool) -> bool:
|
||||
return self.captured == to_player
|
||||
|
||||
def capture(self, game: Game, for_player: bool) -> None:
|
||||
if for_player:
|
||||
self.captured = True
|
||||
faction_name = game.player_name
|
||||
else:
|
||||
self.captured = False
|
||||
faction_name = game.enemy_name
|
||||
|
||||
self.base.set_strength_to_minimum()
|
||||
|
||||
self.base.aircraft = {}
|
||||
self.base.armor = {}
|
||||
|
||||
# Handle cyclic dependency.
|
||||
from .start_generator import generate_airbase_defense_group
|
||||
airbase_def_id = 0
|
||||
for ground_object in self.ground_objects:
|
||||
ground_object.groups = []
|
||||
if ground_object.airbase_group and faction_name != "":
|
||||
generate_airbase_defense_group(airbase_def_id, ground_object,
|
||||
faction_name, game, self)
|
||||
airbase_def_id = airbase_def_id + 1
|
||||
|
||||
Reference in New Issue
Block a user