mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-25 06:05:52 +02:00
Archive update v0.55.0
This commit is contained in:
@@ -94,7 +94,6 @@ export function mockClient(fields: any = {}): IClient {
|
||||
subscribes: [],
|
||||
saysQueue: [],
|
||||
lastSays: [],
|
||||
lastAction: 0,
|
||||
lastBoopAction: 0,
|
||||
lastExpressionAction: 0,
|
||||
viewWidth: 3,
|
||||
|
||||
@@ -132,7 +132,6 @@ describe('playerUtils', () => {
|
||||
safeX: 10,
|
||||
safeY: 20,
|
||||
lastPacket: 123,
|
||||
lastAction: 0,
|
||||
lastBoopAction: 0,
|
||||
lastExpressionAction: 0,
|
||||
lastX: 10,
|
||||
@@ -516,11 +515,11 @@ describe('playerUtils', () => {
|
||||
|
||||
describe('canPerformAction()', () => {
|
||||
it('returns true if last action date is below current time', () => {
|
||||
expect(canPerformAction(mockClient({ lastAction: 1234 }))).true;
|
||||
expect(canPerformAction(mockClient({ lastBoopOrKissAction: 1234 }))).true;
|
||||
});
|
||||
|
||||
it('returns false if last action date is ahead or current time', () => {
|
||||
expect(canPerformAction(mockClient({ lastAction: Date.now() + 1000 }))).false;
|
||||
expect(canPerformAction(mockClient({ lastExpressionAction: Date.now() + 1000 }))).false;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -563,7 +562,8 @@ describe('playerUtils', () => {
|
||||
client = mockClient();
|
||||
client.map = createServerMap('foo', 0, 1, 1);
|
||||
client.pony.region = client.map.regions[0];
|
||||
client.lastAction = 0;
|
||||
client.lastExpressionAction = 0;
|
||||
client.lastBoopOrKissAction = 0;
|
||||
});
|
||||
|
||||
it('sends boop action', () => {
|
||||
@@ -586,12 +586,12 @@ describe('playerUtils', () => {
|
||||
expect(client.pony.options!.expr).equal(EMPTY_EXPRESSION);
|
||||
});
|
||||
|
||||
it('updates last boop action', () => {
|
||||
client.lastBoopAction = 0;
|
||||
it('updates last boop/kiss action', () => {
|
||||
client.lastBoopOrKissAction = 0;
|
||||
|
||||
boop(client, 100);
|
||||
|
||||
expect(client.lastBoopAction).equal(100 + 500);
|
||||
expect(client.lastBoopOrKissAction).equal(100 + 500);
|
||||
});
|
||||
|
||||
it('executes boop on found entity', () => {
|
||||
@@ -618,7 +618,7 @@ describe('playerUtils', () => {
|
||||
});
|
||||
|
||||
it('does nothing if cannot perform action', () => {
|
||||
client.lastAction = 1000;
|
||||
client.lastBoopOrKissAction = 1000;
|
||||
|
||||
boop(client, 0);
|
||||
|
||||
@@ -646,7 +646,7 @@ describe('playerUtils', () => {
|
||||
|
||||
it('does not update flags if cannot perform action', () => {
|
||||
const client = mockClient();
|
||||
client.lastAction = Date.now() + 1000;
|
||||
client.lastBoopOrKissAction = Date.now() + 1000;
|
||||
client.pony.state = 0;
|
||||
|
||||
turnHead(client);
|
||||
@@ -703,7 +703,7 @@ describe('playerUtils', () => {
|
||||
});
|
||||
|
||||
it('does nothing if cannot perform action', () => {
|
||||
client.lastAction = Date.now() + 1000;
|
||||
client.lastBoopOrKissAction = Date.now() + 1000;
|
||||
client.pony.state = 0;
|
||||
|
||||
stand(client);
|
||||
@@ -752,7 +752,7 @@ describe('playerUtils', () => {
|
||||
});
|
||||
|
||||
it('does nothing if cannot perform action', () => {
|
||||
client.lastAction = Date.now() + 1000;
|
||||
client.lastBoopOrKissAction = Date.now() + 1000;
|
||||
client.pony.state = 0;
|
||||
|
||||
sit(client, {});
|
||||
@@ -796,7 +796,7 @@ describe('playerUtils', () => {
|
||||
});
|
||||
|
||||
it('does nothing if cannot perform action', () => {
|
||||
client.lastAction = Date.now() + 1000;
|
||||
client.lastBoopOrKissAction = Date.now() + 1000;
|
||||
client.pony.state = 0;
|
||||
|
||||
lie(client);
|
||||
@@ -844,7 +844,7 @@ describe('playerUtils', () => {
|
||||
});
|
||||
|
||||
it('does nothing if already flying', () => {
|
||||
client.lastAction = Date.now() + 1000;
|
||||
client.lastBoopOrKissAction = Date.now() + 1000;
|
||||
client.pony.state = EntityState.PonyFlying;
|
||||
|
||||
fly(client);
|
||||
@@ -854,7 +854,7 @@ describe('playerUtils', () => {
|
||||
});
|
||||
|
||||
it('does nothing if cannot perform action', () => {
|
||||
client.lastAction = Date.now() + 1000;
|
||||
client.lastBoopOrKissAction = Date.now() + 1000;
|
||||
client.pony.state = 0;
|
||||
|
||||
fly(client);
|
||||
@@ -896,7 +896,7 @@ describe('playerUtils', () => {
|
||||
});
|
||||
|
||||
it('does nothing if cannot perform action', () => {
|
||||
client.lastAction = Date.now() + 1000;
|
||||
client.lastExpressionAction = Date.now() + 1000;
|
||||
|
||||
expressionAction(client, Action.Yawn);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user