Skip to content

Commit

Permalink
Change: simplified mode - special case handling to make Medium mail a…
Browse files Browse the repository at this point in the history
…nd pax cars available, not Large
  • Loading branch information
andythenorth committed May 18, 2024
1 parent 568bcce commit a8cdb4f
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions src/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -2527,14 +2527,29 @@ def get_name_parts(self, context, unit_variant):
)
return result

@property
def joker_by_subclass_rules(self):
# rules can be over-ridden per subclass, for special handling of jokers for e.g. narrow gauge pax cars etc
return None

@property
def joker(self):
# jokers are bonus vehicles (mostly) engines which don't fit strict tech tree progression
# for cars, jokers are mid-length 'B' vehicles and/or rules from the subclass
if self.subtype == "B" or self._joker == True:
# jokers are excluded in simplified game mode
# order is significant here; this is fall through, it's deliberately not else-if
# option to set _joker per vehicle or per subclass
if self._joker == True:
return True
else:
return False

# can be over-ridden per subclass, for special handling of jokers for e.g. narrow gauge pax cars etc
if self.joker_by_subclass_rules != None:
return self.joker_by_subclass_rules

# for wagons/coaches, default jokers are medium and twin lengths, note that this may have been over-ridden by joker_by_subclass_rules above
if self.subtype in ["B", "D"]:
return True

# fall through to default result
return False


class RandomisedConsistMixin(object):
Expand Down Expand Up @@ -5598,6 +5613,17 @@ def __init__(self, **kwargs):
def loading_speed_multiplier(self):
return self.pax_car_capacity_type["loading_speed_multiplier"]

@property
def joker_by_subclass_rules(self):
# special-case handling for simplified mode with narrow gauge mail cars
# make short and medium lengths available, for flexibility
if self.base_track_type_name == "NG":
if self.subtype in ["A", "B"]:
return False
else:
return True
# return None if there are no special rules, then the default rules will be applied by the calling function
return None

class MailRailcarTrailerCarConsistBase(MailCarConsistBase):
"""
Expand Down Expand Up @@ -6032,6 +6058,17 @@ def __init__(self, **kwargs):
def loading_speed_multiplier(self):
return self.pax_car_capacity_type["loading_speed_multiplier"]

@property
def joker_by_subclass_rules(self):
# special-case handling for simplified mode with narrow gauge pax cars
if self.base_track_type_name == "NG":
if self.subtype in ["A", "B"]:
return False
else:
return True
# return None if there are no special rules, then the default rules will be applied by the calling function
return None


class PassengeRailcarTrailerCarConsistBase(PassengerCarConsistBase):
"""
Expand Down

0 comments on commit a8cdb4f

Please sign in to comment.