@quenty/modelappearance 10.8.4 → 10.8.5-canary.11a5dcf.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,17 @@
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
+ ## [10.8.5-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/modelappearance@10.8.4...@quenty/modelappearance@10.8.5-canary.11a5dcf.0) (2025-05-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Additional type checking updates ([05ba29a](https://github.com/Quenty/NevermoreEngine/commit/05ba29a03efc9f3feed74b34f1d9dfb237496214))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [10.8.4](https://github.com/Quenty/NevermoreEngine/compare/@quenty/modelappearance@10.8.3...@quenty/modelappearance@10.8.4) (2025-04-10)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/modelappearance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/modelappearance",
3
- "version": "10.8.4",
3
+ "version": "10.8.5-canary.11a5dcf.0",
4
4
  "description": "Allows the appearance of a model to be overridden. Most commonly used when placing down an object in a building game.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,11 +25,11 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/loader": "^10.8.3",
29
- "@quenty/math": "^2.7.3"
28
+ "@quenty/loader": "10.8.4-canary.11a5dcf.0",
29
+ "@quenty/math": "2.7.3"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "b06c070ae91d5dab7bd8de6e290ad2caabb15d8f"
34
+ "gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
35
35
  }
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  Allows the appearance of a model to be overridden. Most commonly used when
3
4
  placing down an object in a building game.
@@ -13,8 +14,29 @@ local ModelAppearance = {}
13
14
  ModelAppearance.ClassName = "ModelAppearance"
14
15
  ModelAppearance.__index = ModelAppearance
15
16
 
16
- function ModelAppearance.new(model)
17
- local self = setmetatable({}, ModelAppearance)
17
+ export type ModelAppearance = typeof(setmetatable(
18
+ {} :: {
19
+ _parts: {
20
+ [BasePart]: {
21
+ Transparency: number,
22
+ Color: Color3,
23
+ Material: Enum.Material,
24
+ CanCollide: boolean,
25
+ UsePartColor: boolean?,
26
+ },
27
+ },
28
+ _interactions: { Instance },
29
+ _seats: { [Seat | VehicleSeat]: Instance },
30
+ _canCollide: boolean?,
31
+ _transparency: number?,
32
+ _color: Color3?,
33
+ _material: Enum.Material?,
34
+ },
35
+ {} :: typeof({ __index = ModelAppearance })
36
+ ))
37
+
38
+ function ModelAppearance.new(model: Instance): ModelAppearance
39
+ local self: ModelAppearance = setmetatable({} :: any, ModelAppearance)
18
40
 
19
41
  self._parts = {}
20
42
  self._interactions = {}
@@ -23,10 +45,10 @@ function ModelAppearance.new(model)
23
45
  for _, part in model:GetDescendants() do
24
46
  if part:IsA("BasePart") then
25
47
  self._parts[part] = {
26
- Transparency = part.Transparency;
27
- Color = part.Color;
28
- Material = part.Material;
29
- CanCollide = part.CanCollide;
48
+ Transparency = part.Transparency,
49
+ Color = part.Color,
50
+ Material = part.Material,
51
+ CanCollide = part.CanCollide,
30
52
  }
31
53
 
32
54
  if part:IsA("Seat") or part:IsA("VehicleSeat") then
@@ -44,20 +66,29 @@ function ModelAppearance.new(model)
44
66
  return self
45
67
  end
46
68
 
47
- -- Destructive, cannot be reverted
48
- function ModelAppearance:DisableInteractions()
69
+ --[=[
70
+ Disables all interactions with the model. This includes click detectors and seats
71
+
72
+ :::tip
73
+ Destructive, cannot be reverted
74
+ :::
75
+ ]=]
76
+ function ModelAppearance.DisableInteractions(self: ModelAppearance)
49
77
  for _, item in self._interactions do
50
78
  item:Destroy()
51
79
  end
52
80
  self._interactions = {}
53
81
  for seat, _ in self._seats do
54
- seat.Disabled = true
82
+ (seat :: Seat).Disabled = true
55
83
  end
