@quenty/parttouchingcalculator 14.40.1 → 14.42.0
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
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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
|
+
# [14.42.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/parttouchingcalculator@14.41.0...@quenty/parttouchingcalculator@14.42.0) (2026-07-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/parttouchingcalculator
|
|
9
|
+
|
|
10
|
+
# [14.41.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/parttouchingcalculator@14.40.1...@quenty/parttouchingcalculator@14.41.0) (2026-07-14)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **lint:** resolve selene and moonwave issues from strict conversions ([d427005](https://github.com/Quenty/NevermoreEngine/commit/d42700569ecb085fee4166c5bfdad382dd8442c2))
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **parttouchingcalculator:** convert package to --!strict ([0ec2478](https://github.com/Quenty/NevermoreEngine/commit/0ec2478e41ad9c4eeae331cbc00485e10e2ef8fe))
|
|
19
|
+
|
|
6
20
|
## [14.40.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/parttouchingcalculator@14.40.0...@quenty/parttouchingcalculator@14.40.1) (2026-05-30)
|
|
7
21
|
|
|
8
22
|
**Note:** Version bump only for package @quenty/parttouchingcalculator
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/parttouchingcalculator",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.42.0",
|
|
4
4
|
"description": "Determines if parts are touching or not",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"Quenty"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/binder": "14.
|
|
31
|
+
"@quenty/binder": "14.37.0",
|
|
32
32
|
"@quenty/boundingboxutils": "4.5.2",
|
|
33
|
-
"@quenty/characterutils": "12.
|
|
33
|
+
"@quenty/characterutils": "12.33.0",
|
|
34
34
|
"@quenty/loader": "10.11.0",
|
|
35
|
-
"@quenty/qgui": "2.
|
|
35
|
+
"@quenty/qgui": "2.5.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "d577f1529aa03f5e77534145501e878bde07ca98"
|
|
41
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Extends PartTouchingCalculator with generic binder stuff
|
|
4
4
|
@class BinderTouchingCalculator
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
+
local Binder = require("Binder")
|
|
9
10
|
local BinderUtils = require("BinderUtils")
|
|
10
11
|
local PartTouchingCalculator = require("PartTouchingCalculator")
|
|
11
12
|
|
|
@@ -13,14 +14,28 @@ local BinderTouchingCalculator = setmetatable({}, PartTouchingCalculator)
|
|
|
13
14
|
BinderTouchingCalculator.ClassName = "BinderTouchingCalculator"
|
|
14
15
|
BinderTouchingCalculator.__index = BinderTouchingCalculator
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
export type TouchingClassData<T> = {
|
|
18
|
+
Object: T,
|
|
19
|
+
Touching: { BasePart },
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type BinderTouchingCalculator =
|
|
23
|
+
typeof(setmetatable({} :: {}, {} :: typeof({ __index = BinderTouchingCalculator })))
|
|
24
|
+
& PartTouchingCalculator.PartTouchingCalculator
|
|
25
|
+
|
|
26
|
+
function BinderTouchingCalculator.new(): BinderTouchingCalculator
|
|
27
|
+
local self: BinderTouchingCalculator = setmetatable(PartTouchingCalculator.new() :: any, BinderTouchingCalculator)
|
|
18
28
|
|
|
19
29
|
return self
|
|
20
30
|
end
|
|
21
31
|
|
|
22
|
-
function BinderTouchingCalculator
|
|
23
|
-
|
|
32
|
+
function BinderTouchingCalculator.GetTouchingClass<T>(
|
|
33
|
+
_self: BinderTouchingCalculator,
|
|
34
|
+
binder: Binder.Binder<T>,
|
|
35
|
+
touchingList: { BasePart },
|
|
36
|
+
ignoreObject: T?
|
|
37
|
+
): { TouchingClassData<T> }
|
|
38
|
+
local touching: { [T]: TouchingClassData<T> } = {}
|
|
24
39
|
|
|
25
40
|
for _, part in touchingList do
|
|
26
41
|
local object = BinderUtils.findFirstAncestor(binder, part)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Determines if parts are touching or not
|
|
4
4
|
@class PartTouchingCalculator
|
|
@@ -16,16 +16,29 @@ local PartTouchingCalculator = {}
|
|
|
16
16
|
PartTouchingCalculator.__index = PartTouchingCalculator
|
|
17
17
|
PartTouchingCalculator.ClassName = "PartTouchingCalculator"
|
|
18
18
|
|
|
19
|
+
export type TouchingHumanoidData = {
|
|
20
|
+
Humanoid: Humanoid,
|
|
21
|
+
Character: Model?,
|
|
22
|
+
Player: Player?,
|
|
23
|
+
Touching: { BasePart },
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type PartTouchingCalculator = typeof(setmetatable({} :: {}, {} :: typeof({ __index = PartTouchingCalculator })))
|
|
27
|
+
|
|
19
28
|
--[=[
|
|
20
29
|
Constructs a new PartTouchingCalculator
|
|
21
30
|
]=]
|
|
22
|
-
function PartTouchingCalculator.new()
|
|
31
|
+
function PartTouchingCalculator.new(): PartTouchingCalculator
|
|
23
32
|
local self = setmetatable({}, PartTouchingCalculator)
|
|
24
33
|
|
|
25
34
|
return self
|
|
26
35
|
end
|
|
27
36
|
|
|
28
|
-
function PartTouchingCalculator
|
|
37
|
+
function PartTouchingCalculator.CheckIfTouchingHumanoid(
|
|
38
|
+
self: PartTouchingCalculator,
|
|
39
|
+
humanoid: Humanoid,
|
|
40
|
+
parts: { BasePart }
|
|
41
|
+
): boolean
|
|
29
42
|
assert(humanoid, "Bad humanoid")
|
|
30
43
|
assert(parts, "Must have parts")
|
|
31
44
|
|
|
@@ -48,17 +61,18 @@ function PartTouchingCalculator:CheckIfTouchingHumanoid(humanoid: Humanoid, part
|
|
|
48
61
|
|
|
49
62
|
local dummyPart = self:GetCollidingPartFromParts(humanoidParts)
|
|
50
63
|
|
|
51
|
-
local previousProperties = {}
|
|
52
|
-
local toSet = {
|
|
64
|
+
local previousProperties: { [BasePart]: { [string]: any } } = {}
|
|
65
|
+
local toSet: { [string]: any } = {
|
|
53
66
|
CanCollide = true,
|
|
54
67
|
Anchored = false,
|
|
55
68
|
}
|
|
56
|
-
local partSet = {}
|
|
69
|
+
local partSet: { [BasePart]: boolean } = {}
|
|
57
70
|
for _, part in parts do
|
|
58
71
|
previousProperties[part] = {}
|
|
72
|
+
local anyPart = part :: any
|
|
59
73
|
for name, value in toSet do
|
|
60
|
-
previousProperties[part][name] =
|
|
61
|
-
|
|
74
|
+
previousProperties[part][name] = anyPart[name]
|
|
75
|
+
anyPart[name] = value
|
|
62
76
|
end
|
|
63
77
|
partSet[part] = true
|
|
64
78
|
end
|
|
@@ -77,17 +91,22 @@ function PartTouchingCalculator:CheckIfTouchingHumanoid(humanoid: Humanoid, part
|
|
|
77
91
|
|
|
78
92
|
for part, properties in previousProperties do
|
|
79
93
|
for name, value in properties do
|
|
80
|
-
part[name] = value
|
|
94
|
+
(part :: any)[name] = value
|
|
81
95
|
end
|
|
82
96
|
end
|
|
83
97
|
|
|
84
98
|
return returnValue
|
|
85
99
|
end
|
|
86
100
|
|
|
87
|
-
function PartTouchingCalculator
|
|
88
|
-
|
|
101
|
+
function PartTouchingCalculator.GetCollidingPartFromParts(
|
|
102
|
+
_self: PartTouchingCalculator,
|
|
103
|
+
parts: { BasePart },
|
|
104
|
+
relativeTo: CFrame?,
|
|
105
|
+
padding: number?
|
|
106
|
+
): BasePart
|
|
107
|
+
local actualRelativeTo = relativeTo or CFrame.new()
|
|
89
108
|
|
|
90
|
-
local size, position = BoundingBoxUtils.getPartsBoundingBox(parts,
|
|
109
|
+
local size, position = BoundingBoxUtils.getPartsBoundingBox(parts, actualRelativeTo)
|
|
91
110
|
|
|
92
111
|
if padding then
|
|
93
112
|
size = size + Vector3.new(padding, padding, padding)
|
|
@@ -96,7 +115,7 @@ function PartTouchingCalculator:GetCollidingPartFromParts(parts, relativeTo, pad
|
|
|
96
115
|
local dummyPart = Instance.new("Part")
|
|
97
116
|
dummyPart.Name = "CollisionDetection"
|
|
98
117
|
dummyPart.Size = size
|
|
99
|
-
dummyPart.CFrame =
|
|
118
|
+
dummyPart.CFrame = actualRelativeTo + actualRelativeTo:VectorToWorldSpace(position)
|
|
100
119
|
dummyPart.Anchored = false
|
|
101
120
|
dummyPart.CanCollide = true
|
|
102
121
|
dummyPart.Parent = Workspace
|
|
@@ -104,7 +123,12 @@ function PartTouchingCalculator:GetCollidingPartFromParts(parts, relativeTo, pad
|
|
|
104
123
|
return dummyPart
|
|
105
124
|
end
|
|
106
125
|
|
|
107
|
-
function PartTouchingCalculator
|
|
126
|
+
function PartTouchingCalculator.GetTouchingBoundingBox(
|
|
127
|
+
self: PartTouchingCalculator,
|
|
128
|
+
parts: { BasePart },
|
|
129
|
+
relativeTo: CFrame?,
|
|
130
|
+
padding: number?
|
|
131
|
+
): { BasePart }
|
|
108
132
|
local dummy = self:GetCollidingPartFromParts(parts, relativeTo, padding)
|
|
109
133
|
local touching = dummy:GetTouchingParts()
|
|
110
134
|
dummy:Destroy()
|
|
@@ -113,8 +137,12 @@ function PartTouchingCalculator:GetTouchingBoundingBox(parts, relativeTo, paddin
|
|
|
113
137
|
end
|
|
114
138
|
|
|
115
139
|
-- Expensive hull check on a list of parts (aggregating each parts touching list)
|
|
116
|
-
function PartTouchingCalculator
|
|
117
|
-
|
|
140
|
+
function PartTouchingCalculator.GetTouchingHull(
|
|
141
|
+
self: PartTouchingCalculator,
|
|
142
|
+
parts: { BasePart },
|
|
143
|
+
padding: number?
|
|
144
|
+
): { BasePart }
|
|
145
|
+
local hitParts: { [BasePart]: boolean } = {}
|
|
118
146
|
|
|
119
147
|
for _, part in parts do
|
|
120
148
|
for _, TouchingPart in self:GetTouching(part, padding) do
|
|
@@ -136,9 +164,13 @@ end
|
|
|
136
164
|
@param padding number -- studs of padding around the part
|
|
137
165
|
@return { BasePart }
|
|
138
166
|
]=]
|
|
139
|
-
function PartTouchingCalculator
|
|
140
|
-
|
|
141
|
-
|
|
167
|
+
function PartTouchingCalculator.GetTouching(
|
|
168
|
+
_self: PartTouchingCalculator,
|
|
169
|
+
basePart: BasePart,
|
|
170
|
+
padding: number?
|
|
171
|
+
): { BasePart }
|
|
172
|
+
local actualPadding = padding or 2
|
|
173
|
+
local part: BasePart
|
|
142
174
|
|
|
143
175
|
if basePart:IsA("TrussPart") then
|
|
144
176
|
-- Truss parts can't be resized
|
|
@@ -155,7 +187,7 @@ function PartTouchingCalculator:GetTouching(basePart, padding)
|
|
|
155
187
|
part:ClearAllChildren()
|
|
156
188
|
end
|
|
157
189
|
|
|
158
|
-
part.Size = basePart.Size + Vector3.new(
|
|
190
|
+
part.Size = basePart.Size + Vector3.new(actualPadding, actualPadding, actualPadding)
|
|
159
191
|
part.CFrame = basePart.CFrame
|
|
160
192
|
part.Anchored = false
|
|
161
193
|
part.CanCollide = true
|
|
@@ -169,11 +201,15 @@ function PartTouchingCalculator:GetTouching(basePart, padding)
|
|
|
169
201
|
return touching
|
|
170
202
|
end
|
|
171
203
|
|
|
172
|
-
function PartTouchingCalculator
|
|
173
|
-
|
|
204
|
+
function PartTouchingCalculator.GetTouchingHumanoids(
|
|
205
|
+
_self: PartTouchingCalculator,
|
|
206
|
+
touchingList: { BasePart }
|
|
207
|
+
): { TouchingHumanoidData }
|
|
208
|
+
local touchingHumanoids: { [Humanoid]: TouchingHumanoidData } = {}
|
|
174
209
|
|
|
175
210
|
for _, part in touchingList do
|
|
176
|
-
local
|
|
211
|
+
local parent = part.Parent
|
|
212
|
+
local humanoid = parent and parent:FindFirstChildOfClass("Humanoid")
|
|
177
213
|
if humanoid then
|
|
178
214
|
if not touchingHumanoids[humanoid] then
|
|
179
215
|
local player = CharacterUtils.getPlayerFromCharacter(humanoid)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Renders touching parts from the PartTouchingCalculator
|
|
4
4
|
@class PartTouchingRenderer
|
|
@@ -14,13 +14,15 @@ local PartTouchingRenderer = {}
|
|
|
14
14
|
PartTouchingRenderer.__index = PartTouchingRenderer
|
|
15
15
|
PartTouchingRenderer.ClassName = "PartTouchingRenderer"
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
export type PartTouchingRenderer = typeof(setmetatable({} :: {}, {} :: typeof({ __index = PartTouchingRenderer })))
|
|
18
|
+
|
|
19
|
+
function PartTouchingRenderer.new(): PartTouchingRenderer
|
|
20
|
+
local self: PartTouchingRenderer = setmetatable({}, PartTouchingRenderer)
|
|
19
21
|
|
|
20
22
|
return self
|
|
21
23
|
end
|
|
22
24
|
|
|
23
|
-
function PartTouchingRenderer
|
|
25
|
+
function PartTouchingRenderer.RenderTouchingProps(_self: PartTouchingRenderer, touchingPartList: { BasePart }): ()
|
|
24
26
|
for _, part in touchingPartList do
|
|
25
27
|
local selectionBox = Instance.new("SelectionBox")
|
|
26
28
|
selectionBox.Name = "TouchingWarning"
|