Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local LookAtButtonsClient = setmetatable({}, BaseObject)
LookAtButtonsClient.ClassName = "LookAtButtonsClient"
LookAtButtonsClient.__index = LookAtButtonsClient

function LookAtButtonsClient.new(humanoid, serviceBag: ServiceBag.ServiceBag)
function LookAtButtonsClient.new(humanoid: Humanoid, serviceBag: ServiceBag.ServiceBag)
local self = setmetatable(BaseObject.new(humanoid), LookAtButtonsClient)

self._serviceBag = assert(serviceBag, "No serviceBag")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function PreviewFinder:_setup()
end
end

function PreviewFinder:_setupParent(parent)
function PreviewFinder:_setupParent(parent: Instance)
local maid = Maid.new()

maid:GiveTask(parent.DescendantAdded:Connect(function(child)
Expand Down
36 changes: 36 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/acceltween/src/Shared/AccelTween.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export type AccelTween = typeof(setmetatable(
_y1: number,
_a1: number,
},
{ __index = AccelTween }
{} :: typeof({ __index = AccelTween })
))

--[=[
Expand Down Expand Up @@ -99,6 +99,15 @@ function AccelTween.new(maxaccel: number?): AccelTween
return self :: any
end

function AccelTween.SetTarget(self: AccelTween, target: number, doNotAnimate: boolean?): ()
self.t = target

if doNotAnimate then
self.p = target
self.v = 0
end
end

function AccelTween:__index(index)
if AccelTween[index] then
return AccelTween[index]
Expand Down
2 changes: 1 addition & 1 deletion src/adorneedata/src/Shared/AdorneeDataValue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ AdorneeDataValue.__index = AdorneeDataValue
@param prototype table
@return AdorneeDataValue<T>
]=]
function AdorneeDataValue.new(adornee, prototype)
function AdorneeDataValue.new(adornee: Instance, prototype)
assert(typeof(adornee) == "Instance", "Bad adornee")
assert(type(prototype) == "table", "Bad prototype")

Expand Down
2 changes: 1 addition & 1 deletion src/bodycolorsutils/src/Shared/RxBodyColorsDataUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local RxBodyColorsDataUtils = {}
@param instance Instance
@return Observable<BodyColorsData>
]=]
function RxBodyColorsDataUtils.observeFromAttributes(instance)
function RxBodyColorsDataUtils.observeFromAttributes(instance: Instance)
assert(typeof(instance) == "Instance", "Bad instance")

local observables = {}
Expand Down
2 changes: 1 addition & 1 deletion src/boundlinkutils/src/Shared/BoundLinkCollection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function BoundLinkCollection:HasClass(class)
return self._classes[class] ~= nil
end

function BoundLinkCollection:TrackParent(parent)
function BoundLinkCollection:TrackParent(parent: Instance)
assert(parent, "Bad parent")

