Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions crates/block_data_gen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,23 @@ fn process_block(
),
};
}

// Sort properties by their change interval in the state list in ascending order.
props.sort_by_cached_key(|prop| {
let name = prop.name.as_str();

let previous_state =
json.states.first().unwrap().properties.as_ref().unwrap()[name].as_str();

let interval = json
.states
.iter()
.position(|state| state.properties.as_ref().unwrap()[name] != previous_state)
.unwrap();

usize::MAX - interval
});

let mut attrs = BlockAttrs::default();
for attr in attrs_str.split(',').filter(|s| !s.is_empty()) {
match attr {
Expand Down
Loading