rbxts-vex 1.0.0 → 1.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/LICENSE +21 -0
- package/README.md +75 -0
- package/package.json +1 -1
- package/src/index.d.ts +7 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 savruun
|
|
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,75 @@
|
|
|
1
|
+
<!-- <div align="center">
|
|
2
|
+
<p>
|
|
3
|
+
<img src= />
|
|
4
|
+
</p>
|
|
5
|
+
</div> -->
|
|
6
|
+
|
|
7
|
+
<div align="center">
|
|
8
|
+
<a href=https://www.npmjs.com/package/rbxts-vex>
|
|
9
|
+
<img src=https://img.shields.io/npm/v/rbxts-vex />
|
|
10
|
+
</a>
|
|
11
|
+
<a href=https://www.npmjs.com/package/rbxts-vex>
|
|
12
|
+
<img src=https://img.shields.io/npm/dt/rbxts-vex />
|
|
13
|
+
</a>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## About
|
|
17
|
+
An efficient, performance-minded voxel destruction model.
|
|
18
|
+
Created by EternalEthel/qrisquinn. Ported to Typescript for rbxts by savruun.
|
|
19
|
+
|
|
20
|
+
> [!IMPORTANT]
|
|
21
|
+
> This package is a port of [Vex 2.0](https://devforum.roblox.com/t/vex-20-remastered-for-your-voxel-destruction-needs/1619456) last updated in January of 2022 meaning this package is not updated anymore.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
25
|
+
Install package via [NPM](https://www.npmjs.com/package/rbxts-vex):
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm i rbxts-vex
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Usage Example
|
|
32
|
+
Here's some basic examples of using the vex module:
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
> Destructible walls.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { Workspace } from '@rbxts/services';
|
|
39
|
+
import Vex from 'rbxts-vex';
|
|
40
|
+
|
|
41
|
+
const wall = Workspace.WaitForChild('Wall') as Part
|
|
42
|
+
const projectile = Workspace.WaitForChild('Projectile') as Part
|
|
43
|
+
|
|
44
|
+
const structure = new Vex(wall, {
|
|
45
|
+
voxelSize: 2,
|
|
46
|
+
lifetime: 15
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
projectile.Touched.Connect((hit) => {
|
|
50
|
+
if (hit === wall) {
|
|
51
|
+
structure.Destroy()
|
|
52
|
+
structure.ApplyForce(projectile.AssemblyLinearVelocity.mul(10), projectile.Position)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> Timed demolition.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { Workspace } from '@rbxts/services';
|
|
61
|
+
import Vex from 'rbxts-vex';
|
|
62
|
+
|
|
63
|
+
const building = Workspace.WaitForChild('Building') as Model;
|
|
64
|
+
|
|
65
|
+
task.wait(3)
|
|
66
|
+
|
|
67
|
+
const structure = new Vex(building, {
|
|
68
|
+
voxelSize: 2,
|
|
69
|
+
lifetime: 30,
|
|
70
|
+
weldAdjacent: false // Let the pieces fall independently.
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
structure.Destroy()
|
|
74
|
+
structure.ApplyForce(new Vector3(0, 1200, 0), building.PrimaryPart.Position);
|
|
75
|
+
```
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "rbxts-vex",
|
|
3
3
|
"main": "src/init.luau",
|
|
4
4
|
"types": "src/index.d.ts",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.2",
|
|
6
6
|
"description": "An efficient, performance-minded voxel destruction model. Created by EternalEthel/qrisquinn (same person).",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "kunosyn",
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
interface VexOptions {
|
|
2
2
|
/**
|
|
3
3
|
* Bigger voxels = better performance.
|
|
4
4
|
* @default 1
|
|
@@ -46,9 +46,9 @@ export interface VexOptions {
|
|
|
46
46
|
weldAdjacent?: boolean;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
interface VoxelStructure {
|
|
50
50
|
/**
|
|
51
|
-
* Destroys the
|
|
51
|
+
* Destroys the original model and applies voxelization. Use this before applying forces.
|
|
52
52
|
*/
|
|
53
53
|
Destroy(): void;
|
|
54
54
|
|
|
@@ -71,13 +71,13 @@ export interface VoxelStructure {
|
|
|
71
71
|
GetVoxelCount(): number;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
interface VoxelPoolStats {
|
|
75
75
|
readonly active: number;
|
|
76
76
|
readonly pooled: number;
|
|
77
77
|
readonly total: number;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
interface Vex{
|
|
81
81
|
/**
|
|
82
82
|
*
|
|
83
83
|
* @param source The BasePart or Model to voxelize.
|
|
@@ -97,4 +97,5 @@ declare const Vex: {
|
|
|
97
97
|
clearPool(): void;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
declare const Vex: Vex;
|
|
101
|
+
export = Vex;
|