Files

62 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.
# Darklord.js — openDomain() (satır 1948)
[← Darklord.js](index.md) · [← Master](../../wiki.md)
Parça 1/2 · [sonraki](openDomain-2.md)
```javascript
function openDomain(c, p)
{
if (!canUseDomain(p))
{
p.send(TAG + "\u00a7cBu alan 5zeb'e ozel. Si0n sadece test edebilir.");
return;
}
var existing = loadDomain(c);
if (existing && existing.active)
{
p.send(TAG + (existing.closing ? "\u00a78Alan zaten kapaniyor." : "\u00a78Alan zaten acik. Kapatmak icin \u00a7f!alan_kapan\u00a78."));
return;
}
var pos = p.getPosition();
var runId = nowMs();
var cx = Math.floor(pos.x);
var floorY = Math.floor(pos.y) - 1;
var cz = Math.floor(pos.z);
var plan = buildDomainPlan(cx, floorY, cz);
var role = roleByPlayer(p.getName());
var domain = {
active: true,
closing: false,
owner: p.getName(),
ownerRp: role ? role.rp : p.getName(),
x: cx,
y: floorY,
z: cz,
dim: getDimensionSafe(p),
radius: DOMAIN_RADIUS,
height: DOMAIN_HEIGHT,
runId: runId,
createdAt: nowMs(),
buildIndex: 0,
protectIndex: 0,
restoreIndex: null,
plan: plan,
saved: [],
savedMap: {},
participants: collectDomainParticipants(c, p, cx, floorY, cz),
built: false,
pulse: 0
};
saveDomain(c, domain);
setDomainRun(runId);
play(p.getWorld(), "minecraft:entity.evocation_illager.prepare_summon", pos.x, pos.y + 0.8, pos.z, 1.0, 0.45);
play(p.getWorld(), "minecraft:entity.evocation_illager.prepare_attack", pos.x, pos.y + 0.8, pos.z, 0.85, 0.38);
play(p.getWorld(), "minecraft:block.beacon.activate", pos.x, pos.y + 0.8, pos.z, 1.15, 0.62);
```