本文整理汇总了TypeScript中@csegames/camelot-unchained.registerSlashCommand函数的典型用法代码示例。如果您正苦于以下问题:TypeScript registerSlashCommand函数的具体用法?TypeScript registerSlashCommand怎么用?TypeScript registerSlashCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerSlashCommand函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: default
export default () => {
/**
* Print registered slash command help
*/
registerSlashCommand('help', 'show available slash commands', () => {
const commands = getSlashCommands();
for (let i = 0; i < commands.length; ++i) {
systemMessage(`${commands[i].command} : ${commands[i].helpText}`);
}
});
registerSlashCommand('respawn', 'respawn your character', (id?: string) => {
game.selfPlayerState.respawn(id || '');
});
/**
* Change camera mode
*/
registerSlashCommand('togglecamera', 'toggles the camera mode', () => game.triggerKeyAction(
game.keyActions.PlayerCameraFreeToggle, // COHERENT TODO should this be something else?
));
/**
* Get your characters current x, y, z coordinates -- ONLY DURING DEVELOPMENT
*/
registerSlashCommand('loc', 'tells you your current location', () => {
setTimeout(() => systemMessage(
`${game.selfPlayerState.position.x},${game.selfPlayerState.position.y},${game.selfPlayerState.position.z}`,
), 100);
});
};
示例2: default
export default () => {
/**
* Play the Dance 1 emote
*/
registerSlashCommand('dance1', 'Dance!', () => client.Emote(emotes.DANCE1));
/**
* Play the Dance 2 emote
*/
registerSlashCommand('dance2', 'Dance!', () => client.Emote(emotes.DANCE2));
/**
* Play the Wave 1 emote
*/
registerSlashCommand('wave1', 'Wave!', () => client.Emote(emotes.WAVE1));
/**
* Play the Wave 2 emote
*/
registerSlashCommand('wave2', 'Wave!', () => client.Emote(emotes.WAVE2));
/**
* Stop your repeating emote
*/
registerSlashCommand('stop', 'Stop!', () => client.Emote(emotes.STOP));
};
示例3: default
export default () => {
/**
* Reload the UI or a single UI Module
*/
registerSlashCommand('reloadui', 'reload the ui, or a single module if a name is provided', () => {
game.reloadUI();
});
/**
* Enables console debugging for the UI
*/
registerSlashCommand('debugui', 'Toggle UI debug logging', () => {
_devGame.debug = !_devGame.debug;
});
};
示例4: default
export default () => {
/**
* Reload the UI or a single UI Module
*/
registerSlashCommand('reloadui', 'reload the ui, or a single module if a name is provided', (params: string = '') => {
client.ReleaseInputOwnership();
if (params.length > 0) {
client.ReloadUI(params);
} else {
client.ReloadAllUI();
}
});
/**
* Open a UI Module
*/
registerSlashCommand('openui', 'open a ui module', (params: string) => {
if (params.length > 0) client.OpenUI(params);
});
/**
* Close a UI Module
*/
registerSlashCommand('closeui', 'close a ui module', (params: string) => {
if (params.length > 0) {
client.ReleaseInputOwnership();
client.CloseUI(params);
}
});
/**
* Show a hidden UI module
*/
registerSlashCommand('showui', 'show a hidden ui module', (params: string) => {
if (params.length > 0) client.ShowUI(params);
});
/**
* Hide a UI module
*/
registerSlashCommand('hideui', 'hide a ui module', (params: string) => {
if (params.length > 0) client.HideUI(params);
});
};
示例5: default
export default () => {
/**
* Print registered slash command help
*/
registerSlashCommand('help', 'show available slash commands', () => {
const commands = getSlashCommands();
for (let i = 0; i < commands.length; ++i) {
systemMessage(`${commands[i].command} : ${commands[i].helpText}`);
}
});
/**
* Unstuck! (kills you and respawns for now)
*/
registerSlashCommand('stuck', 'get your character unstuck', () => client.Stuck());
/**
* Change your zone -- Only works on Hatchery / Debug & Internal builds
*/
registerSlashCommand('zone', 'change your zone', (params: string) => client.ChangeZone(parseInt(params, 10)));
/**
* Change camera mode
*/
registerSlashCommand('togglecamera', 'toggles the camera mode', () => client.ToggleCamera());
/**
* Crash the game -- Yes, this really just crashes the game
*/
registerSlashCommand('crashthegame', 'CRASH the game client!!', () => client.CrashTheGame());
/**
* Get your characters current x, y, z coordinates -- ONLY DURING DEVELOPMENT
*/
registerSlashCommand('loc', 'tells you your current location', () => {
setTimeout(() => systemMessage(`${client.locationX},${client.locationY},${client.locationZ}`), 100);
});
};
示例6: default
export default () => {
if (!hasClientAPI()) return;
/**
* Set field of view
*/
registerSlashCommand('fov', 'set your field of view, client accepts values from 20 -> 179.9', (params: string = '') => {
const argv = parseArgs(params);
const degrees = argv._.length > 0 ? argv._[0] : 120;
client.FOV(degrees);
});
/**
* Drop a temporary light at the characters feet
*/
registerSlashCommand(
'droplight',
'drop a light at your location, options: (colors are 0-255) droplight <intensity> <radius> <red> <green> <blue>',
(params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length > 0) {
const intensity = argv._.length >= 0 ? argv._[0] : 1;
const radius = argv._.length > 1 ? argv._[1] : 20;
const red = argv._.length > 2 ? argv._[2] : 100;
const green = argv._.length > 3 ? argv._[3] : 100;
const blue = argv._.length > 4 ? argv._[4] : 100;
client.DropLight(intensity, radius, red, green, blue);
return;
}
const intensity = argv.intensity ? argv.intensity : 1;
const radius = argv.radius > 1 ? argv.radius : 20;
const red = argv.red > 2 ? argv.red : 100;
const green = argv.green > 3 ? argv.green : 100;
const blue = argv.blue > 4 ? argv.blue : 100;
client.DropLight(intensity, radius, red, green, blue);
});
/**
* Remove the closest dropped light to the player
*/
registerSlashCommand('removelight', 'removes the closest dropped light to the player', (params: string = '') => {
client.RemoveLight();
});
/**
* Remove all lights placed with the drop light command
*/
registerSlashCommand('resetlights', 'removes all dropped lights from the world', (params: string = '') => {
client.ResetLights();
});
/**
* Count all the placed blocks in the world
*/
registerSlashCommand('countblocks', 'count all placed blocks in the world.', () => {
client.CountBlocks();
setTimeout(() => systemMessage(`There are ${client.placedBlockCount} blocks in this world.`), 1000);
});
/**
* Quit the game
*/
registerSlashCommand('exit', 'quit the game', () => client.Quit());
registerSlashCommand(
'replacesubstance',
'replace blocks with type args[0] with blocks with type of args[1]', (params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length >= 2) {
client.ReplaceSubstance(argv._[0], argv._[1]);
}
return;
});
registerSlashCommand(
'replaceshape',
'replace blocks with shape args[0] with blocks with shape of args[1]', (params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length >= 2) {
client.ReplaceShapes(argv._[0], argv._[1]);
}
return;
});
registerSlashCommand(
'replaceselectedsubstance',
'replace blocks with type args[0] with blocks with type of args[1] within selected range', (params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length >= 2) {
client.ReplaceSelectedSubstance(argv._[0], argv._[1]);
}
return;
});
registerSlashCommand(
'replaceselectedshape',
'replace blocks with shape args[0] to blocks with shape of args[1] within selected range', (params: string = '') => {
//.........这里部分代码省略.........
示例7: default
export default () => {
/**
* Drop a temporary light at the characters feet
*/
registerSlashCommand(
'droplight',
'drop a light at your location, options: (colors are 0-255) droplight <intensity> <radius> <red> <green> <blue>',
(params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length > 0) {
const intensity = argv._.length >= 0 ? argv._[0] : 1;
const radius = argv._.length > 1 ? argv._[1] : 20;
const red = argv._.length > 2 ? argv._[2] : 100;
const green = argv._.length > 3 ? argv._[3] : 100;
const blue = argv._.length > 4 ? argv._[4] : 100;
game.dropLight.drop(intensity, radius, red, green, blue);
return;
}
const intensity = argv.intensity ? argv.intensity : 1;
const radius = argv.radius > 1 ? argv.radius : 20;
const red = argv.red > 2 ? argv.red : 100;
const green = argv.green > 3 ? argv.green : 100;
const blue = argv.blue > 4 ? argv.blue : 100;
game.dropLight.drop(intensity, radius, red, green, blue);
});
/**
* Remove the closest dropped light to the player
*/
registerSlashCommand('removelight', 'removes the closest dropped light to the player', (params: string = '') => {
game.dropLight.removeLast();
});
/**
* Remove all lights placed with the drop light command
*/
registerSlashCommand('resetlights', 'removes all dropped lights from the world', (params: string = '') => {
game.dropLight.clearAll();
});
/**
* Quit the game
*/
registerSlashCommand('exit', 'quit the game', () => game.quit());
registerSlashCommand(
'replacesubstance',
'replace blocks with type args[0] with blocks with type of args[1]', (params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length >= 2) {
game.building.replaceMaterialsAsync(argv._[0], argv._[1], false);
}
return;
});
registerSlashCommand(
'replaceshape',
'replace blocks with shape args[0] with blocks with shape of args[1]', (params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length >= 2) {
game.building.replaceShapesAsync(argv._[0], argv._[1], false);
}
return;
});
registerSlashCommand(
'replaceselectedsubstance',
'replace blocks with type args[0] with blocks with type of args[1] within selected range', (params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length >= 2) {
game.building.replaceMaterialsAsync(argv._[0], argv._[1], true);
}
return;
});
registerSlashCommand(
'replaceselectedshape',
'replace blocks with shape args[0] to blocks with shape of args[1] within selected range', (params: string = '') => {
if (params.length === 0) return;
const argv = parseArgs(params);
if (argv._.length >= 2) {
game.building.replaceShapesAsync(argv._[0], argv._[1], true);
}
return;
});
registerSlashCommand('blocktypes', 'prints out substance and shape of selected blocks', () => {
// TODO COHERENT BlockTypes is missing, potentially use materials property
// client.BlockTypes();
// setTimeout(() => systemMessage(`${client.blockTypes}`), 1000);
});
registerSlashCommand('rotatex', 'rotate selected blocks 90 degrees around the x axis', () => {
game.triggerKeyAction(game.keyActions.CubeRotateBlockX);
});
registerSlashCommand('rotatey', 'rotate selected blocks 90 degrees around the y axis', () => {
game.triggerKeyAction(game.keyActions.CubeRotateBlockY);
});
//.........这里部分代码省略.........