diff --git a/Scarb.lock b/Scarb.lock index 8740ad7..1c8c250 100644 --- a/Scarb.lock +++ b/Scarb.lock @@ -4,7 +4,7 @@ version = 1 [[package]] name = "dojo" version = "0.5.1" -source = "git+https://github.com/dojoengine/dojo?tag=v0.6.0-alpha.12#c595fc927b7e33bd2c1d14e75dba459229d40363" +source = "git+https://github.com/dojoengine/dojo?tag=v0.6.0-alpha.13#5bdcfdff82c7a01443bf603047f4bfe00d210ed6" dependencies = [ "dojo_plugin", ] diff --git a/Scarb.toml b/Scarb.toml index 4e005ff..8114f75 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -11,7 +11,7 @@ migrate = "sozo build && sozo migrate && ./scripts/default_auth.sh" spawn = "./scripts/spawn.sh" [dependencies] -dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.6.0-alpha.12" } +dojo = { git = "https://github.com/dojoengine/dojo", tag = "v0.6.0-alpha.13" } [[target.dojo]] diff --git a/abis/base/contracts/actions.json b/abis/base/contracts/actions.json index ca59fdb..e70ade6 100644 --- a/abis/base/contracts/actions.json +++ b/abis/base/contracts/actions.json @@ -156,23 +156,6 @@ } ] }, - { - "type": "event", - "name": "dojo_starter::systems::actions::actions::Moved", - "kind": "struct", - "members": [ - { - "name": "player", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "direction", - "type": "dojo_starter::models::moves::Direction", - "kind": "data" - } - ] - }, { "type": "event", "name": "dojo_starter::systems::actions::actions::Event", @@ -182,11 +165,6 @@ "name": "UpgradeableEvent", "type": "dojo::components::upgradeable::upgradeable::Event", "kind": "nested" - }, - { - "name": "Moved", - "type": "dojo_starter::systems::actions::actions::Moved", - "kind": "nested" } ] } diff --git a/abis/base/models/moved.json b/abis/base/models/moved.json deleted file mode 100644 index 24e91f1..0000000 --- a/abis/base/models/moved.json +++ /dev/null @@ -1,239 +0,0 @@ -[ - { - "type": "impl", - "name": "DojoModelImpl", - "interface_name": "dojo::model::IDojoModel" - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::>", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::>" - } - ] - }, - { - "type": "struct", - "name": "dojo::database::introspect::Struct", - "members": [ - { - "name": "name", - "type": "core::felt252" - }, - { - "name": "attrs", - "type": "core::array::Span::" - }, - { - "name": "children", - "type": "core::array::Span::>" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::<(core::felt252, core::array::Span::)>", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::<(core::felt252, core::array::Span::)>" - } - ] - }, - { - "type": "struct", - "name": "dojo::database::introspect::Enum", - "members": [ - { - "name": "name", - "type": "core::felt252" - }, - { - "name": "attrs", - "type": "core::array::Span::" - }, - { - "name": "children", - "type": "core::array::Span::<(core::felt252, core::array::Span::)>" - } - ] - }, - { - "type": "enum", - "name": "dojo::database::introspect::Ty", - "variants": [ - { - "name": "Primitive", - "type": "core::felt252" - }, - { - "name": "Struct", - "type": "dojo::database::introspect::Struct" - }, - { - "name": "Enum", - "type": "dojo::database::introspect::Enum" - }, - { - "name": "Tuple", - "type": "core::array::Span::>" - }, - { - "name": "Array", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::model::IDojoModel", - "items": [ - { - "type": "function", - "name": "name", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "unpacked_size", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "packed_size", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "layout", - "inputs": [], - "outputs": [ - { - "type": "core::array::Span::" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "schema", - "inputs": [], - "outputs": [ - { - "type": "dojo::database::introspect::Ty" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "movedImpl", - "interface_name": "dojo_starter::systems::actions::actions::Imoved" - }, - { - "type": "enum", - "name": "dojo_starter::models::moves::Direction", - "variants": [ - { - "name": "None", - "type": "()" - }, - { - "name": "Left", - "type": "()" - }, - { - "name": "Right", - "type": "()" - }, - { - "name": "Up", - "type": "()" - }, - { - "name": "Down", - "type": "()" - } - ] - }, - { - "type": "struct", - "name": "dojo_starter::systems::actions::actions::Moved", - "members": [ - { - "name": "player", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "direction", - "type": "dojo_starter::models::moves::Direction" - } - ] - }, - { - "type": "interface", - "name": "dojo_starter::systems::actions::actions::Imoved", - "items": [ - { - "type": "function", - "name": "ensure_abi", - "inputs": [ - { - "name": "model", - "type": "dojo_starter::systems::actions::actions::Moved" - } - ], - "outputs": [], - "state_mutability": "view" - } - ] - }, - { - "type": "event", - "name": "dojo_starter::systems::actions::actions::moved::Event", - "kind": "enum", - "variants": [] - } -] \ No newline at end of file diff --git a/abis/deployments/KATANA/contracts/actions.json b/abis/deployments/KATANA/contracts/actions.json index ca59fdb..e70ade6 100644 --- a/abis/deployments/KATANA/contracts/actions.json +++ b/abis/deployments/KATANA/contracts/actions.json @@ -156,23 +156,6 @@ } ] }, - { - "type": "event", - "name": "dojo_starter::systems::actions::actions::Moved", - "kind": "struct", - "members": [ - { - "name": "player", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "direction", - "type": "dojo_starter::models::moves::Direction", - "kind": "data" - } - ] - }, { "type": "event", "name": "dojo_starter::systems::actions::actions::Event", @@ -182,11 +165,6 @@ "name": "UpgradeableEvent", "type": "dojo::components::upgradeable::upgradeable::Event", "kind": "nested" - }, - { - "name": "Moved", - "type": "dojo_starter::systems::actions::actions::Moved", - "kind": "nested" } ] } diff --git a/manifests/base/contracts/actions.toml b/manifests/base/contracts/actions.toml index 009ebc0..94411ff 100644 --- a/manifests/base/contracts/actions.toml +++ b/manifests/base/contracts/actions.toml @@ -1,5 +1,5 @@ kind = "DojoContract" -class_hash = "0x2ba96498480b9870625f788af7ed10381f12cf36e6a6d9beb7285271aa06d0d" +class_hash = "0x4ba35a779b3d17572238ae6517f06de0f6effe75e7d150e6f0f9e683c5f625e" abi = "abis/base/contracts/actions.json" reads = [] writes = [] diff --git a/manifests/base/models/moved.toml b/manifests/base/models/moved.toml deleted file mode 100644 index 7ba61d5..0000000 --- a/manifests/base/models/moved.toml +++ /dev/null @@ -1,14 +0,0 @@ -kind = "DojoModel" -class_hash = "0xf00737ffe57c5c931bfec9a7ea66f76d5eaae12cacca6952dcee0c2e3d8038" -abi = "abis/base/models/moved.json" -name = "dojo_starter::systems::actions::actions::moved" - -[[members]] -name = "player" -type = "ContractAddress" -key = true - -[[members]] -name = "direction" -type = "Direction" -key = false diff --git a/manifests/deployments/KATANA.json b/manifests/deployments/KATANA.json index 1a110d2..2b1c9c5 100644 --- a/manifests/deployments/KATANA.json +++ b/manifests/deployments/KATANA.json @@ -675,7 +675,7 @@ { "kind": "DojoContract", "address": "0x7ec42d76c6d876b8f219c20b6a152fe35fe2afc62c471b29ba689c2f6a075b3", - "class_hash": "0x2ba96498480b9870625f788af7ed10381f12cf36e6a6d9beb7285271aa06d0d", + "class_hash": "0x4ba35a779b3d17572238ae6517f06de0f6effe75e7d150e6f0f9e683c5f625e", "abi": [ { "type": "impl", @@ -834,23 +834,6 @@ } ] }, - { - "type": "event", - "name": "dojo_starter::systems::actions::actions::Moved", - "kind": "struct", - "members": [ - { - "name": "player", - "type": "core::starknet::contract_address::ContractAddress", - "kind": "key" - }, - { - "name": "direction", - "type": "dojo_starter::models::moves::Direction", - "kind": "data" - } - ] - }, { "type": "event", "name": "dojo_starter::systems::actions::actions::Event", @@ -860,11 +843,6 @@ "name": "UpgradeableEvent", "type": "dojo::components::upgradeable::upgradeable::Event", "kind": "nested" - }, - { - "name": "Moved", - "type": "dojo_starter::systems::actions::actions::Moved", - "kind": "nested" } ] } @@ -876,262 +854,6 @@ } ], "models": [ - { - "kind": "DojoModel", - "members": [ - { - "name": "player", - "type": "ContractAddress", - "key": true - }, - { - "name": "direction", - "type": "Direction", - "key": false - } - ], - "class_hash": "0xf00737ffe57c5c931bfec9a7ea66f76d5eaae12cacca6952dcee0c2e3d8038", - "abi": [ - { - "type": "impl", - "name": "DojoModelImpl", - "interface_name": "dojo::model::IDojoModel" - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::>", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::>" - } - ] - }, - { - "type": "struct", - "name": "dojo::database::introspect::Struct", - "members": [ - { - "name": "name", - "type": "core::felt252" - }, - { - "name": "attrs", - "type": "core::array::Span::" - }, - { - "name": "children", - "type": "core::array::Span::>" - } - ] - }, - { - "type": "struct", - "name": "core::array::Span::<(core::felt252, core::array::Span::)>", - "members": [ - { - "name": "snapshot", - "type": "@core::array::Array::<(core::felt252, core::array::Span::)>" - } - ] - }, - { - "type": "struct", - "name": "dojo::database::introspect::Enum", - "members": [ - { - "name": "name", - "type": "core::felt252" - }, - { - "name": "attrs", - "type": "core::array::Span::" - }, - { - "name": "children", - "type": "core::array::Span::<(core::felt252, core::array::Span::)>" - } - ] - }, - { - "type": "enum", - "name": "dojo::database::introspect::Ty", - "variants": [ - { - "name": "Primitive", - "type": "core::felt252" - }, - { - "name": "Struct", - "type": "dojo::database::introspect::Struct" - }, - { - "name": "Enum", - "type": "dojo::database::introspect::Enum" - }, - { - "name": "Tuple", - "type": "core::array::Span::>" - }, - { - "name": "Array", - "type": "core::integer::u32" - } - ] - }, - { - "type": "interface", - "name": "dojo::model::IDojoModel", - "items": [ - { - "type": "function", - "name": "name", - "inputs": [], - "outputs": [ - { - "type": "core::felt252" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "unpacked_size", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "packed_size", - "inputs": [], - "outputs": [ - { - "type": "core::integer::u32" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "layout", - "inputs": [], - "outputs": [ - { - "type": "core::array::Span::" - } - ], - "state_mutability": "view" - }, - { - "type": "function", - "name": "schema", - "inputs": [], - "outputs": [ - { - "type": "dojo::database::introspect::Ty" - } - ], - "state_mutability": "view" - } - ] - }, - { - "type": "impl", - "name": "movedImpl", - "interface_name": "dojo_starter::systems::actions::actions::Imoved" - }, - { - "type": "enum", - "name": "dojo_starter::models::moves::Direction", - "variants": [ - { - "name": "None", - "type": "()" - }, - { - "name": "Left", - "type": "()" - }, - { - "name": "Right", - "type": "()" - }, - { - "name": "Up", - "type": "()" - }, - { - "name": "Down", - "type": "()" - } - ] - }, - { - "type": "struct", - "name": "dojo_starter::systems::actions::actions::Moved", - "members": [ - { - "name": "player", - "type": "core::starknet::contract_address::ContractAddress" - }, - { - "name": "direction", - "type": "dojo_starter::models::moves::Direction" - } - ] - }, - { - "type": "interface", - "name": "dojo_starter::systems::actions::actions::Imoved", - "items": [ - { - "type": "function", - "name": "ensure_abi", - "inputs": [ - { - "name": "model", - "type": "dojo_starter::systems::actions::actions::Moved" - } - ], - "outputs": [], - "state_mutability": "view" - } - ] - }, - { - "type": "event", - "name": "dojo_starter::systems::actions::actions::moved::Event", - "kind": "enum", - "variants": [] - } - ], - "name": "dojo_starter::systems::actions::actions::moved" - }, { "kind": "DojoModel", "members": [ diff --git a/manifests/deployments/KATANA.toml b/manifests/deployments/KATANA.toml index 71f6ac0..f3de7ef 100644 --- a/manifests/deployments/KATANA.toml +++ b/manifests/deployments/KATANA.toml @@ -16,29 +16,13 @@ name = "dojo::base::base" [[contracts]] kind = "DojoContract" address = "0x7ec42d76c6d876b8f219c20b6a152fe35fe2afc62c471b29ba689c2f6a075b3" -class_hash = "0x2ba96498480b9870625f788af7ed10381f12cf36e6a6d9beb7285271aa06d0d" +class_hash = "0x4ba35a779b3d17572238ae6517f06de0f6effe75e7d150e6f0f9e683c5f625e" abi = "abis/deployments/KATANA/contracts/actions.json" reads = [] writes = [] computed = [] name = "dojo_starter::systems::actions::actions" -[[models]] -kind = "DojoModel" -class_hash = "0xf00737ffe57c5c931bfec9a7ea66f76d5eaae12cacca6952dcee0c2e3d8038" -abi = "abis/base/models/moved.json" -name = "dojo_starter::systems::actions::actions::moved" - -[[models.members]] -name = "player" -type = "ContractAddress" -key = true - -[[models.members]] -name = "direction" -type = "Direction" -key = false - [[models]] kind = "DojoModel" class_hash = "0x23c28dcfad6be01ca6509fdb35fd2bed6622238397613c60da5d387a43c38d0" diff --git a/src/systems/actions.cairo b/src/systems/actions.cairo index 1814866..fde9df4 100644 --- a/src/systems/actions.cairo +++ b/src/systems/actions.cairo @@ -16,20 +16,20 @@ mod actions { use starknet::{ContractAddress, get_caller_address}; use dojo_starter::models::{position::{Position, Vec2}, moves::{Moves, Direction}}; - // declaring custom event struct - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - Moved: Moved, - } + // // declaring custom event struct + // #[event] + // #[derive(Drop, starknet::Event)] + // enum Event { + // Moved: Moved, + // } - // declaring custom event struct - #[derive(starknet::Event, Model, Copy, Drop, Serde)] - struct Moved { - #[key] - player: ContractAddress, - direction: Direction - } + // // declaring custom event struct + // #[derive(starknet::Event, Model, Copy, Drop, Serde)] + // struct Moved { + // #[key] + // player: ContractAddress, + // direction: Direction + // } // impl: implement functions specified in trait #[abi(embed_v0)] @@ -48,9 +48,7 @@ mod actions { set!( world, ( - Moves { - player, remaining: moves.remaining + 1, last_direction: Direction::None(()) - }, + Moves { player, remaining: 100, last_direction: Direction::None(()) }, Position { player, vec: Vec2 { x: position.vec.x + 10, y: position.vec.y + 10 } }, @@ -77,9 +75,8 @@ mod actions { // // Update the world state with the new moves data and position. set!(world, (moves, next)); - - // Emit an event to the world to notify about the player's move. - emit!(world, Moved { player, direction }); + // Emit an event to the world to notify about the player's move. + // emit!(world, Moved { player, direction }); } } }