Skip to content

Commit e151df8

Browse files
authored
Remove world border (#100)
1 parent bc5c66e commit e151df8

21 files changed

+19
-96
lines changed

packages/experience/worlds.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"31337": {
3-
"address": "0x0d0B03BBe791F2DDDF054a0E196fAf8F24a977a6"
3+
"address": "0x30dbE048cB02425dC745ea4231a8Ebf4a2FcDEB8"
44
}
55
}

packages/world/src/Constants.sol

-11
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@ uint16 constant MAX_BLOCK_STACKABLE = 99;
55
uint16 constant MAX_ITEM_STACKABLE = 99;
66
uint16 constant MAX_TOOL_STACKABLE = 1;
77

8-
int32 constant WORLD_BORDER_LOW_X = -2016;
9-
int32 constant WORLD_BORDER_LOW_Y = -160;
10-
int32 constant WORLD_BORDER_LOW_Z = -2016;
11-
12-
int32 constant WORLD_BORDER_HIGH_X = 2016;
13-
int32 constant WORLD_BORDER_HIGH_Y = 256;
14-
int32 constant WORLD_BORDER_HIGH_Z = 2016;
15-
16-
int32 constant WORLD_DIM_X = WORLD_BORDER_HIGH_X - WORLD_BORDER_LOW_X;
17-
int32 constant WORLD_DIM_Z = WORLD_BORDER_HIGH_Z - WORLD_BORDER_LOW_Z;
18-
198
int32 constant FORCE_FIELD_FRAGMENT_DIM = 8;
209
int32 constant LOCAL_ENERGY_POOL_SHARD_DIM = 512;
2110

packages/world/src/Utils.sol

-11
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,13 @@ import { Vec3 } from "./Vec3.sol";
55

66
import { UniqueEntity } from "./codegen/tables/UniqueEntity.sol";
77
import { WorldStatus } from "./codegen/tables/WorldStatus.sol";
8-
import { WORLD_BORDER_LOW_X, WORLD_BORDER_LOW_Y, WORLD_BORDER_LOW_Z, WORLD_BORDER_HIGH_X, WORLD_BORDER_HIGH_Y, WORLD_BORDER_HIGH_Z } from "./Constants.sol";
98

109
import { EntityId } from "./EntityId.sol";
1110

1211
function checkWorldStatus() view {
1312
require(!WorldStatus._getInMaintenance(), "Biomes is in maintenance mode. Try again later");
1413
}
1514

