pioneerspacesim / pioneer

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

Weapon on sale not installed #5567

Open DynV opened 1 year ago

DynV commented 1 year ago

Observed behaviour

If buying a weapon on sale without selling your current one 1st, it won't install BUT it will subtract the amount from your account.

Since the related part of #5539 didn't take off there, I'm forking it here. The shorter video shows the issue, the longer one is the workaround.

https://user-images.githubusercontent.com/2823807/223312119-a2d02c10-d165-4a96-9d5e-85113562fcb8.mp4

https://user-images.githubusercontent.com/2823807/223312133-b6d474c1-2c11-41a1-b6cb-2b2b47dedea3.mp4

Expected behaviour

Either

Steps to reproduce

  1. Load gamesave
  2. notice current weapon & money
  3. buy Large plasma accelerator on sale (in Bulletin Board)
  4. notice if there was a change in weapon or money.

My pioneer version (and OS): 20230203-win

My output.txt (required) and game save (optional, but recommended) The game save file was simply renamed to go through the upload extension filter, there was no modification to its content. output.txt Pioneer-Yoan_Faure-20230203-230425-Large_plasma_accelerator_on_sale_having_enough_money.zip

impaktor commented 1 year ago

Just looking at the code, for some reason, the Game.player:GetEquipFree(e.slots[i]) doesn't register that a slot is already taken, I assume there's been some code breaking change that changed how it works.

(There is no code for swapping, so the proper thing is for the advert to tell the player to first sell the current equipment, before fitting the new).

impaktor commented 1 year ago

OK, I've done some test. The code works if doing it with a ship that only has one weapon slot (laser_rear:0). The problem is that pioneer atm, doesn't support fitting rear lasers (it was broken a while ago, when the equipment system got upgraded). Thus the module correctly identifies there's a free slot, and does the transaction, but the Pioneer engine can't fit the weapon.

According to @Web-eWorks the slot system is on its way out, and will soon be replaced with hardpoint system, so no point in spending time on code that's about to be replaced within a month or a few. I'll spend that time on writing new code instead.

If anyone want to fix their pioneer, just open all json files in data/ships/ and set "laser_rear: 0", meanwhile.

I suppose we'll leave this bug report open until the new code is in place.