Ink Coords
Example apps / ink-coords / v0.2.0
Node modIn the downloadneeds codeware
V's position on the HUD, drawn by the game itself with the ink API instead of in the overlay, in the game's own look. Needs Codeware.
The box stands for the game's screen. In the game, Codeware's HUD layer is the screen, and the text uses the game's Rajdhani font.
// Ink Coords: the Coords HUD sample, drawn by the game itself with the ink API (I2a, the
// game look since I2b).
// The tree is built once; each update changes one text. REDnode builds it again after a
// save load and removes it when this mod stops, so there is nothing to clean up here.
import { game, ink } from 'rednode';
// The game look: the label and value text styles take the game's own sizes, weights and
// colors from its style sheet, so nothing here is styled by hand.
const where = ink.text('Load a save', { style: 'value' });
ink.mount(
'hud',
{ anchor: 'top-right', x: -60, y: 260 },
ink.column({ gap: 2, align: 'right' }, ink.text('REDnode // where', { style: 'label' }), where),
);
let shown = '';
async function update() {
let text;
try {
const p = await game.player.position();
text = `${p.x.toFixed(1)} ${p.y.toFixed(1)} ${p.z.toFixed(1)}`;
} catch {
text = 'No player';
}
if (text === shown) return; // only real changes go to the game
shown = text;
where.set({ text });
}
setInterval(update, 250);
update();
console.log('Ink Coords ready');
REDnode runs JavaScript. The rednode package also has TypeScript types, so an editor checks these calls; compile TypeScript to .mjs first.
{
"id": "ink-coords",
"name": "Ink Coords",
"version": "0.2.0",
"author": "Edgemodders",
"description": "V's position at the top right of the HUD, drawn by the game itself with the ink API rather than in the overlay. In the game's own look: its text styles and colors. The sample of phases I2a and I2b. Needs Codeware.",
"main": "mod.mjs",
"open": false,
"requires": {
"codeware": ">=1.16"
}
}
The manifest names the package and says how REDnode runs it. Its fields are in Overlay apps.
How it works
ink.mount("hud", ...) puts a tree of the game's own widgets on its HUD layer, through Codeware. The game draws it, so it sits under the overlay and hides with the HUD.
The label and value text styles take the game's own sizes, weights and colors from its style sheet: nothing is styled by hand.
The tree is built once. Each update calls set on one text, and only a real change goes to the game: changes made in the same tick go in one call.
REDnode keeps the tree in the plugin and builds it again after a save load, and removes it when the mod stops, so the mod has nothing to clean up.
What it uses
ink.mount ink.column ink.text style node.set game.player.position
Try this
- Move it to the bottom left:
anchor: "bottom-left", x: 60, y: -200. - Add a dark box behind it with
ink.canvasandink.rect.
Use it
Copy the files into red4ext/plugins/REDnode/apps/ink-coords/ in the game folder, or start your own package from them: change id and name in the manifest first. The whole folder is on GitHub.