Skip to content

Commit

Permalink
Merge branch 'inf-480-525-fo4-records-pt4' into dev
Browse files Browse the repository at this point in the history
The fourth part of my ongoing records refactoring towards Fallout 4.

A couple records (COLL, DEBR, DLBR and DLVW) have been moved to
common_records as they are entirely identical between Skyrim and Fallout
4. Beyond that, there are some renames in here as well as some
refactoring to make all games use AMelLLitems and AMelItems.

One interesting thing to note is DMGT, the first record type for which
upgrading records to the latest form version is impossible, so needed a
framework for skipping form version upgrades and a decider for handling
form versions.

New FO4 records implemented: CAMS, CLAS, CLFM, CLMT, CMPO, COBJ, COLL,
CONT, CPTH, CSTY, DEBR, DFOB, DLBR, DLVW, DMGT, DOBJ, DOOR and DUAL.

Under #480, #482 and #525.
  • Loading branch information
Infernio committed Aug 22, 2022
2 parents 57ce267 + 47d601b commit 28578a6
Show file tree
Hide file tree
Showing 29 changed files with 1,179 additions and 703 deletions.
13 changes: 11 additions & 2 deletions Mopy/Docs/Wrye Bash Advanced Readme.html
Expand Up @@ -4913,7 +4913,7 @@ <h3 id="patch-tags">Bash Tags <a class="back2top" href="#contents">Back to top</
<ul>
<li>(SNAM) Sound - Open</li>
<li>(QNAM) Sound - Close</li>
<li>(RNAM) Sound - Looping/Random - <strong>Fallout&colon; New Vegas only</strong></li>
<li>(RNAM) Sound - Random/Looping - <strong>Fallout&colon; New Vegas only</strong></li>
</ul>
</li>
<li>(CREA) Creature:
Expand Down Expand Up @@ -6359,14 +6359,23 @@ <h3 id="patch-filter">Merge Filtering <a class="back2top" href="#contents">Back
<td>Skyrim, Enderal&colon; Forgotten Stories &amp; Skyrim&colon;
Special Edition</td>
</tr>
<tr>
<td>(COBJ) Constructible Object</td>
<td>
<ul>
<li>(FVPA) Components</li>
</ul>
</td>
<td>Fallout 4</td>
</tr>
<tr>
<td>(CONT) Container</td>
<td>
<ul>
<li>(INAM) Items</li>
</ul>
</td>
<td>All but Fallout 4</td>
<td>All games</td>
</tr>
<tr>
<td>(CREA) Creature</td>
Expand Down
20 changes: 20 additions & 0 deletions Mopy/bash/brec/advanced_elements.py
Expand Up @@ -29,6 +29,7 @@
__author__ = u'Infernio'

import copy
import operator
from collections import OrderedDict
from itertools import chain

Expand Down Expand Up @@ -680,6 +681,25 @@ def _decide_common(self, record):
return all(getattr(flags_val, flag_name)
for flag_name in self._required_flags)

class FormVersionDecider(ACommonDecider):
"""Decider that checks if the record's form version against a target form
version."""
def __init__(self, comp_op, target_form_ver: int):
"""Creates a new SinceFormVersionDecider with the specified target form
version.
:param comp_op: A callable that takes two integers. The first will be
the record's form version and the second will be target_form_ver.
The return value of this callable will be what's returned by the
decider. operator.ge is an example of a valid callable here.
:param target_form_ver: The form version in which the change was
introduced."""
self._comp_op = comp_op
self._target_form_ver = target_form_ver

def _decide_common(self, record):
return self._comp_op(record.header.form_version, self._target_form_ver)

class PartialLoadDecider(ADecider):
"""Partially loads a subrecord using a given loader, then rewinds the
input stream and delegates to a given decider. Can decide at dump-time
Expand Down

0 comments on commit 28578a6

Please sign in to comment.