pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.64k stars 380 forks source link

Crash/assert when starting new game other than Mars #5969

Open fluffyfreak opened 4 hours ago

fluffyfreak commented 4 hours ago

Observed behaviour

Launch Pioneer, choose "New Game" at the menu, select "Start at New Hope" from the profile drop-down and you get the following assert. PioneerLuaNewGameCrash

If you accept these you'll receive another and then a warning and an error before Pioneer quits out.

It looks like an issue with an EquipSet slot

Expected behaviour

Not expected to assert and crash 😁

My pioneer version (and OS): Windows 10, 2668aa861 Also seen on Raspberry Pi.

My output.txt (required) and game save (optional, but recommended)

output.txt

Web-eWorks commented 4 hours ago

Ah, you weren't here for the discussion - this is intentional and waiting on @Gliese852 to finish porting the new-game-window to EquipSet v2. I merged the branch to allow other contributors to work in parallel on it rather than be completely blocked.

fluffyfreak commented 4 hours ago

Ah my apologies I must have missed that.

fluffyfreak commented 4 hours ago

I do have a "quick fix" for it locally to treat the assert as an if-then block instead which allows me to start on New Hope

EDIT: and Barnard's Star

fluffyfreak commented 4 hours ago

diff.txt

index 476f12265..793543f58 100644
--- a/data/pigui/modules/new-game-window/class.lua
+++ b/data/pigui/modules/new-game-window/class.lua
@@ -185,16 +185,16 @@ local function startGame(gameParams)
        -- print("Installing equipment {} (proto: {}) into slot {}" % { item, proto, slot })
        if type(slot) == "string" then
            local slotHandle = equipSet:GetSlotHandle(slot)
-           assert(slotHandle)
+           if slotHandle then
+               local inst = proto:Instance()

-           local inst = proto:Instance()
-
-           if slotHandle.count then
-               inst:SetCount(slotHandle.count)
-           end
+               if slotHandle.count then
+                   inst:SetCount(slotHandle.count)
+               end

-           if not equipSet:Install(inst, slotHandle) then
-               print("Couldn't install equipment item {} into slot {}" % { inst:GetName(), slot })
+               if not equipSet:Install(inst, slotHandle) then
+                   print("Couldn't install equipment item {} into slot {}" % { inst:GetName(), slot })
+               end
            end
        end
    end
Web-eWorks commented 4 hours ago

Ah my apologies I must have missed that.

No apologies necessary! It's good to have this tracked in a standalone issue so we don't forget about it :smile:

I do have a "quick fix" for it locally

I'll leave it to @Gliese852 to decide whether he wants to merge the above and rebase his in-progress work ontop of that, or just hold off until the "full" fix is done.