mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-24 17:21:43 +00:00
Fixed player respawn health
This commit is contained in:
parent
6e747b6fc0
commit
afb4ecb1a9
2 changed files with 13 additions and 0 deletions
|
|
@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ function inject(serv, player)
|
||||||
levelType:'default'
|
levelType:'default'
|
||||||
});
|
});
|
||||||
player.sendInitialPosition();
|
player.sendInitialPosition();
|
||||||
|
player.updateHealth(20);
|
||||||
player.spawn();
|
player.spawn();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue