Add shrug command

This commit is contained in:
Stubenhocker1399
2019-09-17 18:17:19 +02:00
parent 4def56d96c
commit 8f3755794f
2 changed files with 10 additions and 2 deletions
@@ -244,8 +244,15 @@ export class ChatBox implements AfterViewInit, OnDestroy {
} }
private say(message: string, chatType: ChatType, entityId: number): boolean { private say(message: string, chatType: ChatType, entityId: number): boolean {
this.game.lastChatMessageType = chatType; this.game.lastChatMessageType = 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)); return !!this.game.send(server => server.say(entityId, message, chatType));
} }
}
private changeChatType(e: KeyboardEvent, chatType: ChatType) { private changeChatType(e: KeyboardEvent, chatType: ChatType) {
this.chatType = chatType; this.chatType = chatType;
this.message = ''; this.message = '';
+2 -1
View File
@@ -196,6 +196,7 @@ export function createCommands(world: World): Command[] {
command(['t', 'think'], '/t - thinking balloon', '', shouldNotBeCalled), command(['t', 'think'], '/t - thinking balloon', '', shouldNotBeCalled),
command(['w', 'whisper'], '/w <name> - whisper to player', '', shouldNotBeCalled), command(['w', 'whisper'], '/w <name> - whisper to player', '', shouldNotBeCalled),
command(['r', 'reply'], '/r - reply to whisper', '', shouldNotBeCalled), command(['r', 'reply'], '/r - reply to whisper', '', shouldNotBeCalled),
command(['shrug'], '/shrug - ¯\\_(ツ)_/¯', '', shouldNotBeCalled),
command(['e'], '/e - set permanent expression', '', ({ }, { pony }, message) => { command(['e'], '/e - set permanent expression', '', ({ }, { pony }, message) => {
pony.exprPermanent = parseExpression(message, true); pony.exprPermanent = parseExpression(message, true);
setEntityExpression(pony, undefined, 0); setEntityExpression(pony, undefined, 0);
@@ -608,7 +609,7 @@ chatTypes.set('w', ChatType.Whisper);
chatTypes.set('whisper', ChatType.Whisper); chatTypes.set('whisper', ChatType.Whisper);
export function parseCommand(text: string, type: ChatType): { command?: string; args: string; type: ChatType; } { 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 }; return { args: text, type };
} }