20 lines
596 B
JavaScript
20 lines
596 B
JavaScript
const packet_255 = require("../Packets/packet_255");
|
|
|
|
module.exports = function (ws, message, player) {
|
|
let isRepairSuccessful = null;
|
|
|
|
if (player.isRepairing()) {
|
|
player.cancelRepair();
|
|
isRepairSuccessful = false;
|
|
} else {
|
|
player.initializeRepair();
|
|
isRepairSuccessful = true;
|
|
};
|
|
|
|
const packet = packet_255({ packetId: 14, isSuccessful: isRepairSuccessful });
|
|
ws.send(packet, true, true); // should use central packet distributor
|
|
|
|
const metadata = [player.hp.current / player.hp.maximum, player.isAttacking()];
|
|
|
|
return metadata;
|
|
}; |