FelicitusNeko / meritous-ap

Lancer-X's procedurally-generated dungeon crawler, modified for Archipelago Multiworld
https://archipelago.gg/tutorial/Meritous/setup/en
GNU General Public License v3.0
0 stars 2 forks source link

Fix !GetItem command crashing the game #21

Closed Rnd-Guy closed 1 month ago

Rnd-Guy commented 2 months ago

!GetItem counts as a local item (as you get them via logging into text client as the meritous player) ie has item.player == me but has location Cheat console which has location id -1 Because the !GetItem item is local, the game tries to get the local location to see if it needs to mark off the caches. It does this by taking 593000 from the item's location (-1) to get -593001 for its localLocation and then trying to access arrays with this negative number as the index crashes the game.

This crash repeats everytime the game reconnects to the server, as the server attempts to give the player the same item with location -1, rendering the game completely unable to be played.

Thankfully a simple fix is to ignore this special case. I don't know if other special cases also exist though but if so, they may also need to be excluded in a similar way.

This was tested by running a build with and without the fix:

Rnd-Guy commented 2 months ago

Ooh while looking at some other things, it looks like /send from the server works fine, but !GetItem from a text client logged in as Meritous does not. This therefore is likely why #15 was not reproducible, GetItem crashes while /send does not, so this should resolve that issue