doukutsu-rs/src/scripting/doukutsu.d.ts

76 lines
1.7 KiB
TypeScript
Raw Normal View History

2021-01-16 13:51:52 +00:00
declare type EventHandler<T> = (this: void, param: T) => void;
2021-02-12 10:05:28 +00:00
/**
* Represents a
*/
2021-01-16 13:51:52 +00:00
declare interface DoukutsuPlayer {
2021-02-12 10:05:28 +00:00
/**
* The ID of player.
*/
id(): number;
/**
* Current position of player in X axis (as floating point, not internal fixed point representation).
*/
2021-01-16 13:51:52 +00:00
x(): number;
2021-02-12 10:05:28 +00:00
/**
* Current position of player in Y axis (as floating point, not internal fixed point representation).
*/
2021-01-16 13:51:52 +00:00
y(): number;
2021-02-12 10:05:28 +00:00
/**
* Current velocity of player in X axis (as floating point, not internal fixed point representation).
*/
2021-01-16 13:51:52 +00:00
velX(): number;
2021-02-12 10:05:28 +00:00
/**
* Current velocity of player in Y axis (as floating point, not internal fixed point representation).
*/
2021-01-16 13:51:52 +00:00
velY(): number;
2021-02-12 10:05:28 +00:00
}
2021-01-16 13:51:52 +00:00
declare interface DoukutsuScene {
/**
* Returns the tick of current scene.
*/
tick(): number;
/**
2021-02-05 09:47:30 +00:00
* Returns a list of players connected to current game.
2021-01-16 13:51:52 +00:00
*/
2021-02-05 09:47:30 +00:00
onlinePlayers(): DoukutsuPlayer[];
/**
* Returns a list of players on current map.
*/
mapPlayers(): DoukutsuPlayer[];
/**
* Returns the id of local player.
*/
localPlayerId(): number;
/**
* Returns player with specified id.
*/
player(id: number): DoukutsuPlayer | null;
2021-02-12 10:05:28 +00:00
}
2021-01-16 13:51:52 +00:00
declare namespace doukutsu {
/**
* Plays a PixTone sound effect with specified ID.
*/
function playSfx(id: number): void;
/**
* Changes current music to one with specified ID.
* If ID equals 0, the music is stopped.
*/
function playMusic(id: number): void;
function on(event: "tick", handler: EventHandler<DoukutsuScene>): EventHandler<DoukutsuScene>;
function on<T>(event: string, handler: EventHandler<T>): EventHandler<T>;
2021-02-12 10:05:28 +00:00
}