Percedal / FS22_UpgradableFactories

FS22 mod that increase production chains efficiency
GNU General Public License v3.0
28 stars 8 forks source link

When I save the game and load, I lost my building level #51

Open waterormelon opened 1 month ago

waterormelon commented 1 month ago

The map is AKFarmland,I have tried v1.2 @Percedal and v2.0.0.4 @Shad0wlife , both did not work. I checked upgradableFactories.xml, it's right, so I think there's a problem with the loading process. Probably because I upgraded the buildings in the mod. Here's an excerpt from my log:

UpgradableFactories: initialize production Fertilizer [has custom env: FS22_AKFarmland] 2024-07-19 22:33 C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_Baumschule/baumschule.i3d (18.04 ms) 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_Baumschule/baumschule.xml): Unable to load fillType 'COMPOST' for 'placeable.productionPoint.productions.production(0).inputs.input(1)' 2024-07-19 22:33 Warning: UnloadTrigger has invalid fillType 'COMPOST'. 2024-07-19 22:33 Warning (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_Baumschule/baumschule.xml): FillType 'COMPOST' not defined for 'placeable.productionPoint.storage.capacity(1)' UpgradableFactories: initialize production Water Supply [has custom env: FS22_AKFarmland] 2024-07-19 22:33 C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.i3d (0.46 ms) 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'FLOUR_BULK' for 'placeable.productionPoint.productions.production(0).outputs.output(0)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'WASTE' for 'placeable.productionPoint.productions.production(0).outputs.output(1)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): No outputs for production 'placeable.productionPoint.productions.production(0)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'FLOUR_BULK' for 'placeable.productionPoint.productions.production(1).outputs.output(0)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'WASTE' for 'placeable.productionPoint.productions.production(1).outputs.output(1)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): No outputs for production 'placeable.productionPoint.productions.production(1)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'OATMEAL_BULK' for 'placeable.productionPoint.productions.production(2).outputs.output(0)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'WASTE' for 'placeable.productionPoint.productions.production(2).outputs.output(1)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): No outputs for production 'placeable.productionPoint.productions.production(2)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'MAIZEFLOUR_BULK' for 'placeable.productionPoint.productions.production(3).outputs.output(0)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'WASTE' for 'placeable.productionPoint.productions.production(3).outputs.output(1)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): No outputs for production 'placeable.productionPoint.productions.production(3)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'FLOUR_BULK' for 'placeable.productionPoint.productions.production(4).outputs.output(0)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): Unable to load fillType 'WASTE' for 'placeable.productionPoint.productions.production(4).outputs.output(1)' 2024-07-19 22:33 Error (C:/Users/hhh/Documents/My Games/FarmingSimulator2022/mods/FS22_AKFarmland/maps/Placeables/AK_grainMill_Bulk/grainMill.xml): No outputs for production 'placeable.productionPoint.productions.production(4)'

Hope someone can help me out.

Shad0wlife commented 1 month ago

The errors don't actually come from the UpgradableFactories mod and are not errors from a script, but from the game loading XMLs of those productions.

It seems that there are some fillTypes not defined in the map somehow? I'll try and grab the map and investigate.

Shad0wlife commented 1 month ago

The Baumschule errors, because the COMPOST fillType is not defined by the map and thus the production cannot actually work. This is not an issue with UpgradableFactories.

Why the Grain Mill mod does not work, I can't really tell, because it just says unable to load, not "Invalid fill Type" like with the compost. But the error is output by the game code loading production points from XML, so even if UpgradableFactories would mess with the fillTypes, it can't be at the point where the error happens.

Please try if the errors stay without UpgradableFactories. (The Compost error definitely will, but the other ones)

waterormelon commented 1 month ago

The Baumschule errors, because the COMPOST fillType is not defined by the map and thus the production cannot actually work. This is not an issue with UpgradableFactories.

Why the Grain Mill mod does not work, I can't really tell, because it just says unable to load, not "Invalid fill Type" like with the compost. But the error is output by the game code loading production points from XML, so even if UpgradableFactories would mess with the fillTypes, it can't be at the point where the error happens.

Please try if the errors stay without UpgradableFactories. (The Compost error definitely will, but the other ones)

Yes, you are right. The erros stay without UpgradableFactories. Maybe I have to check the other place in the log.

waterormelon commented 1 month ago

