mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 14:31:17 +00:00
Added player.updateHealth documentation
This commit is contained in:
parent
afb4ecb1a9
commit
b00110d19a
2 changed files with 6 additions and 6 deletions
|
|
@ -62,6 +62,7 @@
|
|||
- [player.spawn()](#playerspawn)
|
||||
- [player.setGameMode(gameMode)](#playersetgamemodegamemode)
|
||||
- [player.handleCommand(command)](#playerhandlecommandcommand)
|
||||
- [player.updateHealth(health)](#playerupdatehealthhealth)
|
||||
- [Low level properties](#low-level-properties)
|
||||
- [player._client](#player_client)
|
||||
- [Low level methods](#low-level-methods)
|
||||
|
|
@ -288,6 +289,10 @@ set player gameMode to `gameMode`
|
|||
|
||||
handle `command`
|
||||
|
||||
#### player.updateHealth(health)
|
||||
|
||||
update the player health.
|
||||
|
||||
### Low level properties
|
||||
|
||||
#### player._client
|
||||
|
|
|
|||
|
|
@ -15,12 +15,7 @@ function inject(serv, player)
|
|||
function attackEntity(entityId)
|
||||
{
|
||||
var attackedPlayer = serv.entities[entityId].player;
|
||||
attackedPlayer.entity.health -= 1;
|
||||
attackedPlayer._client.write('update_health', {
|
||||
food: attackedPlayer.entity.food,
|
||||
foodSaturation: 0.0,
|
||||
health: attackedPlayer.entity.health
|
||||
});
|
||||
attackedPlayer.updateHealth(attackedPlayer.entity.health - 1);
|
||||
|
||||
if(attackedPlayer.entity.health==0)
|
||||
attackedPlayer._writeOthers('entity_status',{
|
||||
|
|
|
|||
Loading…
Reference in a new issue