From 198d4d7b44afe4dd3c6016ae7014bc07a7c0bca2 Mon Sep 17 00:00:00 2001 From: gianalarcon Date: Fri, 5 Apr 2024 19:22:04 +0700 Subject: [PATCH] Keep starknet::Event --- src/systems/actions.cairo | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/systems/actions.cairo b/src/systems/actions.cairo index 8e54028..e5d370e 100644 --- a/src/systems/actions.cairo +++ b/src/systems/actions.cairo @@ -15,7 +15,21 @@ 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 + // #[derive(starknet::Event, Model, Copy, Drop, Serde)] + // struct Moved { + // #[key] + // player: ContractAddress, + // direction: Direction + // } // impl: implement functions specified in trait #[abi(embed_v0)] impl ActionsImpl of IActions { @@ -59,8 +73,8 @@ mod actions { // // Update the world state with the new moves data and position. set!(world, (moves, next)); - - // Emit events to the world to notify about the player's move. + // Emit an event to the world to notify about the player's move. + // emit!(world, Moved { player, direction }); emit!(world,( Moves { player, remaining, last_direction: direction })); } }