mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 22:41:52 +00:00
22 lines
No EOL
497 B
JavaScript
22 lines
No EOL
497 B
JavaScript
module.exports=inject;
|
|
|
|
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
|
|
});
|
|
}
|
|
|
|
player._client.on("use_entity", function(packet) {
|
|
if(packet.mouse == 1) {
|
|
attackEntity(packet.target);
|
|
}
|
|
});
|
|
|
|
} |