diff --git a/scripts/default_auth.sh b/scripts/default_auth.sh index 74194fc..0906308 100644 --- a/scripts/default_auth.sh +++ b/scripts/default_auth.sh @@ -27,7 +27,7 @@ echo actions : $ACTIONS_ADDRESS echo "---------------------------------------------------------------------------" # enable system -> component authorizations -COMPONENTS=("Barn" "OuterCity" "Warehouse", "CityBuilding") +COMPONENTS=("Barn" "OuterCity" "Warehouse" "CityBuilding") for component in ${COMPONENTS[@]}; do sozo auth writer $component $ACTIONS_ADDRESS --world $WORLD_ADDRESS --rpc-url $RPC_URL diff --git a/src/actions.cairo b/src/actions.cairo index 423e90d..8f44172 100644 --- a/src/actions.cairo +++ b/src/actions.cairo @@ -3,7 +3,7 @@ mod kingdom_lord_controller { use kingdom_lord::components::barn::{barn_component, Barn}; use kingdom_lord::components::barn::barn_component::BarnInternalImpl; use kingdom_lord::components::warehouse::{warehouse_component, Warehouse}; - use kingdom_lord::components::outer_city::{outer_city_component}; + use kingdom_lord::components::outer_city::{outer_city_component, OuterCity}; use kingdom_lord::components::outer_city::outer_city_component::{OuterCityInternalImpl}; use kingdom_lord::components::city_hall::{city_hall_component, UnderUpgrading}; use kingdom_lord::helpers::tuple::{TupleFour, TupleSix}; @@ -79,6 +79,7 @@ mod kingdom_lord_controller { max_storage: MAX_STORAGE }, Barn { player, food: 0_u64.into(), max_storage: MAX_STORAGE }, + OuterCity { player, last_mined_block: block }, // wood building new_city_building(player, block, GROWTH_RATE, 1_u64.into(), 0_u64), new_city_building(player, block, GROWTH_RATE, 0_u64.into(), 1_u64), diff --git a/src/components/outer_city.cairo b/src/components/outer_city.cairo index f0604bc..b009dd5 100644 --- a/src/components/outer_city.cairo +++ b/src/components/outer_city.cairo @@ -18,7 +18,7 @@ trait OuterCityTrait { #[derive(Model, Copy, Drop, Serde)] struct OuterCity { #[key] - address: ContractAddress, + player: ContractAddress, last_mined_block: u64 } diff --git a/src/tests/test_spawn.cairo b/src/tests/test_spawn.cairo index ed3b2dd..e59d774 100644 --- a/src/tests/test_spawn.cairo +++ b/src/tests/test_spawn.cairo @@ -18,7 +18,8 @@ use starknet::class_hash::Felt252TryIntoClassHash; fn test_spawn() { // deploy world with models let context = setup_world(); - + let caller = starknet::contract_address_const::<0x1>(); + set_caller_address(caller); context.kingdom_lord.spawn(); let (wood,brick,steel,food) = context.kingdom_lord.get_resource();