@@ -70,17 +70,6 @@ function RandoUniverse:DistributeGiveItem(item_id)
7070 if equip == nil then
7171 equip = false
7272 end
73-
74- if Item .GetById (item_id ).isWeapon and item_id ~= 0x0e and item_id ~= 0x12 and item_id ~= 0x09 and item_id ~= 0x15 then -- is weapon that uses ammo
75- for k , v in ipairs (self .buyable_ammo ) do
76- if v == item_id then break end -- if item already in list, do nothing
77- if k == # self .buyable_ammo then -- if we have just checked the last item in the list and reached here, insert new item
78- table.insert (self .buyable_ammo , item_id )
79- self :DistributeVendorContents ()
80- break
81- end
82- end
83- end
8473
8574 item_name = Item .GetById (item_id ).name
8675 if item_id == Item .GetByName (" Hoverboard" ).id then
@@ -100,6 +89,22 @@ function RandoUniverse:DistributeGiveItem(item_id)
10089 player .receivedItemsWhileLoading = true
10190 end
10291 end
92+
93+ if Item .GetById (item_id ).isWeapon and item_id ~= 0x0e and item_id ~= 0x12 and item_id ~= 0x09 and item_id ~= 0x15 then -- is weapon that uses ammo
94+ if # self .buyable_weapons == 1 then
95+ table.insert (self .buyable_ammo , item_id )
96+ self :DistributeVendorContents ()
97+ else
98+ for k , v in ipairs (self .buyable_ammo ) do
99+ if v == item_id then break end -- if item already in list, do nothing
100+ if k == # self .buyable_ammo then -- if we have just checked the last item in the list and reached here, insert new item
101+ table.insert (self .buyable_ammo , item_id )
102+ self :DistributeVendorContents ()
103+ break
104+ end
105+ end
106+ end
107+ end
103108end
104109
105110function RandoUniverse :DistributeUnlockSpecial (special_address )
@@ -245,6 +250,9 @@ function RandoUniverse:AddPlanetVendorItem(planet_id)
245250end
246251
247252function RandoUniverse :DistributeVendorContents ()
253+ print (" buyable weapons: " .. table.concat (self .buyable_weapons , " , " ))
254+ print (" buyable ammo: " .. table.concat (self .buyable_ammo , " , " ))
255+ print (" bought weapons: " .. table.concat (self .already_bought_weapons , " , " ))
248256 for _ , _player in ipairs (self :LuaEntity ():FindChildren (" Player" )) do
249257 _player :UpdateVendorContents ()
250258 end
0 commit comments