mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 13:55:04 +02:00
Add shrug command
This commit is contained in:
@@ -244,7 +244,14 @@ export class ChatBox implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
private say(message: string, chatType: ChatType, entityId: number): boolean {
|
||||
this.game.lastChatMessageType = chatType;
|
||||
return !!this.game.send(server => server.say(entityId, message, chatType));
|
||||
if (message.toLowerCase().startsWith('/shrug')) {
|
||||
var rawMessage = message.substring(6);
|
||||
return !!this.game.send(server =>
|
||||
server.say(entityId, ((rawMessage !== '') ? rawMessage + ' ' : '') + `¯\\_(ツ)_/¯`,
|
||||
chatType));
|
||||
} else {
|
||||
return !!this.game.send(server => server.say(entityId, message, chatType));
|
||||
}
|
||||
}
|
||||
private changeChatType(e: KeyboardEvent, chatType: ChatType) {
|
||||
this.chatType = chatType;
|
||||
|
||||
@@ -196,6 +196,7 @@ export function createCommands(world: World): Command[] {
|
||||
command(['t', 'think'], '/t - thinking balloon', '', shouldNotBeCalled),
|
||||
command(['w', 'whisper'], '/w <name> - whisper to player', '', shouldNotBeCalled),
|
||||
command(['r', 'reply'], '/r - reply to whisper', '', shouldNotBeCalled),
|
||||
command(['shrug'], '/shrug - ¯\\_(ツ)_/¯', '', shouldNotBeCalled),
|
||||
command(['e'], '/e - set permanent expression', '', ({ }, { pony }, message) => {
|
||||
pony.exprPermanent = parseExpression(message, true);
|
||||
setEntityExpression(pony, undefined, 0);
|
||||
@@ -608,7 +609,7 @@ chatTypes.set('w', ChatType.Whisper);
|
||||
chatTypes.set('whisper', ChatType.Whisper);
|
||||
|
||||
export function parseCommand(text: string, type: ChatType): { command?: string; args: string; type: ChatType; } {
|
||||
if (!isCommand(text)) {
|
||||
if (!isCommand(text) || text.toLowerCase().startsWith('/shrug')) {
|
||||
return { args: text, type };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user