mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix income not correctly calculated
- Fix the Income class to correctly count the income with the recent ground object refactoring - Adjust the Factory income from 10 to 2.5 as we now have 4 units instead of 1 as with v5.2 closes #2207
This commit is contained in:
parent
244425381d
commit
00dc8df0de
@ -11,7 +11,7 @@ REWARDS = {
|
|||||||
"farp": 1,
|
"farp": 1,
|
||||||
# TODO: Should generate no cash once they generate units.
|
# TODO: Should generate no cash once they generate units.
|
||||||
# https://github.com/dcs-liberation/dcs_liberation/issues/1036
|
# https://github.com/dcs-liberation/dcs_liberation/issues/1036
|
||||||
"factory": 10,
|
"factory": 2.5,
|
||||||
"oil": 10,
|
"oil": 10,
|
||||||
"derrick": 8,
|
"derrick": 8,
|
||||||
"village": 0.25,
|
"village": 0.25,
|
||||||
|
|||||||
@ -30,25 +30,21 @@ class Income:
|
|||||||
self.control_points = []
|
self.control_points = []
|
||||||
self.buildings = []
|
self.buildings = []
|
||||||
|
|
||||||
names = set()
|
|
||||||
for cp in game.theater.control_points_for(player):
|
for cp in game.theater.control_points_for(player):
|
||||||
if cp.income_per_turn:
|
if cp.income_per_turn:
|
||||||
self.control_points.append(cp)
|
self.control_points.append(cp)
|
||||||
for tgo in cp.ground_objects:
|
|
||||||
names.add(tgo.obj_name)
|
|
||||||
|
|
||||||
for name in names:
|
for tgo in cp.ground_objects:
|
||||||
count = 0
|
if tgo.category not in REWARDS:
|
||||||
tgos = game.theater.find_ground_objects_by_obj_name(name)
|
continue
|
||||||
category = tgos[0].category
|
self.buildings.append(
|
||||||
if category not in REWARDS:
|
BuildingIncome(
|
||||||
continue
|
tgo.obj_name,
|
||||||
for tgo in tgos:
|
tgo.category,
|
||||||
if not tgo.is_dead:
|
len(list(tgo.statics)),
|
||||||
count += 1
|
REWARDS[tgo.category],
|
||||||
self.buildings.append(
|
)
|
||||||
BuildingIncome(name, category, count, REWARDS[category])
|
)
|
||||||
)
|
|
||||||
|
|
||||||
self.from_bases = sum(cp.income_per_turn for cp in self.control_points)
|
self.from_bases = sum(cp.income_per_turn for cp in self.control_points)
|
||||||
self.total_buildings = sum(b.income for b in self.buildings)
|
self.total_buildings = sum(b.income for b in self.buildings)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user