script engine passing methods back into engine
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-16 14:12:00 -04:00
parent f73f110aa8
commit d656d75535
4 changed files with 18 additions and 5 deletions

View File

@ -71,11 +71,9 @@ export const clientHooks: Hook[] = [
} break;
case 'SelectRoom': {
const areaSelection: AreaSelection = engine.classes.areaUtils.static.selectAreaRectangular()
console.log(JSON.stringify(areaSelection))
console.log(areaSelection.getType())
console.log(JSON.stringify(areaSelection.getType()))
console.log(areaSelection.getRectStart())
console.log(JSON.stringify(areaSelection.getRectStart()))
engine.classes.areaUtils.static.makeSelectionVisible(areaSelection)
} break;
case 'ShowFurniture': {
} break;

View File

@ -25,4 +25,10 @@ export interface ClientAreaUtils {
*/
readonly selectAreaRectangular: () => AreaSelection
/**
* Makes a selection visible
* @param selection The selection
*/
readonly makeSelectionVisible: (selection: AreaSelection) => void
}

View File

@ -1848,6 +1848,7 @@ HTML-defined buttons now directly eval in the js context instead of going throug
Fix caching with deleted source files
Proof of concept of ui button calling engine code
Script engine direct access to joml vectors
Script engine passing objects back into methods successfully

View File

@ -25,9 +25,17 @@ public class ScriptClientAreaUtils {
Vector3i chunkPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(cursorPos);
Vector3i blockPos = ClientWorldData.convertRealToLocalBlockSpace(cursorPos);
AreaSelection selection = AreaSelection.selectRectangularBlockCavity(chunkPos, blockPos, AreaSelection.DEFAULT_SELECTION_RADIUS);
Globals.cursorState.selectRectangularArea(selection);
CursorState.makeAreaVisible();
return selection;
}
/**
* Makes a selection visible
* @param selection The selection
*/
@Export
public static void makeSelectionVisible(AreaSelection selection){
Globals.cursorState.selectRectangularArea(selection);
CursorState.makeAreaVisible();
}
}