#
Solidity API
#
AddressBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, address value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (address)
#
AddressComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, address value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (address)
#
getEntitiesWithValue
function getEntitiesWithValue(address value) public view virtual returns (uint256[])
#
BoolBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (bool)
#
BoolComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity) public
#
getValue
function getValue(uint256 entity) public view virtual returns (bool)
#
getEntitiesWithValue
function getEntitiesWithValue(bool value) public view virtual returns (uint256[])
#
Coord
struct Coord {
int32 x;
int32 y;
}
#
CoordBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct Coord value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct Coord)
#
Coord
struct Coord {
int32 x;
int32 y;
}
#
CoordComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct Coord value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct Coord)
#
getEntitiesWithValue
function getEntitiesWithValue(struct Coord coord) public view virtual returns (uint256[])
#
FunctionSelector
struct FunctionSelector {
address contr;
bytes4 func;
}
#
FunctionBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct FunctionSelector value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct FunctionSelector)
#
freeFunction
freeFunction staticcallFunctionSelector(struct FunctionSelector functionSelector, bytes args) internal view returns (bool, bytes)
#
FunctionSelector
struct FunctionSelector {
address contr;
bytes4 func;
}
#
FunctionComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct FunctionSelector value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct FunctionSelector)
#
getEntitiesWithValue
function getEntitiesWithValue(struct FunctionSelector value) public view virtual returns (uint256[])
#
freeFunction
freeFunction staticcallFunctionSelector(struct FunctionSelector functionSelector, bytes args) internal view returns (bool, bytes)
#
Int32BareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, int32 value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (int32)
#
Int32Component
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, int32 value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (int32)
#
getEntitiesWithValue
function getEntitiesWithValue(int32 value) public view virtual returns (uint256[])
#
StringArrayBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, string[] value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (string[])
#
StringArrayComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, string[] value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (string[])
#
getEntitiesWithValue
function getEntitiesWithValue(string[] value) public view virtual returns (uint256[])
#
StringBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, string value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (string)
#
StringComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, string value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (string)
#
getEntitiesWithValue
function getEntitiesWithValue(string value) public view virtual returns (uint256[])
#
SystemCallback
struct SystemCallback {
uint256 systemId;
bytes args;
}
#
SystemCallbackBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct SystemCallback value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct SystemCallback)
#
freeFunction
freeFunction executeSystemCallback(contract IWorld world, struct SystemCallback cb) internal returns (bytes)
Queries world.systems()
for cb.systemId
,
then executes the system with cb.args
.
#
SystemCallbackComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct SystemCallback value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct SystemCallback)
#
getEntitiesWithValue
function getEntitiesWithValue(struct SystemCallback value) public view virtual returns (uint256[])
#
Uint256ArrayBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, uint256[] value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (uint256[])
#
Uint256ArrayComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, uint256[] value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (uint256[])
#
getEntitiesWithValue
function getEntitiesWithValue(uint256 value) public view virtual returns (uint256[])
#
Uint256BareComponent
Reference implementation of a component storing a uint256 value for each entity.
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, uint256 value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (uint256)
#
Uint32ArrayBareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, uint32[] value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (uint32[])
#
Uint32ArrayComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, uint32[] value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (uint32[])
#
getEntitiesWithValue
function getEntitiesWithValue(uint32[] value) public view virtual returns (uint256[])
#
Uint32BareComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, uint32 value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (uint32)
#
Uint32Component
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, uint32 value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (uint32)
#
getEntitiesWithValue
function getEntitiesWithValue(uint32 value) public view virtual returns (uint256[])
#
VoxelCoord
struct VoxelCoord {
int32 x;
int32 y;
int32 z;
}
#
VoxelCoordComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct VoxelCoord value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct VoxelCoord)
#
VoxelCoord
struct VoxelCoord {
int32 x;
int32 y;
int32 z;
}
#
VoxelCoordComponent
#
constructor
constructor(address world, uint256 id) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct VoxelCoord value) public virtual
#
getValue
function getValue(uint256 entity) public view virtual returns (struct VoxelCoord)
#
getEntitiesWithValue
function getEntitiesWithValue(struct VoxelCoord coord) public view virtual returns (uint256[])
#
LibUtils
#
toHex
function toHex(bytes data) internal pure returns (bytes res)
#
arrayContains
function arrayContains(uint256[] arr, uint256 value) internal pure returns (bool)
#
safeDelegateCall
function safeDelegateCall(address addr, bytes callData) internal returns (bytes)
#
distanceBetween
function distanceBetween(contract IUint256Component components, uint256 e1, uint256 e2, uint256 positionComponentId) internal view returns (int32)
#
manhattan
function manhattan(struct Coord a, struct Coord b) internal pure returns (int32)
#
getEntityAt
function getEntityAt(contract IUint256Component components, struct Coord position, uint256 positionComponentId) internal view returns (uint256, bool found)
#
getEntityAt
function getEntityAt(contract World world, struct Coord position, uint256 positionComponentId) internal view returns (uint256, bool found)
#
getEntityWithAt
function getEntityWithAt(contract IUint256Component components, uint256 componentID, struct Coord position, uint256 positionComponentId) internal view returns (uint256 entity, bool found)
#
getEntityWithAt
function getEntityWithAt(contract World world, uint256 componentID, struct Coord position, uint256 positionComponentId) internal view returns (uint256 entity, bool found)
#
ID
uint256 ID
#
ECSEvent
struct ECSEvent {
uint8 component;
uint32 entity;
bytes value;
}
#
BulkSetStateSystem
#
constructor
constructor(contract IWorld _world, address _components) public
#
requirement
function requirement(bytes) public view returns (bytes)
#
execute
function execute(bytes args) public returns (bytes)
#
executeTyped
function executeTyped(uint256[] componentIds, uint256[] entities, struct ECSEvent[] state) external returns (bytes)
#
ID
uint256 ID
#
ComponentDevSystem
#
constructor
constructor(contract IWorld _world, address _components) public
#
requirement
function requirement(bytes) public view returns (bytes)
#
execute
function execute(bytes args) public returns (bytes)
#
executeTyped
function executeTyped(uint256 componentId, uint256 entity, bytes value) public returns (bytes)
#
ID
uint256 ID
#
UpgradableSystem
#
implementation
address implementation
#
constructor
constructor(contract IWorld _world, address _components) public
#
execute
function execute(bytes args) public payable returns (bytes)
#
upgrade
function upgrade(address impl) public
#
_delegate
function _delegate(address impl) internal
From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.7.3/contracts/proxy/Proxy.sol
_Delegates the current call to implementation
.
This function does not return to its internal call site, it will return directly to the external caller._
#
ComponentTest
#
vm
contract Vm vm
#
users
address payable[] users
#
boolComponent
contract BoolComponent boolComponent
#
BoolID
uint256 BoolID
#
boolBareComponent
contract BoolBareComponent boolBareComponent
#
BoolBareID
uint256 BoolBareID
#
uint256Component
contract Uint256Component uint256Component
#
Uint256ID
uint256 Uint256ID
#
uint256BareComponent
contract Uint256BareComponent uint256BareComponent
#
Uint256BareID
uint256 Uint256BareID
#
coordComponent
contract CoordComponent coordComponent
#
CoordID
uint256 CoordID
#
coordBareComponent
contract CoordBareComponent coordBareComponent
#
CoordBareID
uint256 CoordBareID
#
testComponent
contract TestComponent testComponent
#
testBareComponent
contract TestBareComponent testBareComponent
#
setUp
function setUp() public
#
testBaseComponentGas
function testBaseComponentGas() public
#
testStructComponentGas
function testStructComponentGas() public
#
IDeploy
#
deploy
function deploy(address deployer) external returns (contract IWorld world)
#
MudTest
#
vm
contract Vm vm
#
utils
contract Utilities utils
#
alice
address payable alice
#
bob
address payable bob
#
eve
address payable eve
#
deployer
address deployer
#
world
contract IWorld world
#
components
contract IUint256Component components
#
systems
contract IUint256Component systems
#
deploy
contract IDeploy deploy
#
constructor
constructor(contract IDeploy _deploy) public
#
component
function component(uint256 id) public view returns (address)
#
system
function system(uint256 id) public view returns (address)
#
setUp
function setUp() public virtual
#
MudV2Test
#
worldAddress
address worldAddress
#
setUp
function setUp() public virtual
#
SystemCallbackComponentTest
#
vm
contract Vm vm
#
world
contract World world
#
uint256BareComponent
contract Uint256BareComponent uint256BareComponent
#
Uint256BareID
uint256 Uint256BareID
#
systemCallbackBareComponent
contract SystemCallbackBareComponent systemCallbackBareComponent
#
systemCallbackComponent
contract SystemCallbackComponent systemCallbackComponent
#
system
contract TestSystem system
#
TestSystemID
uint256 TestSystemID
#
entity
uint256 entity
#
entities
uint256[] entities
#
values
bytes[] values
#
setUp
function setUp() public
#
testGetAndExecuteSystemCallbackBare
function testGetAndExecuteSystemCallbackBare() public
#
testGetAndExecuteSystemCallback
function testGetAndExecuteSystemCallback() public
#
_cbForGas
function _cbForGas() internal returns (struct SystemCallback)
#
testSystemCallbackGas
function testSystemCallbackGas() public
#
testSystemCallbackBareGas
function testSystemCallbackBareGas() public
#
ID
uint256 ID
#
TestStructBare
struct TestStructBare {
uint256 a;
int32 b;
address c;
string d;
}
#
TestBareComponent
#
constructor
constructor(address world) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct TestStructBare value) public
#
getValue
function getValue(uint256 entity) public view returns (struct TestStructBare)
#
ID
uint256 ID
#
TestStruct
struct TestStruct {
uint256 a;
int32 b;
address c;
string d;
}
#
TestComponent
#
constructor
constructor(address world) public
#
getSchema
function getSchema() public pure returns (string[] keys, enum LibTypes.SchemaValue[] values)
Return the keys and value types of the schema of this component.
#
set
function set(uint256 entity, struct TestStruct value) public
#
getValue
function getValue(uint256 entity) public view returns (struct TestStruct)
#
getEntitiesWithValue
function getEntitiesWithValue(struct TestStruct test) public view returns (uint256[])
#
ID
uint256 ID
#
TestSystem
Sets values of entities
to newValues
for the component with componentId
#
constructor
constructor(contract IWorld _world, address _components) public
#
execute
function execute(bytes args) public returns (bytes)
#
executeTyped
function executeTyped(uint256 componentId, uint256[] entities, bytes[] newValues) public
#
Utilities
#
vm
contract Vm vm
#
nextUser
bytes32 nextUser
#
getNextUserAddress
function getNextUserAddress() external returns (address payable)
#
createUsers
function createUsers(uint256 userNum) external returns (address payable[])
#
mineBlocks
function mineBlocks(uint256 numBlocks) external