- PC/Mac/PS4/XB1: All
- Vehicle/Tool/Model/Object: Placeables of type 'Tree'
- Issue: When deleting a placed tree, via script or via gameplay.
- Single- or Multiplayer: Single
- Steps to reproduce: Place between 3-10 trees, using the 'FS19 MoreTree' or similar mod. Delete the tree (cut, chip, remove stump) or via script with delete(obj). On console: delete placed tree. Then save the game. The save logic will break, see attached log. This results in a CORRUPTED SAVE. All placeables stored in items.xml afterwards will not be saved. Triggers get removed, buildings go missing. Tried different tree types (fir, volumeTree, Birch, Maple) and all seem to cause the same result.
- Does it happen on a standard map without mods yes/no: Yes, but no (mod required for placing tree).
- Which vehicles & machines are involved: Placeables that are of type "tree".
2019-08-19 12:55 Warning (script): Unknown entity id 114127 in method 'getNumOfChildren'.
2019-08-19 12:55 LUA call stack:
2019-08-19 12:55 =dataS/scripts/placeables/TreePlaceable.lua (95) : getNumOfChildren
2019-08-19 12:55 =dataS/scripts/missions/mission00.lua (872) : getNeedsSaving
2019-08-19 12:55 =dataS/scripts/FSCareerMissionInfo.lua (302) : saveItems
2019-08-19 12:55 =dataS/scripts/utils/Utils.lua (381) : oldFunc
2019-08-19 12:55 =dataS/scripts/missions/SavegameController.lua (290) : saveToXMLFile
2019-08-19 12:55 =[C] (4294967295)
2019-08-19 12:55 =dataS/scripts/missions/SavegameController.lua (428) : saveWriteSavegameStart
2019-08-19 12:55 =dataS/scripts/FSBaseMission.lua (2859) : saveSavegame
2019-08-19 12:55 =dataS/scripts/FSBaseMission.lua (2217) : saveSavegame
2019-08-19 12:55 =dataS/scripts/FSBaseMission.lua (2073) : updateSaving
2019-08-19 12:55 =dataS/scripts/missions/mission00.lua (469) : update
2019-08-19 12:55 =dataS/scripts/main.lua (1879) : update
2019-08-19 12:55 Game saved successfully.
2019-08-19 12:55 Application exit request forced.
Update:
As I'm working on a mod, which uses delete(obj); to replace a placed tree with a 'planted' one, I dug in a bit and have overwritten the function. The following code seems to fix the error, note the entityExists(); but not the corruption.
Code: Select all
-- Fix for SaveGame breaking after deleting a Placed Tree
-- TICKET: https://forum.giants-software.com/viewtopic.php?f=998&p=1174406#p1174406
TreePlaceable.getNeedsSaving = Utils.overwrittenFunction(TreePlaceable.getNeedsSaving, function(self, superFunc)
if entityExists(self.nodeId) then
if getNumOfChildren(self.nodeId) == 0 or (self.splitShapeFileId ~= nil and not getFileIdHasSplitShapes(self.splitShapeFileId)) then
-- remove placeable of all split shapes have been removed
self:delete();
return false;
end;
return TreePlaceable:superClass().getNeedsSaving(self);
else
return false;
end;
end);
Weirdly enough, when comparing the items.xml from before corruption to the items.xml version after corruption, they are exactly the same (deleted tree is missing, which is valid). Although when loaded, not all placeables show - so they do not get loaded correctly. Re-saving then empties the entire items.xml