mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 07:24:52 +09:00
Provide reason for player leaving
Expose the reason for why a player is leaving a server in playerEvent.
This commit is contained in:
1 parent
8017497bdd
commit
db562ce6a0
5 files changed
+37
-10
No files matched your search
@@ -89,21 +89,21 @@ describe("class Instance", function() {
|
||||
|
||||
it("should send player_event", function() {
|
||||
instance._recordPlayerJoin("player");
|
||||
instance._recordPlayerLeave("player");
|
||||
instance._recordPlayerLeave("player", "quit");
|
||||
assert.deepEqual(
|
||||
connector.sentMessages[1],
|
||||
{
|
||||
seq: 2,
|
||||
type: "player_event_event",
|
||||
data: { type: "leave", instance_id: instance.id, name: "player" },
|
||||
data: { type: "leave", instance_id: instance.id, name: "player", reason: "quit" },
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("should be idempotent", function() {
|
||||
instance._recordPlayerJoin("player");
|
||||
instance._recordPlayerLeave("player");
|
||||
instance._recordPlayerLeave("player");
|
||||
instance._recordPlayerLeave("player", "quit");
|
||||
instance._recordPlayerLeave("player", "quit");
|
||||
assert(!instance.playersOnline.has("player"), "player was not removed");
|
||||
assert.equal(connector.sentMessages.length, 2);
|
||||
});
|
||||
@@ -148,7 +148,7 @@ describe("class Instance", function() {
|
||||
{
|
||||
seq: 2,
|
||||
type: "player_event_event",
|
||||
data: { type: "leave", instance_id: instance.id, name: "player" },
|
||||
data: { type: "leave", instance_id: instance.id, name: "player", reason: "quit" },
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user