@quenty/metricutils 2.0.1-canary.9c1fd3b.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/LICENSE.md +1 -1
- package/README.md +5 -13
- package/package.json +2 -2
- package/src/Shared/MetricUtils.lua +19 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [2.0.1
|
|
6
|
+
## [2.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/metricutils@2.0.0...@quenty/metricutils@2.0.1) (2021-12-30)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @quenty/metricutils
|
|
9
9
|
|
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
## MetricUtils
|
|
2
2
|
<div align="center">
|
|
3
|
-
<a href="http://quenty.github.io/
|
|
4
|
-
<img src="https://
|
|
3
|
+
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/mhtGUS8">
|
|
7
|
-
<img src="https://img.shields.io/
|
|
7
|
+
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
8
8
|
</a>
|
|
9
9
|
<a href="https://github.com/Quenty/NevermoreEngine/actions">
|
|
10
10
|
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
|
|
@@ -13,17 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
Provides ways to convert to or from metric
|
|
15
15
|
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/MetricUtils">View docs →</a></div>
|
|
17
|
+
|
|
16
18
|
## Installation
|
|
17
19
|
```
|
|
18
20
|
npm install @quenty/metricutils --save
|
|
19
21
|
```
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
Usage is designed to be simple.
|
|
23
|
-
|
|
24
|
-
### `MetricUtils.getSoundDelaySeconds(studs)`
|
|
25
|
-
|
|
26
|
-
### `MetricUtils.studsToKilometers(studs)`
|
|
27
|
-
|
|
28
|
-
### `MetricUtils.studsToMeters(studs)`
|
|
29
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/metricutils",
|
|
3
|
-
"version": "2.0.1
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Provides ways to convert to or from metric",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
|
|
31
31
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Provides ways to convert studs to metric and back.
|
|
3
|
+
@class MetricUtils
|
|
4
|
+
]=]
|
|
4
5
|
|
|
5
6
|
local MetricUtils = {}
|
|
6
7
|
|
|
@@ -8,15 +9,30 @@ local STUDS_PER_METER = 3.57
|
|
|
8
9
|
|
|
9
10
|
local SPEED_OF_SOUND_IN_METERS_PER_SECOND = 343
|
|
10
11
|
|
|
12
|
+
--[=[
|
|
13
|
+
Computes sound delay for the given studs
|
|
14
|
+
@param studs number
|
|
15
|
+
@return number -- seconds
|
|
16
|
+
]=]
|
|
11
17
|
function MetricUtils.getSoundDelaySeconds(studs)
|
|
12
18
|
local meters = MetricUtils.studsToMeters(studs)
|
|
13
19
|
return meters/SPEED_OF_SOUND_IN_METERS_PER_SECOND
|
|
14
20
|
end
|
|
15
21
|
|
|
22
|
+
--[=[
|
|
23
|
+
Converts studs to kilometers
|
|
24
|
+
@param studs number
|
|
25
|
+
@return number -- kilometers
|
|
26
|
+
]=]
|
|
16
27
|
function MetricUtils.studsToKilometers(studs)
|
|
17
28
|
return studs/STUDS_PER_METER/1000
|
|
18
29
|
end
|
|
19
30
|
|
|
31
|
+
--[=[
|
|
32
|
+
Converts studs to kilometers
|
|
33
|
+
@param studs number
|
|
34
|
+
@return number -- meters
|
|
35
|
+
]=]
|
|
20
36
|
function MetricUtils.studsToMeters(studs)
|
|
21
37
|
return studs/STUDS_PER_METER
|
|
22
38
|
end
|