self._maid:GiveTask(parent.ChildAdded:Connect(function(child)
Expand Down
2 changes: 1 addition & 1 deletion src/buttondragmodel/src/Client/ButtonDragModel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type ButtonDragModel =
_clampWithinButton: ValueObject.ValueObject<boolean>,
_activePositions: { [InputObject | string]: Vector2? },

DragPositionChanged: Signal.Signal<Vector2>,
DragPositionChanged: Signal.Signal<(Vector2?, Vector2?, ...any)>,
IsDraggingChanged: Signal.Signal<boolean>,
},
{} :: typeof({ __index = ButtonDragModel })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function HasChatTagsBase.new(player: Player): HasChatTagsBase
return
end

local tagDataList = brio:GetValue()
local tagDataList: { ChatTagDataUtils.ChatTagData } = brio:GetValue()
local maid = brio:ToMaid()

table.sort(tagDataList, function(a, b)
Expand Down
1 change: 1 addition & 0 deletions src/clienttranslator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
],
"dependencies": {
"@quenty/blend": "workspace:*",
"@quenty/enums": "workspace:*",
"@quenty/instanceutils": "workspace:*",
"@quenty/loader": "workspace:*",
"@quenty/maid": "workspace:*",
Expand Down
18 changes: 6 additions & 12 deletions src/clienttranslator/src/Shared/Numbers/RoundingBehaviourTypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@

local require = require(script.Parent.loader).load(script)

local Table = require("Table")
local SimpleEnum = require("SimpleEnum")

export type RoundingBehaviourType = "roundToClosest" | "truncate" | "None"

export type RoundingBehaviourTypeMap = {
ROUND_TO_CLOSEST: "roundToClosest",
TRUNCATE: "truncate",
NONE: "none",
}

return Table.readonly({
ROUND_TO_CLOSEST = "roundToClosest",
TRUNCATE = "truncate",
NONE = "none",
} :: RoundingBehaviourTypeMap)
return SimpleEnum.new({
ROUND_TO_CLOSEST = "roundToClosest" :: "roundToClosest",
TRUNCATE = "truncate" :: "truncate",
NONE = "none" :: "none",
})
6 changes: 3 additions & 3 deletions src/colorpalette/src/Shared/ColorPalette.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ function ColorPalette.ObserveColor(self: ColorPalette, color, grade, vividness):
end
end

function ColorPalette.SetDefaultSurfaceName(self: ColorPalette, surfaceName: string)
function ColorPalette.SetDefaultSurfaceName(self: ColorPalette, surfaceName: string): ()
assert(type(surfaceName) == "string", "Bad surfaceName")

self._gradePalette:SetDefaultSurfaceName(surfaceName)
end

function ColorPalette.GetColorSwatch(self: ColorPalette, colorName: string)
function ColorPalette.GetColorSwatch(self: ColorPalette, colorName: string): ColorSwatch.ColorSwatch
local swatch = self._swatchMap:Get(colorName)
if not swatch then
error(string.format("No swatch with name %q", colorName))
Expand Down Expand Up @@ -261,7 +261,7 @@ function ColorPalette._toVividness(self: ColorPalette, vividness, grade, name):
end
end

function ColorPalette.GetColorValue(self: ColorPalette, colorName: string)
function ColorPalette.GetColorValue(self: ColorPalette, colorName: string): ValueObject.ValueObject<Color3>
assert(type(colorName) == "string", "Bad colorName")

local colorValue = self._colorValues[colorName]
Expand Down
4 changes: 2 additions & 2 deletions src/colorpalette/src/Shared/Swatch/ColorSwatch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ function ColorSwatch.new(color: ValueObject.Mountable<Color3>, vividness: number
return self
end

function ColorSwatch:GetGraded(colorGrade: number): Color3
function ColorSwatch:GetGraded(colorGrade: number, vividness: number?): Color3
assert(type(colorGrade) == "number", "Bad colorGrade")

return ColorGradeUtils.getGradedColor(self._color.Value, colorGrade, self._vividness.Value)
return ColorGradeUtils.getGradedColor(self._color.Value, colorGrade, vividness or self._vividness.Value)
end

function ColorSwatch:ObserveGraded(
Expand Down
8 changes: 2 additions & 6 deletions src/convexhull/src/Shared/ConvexHull2DUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ end
--[=[
Computes line intersection between vectors
]=]
function ConvexHull2DUtils.lineIntersect(a: Vector2, b: Vector2, c: Vector2, d: Vector2): Vector2 | nil
function ConvexHull2DUtils.lineIntersect(a: Vector2, b: Vector2, c: Vector2, d: Vector2): Vector2?
local r = b - a
local s = d - c
local dot = r.X * s.Y - r.Y * s.X
Expand All @@ -59,11 +59,7 @@ end
--[=[
Raycasts from `from` to `to` against the convex hull.
]=]
function ConvexHull2DUtils.raycast(
from: Vector2,
to: Vector2,
hull: { Vector2 }
): (Vector2 | nil, Vector2 | nil, Vector2 | nil)
function ConvexHull2DUtils.raycast(from: Vector2, to: Vector2, hull: { Vector2 }): (Vector2?, Vector2?, Vector2?)
local candidates = {}
local n = #hull

Expand Down
4 changes: 2 additions & 2 deletions src/draw/src/Shared/Draw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ end
@param parent Instance? -- Optional parent
@return BasePart
]=]
function Draw.sphere(position: Vector3Like, radius: number, color: Color3?, parent: Instance)
function Draw.sphere(position: Vector3Like, radius: number, color: Color3?, parent: Instance?): BasePart
return Draw.point(position, color, parent, radius * 2)
end

Expand Down Expand Up @@ -872,7 +872,7 @@ end
--[=[
Draws a screen point
]=]
function Draw.screenPoint(position: Vector2, parent: Instance, color: Color3Like?, diameter: number?): Frame
function Draw.screenPoint(position: Vector2, parent: Instance?, color: Color3Like?, diameter: number?): Frame
local pointColor = Draw._toColor3(color) or Color3.new(0.658824, 0.501961, 0.501961)
local pointDiameter = diameter or 3

Expand Down
23 changes: 23 additions & 0 deletions src/enums/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Enums

<div align="center">
<a href="http://quenty.github.io/NevermoreEngine/">
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
</a>
<a href="https://discord.gg/mhtGUS8">
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
</a>
<a href="https://github.com/Quenty/NevermoreEngine/actions">
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
</a>
</div>

A very simple enum implementation that makes typechecking boilerplate simpler.

<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/SimpleEnum">View docs →</a></div>

## Installation

```
npm install @quenty/enums --save
```
14 changes: 14 additions & 0 deletions src/enums/default.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "enums",
"globIgnorePaths": [
"**/.package-lock.json",
"**/.pnpm",
"**/.pnpm-workspace-state-v1.json",
"**/.modules.yaml",
"**/.ignored",
"**/.ignored_*"
],
"tree": {
"$path": "src"
}
}
37 changes: 37 additions & 0 deletions src/enums/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@quenty/enums",
"version": "1.0.0",
"description": "Custom Luau enum implementation",
"keywords": [
"Roblox",
"Nevermore",
"Lua",
"enums"
],
"bugs": {
"url": "https://github.com/Quenty/NevermoreEngine/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Quenty/NevermoreEngine.git",
"directory": "src/enums/"
},
"funding": {
"type": "patreon",
"url": "https://www.patreon.com/quenty"
},
"license": "MIT",
"scripts": {
"preinstall": "npx only-allow pnpm"
},
"contributors": [
"Quenty"
],
"dependencies": {
"@quenty/loader": "workspace:*",
"@quentystudios/t": "^3.0.0"
},
"publishConfig": {
"access": "public"
}
}
Loading
Loading