56
84
 
57
85
  self:SetCanCollide(false)
58
86
  end
59
87
 
60
- function ModelAppearance:SetCanCollide(canCollide: boolean)
88
+ --[=[
89
+ Sets the models collision state
90
+ ]=]
91
+ function ModelAppearance.SetCanCollide(self: ModelAppearance, canCollide: boolean)
61
92
  assert(type(canCollide) == "boolean", "Bad canCollide")
62
93
 
63
94
  if self._canCollide == canCollide then
@@ -70,11 +101,19 @@ function ModelAppearance:SetCanCollide(canCollide: boolean)
70
101
  end
71
102
  end
72
103
 
73
- function ModelAppearance:ResetCanCollide()
104
+ --[=[
105
+ Resets the can collide state to the original state
106
+ ]=]
107
+ function ModelAppearance.ResetCanCollide(self: ModelAppearance)
74
108
  self:SetCanCollide(true)
75
109
  end
76
110
 
77
- function ModelAppearance:SetTransparency(transparency)
111
+ --[=[
112
+ Sets the transparency of the model
113
+
114
+ @param transparency number
115
+ ]=]
116
+ function ModelAppearance.SetTransparency(self: ModelAppearance, transparency: number)
78
117
  if self._transparency == transparency then
79
118
  return
80
119
  end
@@ -85,7 +124,10 @@ function ModelAppearance:SetTransparency(transparency)
85
124
  end
86
125
  end
87
126
 
88
- function ModelAppearance:ResetTransparency()
127
+ --[=[
128
+ Resets the transparency to the original state
129
+ ]=]
130
+ function ModelAppearance.ResetTransparency(self: ModelAppearance)
89
131
  if not self._transparency then
90
132
  return
91
133
  end
@@ -96,7 +138,12 @@ function ModelAppearance:ResetTransparency()
96
138
  end
97
139
  end
98
140
 
99
- function ModelAppearance:SetColor(color)
141
+ --[=[
142
+ Sets the color of the model
143
+
144
+ @param color Color3
145
+ ]=]
146
+ function ModelAppearance.SetColor(self: ModelAppearance, color: Color3)
100
147
  assert(typeof(color) == "Color3", "Bad color")
101
148
 
102
149
  if self._color == color then
@@ -113,7 +160,10 @@ function ModelAppearance:SetColor(color)
113
160
  end
114
161
  end
115
162
 
116
- function ModelAppearance:ResetColor()
163
+ --[=[
164
+ Resets the color to the original state
165
+ ]=]
166
+ function ModelAppearance.ResetColor(self: ModelAppearance)
117
167
  if not self._color then
118
168
  return
119
169
  end
@@ -123,12 +173,15 @@ function ModelAppearance:ResetColor()
123
173
  part.Color = properties.Color
124
174
 
125
175
  if part:IsA("PartOperation") then
126
- part.UsePartColor = properties.UsePartColor
176
+ part.UsePartColor = properties.UsePartColor :: boolean
127
177
  end
128
178
  end
129
179
  end
130
180
 
131
- function ModelAppearance:ResetMaterial()
181
+ --[=[
182
+ Resets the material to the original state
183
+ ]=]
184
+ function ModelAppearance.ResetMaterial(self: ModelAppearance): ()
132
185
  if not self._material then
133
186
  return
134
187
  end
@@ -139,7 +192,12 @@ function ModelAppearance:ResetMaterial()
139
192
  end
140
193
  end
141
194
 
142
- function ModelAppearance:SetMaterial(material)
195
+ --[=[
196
+ Sets the material of the model
197
+
198
+ @param material Enum.Material
199
+ ]=]
200
+ function ModelAppearance.SetMaterial(self: ModelAppearance, material: Enum.Material)
143
201
  if self._material == material then
144
202
  return
145
203
  end
@@ -150,4 +208,4 @@ function ModelAppearance:SetMaterial(material)
150
208
  end
151
209
  end
152
210
 
153
- return ModelAppearance
211
+ return ModelAppearance