import { runInterval } from "./eternal/utils";
import { world } from "./eternal/constants";
import { EquipmentSlot } from "@minecraft/server";

// Grants speed boost when the full set is worn.
runInterval(() => {
  for (const player of world.players) {
    const equipmentSlots = [
      player.getEquipment(EquipmentSlot.Head),
      player.getEquipment(EquipmentSlot.Chest),
      player.getEquipment(EquipmentSlot.Legs),
      player.getEquipment(EquipmentSlot.Feet),
    ];

    for (const equipment of equipmentSlots) {
      if (!equipment || !equipment.typeId.startsWith("ecbl_bc:exoskeleton_")) {
        return;
      }
    }

    player.addEffect("speed", 10, { showParticles: false });
  }
});
