Updated IsSameCellPackage
This commit is contained in:
parent
ce2345d7aa
commit
fae731a9dd
@ -34,8 +34,8 @@ begin
|
|||||||
sig := Signature(referencingRecord);
|
sig := Signature(referencingRecord);
|
||||||
|
|
||||||
// Locational links are bi-directional, this script does not process them. To fix them, resave plugin in CK.
|
// Locational links are bi-directional, this script does not process them. To fix them, resave plugin in CK.
|
||||||
// WRLD records may refer to REFRs if they are large references. Being a large reference does not imply necessity of the persistence flag.
|
// WRLD records usually refer to large reference REFRs. Being a large reference does not imply necessity of the persistence flag.
|
||||||
// TES4 may refer to REFRs if they are listed in ONAM. To keep ONAM up to date, enable "Always save ONAM" in xEdit.
|
// TES4 refers to REFRs if they are listed in ONAM. To keep ONAM up to date, enable "Always save ONAM" in xEdit.
|
||||||
|
|
||||||
if (sig = 'LCTN') or (sig = 'WRLD') or (sig = 'TES4') then
|
if (sig = 'LCTN') or (sig = 'WRLD') or (sig = 'TES4') then
|
||||||
continue;
|
continue;
|
||||||
@ -45,7 +45,6 @@ begin
|
|||||||
if GetLoadOrder(GetFile(referencingRecord)) <= GetLoadOrder(GetFile(rec)) then begin
|
if GetLoadOrder(GetFile(referencingRecord)) <= GetLoadOrder(GetFile(rec)) then begin
|
||||||
|
|
||||||
// When referencing record is not referenced and it's in the same cell, the ref does not need persistence.
|
// When referencing record is not referenced and it's in the same cell, the ref does not need persistence.
|
||||||
// Does not cover long chains of linked refs.
|
|
||||||
if (ReferencedByCount(referencingRecord) = 0) then begin
|
if (ReferencedByCount(referencingRecord) = 0) then begin
|
||||||
if (sig = 'REFR') then begin
|
if (sig = 'REFR') then begin
|
||||||
if InSameCell(rec, referencingRecord) then continue;
|
if InSameCell(rec, referencingRecord) then continue;
|
||||||
@ -181,45 +180,55 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function IsSameCellPackage(package: IwbMainRecord): boolean;
|
function IsSameCellPackage(inputValues: IwbElement): boolean;
|
||||||
var
|
var
|
||||||
packageLoc, packageType: string;
|
packageLoc: string;
|
||||||
|
inputVal: IwbElement;
|
||||||
refCell, linkedRefKeyword, linkedRef: IwbMainRecord;
|
refCell, linkedRefKeyword, linkedRef: IwbMainRecord;
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
packageLoc := GetElementEditValues(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Type');
|
result := True;
|
||||||
|
|
||||||
if packageLoc <> '' then begin
|
for i := 0 to Pred(ElementCount(inputValues)) do begin
|
||||||
|
inputVal := ElementByIndex(inputValues, i);
|
||||||
|
packageLoc := GetElementEditValues(inputVal, 'PLDT\Type');
|
||||||
|
|
||||||
if (packageLoc = 'Near editor location') or (packageLoc = 'Near self') then begin
|
if packageLoc <> '' then begin
|
||||||
//AddMessage(' Skipping editor location actor: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
|
||||||
continue;
|
if (packageLoc = 'Near editor location') or (packageLoc = 'Near self') then begin
|
||||||
end
|
//AddMessage(' Skipping editor location actor: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
||||||
else if (packageLoc = 'In cell') then begin
|
continue;
|
||||||
refCell := LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Cell'));
|
end
|
||||||
if Assigned(refCell) then begin
|
else if (packageLoc = 'In cell') then begin
|
||||||
if SameRecord(refCell, LinksTo(ElementByPath(e, 'Cell'))) then continue;
|
refCell := LinksTo(ElementByPath(inputVal, 'PLDT\Cell'));
|
||||||
|
if Assigned(refCell) then begin
|
||||||
|
if SameRecord(refCell, LinksTo(ElementByPath(e, 'Cell'))) then continue;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else if (packageLoc = 'Near linked reference') then begin
|
||||||
|
linkedRefKeyword := LinksTo(ElementByPath(inputVal, 'PLDT\Keyword'));
|
||||||
|
if not IsLinkedRefRemote(e, linkedRefKeyword) then continue;
|
||||||
|
end
|
||||||
|
else if (packageLoc = 'Near reference') then begin
|
||||||
|
if InSameCell(e, LinksTo(ElementByPath(inputVal, 'PLDT\Reference'))) then continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end
|
end
|
||||||
else if (packageLoc = 'Near linked reference') then begin
|
else begin
|
||||||
linkedRefKeyword := LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Keyword'));
|
packageLoc := GetElementEditValues(inputVal, 'PTDA\Target Data\Type');
|
||||||
if not IsLinkedRefRemote(e, linkedRefKeyword) then continue;
|
|
||||||
end
|
if (packageLoc = 'Linked Reference') then begin
|
||||||
else if (packageLoc = 'Near reference') then begin
|
linkedRefKeyword := LinksTo(ElementByPath(inputVal, 'PTDA\Target Data\Reference'));
|
||||||
if InSameCell(e, LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Reference'))) then continue;
|
if not IsLinkedRefRemote(e, linkedRefKeyword) then continue;
|
||||||
|
end
|
||||||
|
else if (packageLoc = 'Specific Reference') then begin
|
||||||
|
linkedRef := LinksTo(ElementByPath(inputVal, 'PTDA\Target Data\Reference'));
|
||||||
|
if InSameCell(e, linkedRef) then continue;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end
|
result := False;
|
||||||
else begin
|
break;
|
||||||
packageLoc := GetElementEditValues(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PTDA\Target Data\Type');
|
|
||||||
|
|
||||||
if (packageLoc = 'Linked Reference') then begin
|
|
||||||
linkedRefKeyword := LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PTDA\Target Data\Reference'));
|
|
||||||
if not IsLinkedRefRemote(e, linkedRefKeyword) then continue;
|
|
||||||
end
|
|
||||||
else if (packageLoc = 'Specific Reference') then begin
|
|
||||||
linkedRef := LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PTDA\Target Data\Reference'));
|
|
||||||
if InSameCell(e, linkedRef) then continue;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -240,7 +249,7 @@ begin
|
|||||||
|
|
||||||
// DLZM and DCZM Default Objects.
|
// DLZM and DCZM Default Objects.
|
||||||
// For simplicity sake, I assume they are unchanged, which is true in 99.999% cases.
|
// For simplicity sake, I assume they are unchanged, which is true in 99.999% cases.
|
||||||
// If you ever find a mod, changing these objects, I will update this to retrieve actual values.
|
// If you ever find a mod, changing these objects, update this to retrieve actual values.
|
||||||
hardcodedStatForms.Add($138C0); // DragonMarker
|
hardcodedStatForms.Add($138C0); // DragonMarker
|
||||||
hardcodedStatForms.Add($3DF55); // DragonMarkerCrashStrip
|
hardcodedStatForms.Add($3DF55); // DragonMarkerCrashStrip
|
||||||
end;
|
end;
|
||||||
@ -250,7 +259,7 @@ var
|
|||||||
currentPlugin: IwbFile;
|
currentPlugin: IwbFile;
|
||||||
baseRefRecord, package, actorLocation: IwbMainRecord;
|
baseRefRecord, package, actorLocation: IwbMainRecord;
|
||||||
packages: IwbElement;
|
packages: IwbElement;
|
||||||
i, baseID, packageCount, typeId: integer;
|
i, j, baseID, packageCount, typeId: integer;
|
||||||
sig, baseSig: string;
|
sig, baseSig: string;
|
||||||
isREFR, isACHR, skip: boolean;
|
isREFR, isACHR, skip: boolean;
|
||||||
begin
|
begin
|
||||||
@ -388,7 +397,7 @@ begin
|
|||||||
continue;
|
continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (IsSameCellPackage(package)) then continue;
|
if (IsSameCellPackage(ElementByPath(package, 'Package Data\Data Input Values'))) then continue;
|
||||||
|
|
||||||
skip := false;
|
skip := false;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user