Thank you for looking into this.
MegaJohnny wrote: ↑Sat, 27. Oct 18, 22:11
Just to clarify, your post mentioned the bug being to do with build modules, but I don't think the production rowclass is affected by this - and I didn't get any errors when viewing a station with a destroyed production module. Do you have any debuglog output from when the bug happened?
Oh well, looks like I remembered that wrong. The station that I initially had this problem with was a Xenon Shipyard which has both XL/L ship productions and also a production line for small ships. It turns out that it was not the damage on the big ship productions that triggered it but instead the damage on the small ship production (which is a regular production module FWIW).
I managed to reproduce the problem by loading up one of the saves I used to reproduce the problem at first when I was still thinking that this may be a problem with the New Frontiers mod and even saw another problem, but first the debuglog entry from trying to open the object details menu when the small ship production (Medium Shipyard) module is damaged:
Code: Select all
[General] 9228.62 ======================================
[=ERROR=] 9228.62 Error while executing onEvent script for event: showObjectMenu.
Errormessage: [string "extensions/mej_improved_object_menu/ui/addons..."]:886: attempt to index local 'product' (a nil value)
[General] 9228.62 ======================================
[General] 9228.62 ======================================
[=ERROR=] 9228.62 Error detected while displaying Improved Object Menu! Please contact MegaJohnny with the relevant error messages
[General] 9228.62 ======================================
In the save I still had laying around the module was at 100% already and I had to destroy it again. To find it I wanted to set a waypoint to the module from the map. When I tried to open the object details of that module I as greeted with another crash, this is what I got in the debuglog for it:
Code: Select all
[General] 9079.07 ======================================
[=ERROR=] 9079.07 C:/Spiele/SteamLibrary/steamapps/common/X Rebirth/extensions/mej_improved_object_menu/ui/addons...(413): GetWareCapacity(): Component 'Mittlere Schiffswerft' is not of class container
[General] 9079.07 ======================================
[General] 9079.07 ======================================
[=ERROR=] 9079.07 Error while executing onEvent script for event: showObjectMenu.
Errormessage: [string "extensions/mej_improved_object_menu/ui/addons..."]:413: attempt to compare number with nil
[General] 9079.07 ======================================
[General] 9079.07 ======================================
[=ERROR=] 9079.07 Error detected while displaying Improved Object Menu! Please contact MegaJohnny with the relevant error messages
[General] 9079.07 ======================================
I tested another change which seems to prevent the problem from happening (if combined with my first change to "rcProduction:display") but I don't know if that's how you'd like to address this. The root of this issue seems to be that "GetWareCapacity" will return nil for the damaged small ship production module.
Code: Select all
function rcWare:getWareAmountCell()
local mot
local amountString = ConvertIntegerString(self.ware.amount, true, 4, true)
--decide the color of the amount, and whether there should be any "x / y" bit
if self.ware.amount == 0 then
amountString = "\27Z" .. amountString .. "\27X"
elseif menu.isPlayerOwned then
local capacity = GetWareCapacity(menu.object, self.ware.ware, false)
if capacity ~= nil then
self.isFull = next(self.category.productCycleAmounts) and (capacity <= self.cycleAmount or (self.limit - self.cycleAmount) < self.ware.amount)
else
self.isFull = false
end
if self.isFull then
if self.cycleAmount > 0 then
--it's a product with full storage (which actually stalls production so it gets a harsher colour)
amountString = "\27R" .. amountString .. "\27X"
mot = ReadText(1001, 1125)
else
--it's a resource with full storage
amountString = "\27Y" .. amountString .. "\27X"
mot = ReadText(1001, 1126)
end
end
end
if menu.isPlayerOwned and self.limit > 0 then
amountString = amountString .. " / " .. ConvertIntegerString(self.limit, true, 4, true)
end
return Helper.createFontString(amountString, false, "right", 255, 255, 255, 100, nil, nil, nil, nil, nil, nil, nil, mot)
end
Edit: If you're interested I can also upload the save somewhere. But you'd need to have at least the New Frontiers mod installed to run it.
Edit2: Looks like even with my second change, it still spams the debuglog a little afterwards when opening the object details of the single module:
Code: Select all
[General] 9305.03 ======================================
[=ERROR=] 9305.03 C:/Spiele/SteamLibrary/steamapps/common/X Rebirth/extensions/mej_improved_object_menu/ui/addons...(413): GetWareCapacity(): Component 'Mittlere Schiffswerft' is not of class container
[General] 9305.03 ======================================
Edit3: I did some more testing and managed to reproduce the "rcProduction" error using a mostly complete vanilla setup. The only mod I had active was Simooms Lantern to speed up the testing process, but that should not really influence the results. I started a new "Free Play" game and after equipping the Skunk a bit jumped straight to "Cuspid Splint" in Albion. I then damaged one of the medium shipyard modules of the Ledda Industrial small shipyard there to roughly 80%. After that when opening the object details menu for the whole station or the single module the "rcProduction" nil error happens.
I did not manage to reproduce the second error from above. Not even after using Simooms Lantern to take over the station since I saw that it would only trigger on player-owned stations. So I'm still a bit unsure under which conditions that one happens. I suppose in plain vanilla this one would never happen since there is no way to own a small ship production without using mods.
I've uploaded the savegame of that experiment, you can download it
here. It should be safe to load this without any mods enabled besides the official DLCs. After loading you should have the damage medium shipyard module in target. Just try opening the object details menu of the module or the whole station and you should see the error. Watch out though, Ledda Industrial is still a little upset about my testing methods