@rbxts/distancepoller
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

@rbxts/distancepoller

A small utility for priority distance polling. This means that it polls an object's distance quicker/slower depending on how far away it was last time it checked

Installation

npm i @rbxts/distancepoller

Example Usage

import * as DistancePoller from "@rbxts/distancepoller";

const MINIMUM_INTERVAL = 0.1
const MAXIMUM_INTERVAL = 5

const radius = 5
const players = [Players.LocalPlayer]

const goal = new DistancePoller.Goal(target, radius, players, (distance) => {
    return math.min(math.max(distance / 40, MINIMUM_INTERVAL), MAXIMUM_INTERVAL);
});

goal.entered.Connect(() => {
    print("Player entered radius around target")
})

goal.left.Connect(() => {
    print("Player left radius around target")
})

Readme

Keywords

none

Package Sidebar

Install

npm i @rbxts/distancepoller

Weekly Downloads

0

Version

1.0.6

License

ISC

Unpacked Size

13.7 kB

Total Files

5

Last publish

Collaborators

  • evancat77