Skip to content

Commit 3cc80f2

Browse files
authored
Merge pull request #651 from Quenty/users/quenty/support
Users/quenty/support
2 parents cc1fcc1 + a0cf24f commit 3cc80f2

File tree

5 files changed

+200
-18
lines changed

5 files changed

+200
-18
lines changed

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/camerastoryutils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"Quenty"
3030
],
3131
"dependencies": {
32-
"@quenty/insertserviceutils": "workspace:*",
32+
"@quenty/blend": "workspace:*",
3333
"@quenty/loader": "workspace:*",
3434
"@quenty/math": "workspace:*",
3535
"@quenty/promise": "workspace:*"

src/camerastoryutils/src/Client/CameraStoryUtils.lua

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ local require = require(script.Parent.loader).load(script)
99
local RunService = game:GetService("RunService")
1010
local TextService = game:GetService("TextService")
1111

12-
local InsertServiceUtils = require("InsertServiceUtils")
1312
local Maid = require("Maid")
1413
local Math = require("Math")
1514
local Promise = require("Promise")
15+
local RenderCrateUtils = require("RenderCrateUtils")
1616

1717
local CameraStoryUtils = {}
1818

@@ -71,17 +71,16 @@ end
7171
]=]
7272
function CameraStoryUtils.promiseCrate(
7373
maid: Maid.Maid,
74-
viewportFrame: ViewportFrame,
75-
properties
74+
viewportFrame: ViewportFrame?,
75+
properties: { [string]: any }?
7676
): Promise.Promise<Instance>
77-
return maid:GivePromise(InsertServiceUtils.promiseAsset(182451181)):Then(function(model)
78-
maid:GiveTask(model)
77+
local promise = maid:GivePromise(Promise.new())
7978

80-
local crate = (model :: any):GetChildren()[1]
81-
if not crate then
82-
return Promise.rejected()
83-
end
79+
maid:GiveTask(RenderCrateUtils.crate():Subscribe(function(crate)
80+
promise:Resolve(crate)
81+
end))
8482

83+
return promise:Then(function(crate)
8584
if properties then
8685
for _, item in crate:GetDescendants() do
8786
if item:IsA("BasePart") then
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
--!strict
2+
--[=[
3+
@class RenderCrateUtils
4+
]=]
5+
6+
local require = require(script.Parent.loader).load(script)
7+
8+
local Blend = require("Blend")
9+
10+
local RenderCrateUtils = {}
11+
12+
function RenderCrateUtils.crate()
13+
local center = Blend.State(nil)
14+
15+
return Blend.New "Model" {
16+
Name = "Wood Crate",
17+
PrimaryPart = center,
18+
Blend.New "Part" {
19+
Size = Vector3.new(3.4, 0.6, 0.6),
20+
BrickColor = BrickColor.new("Reddish brown"),
21+
CFrame = CFrame.new(1.7, -0.300135, -1.699984, 0, -1, 0, -1, 0, 0, 0, 0, -1),
22+
Color = Color3.fromRGB(105, 64, 40),
23+
Material = Enum.Material.WoodPlanks,
24+
Rotation = Vector3.new(180, 0, 90),
25+
},
26+
Blend.New "Part" {
27+
Size = Vector3.new(2.8, 0.6, 0.6),
28+
BrickColor = BrickColor.new("Reddish brown"),
29+
CFrame = CFrame.new(0, 1.7, -1.7, 1, 0, 0, 0, 1, 0, 0, 0, 1),
30+
Color = Color3.fromRGB(105, 64, 40),
31+
Material = Enum.Material.WoodPlanks,
32+
},
33+
Blend.New "Part" {
34+
Size = Vector3.new(4, 0.6, 0.6),
35+
BrickColor = BrickColor.new("Reddish brown"),
36+
CFrame = CFrame.new(0, 0.028748, 1.641696, -0.707111, -0.707102, 0, 0.707102, -0.707112, 0, 0, 0, 1),
37+
Color = Color3.fromRGB(105, 64, 40),
38+
Material = Enum.Material.WoodPlanks,
39+
Rotation = Vector3.new(0, 0, 135),
40+
},
41+
Blend.New "Part" {
42+
Size = Vector3.new(0.6, 0.6, 4),
43+
BrickColor = BrickColor.new("Reddish brown"),
44+
CFrame = CFrame.new(0, 0.028749, -1.658263, 0, -0.707102, -0.707111, 0, -0.707111, 0.707102, -1, -0, 0),
45+
Color = Color3.fromRGB(105, 64, 40),
46+
Material = Enum.Material.WoodPlanks,
47+
Rotation = Vector3.new(-90, -45, 90),
48+
},
49+
Blend.New "Part" {
50+
Size = Vector3.new(4, 0.6, 0.6),
51+
BrickColor = BrickColor.new("Reddish brown"),
52+
CFrame = CFrame.new(
53+
-1.649982,
54+
0.02874,
55+
-0.008285,
56+
0,
57+
0,
58+
-1,
59+
0.707106,
60+
-0.707108,
61+
0,
62+
-0.707108,
63+
-0.707106,
64+
-0
65+
),
66+
Color = Color3.fromRGB(105, 64, 40),
67+
Material = Enum.Material.WoodPlanks,
68+
Rotation = Vector3.new(-135, -90, 0),
69+
},
70+
Blend.New "Part" {
71+
Size = Vector3.new(3.4, 0.6, 0.6),
72+
BrickColor = BrickColor.new("Reddish brown"),
73+
CFrame = CFrame.new(0.3, -1.7, 1.7, 1, 0, 0, 0, 1, 0, 0, 0, 1),
74+
Color = Color3.fromRGB(105, 64, 40),
75+
Material = Enum.Material.WoodPlanks,
76+
},
77+
Blend.New "Part" {
78+
Size = Vector3.new(3.4, 0.6, 0.6),
79+
BrickColor = BrickColor.new("Reddish brown"),
80+
CFrame = CFrame.new(-1.7, 1.7, -0.3) * CFrame.Angles(0, math.pi / 2, 0),
81+
Color = Color3.fromRGB(105, 64, 40),
82+
Material = Enum.Material.WoodPlanks,
83+
Rotation = Vector3.new(0, 90, 0),
84+
},
85+
Blend.New "Part" {
86+
Size = Vector3.new(3.4, 0.6, 0.6),
87+
BrickColor = BrickColor.new("Reddish brown"),
88+
CFrame = CFrame.new(-1.7, -0.3, -1.7) * CFrame.Angles(-math.pi / 2, math.pi / 2, 0),
89+
Color = Color3.fromRGB(105, 64, 40),
90+
Material = Enum.Material.WoodPlanks,
91+
Rotation = Vector3.new(-90, 90, 0),
92+
},
93+
Blend.New "Part" {
94+
Size = Vector3.new(2.8, 0.6, 0.6),
95+
BrickColor = BrickColor.new("Reddish brown"),
96+
CFrame = CFrame.new(0.000019, -1.70013, -1.7, 1, 0, 0, 0, 1, 0, 0, 0, 1),
97+
Color = Color3.fromRGB(105, 64, 40),
98+
Material = Enum.Material.WoodPlanks,
99+
},
100+
Blend.New "Part" {
101+
Size = Vector3.new(3.4, 0.6, 0.6),
102+
BrickColor = BrickColor.new("Reddish brown"),
103+
CFrame = CFrame.new(1.7, 0.3, 1.7, 0, -1, 0, 1, 0, 0, 0, 0, 1),
104+
Color = Color3.fromRGB(105, 64, 40),
105+
Material = Enum.Material.WoodPlanks,
106+
Rotation = Vector3.new(0, 0, 90),
107+
},
108+
Blend.New "Part" {
109+
Size = Vector3.new(3.4, 0.6, 0.6),
110+
BrickColor = BrickColor.new("Reddish brown"),
111+
CFrame = CFrame.new(-0.3, 1.7, 1.7, 1, 0, 0, 0, 1, 0, 0, 0, 1),
112+
Color = Color3.fromRGB(105, 64, 40),
113+
Material = Enum.Material.WoodPlanks,
114+
},
115+
Blend.New "Part" {
116+
Size = Vector3.new(4, 0.6, 0.6),
117+
BrickColor = BrickColor.new("Reddish brown"),
118+
CFrame = CFrame.new(1.649986, 0.028765, 0, 0, 0, 1, 0.707111, 0.707102, 0, -0.707102, 0.707111, 0),
119+
Color = Color3.fromRGB(105, 64, 40),
120+
Material = Enum.Material.WoodPlanks,
121+
Rotation = Vector3.new(45, 90, 0),
122+
},
123+
Blend.New "Part" {
124+
Size = Vector3.new(4, 0.6, 0.6),
125+
BrickColor = BrickColor.new("Reddish brown"),
126+
CFrame = CFrame.new(-0.007957, 1.649938, 0.054213, 0.707106, 0, 0.707108, 0, 1, 0, -0.707108, 0, 0.707106),
127+
Color = Color3.fromRGB(105, 64, 40),
128+
Material = Enum.Material.WoodPlanks,
129+
Rotation = Vector3.new(0, 45, 0.001),
130+
},
131+
Blend.New "Part" {
132+
Size = Vector3.new(3.4, 0.6, 0.6),
133+
BrickColor = BrickColor.new("Reddish brown"),
134+
CFrame = CFrame.new(-1.699978, -1.700141, 0.299995) * CFrame.Angles(0, math.pi / 2, 0),
135+
Color = Color3.fromRGB(105, 64, 40),
136+
Material = Enum.Material.WoodPlanks,
137+
Rotation = Vector3.new(0, 90, 0),
138+
},
139+
Blend.New "Part" {
140+
Size = Vector3.new(2.8, 0.6, 0.6),
141+
BrickColor = BrickColor.new("Reddish brown"),
142+
CFrame = CFrame.new(-1.7, 0, 1.7, 0, 1, 0, -1, 0, 0, 0, 0, 1),
143+
Color = Color3.fromRGB(105, 64, 40),
144+
Material = Enum.Material.WoodPlanks,
145+
Rotation = Vector3.new(0, 0, -90),
146+
},
147+
Blend.New "Part" {
148+
Size = Vector3.new(4, 0.6, 0.6),
149+
BrickColor = BrickColor.new("Reddish brown"),
150+
CFrame = CFrame.new(0, -1.671373, -0.008285, 0.707105, 0.707108, -0, 0, 0, 1, 0.707108, -0.707105, -0),
151+
Color = Color3.fromRGB(105, 64, 40),
152+
Material = Enum.Material.WoodPlanks,
153+
Rotation = Vector3.new(-90, -0.001, -45),
154+
},
155+
Blend.New "Part" {
156+
Size = Vector3.new(2.8, 0.6, 0.6),
157+
BrickColor = BrickColor.new("Reddish brown"),
158+
CFrame = CFrame.new(1.7, -1.7, 0) * CFrame.Angles(math.pi, math.pi / 2, 0),
159+
Color = Color3.fromRGB(105, 64, 40),
160+
Material = Enum.Material.WoodPlanks,
161+
Rotation = Vector3.new(180, 90, 0),
162+
},
163+
Blend.New "Part" {
164+
Name = "Center",
165+
Size = Vector3.new(3.6, 3.6, 3.6),
166+
BrickColor = BrickColor.new("Brown"),
167+
CFrame = CFrame.Angles(0, 0, 0),
168+
Color = Color3.fromRGB(124, 92, 70),
169+
Material = Enum.Material.WoodPlanks,
170+
[Blend.Instance] = center,
171+
},
172+
Blend.New "Part" {
173+
Size = Vector3.new(3.4, 0.6, 0.6),
174+
BrickColor = BrickColor.new("Reddish brown"),
175+
CFrame = CFrame.new(1.7, 1.7, -0.3) * CFrame.Angles(0, -math.pi / 2, 0),
176+
Color = Color3.fromRGB(105, 64, 40),
177+
Material = Enum.Material.WoodPlanks,
178+
Rotation = Vector3.new(0, -90, 0),
179+
},
180+
}
181+
end
182+
183+
return RenderCrateUtils

src/uiobjectutils/src/Client/UICornerUtils.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function UICornerUtils.clampPositionToFrame(
4747
frameSize: Vector2,
4848
radius: number,
4949
point: Vector2
50-
): (Vector2?, Vector2?)
50+
): (Vector2?, Vector2?, Vector2?)
5151
assert(radius >= 0, "Bad radius")
5252
assert(point, "Bad point")
5353

@@ -77,18 +77,18 @@ function UICornerUtils.clampPositionToFrame(
7777
rpy = miny
7878
end
7979

80-
local position = Vector2.new(rpx, rpy)
80+
local insidePosition = Vector2.new(rpx, rpy)
8181

8282
-- project in direction of offset
83-
local direction = point - position
83+
local direction = point - insidePosition
8484
if direction.Magnitude == 0 then
8585
-- Shouldn't happen!
86-
return nil, nil
86+
return nil, nil, nil
8787
end
8888

8989
local normal = direction.Unit
90-
local outsidePosition = position + normal * radius
91-
return outsidePosition, normal
90+
local outsidePosition = insidePosition + normal * radius
91+
return outsidePosition, normal, insidePosition
9292
end
9393

9494
return UICornerUtils

0 commit comments

Comments
 (0)