Files

46 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ezoicportal.js — main() (satır 1)
[← ezoicportal.js](index.md) · [← Master](../../wiki.md)
Parça 2/3 · [önceki](main.md) · [sonraki](main-3.md)
```javascript
if (data.tick > maxTicks && data.state === "open") {
data.state = "closing";
data.tick = 0;
context.getWorld().playSound("block.fire.extinguish", hitX, hitY, hitZ, 1.0, 1.0);
}
var currentRx = radiusX;
var currentRy = radiusY;
if (data.state === "opening") {
var progress = data.tick / 15.0; // 15 tickte açılsın
if (progress >= 1.0) {
data.state = "open";
progress = 1.0;
data.tick = 0;
}
currentRx = radiusX * progress;
currentRy = radiusY * progress;
} else if (data.state === "closing") {
var progress = 1.0 - (data.tick / 15.0); // 15 tickte kapansın
if (progress <= 0) {
return; // Animasyon bitti, loop'u bitir
}
currentRx = radiusX * progress;
currentRy = radiusY * progress;
} else if (data.state === "open") {
// Ezoic'in konumunu kontrol et
var target = context.getServer().getPlayer("Ezoic");
if (target != null) {
var targetPos = target.getPosition();
var dx = targetPos.x - hitX;
var dy = targetPos.y - hitY;
var dz = targetPos.z - hitZ;
// Portal merkezine yakınlık (yükseklik farkını tolare etmek için Y eksenini ayarladık)
var distSq = dx * dx + (dy - 0.9) * (dy - 0.9) + dz * dz;
if (distSq < 1.0) { // Oyuncu boyutuyla uyumlu mesafe
```