@kunosyn/shatterbox 0.0.1 → 0.0.2
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/README.md +76 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<a href=https://www.npmjs.com/package/@
|
|
9
|
-
<img src=https://img.shields.io/npm/v/@
|
|
8
|
+
<a href=https://www.npmjs.com/package/@kunosyn/shatterbox>
|
|
9
|
+
<img src=https://img.shields.io/npm/v/@kunosyn/shatterbox />
|
|
10
10
|
</a>
|
|
11
|
-
<a href=https://www.npmjs.com/package/@
|
|
12
|
-
<img src=https://img.shields.io/npm/dt
|
|
11
|
+
<a href=https://www.npmjs.com/package/@kunosyn/shatterbox>
|
|
12
|
+
<img src=https://img.shields.io/npm/dt/@kunosynshatterbox />
|
|
13
13
|
</a>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
@@ -21,15 +21,84 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
### Installation
|
|
24
|
-
Install package via [NPM](https://www.npmjs.com/package/@
|
|
24
|
+
> Install package via [NPM](https://www.npmjs.com/package/@kunosyn/shatterbox):
|
|
25
|
+
```sh
|
|
26
|
+
npm i @kunosyn/shatterbox
|
|
27
|
+
```
|
|
25
28
|
|
|
29
|
+
> Add path to tsconfig.json in compilerOptions.typeRoots
|
|
26
30
|
```sh
|
|
27
|
-
|
|
31
|
+
"typeRoots": ["node_modules/@kunosyn", ...]
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
> Add path to @kunosyn to default.project.json in rbxts_include/node_modules.
|
|
35
|
+
```sh
|
|
36
|
+
"ReplicatedStorage": {
|
|
37
|
+
"$className": "ReplicatedStorage",
|
|
38
|
+
"rbxts_include": {
|
|
39
|
+
"$path": "include",
|
|
40
|
+
"node_modules": {
|
|
41
|
+
"$className": "Folder",
|
|
42
|
+
"@kunosyn": {
|
|
43
|
+
"$path": "node_modules/@kunosyn"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
```
|
|
31
49
|
|
|
32
50
|
*Done!*
|
|
33
51
|
|
|
34
52
|
### Usage Example
|
|
35
53
|
Here's some basic examples of using the shatterbox module:
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
> Server Initialization
|
|
57
|
+
```ts
|
|
58
|
+
import Shatterbox from '@kunosyn/shatterbox'
|
|
59
|
+
|
|
60
|
+
const shatterbox = new Shatterbox()
|
|
61
|
+
|
|
62
|
+
shatterbox.Start()
|
|
63
|
+
|
|
64
|
+
// Registers one of the default effects.
|
|
65
|
+
shatterbox.RegisterOnVoxelDestruct('BumpyFloorBreakWalls', shatterbox.DefaultEffects.BumpyFloorBreakWalls)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
> Client Initialization
|
|
70
|
+
```ts
|
|
71
|
+
import Shatterbox from '@kunosyn/shatterbox'
|
|
72
|
+
|
|
73
|
+
const shatterbox = new Shatterbox()
|
|
74
|
+
|
|
75
|
+
shatterbox.Start()
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
> Jujustu Shenanigans Styled Destruction (Server)
|
|
79
|
+
```ts
|
|
80
|
+
import Shatterbox from '@kunosyn/shatterbox'
|
|
81
|
+
|
|
82
|
+
const shatterbox = new Shatterbox()
|
|
83
|
+
|
|
84
|
+
shatterbox.Start()
|
|
85
|
+
|
|
86
|
+
// Registers one of the default effects.
|
|
87
|
+
shatterbox.RegisterOnVoxelDestruct('BumpyFloorBreakWalls', shatterbox.DefaultEffects.BumpyFloorBreakWalls)
|
|
88
|
+
|
|
89
|
+
// Create a Hitbox Instance
|
|
90
|
+
const hb = this.shatterbox.CreateHitbox()
|
|
91
|
+
hb.Size = Vector3.one.mul(10) // Sets the hitbox size
|
|
92
|
+
hb.OnVoxelDestruct = 'BumpyFloorBreakWalls' // Sets the Destruction Effect
|
|
93
|
+
hb.CleanupDelay = 10 // How long to wait until cleanup
|
|
94
|
+
|
|
95
|
+
// Replace with your networking solution of choice.
|
|
96
|
+
Events.M1.Connect((player, hitPosition, normal) => {
|
|
97
|
+
const char = player.Character || player.CharacterAdded.Wait()[0]
|
|
98
|
+
const hrp = char.WaitForChild('HumanoidRootPart') as BasePart
|
|
99
|
+
|
|
100
|
+
hb.CFrame = new CFrame(hit) // Sets the position of the hitbox
|
|
101
|
+
hb.UserData['CastOrigin'] = hrp.Position // Sets the cast origin.
|
|
102
|
+
hb.Destroy() // Destructs the voxels in the hitbox.
|
|
103
|
+
})
|
|
104
|
+
```
|