Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- Removes unique npc, preculling and location data from the duplicated worldspace.
- }
- unit CleanupDuplicatedWorldspace;
- function CheckHasFlag(elem: IInterface; flagName: string): boolean;
- var
- sl: TStringList;
- i: Integer;
- f, f2: Cardinal;
- val: boolean;
- begin
- val := false;
- sl := TStringList.Create;
- sl.Text := FlagValues(elem);
- f := GetNativeValue(elem);
- for i := 0 to Pred(sl.Count) do
- if SameText(sl[i], flagName) then begin
- f2 := f or (1 shl i);
- if f = f2 then
- val := true;
- Break;
- end;
- sl.Free;
- Result := val;
- end;
- // called for every record selected in xEdit
- function Process(e: IInterface): integer;
- var
- el: IInterface;
- begin
- if Signature(e) = 'CELL' then begin
- //AddMessage('Processing CELL: ' + FullPath(e));
- if ElementExists(e, 'PCMB') then begin
- el := ElementByPath(e, 'PCMB');
- if Assigned(el) then
- RemoveElement(e, el);
- end;
- if ElementExists(e, 'XPRI') then begin
- el := ElementByPath(e, 'XPRI');
- if Assigned(el) then
- RemoveElement(e, el);
- end;
- if ElementExists(e, 'XCRI') then begin
- el := ElementByPath(e, 'XCRI');
- if Assigned(el) then
- RemoveElement(e, el);
- end;
- if ElementExists(e, 'VISI') then begin
- el := ElementByPath(e, 'VISI');
- if Assigned(el) then
- RemoveElement(e, el);
- end;
- if ElementExists(e, 'RVIS') then begin
- el := ElementByPath(e, 'RVIS');
- if Assigned(el) then
- RemoveElement(e, el);
- end;
- if ElementExists(e, 'XLCN') then begin
- el := ElementByPath(e, 'XLCN');
- if Assigned(el) then
- RemoveElement(e, el);
- end;
- end;
- if Signature(e) = 'ACHR' then begin
- el := LinksTo(ElementByName(e, 'NAME - Base'));
- if CheckHasFlag(ElementByPath(el, 'ACBS - Configuration\Flags'), 'Unique') then begin
- AddMessage('Removing: ' + Name(e));
- RemoveNode(e);
- end;
- end;
- Result := 0;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement