Add excite action

This commit is contained in:
Stubenhocker1399
2019-09-18 23:08:20 +02:00
parent f246d9279e
commit ba2b31c748
6 changed files with 18 additions and 4 deletions
+7 -1
View File
@@ -11,7 +11,7 @@ import { PonyTownGame } from './game';
import { boopAction, upAction, downAction, turnHeadAction } from './playerActions';
import { ACTIONS_LIMIT, COMMAND_ACTION_TIME_DELAY } from '../common/constants';
import { cloneDeep, hasFlag } from '../common/utils';
import { boop, defaultHeadFrame, stand, sneeze, yawn, lie, sit, fly, laugh } from './ponyAnimations';
import { boop, defaultHeadFrame, stand, sneeze, yawn, lie, sit, fly, laugh, excite } from './ponyAnimations';
import { createDefaultPony, syncLockedPonyInfo, toPalette, mockPaletteManager } from '../common/ponyInfo';
import {
ACTION_EXPRESSION_EYE_COLOR, ACTION_EXPRESSION_BG, ACTION_ACTION_COAT_COLOR, WHITE, HEARTS_COLOR,
@@ -113,6 +113,7 @@ const actionActions = [
actionButtonAction('yawn', 'Yawn', Action.Yawn),
actionButtonAction('love', 'Love', Action.Love),
actionButtonAction('laugh', 'Laugh', Action.Laugh),
actionButtonAction('excite', 'Excite', Action.Excite),
actionButtonAction('blush', 'Blush', Action.Blush),
actionButtonAction('drop', 'Drop item', Action.Drop),
actionButtonAction('drop-toy', 'Drop toy', Action.DropToy),
@@ -472,6 +473,11 @@ export function drawAction(canvas: HTMLCanvasElement, action: ButtonAction | und
drawPony(batch, actionPony, state, 17, 40, defaultDrawPonyOptions());
break;
}
case 'excite': {
const state = { ...createState(), headAnimation: excite, headAnimationFrame: 3 };
drawPony(batch, actionPony, state, 17, 40, defaultDrawPonyOptions());
break;
}
case 'sleep': {
const state = { ...createState(), expression: createExpression(Eye.Closed, Eye.Closed, Muzzle.Neutral) };
drawPony(batch, actionPony, state, 18, 40, defaultDrawPonyOptions());
+6 -1
View File
@@ -25,7 +25,7 @@ import { decodeUpdate, readOneUpdate } from '../common/encoders/updateDecoder';
import { updateEntityVelocity } from '../common/entityUtils';
import { decodePonyInfo } from '../common/compressPony';
import { mockPaletteManager } from '../common/ponyInfo';
import { yawn, laugh, sneeze } from './ponyAnimations';
import { yawn, laugh, sneeze, excite } from './ponyAnimations';
import {
findEntityById, getRegionGlobal, setTile, removeEntity, addEntity, removeEntityDirectly, setRegion,
addEntityToMapRegion, switchEntityRegion, getRegionUnsafe, addOrRemoveFromEntityList,
@@ -415,6 +415,11 @@ export function handleAction(game: PonyTownGame, id: number, action: Action) {
setHeadAnimation(pony, sneeze);
}
break;
case Action.Excite:
if (!hasHeadAnimation(pony)) {
setHeadAnimation(pony, excite);
}
break;
default:
log(`handleAction: Invalid action: ${action}`);
}