Server actually ticks
This commit is contained in:
+15
-1
@@ -79,7 +79,21 @@ export function set_state_value(value: number, block_info: BlockRegistry, name:
|
||||
|
||||
state_bits = (state_bits & ~s.mask) | (new_value << s.shift);
|
||||
|
||||
return (state_bits << 16) | id;
|
||||
// >>> 0 keeps it unsigned when the top state bit is set
|
||||
return ((state_bits << 16) | id) >>> 0;
|
||||
}
|
||||
|
||||
// a block's numeric id with its states at their defaults, what placing it should store
|
||||
export function default_block_value(nid: number, block_info: BlockRegistry | undefined): number {
|
||||
let value = nid;
|
||||
for (const state of block_info?.states ?? []) {
|
||||
value = set_state_value(value, block_info!, state.name, state.default) ?? value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
export function block_value(nid: number, state: number): number {
|
||||
return ((state << STATE_SHIFT) | nid) >>> 0;
|
||||
}
|
||||
|
||||
function compile_block_states(block_info: BlockRegistry) {
|
||||
|
||||
Reference in New Issue
Block a user