mirror of
https://github.com/danbulant/flying-squid
synced 2026-07-06 03:31:10 +00:00
implement leaving, fix #6
This commit is contained in:
parent
bddc8d117d
commit
213fe7d84b
1 changed files with 11 additions and 0 deletions
|
|
@ -181,7 +181,18 @@ function inject(serv,player)
|
||||||
|
|
||||||
player._client.on('end', function () {
|
player._client.on('end', function () {
|
||||||
serv.broadcast(player.username + ' quit the game.', "yellow");
|
serv.broadcast(player.username + ' quit the game.', "yellow");
|
||||||
|
player._writeOthers('player_info',{
|
||||||
|
action: 4,
|
||||||
|
data: [{
|
||||||
|
UUID: transformUuid(player._client.uuid)
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
player._writeOthers('entity_destroy',{'entityIds':[player.entity.id]});
|
||||||
player.emit('disconnect');
|
player.emit('disconnect');
|
||||||
|
var index=serv.players.indexOf(player);
|
||||||
|
if(index>-1)
|
||||||
|
serv.players.slice(index,1);
|
||||||
|
delete serv.uuidToPlayer[player._client.uuid];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue