Files

951 B
Raw Permalink Blame History

npc.js — startLoop() (satır 374)

← npc.js · ← Master

Parça 3/3 · önceki

                // hasar anında, hasar alan oyuncunun yanında diyalog aç (cooldown'lı)
                var now = Date.now();
                if (now > (mappet.get("hector_dialogue_cd") || 0))
                {
                    target.executeCommand("/mp dialogue open @p[r=5] " + DIALOGUE_ID);
                    mappet.set("hector_dialogue_cd", now + DIALOGUE_CD_MS);
                }

                continue;
            }

            if (dist < STOP_DIST) continue;

            // hedefe doğru it + yüzünü çevir
            e.addMotion((dx / dist) * FOLLOW_SPEED, 0, (dz / dist) * FOLLOW_SPEED);
            e.setRotations(0, yaw, yaw);
        }

        ctx.scheduleScript(LOOP_TICKS, loop);
    }

    c.scheduleScript(LOOP_TICKS, loop);
}