I compared the logs with and without UpgradableFactories. UpgradableFactories didn't cause any errors, so I've listed all the logs about UpgradableFactories below, hope it's helpful. And I checked the xml, only the level return to 1. Available mod: (Hash: 84a76e1613da01d9629e9af58fbc9b95) (Version: 2.0.0.4) FS22_UpgradableFactories 2024-07-20 09:38 Load mod: FS22_UpgradableFactories 2024-07-20 09:38 UpgradableFactories: Game is Server -> Get Production levels from Savegame 2024-07-20 09:38 UpgradableFactories: Loading XML... 2024-07-20 09:38 UpgradableFactories: 6 productions loaded from XML 2024-07-20 09:38 UpgradableFactories: Production maximum level: 10 2024-07-20 09:38 UpgradableFactories: initialize production Sawmill [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production 沼气厂 1MW [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production Seedfactory [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production Fertilizer [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production Baumschule [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production Windkraftanlage [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production Windkraftanlage [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production Water Supply [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production 谷物磨坊 [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: initialize production Saegewerk [has custom env: FS22_AKFarmland] 2024-07-20 09:38 UpgradableFactories: Initialize loaded production Sawmill [is upgradable: true] 2024-07-20 09:38 UpgradableFactories: Broadcasting ProductionUpgradedEvent. 2024-07-20 09:38 UpgradableFactories: Initialize loaded production Sawmill [is upgradable: true] 2024-07-20 09:38 UpgradableFactories: Broadcasting ProductionUpgradedEvent. 2024-07-20 09:38 UpgradableFactories: Initialize loaded production Sawmill [is upgradable: true] 2024-07-20 09:38 UpgradableFactories: Broadcasting ProductionUpgradedEvent. 2024-07-20 09:38 UpgradableFactories: Initialize loaded production Sawmill [is upgradable: true] 2024-07-20 09:38 UpgradableFactories: Broadcasting ProductionUpgradedEvent. 2024-07-20 09:38 UpgradableFactories: Initialize loaded production Sawmill [is upgradable: true] 2024-07-20 09:38 UpgradableFactories: Broadcasting ProductionUpgradedEvent. 2024-07-20 09:38 UpgradableFactories: Initialize loaded production Sawmill [is upgradable: true] 2024-07-20 09:38 UpgradableFactories: Broadcasting ProductionUpgradedEvent.

waterormelon commented 1 month ago

@Shad0wlife Hello sir, I might find the reason. I check the UpgradableFactories.lua, and find a function: getProductionPointFromPosition(pos, farmId). Then I check the xml, and find all my buildings' position is 0,0,0. So I think all of my factories are treated as one. That'S why ‘’Initialize loaded production Sawmill‘ repeat 6 times in the log, and only the sawmill retained its level in the game. Look forward to your reply.

jcb83 commented 1 month ago

I came here having the same problem, playing on the "No Man's Land" map. Pursuing @waterormelon's tip about the locations of the factories, I had a look in the upgradableFactories.xml, and indeed, at least all of my greenhouses (that kept reverting to level 1 on load) appear to have the same X- and Y-coordinates. I then checked the placeables.xml of the save, and discovered that the greenhouses (which I built using grid alignment) do also have the exact same X- and Y-coordinates on the map. However, they differ in their Z-position. I have no idea why this should be, as in-game they definitely are not stacked on top of each other (and are standing at the same height on completely level ground). I can only assume that there is something special going on with the coordinate system on this specific map -- maybe the axis are swapped, or the map author does something else very funky, no clue.

For completeness sake, here are the greenhouses positions in placebles.xml:

<placeable filename="data/placeables/lizard/greenhouses/greenhouseLarge/greenhouseLarge.xml" id="18" position="58.5 100.02723693848 715.5" rotation="0 270.00000068325 0" age="24.000000" price="10000.000000" farmId="1">
[...]
<placeable filename="data/placeables/lizard/greenhouses/greenhouseLarge/greenhouseLarge.xml" id="19" position="58.5 100.02723693848 733.25" rotation="0 270.00000068325 0" age="24.000000" price="10000.000000" farmId="1">
[...]
<placeable filename="data/placeables/lizard/greenhouses/greenhouseLarge/greenhouseLarge.xml" id="20" position="58.5 100.02723693848 752" rotation="0 270.00000068325 0" age="24.000000" price="10000.000000" farmId="1">
[...]

And here are the corresponding values in upgradableFactories.xml:

    <production id="2" name="Large Greenhouse" level="1" basePrice="10000" totalValue="10000">
        <position x="58.500000" y="100.027237"/>
[...]
    <production id="3" name="Large Greenhouse" level="1" basePrice="10000" totalValue="10000">
        <position x="58.500000" y="100.027237"/>
[...]
    <production id="4" name="Large Greenhouse" level="1" basePrice="10000" totalValue="10000">
        <position x="58.500000" y="100.027237"/>
[...]
    </production>

I hope this helps narrow the problem down.

Shad0wlife commented 1 month ago

Easy, thats because the y coordinate is the height, so it's all fine. It just means that they're all along an exact line. This is also the reason why the modhub version of the mod breaks - place buildings in a line on the grid, and they have the same x and y coordinate.

That's why berndtseb and me changed it to properly use x and z.

I guess you still use the modhub version, please use an updated one, for example from my fork.

jcb83 commented 1 month ago

Ah, thank you very much, that explains it very nicely. I only recently found this mod using the ingame modbrowser, so I was not aware that the version on there is not quite up to date -- but that's on me for not checking.