Skip to content

Commit

Permalink
use hook util
Browse files Browse the repository at this point in the history
  • Loading branch information
dhvanipa committed May 13, 2024
1 parent 4699813 commit 66cd7ec
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 851 deletions.
5 changes: 3 additions & 2 deletions packages/hardhat/contracts/Game.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ObjectTypeMetadata } from "@biomesaw/world/src/codegen/tables/ObjectTyp
import { AirObjectID } from "@biomesaw/world/src/ObjectTypeIds.sol";
import { getObjectType, getEntityAtCoord, getPosition, getEntityFromPlayer, getObjectTypeAtCoord } from "../utils/EntityUtils.sol";
import { voxelCoordsAreEqual } from "@biomesaw/utils/src/VoxelCoordUtils.sol";
import { decodeCallData } from "../utils/HookUtils.sol";

import { NamedBuild } from "../utils/GameUtils.sol";

Expand Down Expand Up @@ -93,8 +94,8 @@ contract Game is ICustomUnregisterDelegation, IOptionalSystemHook {
bytes memory callData
) external override onlyBiomeWorld {
if (ResourceId.unwrap(systemId) == ResourceId.unwrap(BuildSystemId)) {
Slice callDataArgs = SliceLib.getSubslice(callData, 4);
(, VoxelCoord memory coord) = abi.decode(callDataArgs.toBytes(), (uint8, VoxelCoord));
(, bytes memory callDataArgs) = decodeCallData(callData);
(, VoxelCoord memory coord) = abi.decode(callDataArgs, (uint8, VoxelCoord));
coordHashToBuilder[getCoordHash(coord)] = msgSender;
}
}
Expand Down
Loading

0 comments on commit 66cd7ec

Please sign in to comment.