Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Sep 8, 2024
1 parent cc2e099 commit f5aa22c
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions crates/dojo-core/src/world/world_contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ pub trait IWorld<T> {
fn uuid(ref self: T) -> usize;
fn emit(self: @T, keys: Array<felt252>, values: Span<felt252>);

fn entity_lobotomized(
self: @T, model_selector: felt252, entity_id: felt252
) -> felt252;
fn entity_lobotomized(self: @T, model_selector: felt252, entity_id: felt252) -> felt252;
fn entity(
self: @T, model_selector: felt252, index: ModelIndex, layout: Layout
) -> Span<felt252>;
Expand All @@ -54,9 +52,7 @@ pub trait IWorld<T> {
value: felt252,
);
fn delete_entity(ref self: T, model_selector: felt252, index: ModelIndex, layout: Layout);
fn delete_entity_lobotomized(
ref self: T, model_selector: felt252, entity_id: felt252
);
fn delete_entity_lobotomized(ref self: T, model_selector: felt252, entity_id: felt252);

fn base(self: @T) -> ClassHash;
fn resource(self: @T, selector: felt252) -> Resource;
Expand Down Expand Up @@ -821,14 +817,13 @@ pub mod world {
entity_id: felt252,
value: felt252,
) {
assert(
self.is_writer(model_selector, get_caller_address()), 'no writer'
);
assert(self.is_writer(model_selector, get_caller_address()), 'no writer');

storage::layout::write_lobotomized(
model_selector, entity_id, value
storage::layout::write_lobotomized(model_selector, entity_id, value);
EventEmitter::emit(
ref self,
StoreSetRecord { table: model_selector, keys, values: array![value].span() }
);
EventEmitter::emit(ref self, StoreSetRecord { table: model_selector, keys, values: array![value].span() });
}

/// Deletes a record/entity of a model..
Expand All @@ -849,16 +844,10 @@ pub mod world {
fn delete_entity_lobotomized(
ref self: ContractState, model_selector: felt252, entity_id: felt252
) {
assert(
self.is_writer(model_selector, get_caller_address()), 'no writer'
);
assert(self.is_writer(model_selector, get_caller_address()), 'no writer');

storage::layout::write_lobotomized(
model_selector, entity_id, value
);
EventEmitter::emit(
ref self, StoreDelRecord { table: model_selector, entity_id }
);
storage::layout::write_lobotomized(model_selector, entity_id, 0);
EventEmitter::emit(ref self, StoreDelRecord { table: model_selector, entity_id });
}

/// Gets the base contract class hash.
Expand Down

0 comments on commit f5aa22c

Please sign in to comment.