mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-05-22 22:28:28 +02:00
add new feature:
show position , health ,weather and food
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
module.exports = function($scope, socket) {
|
||||
|
||||
$scope.players = [];
|
||||
$scope.food=0;
|
||||
$scope.health=0;
|
||||
|
||||
// request player list every 5000ms
|
||||
setInterval(function() {
|
||||
@@ -26,6 +28,11 @@ module.exports = function($scope, socket) {
|
||||
socket.on('disconnect', function() {
|
||||
$scope.$apply(function() {
|
||||
$scope.players = [];
|
||||
$scope.posx = 'no';
|
||||
$scope.posy = 'no';
|
||||
$scope.posz = 'no';
|
||||
$scope.food=0;
|
||||
$scope.health=0;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,7 +40,34 @@ module.exports = function($scope, socket) {
|
||||
socket.on('bot:disconnect', function() {
|
||||
$scope.$apply(function() {
|
||||
$scope.players = [];
|
||||
$scope.posx = 'no';
|
||||
$scope.posy = 'no';
|
||||
$scope.posz = 'no';
|
||||
$scope.food=0;
|
||||
$scope.health=0;
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('bot:move', function(data) {
|
||||
$scope.$apply(function() {
|
||||
$scope.posx=data.x;
|
||||
$scope.posy=data.y;
|
||||
$scope.posz=data.z;
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('bot:forcedMove', function(data) {
|
||||
$scope.$apply(function() {
|
||||
$scope.posx=data.x;
|
||||
$scope.posy=data.y;
|
||||
$scope.posz=data.z;
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('bot:health',function(data){
|
||||
$scope.$apply(function() {
|
||||
$scope.health=data.health;
|
||||
$scope.food=data.food;
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user