Merge pull request #128 from Stubenhocker1399/shrug-command

Add shrug command
This commit is contained in:
Eliot Partridge
2019-09-17 18:05:47 -05:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
@@ -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;
+2 -1
View File
@@ -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 };
}