16-
function inWorldBorder(Vec3 coord) pure returns (bool) {
17-
return
18-
coord.x() >= WORLD_BORDER_LOW_X &&
19-
coord.x() <= WORLD_BORDER_HIGH_X &&
20-
coord.y() >= WORLD_BORDER_LOW_Y &&
21-
coord.y() <= WORLD_BORDER_HIGH_Y &&
22-
coord.z() >= WORLD_BORDER_LOW_Z &&
23-
coord.z() <= WORLD_BORDER_HIGH_Z;
24-
}
25-
2615
function getUniqueEntity() returns (EntityId) {
2716
uint256 uniqueEntity = UniqueEntity._get() + 1;
2817
UniqueEntity._set(uniqueEntity);

packages/world/src/systems/BedSystem.sol

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { requireValidPlayer, requireInPlayerInfluence, addPlayerToGrid, removePl
1515
import { MAX_PLAYER_ENERGY, PLAYER_ENERGY_DRAIN_RATE, MAX_PLAYER_RESPAWN_HALF_WIDTH } from "../Constants.sol";
1616
import { ObjectTypeId } from "../ObjectTypeId.sol";
1717
import { ObjectTypes } from "../ObjectTypes.sol";
18-
import { checkWorldStatus, getUniqueEntity, inWorldBorder } from "../Utils.sol";
18+
import { checkWorldStatus, getUniqueEntity } from "../Utils.sol";
1919
import { notify, SleepNotifData, WakeupNotifData } from "../utils/NotifUtils.sol";
2020
import { mod } from "../utils/MathUtils.sol";
2121
import { getForceField } from "../utils/ForceFieldUtils.sol";
@@ -108,8 +108,6 @@ contract BedSystem is System {
108108
}
109109

110110
function wakeupWithExtraData(Vec3 spawnCoord, bytes memory extraData) public {
111-
require(inWorldBorder(spawnCoord), "Cannot spawn outside the world border");
112-
113111
require(!MoveLib._gravityApplies(spawnCoord), "Cannot spawn player here as gravity applies");
114112

115113
EntityId playerEntityId = Player._get(_msgSender());

packages/world/src/systems/BuildSystem.sol

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ActionType, Direction } from "../codegen/common.sol";
1515

1616
import { PlayerPosition, ReversePlayerPosition } from "../utils/Vec3Storage.sol";
1717

18-
import { inWorldBorder, getUniqueEntity } from "../Utils.sol";
18+
import { getUniqueEntity } from "../Utils.sol";
1919
import { removeFromInventory } from "../utils/InventoryUtils.sol";
2020
import { requireValidPlayer, requireInPlayerInfluence } from "../utils/PlayerUtils.sol";
2121
import { getOrCreateEntityAt } from "../utils/EntityUtils.sol";
@@ -39,7 +39,6 @@ import { PLAYER_BUILD_ENERGY_COST } from "../Constants.sol";
3939

4040
library BuildLib {
4141
function _addBlock(ObjectTypeId buildObjectTypeId, Vec3 coord) public returns (EntityId) {
42-
require(inWorldBorder(coord), "Cannot build outside the world border");
4342
(EntityId terrainEntityId, ObjectTypeId terrainObjectTypeId) = getOrCreateEntityAt(coord);
4443
require(terrainObjectTypeId == ObjectTypes.Air, "Cannot build on a non-air block");
4544
require(

packages/world/src/systems/DropSystem.sol

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Energy, EnergyData } from "../codegen/tables/Energy.sol";
1111

1212
import { ObjectTypeId } from "../ObjectTypeId.sol";
1313
import { ObjectTypes } from "../ObjectTypes.sol";
14-
import { inWorldBorder, getUniqueEntity } from "../Utils.sol";
14+
import { getUniqueEntity } from "../Utils.sol";
1515
import { transferInventoryNonEntity, transferInventoryEntity } from "../utils/InventoryUtils.sol";
1616
import { requireValidPlayer, requireInPlayerInfluence } from "../utils/PlayerUtils.sol";
1717
import { notify, DropNotifData } from "../utils/NotifUtils.sol";
@@ -25,7 +25,6 @@ import { getOrCreateEntityAt } from "../utils/EntityUtils.sol";
2525
// TODO: combine the tool and non-tool drop functions
2626
contract DropSystem is System {
2727
function dropCommon(Vec3 coord) internal returns (EntityId, EntityId) {
28-
require(inWorldBorder(coord), "Cannot drop outside the world border");
2928
(EntityId playerEntityId, Vec3 playerCoord, ) = requireValidPlayer(_msgSender());
3029
requireInPlayerInfluence(playerCoord, coord);
3130

packages/world/src/systems/MineSystem.sol

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { Position } from "../utils/Vec3Storage.sol";
1919
import { MinedOrePosition } from "../utils/Vec3Storage.sol";
2020
import { OreCommitment } from "../utils/Vec3Storage.sol";
2121

22-
import { inWorldBorder, getUniqueEntity } from "../Utils.sol";
22+
import { getUniqueEntity } from "../Utils.sol";
2323
import { addToInventory, useEquipped } from "../utils/InventoryUtils.sol";
2424
import { requireValidPlayer, requireInPlayerInfluence, removePlayerFromBed } from "../utils/PlayerUtils.sol";
2525
import { updateEnergyLevel, energyToMass, transferEnergyToPool, updateSleepingPlayerEnergy } from "../utils/EnergyUtils.sol";
@@ -171,8 +171,6 @@ contract MineSystem is System {
171171
}
172172

173173
function mineWithExtraData(Vec3 coord, bytes memory extraData) public payable returns (EntityId) {
174-
require(inWorldBorder(coord), "Cannot mine outside the world border");
175-
176174
(EntityId playerEntityId, Vec3 playerCoord, ) = requireValidPlayer(_msgSender());
177175
requireInPlayerInfluence(playerCoord, coord);
178176

packages/world/src/systems/OreSystem.sol

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { Player } from "../codegen/tables/Player.sol";
1111
import { ActionType } from "../codegen/common.sol";
1212
import { Position, ReversePosition, OreCommitment, MinedOrePosition } from "../utils/Vec3Storage.sol";
1313

14-
import { inWorldBorder } from "../Utils.sol";
1514
import { requireValidPlayer, requireInPlayerInfluence } from "../utils/PlayerUtils.sol";
1615
import { notify, InitiateOreRevealNotifData, RevealOreNotifData } from "../utils/NotifUtils.sol";
1716
import { TerrainLib } from "./libraries/TerrainLib.sol";

packages/world/src/systems/PickupSystem.sol

-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { ReversePosition } from "../utils/Vec3Storage.sol";
1111

1212
import { ObjectTypeId } from "../ObjectTypeId.sol";
1313
import { ObjectTypes } from "../ObjectTypes.sol";
14-
import { inWorldBorder } from "../Utils.sol";
1514
import { transferInventoryNonEntity, transferInventoryEntity, transferAllInventoryEntities } from "../utils/InventoryUtils.sol";
1615
import { requireValidPlayer, requireInPlayerInfluence } from "../utils/PlayerUtils.sol";
1716
import { notify, PickupNotifData } from "../utils/NotifUtils.sol";
@@ -23,8 +22,6 @@ import { transferEnergyToPool } from "../utils/EnergyUtils.sol";
2322

2423
contract PickupSystem is System {
2524
function pickupCommon(Vec3 coord) internal returns (EntityId, EntityId) {
26-
require(inWorldBorder(coord), "Cannot pickup outside the world border");
27-
2825
(EntityId playerEntityId, Vec3 playerCoord, ) = requireValidPlayer(_msgSender());
2926
requireInPlayerInfluence(playerCoord, coord);
3027

packages/world/src/systems/SpawnSystem.sol

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { MAX_PLAYER_ENERGY, PLAYER_ENERGY_DRAIN_RATE, SPAWN_BLOCK_RANGE, MAX_PLA
1919
import { ObjectTypeId } from "../ObjectTypeId.sol";
2020
import { ObjectTypeLib } from "../ObjectTypeLib.sol";
2121
import { ObjectTypes } from "../ObjectTypes.sol";
22-
import { checkWorldStatus, getUniqueEntity, inWorldBorder } from "../Utils.sol";
22+
import { checkWorldStatus, getUniqueEntity } from "../Utils.sol";
2323
import { notify, SpawnNotifData } from "../utils/NotifUtils.sol";
2424
import { mod } from "../utils/MathUtils.sol";
2525
import { getForceField } from "../utils/ForceFieldUtils.sol";
@@ -174,7 +174,6 @@ contract SpawnSystem is System {
174174
}
175175

176176
function _spawnPlayer(uint32 playerMass, Vec3 spawnCoord) internal returns (EntityId) {
177-
require(inWorldBorder(spawnCoord), "Cannot spawn outside the world border");
178177
require(!MoveLib._gravityApplies(spawnCoord), "Cannot spawn player here as gravity applies");
179178

180179
address playerAddress = _msgSender();

packages/world/src/systems/libraries/MoveLib.sol

-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { Position, ReversePosition, PlayerPosition, ReversePlayerPosition } from
1111
import { ObjectTypeId } from "../../ObjectTypeId.sol";
1212
import { ObjectTypes } from "../../ObjectTypes.sol";
1313
import { ObjectTypeLib } from "../../ObjectTypeLib.sol";
14-
import { inWorldBorder } from "../../Utils.sol";
1514
import { PLAYER_MOVE_ENERGY_COST, PLAYER_FALL_ENERGY_COST, MAX_PLAYER_JUMPS, MAX_PLAYER_GLIDES, PLAYER_FALL_DAMAGE_THRESHOLD } from "../../Constants.sol";
1615
import { notify, MoveNotifData } from "../../utils/NotifUtils.sol";
1716
import { TerrainLib } from "./TerrainLib.sol";
@@ -32,7 +31,6 @@ library MoveLib {
3231
Vec3 oldCoord = oldPlayerCoords[i];
3332
Vec3 newCoord = newPlayerCoords[i];
3433

35-
require(inWorldBorder(newCoord), "Cannot move outside the world border");
3634
require(oldCoord.inSurroundingCube(newCoord, 1), "New coord is too far from old coord");
3735

3836
ObjectTypeId newObjectTypeId = safeGetObjectTypeIdAt(newCoord);
@@ -147,10 +145,6 @@ library MoveLib {
147145

148146
function _gravityApplies(Vec3 playerCoord) internal view returns (bool) {
149147
Vec3 belowCoord = playerCoord - vec3(0, 1, 0);
150-
// We don't want players to fall off the edge of the world
151-
if (!inWorldBorder(belowCoord)) {
152-
return false;
153-
}
154148

155149
ObjectTypeId belowObjectTypeId = safeGetObjectTypeIdAt(belowCoord);
156150
// Players can swim in water so we don't want to apply gravity to them

packages/world/test/Build.t.sol

+1-14
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { massToEnergy } from "../src/utils/EnergyUtils.sol";
3030
import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3131
import { ObjectTypes } from "../src/ObjectTypes.sol";
3232
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
33-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X } from "../src/Constants.sol";
33+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH } from "../src/Constants.sol";
3434
import { Vec3, vec3 } from "../src/Vec3.sol";
3535
import { TestInventoryUtils } from "./utils/TestUtils.sol";
3636

@@ -350,26 +350,13 @@ contract BuildTest is BiomesTest {
350350
(address alice, EntityId aliceEntityId, Vec3 playerCoord) = setupAirChunkWithPlayer();
351351

352352
Vec3 buildCoord = playerCoord + vec3(MAX_PLAYER_INFLUENCE_HALF_WIDTH + 1, 0, 0);
353-
EntityId airEntityId = setObjectAtCoord(buildCoord, ObjectTypes.Air);
354353
ObjectTypeId buildObjectTypeId = ObjectTypes.Grass;
355354
TestInventoryUtils.addToInventory(aliceEntityId, buildObjectTypeId, 1);
356-
EntityId buildEntityId = ReversePosition.get(buildCoord);
357355

358356
vm.prank(alice);
359357
vm.expectRevert("Player is too far");
360358
world.build(buildObjectTypeId, buildCoord);
361359

362-
(address bob, EntityId bobEntityId, ) = spawnPlayerOnAirChunk(
363-
vec3(WORLD_BORDER_LOW_X, playerCoord.y(), playerCoord.z())
364-
);
365-
366-
buildCoord = vec3(WORLD_BORDER_LOW_X - 1, playerCoord.y(), playerCoord.z());
367-
setObjectAtCoord(buildCoord, ObjectTypes.Air);
368-
369-
vm.prank(bob);
370-
vm.expectRevert("Cannot build outside the world border");
371-
world.build(buildObjectTypeId, buildCoord);
372-
373360
buildCoord = playerCoord - vec3(1, 0, 0);
374361

375362
vm.prank(alice);

packages/world/test/Chip.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { massToEnergy } from "../src/utils/EnergyUtils.sol";
3535
import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3636
import { ObjectTypes } from "../src/ObjectTypes.sol";
3737
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
38-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X } from "../src/Constants.sol";
38+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH } from "../src/Constants.sol";
3939
import { Vec3 } from "../src/Vec3.sol";
4040
import { TestUtils } from "./utils/TestUtils.sol";
4141

packages/world/test/Craft.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import { massToEnergy } from "../src/utils/EnergyUtils.sol";
3838
import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3939
import { ObjectTypes } from "../src/ObjectTypes.sol";
4040
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
41-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X } from "../src/Constants.sol";
41+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH } from "../src/Constants.sol";
4242
import { Vec3, vec3 } from "../src/Vec3.sol";
4343
import { hashRecipe } from "../src/utils/RecipeUtils.sol";
4444

packages/world/test/Drop.t.sol

+1-13
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { massToEnergy } from "../src/utils/EnergyUtils.sol";
3333
import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3434
import { ObjectTypes } from "../src/ObjectTypes.sol";
3535
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
36-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X } from "../src/Constants.sol";
36+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH } from "../src/Constants.sol";
3737
import { Vec3, vec3 } from "../src/Vec3.sol";
3838
import { PickupData } from "../src/Types.sol";
3939
import { TestInventoryUtils } from "./utils/TestUtils.sol";
@@ -384,12 +384,6 @@ contract DropTest is BiomesTest {
384384
vm.prank(alice);
385385
vm.expectRevert("Player is too far");
386386
world.pickup(transferObjectTypeId, 1, pickupCoord);
387-
388-
pickupCoord = vec3(WORLD_BORDER_LOW_X - 1, playerCoord.y() + 1, playerCoord.z());
389-
390-
vm.prank(alice);
391-
vm.expectRevert("Cannot pickup outside the world border");
392-
world.pickup(transferObjectTypeId, 1, pickupCoord);
393387
}
394388

395389
function testDropFailsIfInvalidCoord() public {
@@ -405,12 +399,6 @@ contract DropTest is BiomesTest {
405399
vm.expectRevert("Player is too far");
406400
world.drop(transferObjectTypeId, 1, dropCoord);
407401

408-
dropCoord = vec3(WORLD_BORDER_LOW_X - 1, playerCoord.y() + 1, playerCoord.z());
409-
410-
vm.prank(alice);
411-
vm.expectRevert("Cannot drop outside the world border");
412-
world.drop(transferObjectTypeId, 1, dropCoord);
413-
414402
dropCoord = playerCoord + vec3(-1, 1, 0);
415403

416404
vm.prank(alice);

packages/world/test/Energy.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3030
import { ObjectTypes } from "../src/ObjectTypes.sol";
3131
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
3232
import { Vec3, vec3 } from "../src/Vec3.sol";
33-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X, MACHINE_ENERGY_DRAIN_RATE } from "../src/Constants.sol";
33+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, MACHINE_ENERGY_DRAIN_RATE } from "../src/Constants.sol";
3434
import { TestUtils } from "./utils/TestUtils.sol";
3535

3636
contract EnergyTest is BiomesTest {

packages/world/test/Equip.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3535
import { ObjectTypes } from "../src/ObjectTypes.sol";
3636
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
3737
import { Vec3, vec3 } from "../src/Vec3.sol";
38-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X } from "../src/Constants.sol";
38+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH } from "../src/Constants.sol";
3939
import { TestInventoryUtils } from "./utils/TestUtils.sol";
4040

4141
contract EquipTest is BiomesTest {

packages/world/test/Gravity.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { massToEnergy } from "../src/utils/EnergyUtils.sol";
3030
import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3131
import { ObjectTypes } from "../src/ObjectTypes.sol";
3232
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
33-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X, PLAYER_FALL_ENERGY_COST } from "../src/Constants.sol";
33+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, PLAYER_FALL_ENERGY_COST } from "../src/Constants.sol";
3434
import { Vec3, vec3 } from "../src/Vec3.sol";
3535
import { TestUtils } from "./utils/TestUtils.sol";
3636

packages/world/test/Mine.t.sol

+2-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3232
import { ObjectTypes } from "../src/ObjectTypes.sol";
3333
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
3434
import { ObjectAmount } from "../src/ObjectTypeLib.sol";
35-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X } from "../src/Constants.sol";
35+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH } from "../src/Constants.sol";
3636
import { Vec3, vec3 } from "../src/Vec3.sol";
3737
import { TestInventoryUtils } from "./utils/TestUtils.sol";
3838

@@ -300,7 +300,7 @@ contract MineTest is BiomesTest {
300300
}
301301

302302
function testMineFailsIfInvalidCoord() public {
303-
(address alice, EntityId aliceEntityId, Vec3 playerCoord) = setupAirChunkWithPlayer();
303+
(address alice, , Vec3 playerCoord) = setupAirChunkWithPlayer();
304304

305305
Vec3 mineCoord = playerCoord + vec3(MAX_PLAYER_INFLUENCE_HALF_WIDTH + 1, 0, 0);
306306
ObjectTypeId mineObjectTypeId = ObjectTypes.Dirt;
@@ -310,13 +310,6 @@ contract MineTest is BiomesTest {
310310
vm.expectRevert("Player is too far");
311311
world.mine(mineCoord);
312312

313-
mineCoord = vec3(WORLD_BORDER_LOW_X - 1, playerCoord.y(), playerCoord.z());
314-
setObjectAtCoord(mineCoord, ObjectTypes.Dirt);
315-
316-
vm.prank(alice);
317-
vm.expectRevert("Cannot mine outside the world border");
318-
world.mine(mineCoord);
319-
320313
mineCoord = playerCoord - vec3(1, 0, 0);
321314

322315
vm.prank(alice);

packages/world/test/Move.t.sol

+3-9
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { massToEnergy } from "../src/utils/EnergyUtils.sol";
3232
import { ObjectTypeId } from "../src/ObjectTypeId.sol";
3333
import { ObjectTypes } from "../src/ObjectTypes.sol";
3434
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
35-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X, MAX_PLAYER_JUMPS, MAX_PLAYER_GLIDES, PLAYER_MOVE_ENERGY_COST, PLAYER_FALL_ENERGY_COST, PLAYER_FALL_DAMAGE_THRESHOLD } from "../src/Constants.sol";
35+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, MAX_PLAYER_JUMPS, MAX_PLAYER_GLIDES, PLAYER_MOVE_ENERGY_COST, PLAYER_FALL_ENERGY_COST, PLAYER_FALL_DAMAGE_THRESHOLD } from "../src/Constants.sol";
3636
import { Vec3, vec3 } from "../src/Vec3.sol";
3737
import { TestUtils } from "./utils/TestUtils.sol";
3838

@@ -459,7 +459,7 @@ contract MoveTest is BiomesTest {
459459
}
460460

461461
function testMoveFailsIfInvalidCoord() public {
462-
(address alice, EntityId aliceEntityId, Vec3 playerCoord) = setupAirChunkWithPlayer();
462+
(address alice, , Vec3 playerCoord) = setupAirChunkWithPlayer();
463463

464464
Vec3[] memory newCoords = new Vec3[](2);
465465
newCoords[0] = playerCoord + vec3(0, 0, 1);
@@ -473,12 +473,6 @@ contract MoveTest is BiomesTest {
473473
vm.expectRevert("New coord is too far from old coord");
474474
world.move(newCoords);
475475

476-
newCoords[1] = vec3(WORLD_BORDER_LOW_X - 1, playerCoord.y(), playerCoord.z() + 2); // Can't use vector addition here due to WORLD_BORDER_LOW_X
477-
478-
vm.prank(alice);
479-
vm.expectRevert("Cannot move outside the world border");
480-
world.move(newCoords);
481-
482476
newCoords[0] = playerCoord - vec3(1, 0, 0);
483477

484478
vm.prank(alice);
@@ -491,7 +485,7 @@ contract MoveTest is BiomesTest {
491485
}
492486

493487
function testMoveFailsIfNoPlayer() public {
494-
(address alice, EntityId aliceEntityId, Vec3 playerCoord) = setupAirChunkWithPlayer();
488+
(address alice, , Vec3 playerCoord) = setupAirChunkWithPlayer();
495489

496490
Vec3[] memory newCoords = new Vec3[](2);
497491
newCoords[0] = playerCoord + vec3(0, 0, 1);

packages/world/test/Transfer.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { massToEnergy } from "../src/utils/EnergyUtils.sol";
3939
import { ObjectTypeId } from "../src/ObjectTypeId.sol";
4040
import { ObjectTypes } from "../src/ObjectTypes.sol";
4141
import { ObjectTypeLib } from "../src/ObjectTypeLib.sol";
42-
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH, WORLD_BORDER_LOW_X } from "../src/Constants.sol";
42+
import { CHUNK_SIZE, MAX_PLAYER_INFLUENCE_HALF_WIDTH } from "../src/Constants.sol";
4343
import { Vec3, vec3 } from "../src/Vec3.sol";
4444
import { TestInventoryUtils } from "./utils/TestUtils.sol";
4545

0 commit comments

Comments
 (0)