Fixed player respawn health

This commit is contained in:
mhsjlw 2015-08-28 11:05:49 -04:00
parent 6e747b6fc0
commit afb4ecb1a9
2 changed files with 13 additions and 0 deletions

View file

@ -2,6 +2,16 @@ module.exports=inject;
function inject(serv, player) function inject(serv, player)
{ {
function updateHealth(health) {
player.entity.health = health;
player._client.write('update_health', {
food: player.entity.food,
foodSaturation: 0.0,
health: player.entity.health
});
}
function attackEntity(entityId) function attackEntity(entityId)
{ {
var attackedPlayer = serv.entities[entityId].player; var attackedPlayer = serv.entities[entityId].player;
@ -30,4 +40,6 @@ function inject(serv, player)
} }
}); });
player.updateHealth = updateHealth;
} }

View file

@ -11,6 +11,7 @@ function inject(serv, player)
levelType:'default' levelType:'default'
}); });
player.sendInitialPosition(); player.sendInitialPosition();
player.updateHealth(20);
player.spawn(); player.spawn();
} }
}); });