-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(store,world): replace
ResourceType
table with ResourceId
tab…
…le and corresponding checks (#1557) Co-authored-by: Kevin Ingersoll <[email protected]>
- Loading branch information
Showing
26 changed files
with
496 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
"@latticexyz/world": patch | ||
"@latticexyz/store": patch | ||
--- | ||
|
||
The `ResourceType` table is removed. | ||
It was previously used to store the resource type for each resource ID in a `World`. This is no longer necessary as the [resource type is now encoded in the resource ID](https://github.com/latticexyz/mud/pull/1544). | ||
|
||
To still be able to determine whether a given resource ID exists, a `ResourceIds` table has been added. | ||
The previous `ResourceType` table was part of `World` and missed tables that were registered directly via `StoreCore.registerTable` instead of via `World.registerTable` (e.g. when a table was registered as part of a root module). | ||
This problem is solved by the new table `ResourceIds` being part of `Store`. | ||
|
||
`StoreCore`'s `hasTable` function was removed in favor of using `ResourceIds.getExists(tableId)` directly. | ||
|
||
```diff | ||
- import { ResourceType } from "@latticexyz/world/src/tables/ResourceType.sol"; | ||
- import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; | ||
+ import { ResourceIds } from "@latticexyz/store/src/codegen/tables/ResourceIds.sol"; | ||
|
||
- bool tableExists = StoreCore.hasTable(tableId); | ||
+ bool tableExists = ResourceIds.getExists(tableId); | ||
|
||
- bool systemExists = ResourceType.get(systemId) != Resource.NONE; | ||
+ bool systemExists = ResourceIds.getExists(systemId); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist | ||
**/.next | ||
.next | ||
templates/phaser/packages/art | ||
CODEOWNERS | ||
out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.