Skip to content

Commit

Permalink
Shopeditor: Item Buyability Broken due to Cache State (#1621)
Browse files Browse the repository at this point in the history
This pullrequest fixes the issue where items (not weapons) had the wrong
state if a custom show was created. This means that they were always
marked as selected, even if they weren't. This was due to the caching
being done too early, before the items were initialized at all.

The issue didn't exist for weapons because their setup is done in the
engine before any lua init code is executed.

---------

Co-authored-by: Tim Goll <github@timgoll.de>
  • Loading branch information
NickCloudAT and TimGoll authored Sep 21, 2024
1 parent dd63d89 commit 4e9ffc5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel
- Fixed avatar icons not refreshing if they were changed on Steam (by @mexikoedi)
- Fixed a wrong label for the sprint speed multiplier in the F1 menu (by @TimGoll)
- Fixed own player name being shown in targetID when in vehicle (by @TimGoll)
- Fixed `ShopEditor.BuildValidEquipmentCache()` being called too early on the client, resulting in a wrong cache state (by @NickCloudAT and @12problems)

### Removed

Expand Down
1 change: 1 addition & 0 deletions gamemodes/terrortown/gamemode/client/cl_changes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2190,6 +2190,7 @@ function CreateChanges()
<li>Avatar icons not refreshing if they were changed on Steam</li>
<li>A wrong label for the sprint speed multiplier in the F1 menu</li>
<li>Own player name being shown in targetID when in vehicle</li>
<li>Fixed <code>ShopEditor.BuildValidEquipmentCache()</code> being called too early on the client, resulting in a wrong cache state</li>
</ul>
<h2>Removed</h2>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions gamemodes/terrortown/gamemode/client/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ function GM:Initialize()

keyhelp.InitializeBasicKeys()

ShopEditor.BuildValidEquipmentCache()

tips.Initialize()

---
Expand Down Expand Up @@ -292,6 +290,8 @@ function GM:InitPostEntity()
-- initialize fallback shops
InitFallbackShops()

ShopEditor.BuildValidEquipmentCache()

---
-- @realm client
-- stylua: ignore
Expand Down

0 comments on commit 4e9ffc5

Please sign in to comment.