@quenty/ugcsanitize 1.0.1-canary.522.1d2faf4.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 ADDED
@@ -0,0 +1,11 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.0.1-canary.522.1d2faf4.0 (2024-12-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add UGCSanitize to FirstPersonTransparency ([c07db09](https://github.com/Quenty/NevermoreEngine/commit/c07db0937e56055ead6cd4332e2fa19f4ab4259e))
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2014-2024 James Onnen (Quenty)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ ## UGCSanitize
2
+
3
+ <div align="center">
4
+ <a href="http://quenty.github.io/NevermoreEngine/">
5
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
6
+ </a>
7
+ <a href="https://discord.gg/mhtGUS8">
8
+ <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
9
+ </a>
10
+ <a href="https://github.com/Quenty/NevermoreEngine/actions">
11
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
12
+ </a>
13
+ </div>
14
+
15
+ Sanitizes UGC hats and other items
16
+
17
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/UGCSanitizeUtils">View docs →</a></div>
18
+
19
+ ## Installation
20
+
21
+ ```
22
+ npm install @quenty/ugcsanitize --save
23
+ ```
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "ugcsanitize",
3
+ "globIgnorePaths": [ "**/.package-lock.json" ],
4
+ "tree": {
5
+ "$path": "src"
6
+ }
7
+ }
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@quenty/ugcsanitize",
3
+ "version": "1.0.1-canary.522.1d2faf4.0",
4
+ "description": "Sanitizes UGC hats and other items",
5
+ "keywords": [
6
+ "Roblox",
7
+ "Nevermore",
8
+ "Lua",
9
+ "ugcsanitize"
10
+ ],
11
+ "bugs": {
12
+ "url": "https://github.com/Quenty/NevermoreEngine/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/Quenty/NevermoreEngine.git",
17
+ "directory": "src/ugcsanitize/"
18
+ },
19
+ "funding": {
20
+ "type": "patreon",
21
+ "url": "https://www.patreon.com/quenty"
22
+ },
23
+ "license": "MIT",
24
+ "contributors": [
25
+ "Quenty"
26
+ ],
27
+ "dependencies": {
28
+ "@quenty/baseobject": "10.7.1",
29
+ "@quenty/instanceutils": "13.13.1-canary.522.1d2faf4.0",
30
+ "@quenty/loader": "10.7.1",
31
+ "@quenty/maid": "3.4.0",
32
+ "@quenty/string": "3.3.0"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "gitHead": "1d2faf48e778ada6f57aecb8000c7c6c76ac33cd"
38
+ }
@@ -0,0 +1,101 @@
1
+ --[=[
2
+ @class DisableHatParticles
3
+ ]=]
4
+
5
+ local require = require(script.Parent.loader).load(script)
6
+
7
+ local BaseObject = require("BaseObject")
8
+ local RxInstanceUtils = require("RxInstanceUtils")
9
+ local String = require("String")
10
+
11
+ local DisableHatParticles = setmetatable({}, BaseObject)
12
+ DisableHatParticles.ClassName = "DisableHatParticles"
13
+ DisableHatParticles.__index = DisableHatParticles
14
+
15
+ function DisableHatParticles.new(character)
16
+ local self = setmetatable(BaseObject.new(character), DisableHatParticles)
17
+
18
+ self._maid:GiveTask(RxInstanceUtils.observeChildrenOfClassBrio(self._obj, "Accessory"):Subscribe(function(brio)
19
+ if brio:IsDead() then
20
+ return
21
+ end
22
+
23
+ local maid, accessory = brio:ToMaidAndValue()
24
+ self:_handleAccessory(maid, accessory)
25
+ end))
26
+
27
+ return self
28
+ end
29
+
30
+ function DisableHatParticles:_handleAccessory(maid, accessory)
31
+ maid:GiveTask(accessory.DescendantAdded:Connect(function(descendant)
32
+ self:_handleAccessoryDescendant(maid, descendant)
33
+ end))
34
+ maid:GiveTask(accessory.DescendantRemoving:Connect(function(descendant)
35
+ maid[descendant] = nil
36
+ end))
37
+
38
+ for _, descendant in pairs(accessory:GetDescendants()) do
39
+ self:_handleAccessoryDescendant(maid, descendant)
40
+ end
41
+ end
42
+
43
+ function DisableHatParticles:_handleAccessoryDescendant(maid, descendant)
44
+ if descendant:IsA("Fire")
45
+ or descendant:IsA("Sparkles")
46
+ or descendant:IsA("Smoke")
47
+ or descendant:IsA("ParticleEmitter") then
48
+ if descendant.Enabled then
49
+ maid[descendant] = function()
50
+ descendant.Enabled = true
51
+ end
52
+
53
+ descendant.Enabled = false
54
+ end
55
+ end
56
+
57
+ -- TODO: This code is unsafe? Use a sound group?
58
+ if self:_isASoundScript(descendant) then
59
+ maid[descendant] = function()
60
+ descendant.Enabled = true
61
+ end
62
+
63
+ descendant.Enabled = false
64
+ end
65
+
66
+ if self:_isSound(descendant) then
67
+ local originalVolume = descendant.Volume
68
+ maid[descendant] = function()
69
+ descendant.Volume = originalVolume
70
+ end
71
+
72
+ descendant.Volume = 0
73
+ end
74
+ end
75
+
76
+ function DisableHatParticles:_isASoundScript(descendant)
77
+ if not descendant:IsA("LocalScript") then
78
+ return false
79
+ end
80
+
81
+ if String.endsWith(descendant.Name, "Sounds") then
82
+ return true
83
+ end
84
+
85
+ if String.endsWith(descendant.Name, "Sound") then
86
+ return true
87
+ end
88
+
89
+ if String.startsWith(descendant.Name, "Sound") then
90
+ return true
91
+ end
92
+
93
+ return false
94
+ end
95
+
96
+ function DisableHatParticles:_isSound(descendant)
97
+ -- Sound group check is paranoid but likely to be valid as to identify hat-sounds
98
+ return descendant:IsA("Sound") and descendant.SoundGroup == nil
99
+ end
100
+
101
+ return DisableHatParticles
@@ -0,0 +1,9 @@
1
+ --[=[
2
+ @class UGCSanitizeUtils
3
+ ]=]
4
+
5
+ local require = require(script.Parent.loader).load(script)
6
+
7
+ local UGCSanitizeUtils = {}
8
+
9
+ return UGCSanitizeUtils
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "node_modules",
3
+ "globIgnorePaths": [ "**/.package-lock.json" ],
4
+ "tree": {
5
+ "$path": { "optional": "../node_modules" }
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "UGCSanitizeTest",
3
+ "globIgnorePaths": [ "**/.package-lock.json" ],
4
+ "tree": {
5
+ "$className": "DataModel",
6
+ "ServerScriptService": {
7
+ "ugcsanitize": {
8
+ "$path": ".."
9
+ }
10
+ }
11
+ }
12
+ }