1.0.6 • Published 3 years ago

@rbxts/distancepoller v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@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")
})
1.0.3-b

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago