@nativewrappers/fivem 0.0.80 → 0.0.82
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/Audio.d.ts +2 -2
- package/Audio.js +99 -0
- package/Blip.d.ts +4 -3
- package/Blip.js +113 -0
- package/Camera.d.ts +3 -3
- package/Camera.js +190 -0
- package/Checkpoint.d.ts +2 -2
- package/Checkpoint.js +51 -0
- package/Events.js +80 -0
- package/Game.d.ts +10 -3
- package/Game.js +478 -0
- package/GameplayCamera.d.ts +2 -2
- package/GameplayCamera.js +152 -0
- package/Model.js +210 -0
- package/NetworkedScene.d.ts +2 -1
- package/NetworkedScene.js +50 -0
- package/ParticleEffect.d.ts +4 -3
- package/ParticleEffect.js +128 -0
- package/ParticleEffectAsset.d.ts +2 -2
- package/ParticleEffectAsset.js +133 -0
- package/Pickup.d.ts +1 -1
- package/Pickup.js +27 -0
- package/Raycast.d.ts +5 -3
- package/Raycast.js +132 -0
- package/RelationshipGroup.d.ts +1 -1
- package/RelationshipGroup.js +72 -0
- package/Rope.d.ts +1 -1
- package/Rope.js +149 -0
- package/TaskSequence.js +52 -0
- package/Tasks.d.ts +8 -3
- package/Tasks.js +334 -0
- package/World.d.ts +13 -4
- package/World.js +945 -0
- package/cfx/StateBagChangeHandler.js +0 -0
- package/cfx/index.d.ts +1 -1
- package/cfx/index.js +4 -0
- package/common/Command.js +111 -0
- package/common/Convar.js +58 -0
- package/common/GlobalData.js +16 -0
- package/common/Kvp.js +137 -0
- package/common/Resource.js +54 -0
- package/common/decors/Events.js +170 -0
- package/common/net/NetworkedMap.js +225 -0
- package/common/types.js +0 -0
- package/common/utils/ClassTypes.js +15 -0
- package/common/utils/Color.js +33 -0
- package/common/utils/Delay.d.ts +1 -0
- package/common/utils/Delay.js +6 -0
- package/common/utils/Maths.js +18 -0
- package/common/utils/Point.d.ts +9 -0
- package/common/utils/Point.js +36 -0
- package/common/utils/PointF.d.ts +1 -1
- package/common/utils/PointF.js +18 -0
- package/common/utils/Quaternion.d.ts +1 -1
- package/common/utils/Quaternion.js +33 -0
- package/common/utils/Vector.js +589 -0
- package/common/utils/cleanPlayerName.js +17 -0
- package/common/utils/enumValues.js +20 -0
- package/common/utils/getStringFromUInt8Array.js +6 -0
- package/common/utils/getUInt32FromUint8Array.js +6 -0
- package/enums/Alignment.js +9 -0
- package/enums/AnimationFlags.js +38 -0
- package/enums/AudioFlag.js +41 -0
- package/enums/BadgeStyle.js +186 -0
- package/enums/Blip.js +229 -0
- package/enums/Bone.js +105 -0
- package/enums/CameraShake.js +17 -0
- package/enums/CameraTypes.js +11 -0
- package/enums/CheckboxStyle.js +8 -0
- package/enums/Checkpoint.js +68 -0
- package/enums/CloudHat.js +27 -0
- package/enums/Control.js +364 -0
- package/enums/CursorSprite.js +18 -0
- package/enums/Driving.js +38 -0
- package/enums/ExplosionType.js +45 -0
- package/enums/FiringPattern.js +23 -0
- package/enums/Font.js +11 -0
- package/enums/ForceType.js +12 -0
- package/enums/Gender.js +8 -0
- package/enums/HelmetType.js +9 -0
- package/enums/HudColor.js +187 -0
- package/enums/HudComponent.js +57 -0
- package/enums/InputMode.js +8 -0
- package/enums/InvertAxis.js +10 -0
- package/enums/Language.js +18 -0
- package/enums/LeaveVehicleFlags.js +14 -0
- package/enums/LoadingSpinnerType.js +11 -0
- package/enums/MarkerType.js +48 -0
- package/enums/MenuAlignment.js +8 -0
- package/enums/NotificationType.js +14 -0
- package/enums/Parachute.js +19 -0
- package/enums/PickupType.js +77 -0
- package/enums/RadioStation.js +28 -0
- package/enums/RagdollType.js +10 -0
- package/enums/RaycastEnums.js +33 -0
- package/enums/Relationship.js +13 -0
- package/enums/RopeType.js +9 -0
- package/enums/ScreenEffect.js +87 -0
- package/enums/SpeechModifier.js +43 -0
- package/enums/Vehicle.js +396 -0
- package/enums/Weather.js +22 -0
- package/enums/ZoneID.js +95 -0
- package/hashes/MaterialHash.js +220 -0
- package/hashes/PedHash.js +728 -0
- package/hashes/VehicleHash.js +526 -0
- package/hashes/WeaponHash.js +155 -0
- package/hashes/WeatherTypeHash.js +22 -0
- package/index.js +166 -18794
- package/interfaces/Dimensions.d.ts +1 -1
- package/interfaces/Dimensions.js +0 -0
- package/models/BaseEntity.d.ts +10 -8
- package/models/BaseEntity.js +576 -0
- package/models/Entity.d.ts +0 -1
- package/models/Entity.js +0 -0
- package/models/EntityBone.d.ts +1 -1
- package/models/EntityBone.js +32 -0
- package/models/EntityBoneCollection.d.ts +1 -1
- package/models/EntityBoneCollection.js +27 -0
- package/models/Ped.d.ts +13 -5
- package/models/Ped.js +711 -0
- package/models/PedBone.d.ts +3 -2
- package/models/PedBone.js +18 -0
- package/models/PedBoneCollection.d.ts +3 -1
- package/models/PedBoneCollection.js +31 -0
- package/models/Player.d.ts +4 -2
- package/models/Player.js +188 -0
- package/models/Prop.d.ts +1 -1
- package/models/Prop.js +34 -0
- package/models/Vehicle.d.ts +9 -4
- package/models/Vehicle.js +582 -0
- package/models/VehicleDoor.d.ts +1 -1
- package/models/VehicleDoor.js +52 -0
- package/models/VehicleDoorCollection.d.ts +1 -1
- package/models/VehicleDoorCollection.js +66 -0
- package/models/VehicleMod.d.ts +1 -1
- package/models/VehicleMod.js +43 -0
- package/models/VehicleModCollection.d.ts +2 -2
- package/models/VehicleModCollection.js +227 -0
- package/models/VehicleToggleMod.d.ts +1 -1
- package/models/VehicleToggleMod.js +37 -0
- package/models/VehicleWheel.js +31 -0
- package/models/VehicleWheelCollection.d.ts +1 -1
- package/models/VehicleWheelCollection.js +61 -0
- package/models/VehicleWindow.d.ts +1 -1
- package/models/VehicleWindow.js +43 -0
- package/models/VehicleWindowCollection.d.ts +1 -1
- package/models/VehicleWindowCollection.js +62 -0
- package/package.json +2 -2
- package/ui/Container.d.ts +4 -2
- package/ui/Container.js +39 -0
- package/ui/Effects.d.ts +1 -1
- package/ui/Effects.js +112 -0
- package/ui/Fading.js +74 -0
- package/ui/Hud.d.ts +3 -2
- package/ui/Hud.js +47 -0
- package/ui/InstructionalButtons.js +42 -0
- package/ui/LoadingPrompt.d.ts +1 -1
- package/ui/LoadingPrompt.js +37 -0
- package/ui/Notification.js +17 -0
- package/ui/Rectangle.d.ts +4 -2
- package/ui/Rectangle.js +46 -0
- package/ui/Scaleform.d.ts +2 -1
- package/ui/Scaleform.js +240 -0
- package/ui/Screen.d.ts +6 -3
- package/ui/Screen.js +83 -0
- package/ui/Sprite.d.ts +3 -1
- package/ui/Sprite.js +70 -0
- package/ui/Text.d.ts +6 -3
- package/ui/Text.js +119 -0
- package/ui/Timerbar.js +241 -0
- package/ui/interfaces/IButton.d.ts +1 -1
- package/ui/interfaces/IButton.js +0 -0
- package/ui/interfaces/IDrawable.d.ts +3 -1
- package/ui/interfaces/IDrawable.js +0 -0
- package/ui/menu/Menu.d.ts +9 -4
- package/ui/menu/Menu.js +830 -0
- package/ui/menu/MenuControl.js +20 -0
- package/ui/menu/MenuControls.js +17 -0
- package/ui/menu/MenuSettings.d.ts +1 -1
- package/ui/menu/MenuSettings.js +57 -0
- package/ui/menu/items/UIMenuCheckboxItem.d.ts +3 -3
- package/ui/menu/items/UIMenuCheckboxItem.js +70 -0
- package/ui/menu/items/UIMenuItem.d.ts +10 -4
- package/ui/menu/items/UIMenuItem.js +1103 -0
- package/ui/menu/items/UIMenuListItem.d.ts +3 -3
- package/ui/menu/items/UIMenuListItem.js +118 -0
- package/ui/menu/items/UIMenuSeparatorItem.d.ts +1 -1
- package/ui/menu/items/UIMenuSeparatorItem.js +37 -0
- package/ui/menu/items/UIMenuSliderItem.d.ts +4 -3
- package/ui/menu/items/UIMenuSliderItem.js +180 -0
- package/ui/menu/items/panels/AbstractUIMenuPanel.d.ts +4 -3
- package/ui/menu/items/panels/AbstractUIMenuPanel.js +49 -0
- package/ui/menu/items/panels/UIMenuColorPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuColorPanel.js +215 -0
- package/ui/menu/items/panels/UIMenuGridPanel.d.ts +3 -3
- package/ui/menu/items/panels/UIMenuGridPanel.js +216 -0
- package/ui/menu/items/panels/UIMenuPercentagePanel.d.ts +2 -2
- package/ui/menu/items/panels/UIMenuPercentagePanel.js +138 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanel.d.ts +3 -2
- package/ui/menu/items/panels/UIMenuStatisticsPanel.js +88 -0
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.d.ts +2 -1
- package/ui/menu/items/panels/UIMenuStatisticsPanelItem.js +48 -0
- package/ui/menu/modules/ListItem.js +18 -0
- package/utils/Animations.js +43 -0
- package/utils/Crypto.js +33 -0
- package/utils/LiteEvent.js +25 -0
- package/utils/Maths.js +18 -0
- package/utils/Point.js +36 -0
- package/utils/Size.js +16 -0
- package/utils/String.d.ts +1 -1
- package/utils/String.js +35 -0
- package/weapon/DlcWeaponData.d.ts +1 -1
- package/weapon/DlcWeaponData.js +40 -0
- package/weapon/Mk2WeaponHash.js +18 -0
- package/weapon/Weapon.d.ts +7 -7
- package/weapon/Weapon.js +276 -0
- package/weapon/WeaponAsset.d.ts +1 -1
- package/weapon/WeaponAsset.js +87 -0
- package/weapon/WeaponCollection.d.ts +3 -2
- package/weapon/WeaponCollection.js +179 -0
- package/weapon/WeaponDisplayNameByHash.d.ts +1 -1
- package/weapon/WeaponDisplayNameByHash.js +73 -0
- package/weapon/WeaponGroup.js +22 -0
- package/weapon/WeaponHudStats.d.ts +1 -1
- package/weapon/WeaponHudStats.js +33 -0
- package/weapon/WeaponLivery.js +17 -0
- package/weapon/WeaponLiveryColor.js +38 -0
- package/weapon/WeaponTint.js +46 -0
- package/weaponComponent/ComponentAttachmentPoint.js +22 -0
- package/weaponComponent/ComponentAttachmentPointByHash.js +307 -0
- package/weaponComponent/ComponentDisplayNameByHash.js +278 -0
- package/weaponComponent/DlcWeaponComponentData.js +40 -0
- package/weaponComponent/InvalidWeaponComponent.d.ts +1 -1
- package/weaponComponent/InvalidWeaponComponent.js +31 -0
- package/weaponComponent/WeaponComponent.d.ts +4 -4
- package/weaponComponent/WeaponComponent.js +124 -0
- package/weaponComponent/WeaponComponentCollection.d.ts +2 -2
- package/weaponComponent/WeaponComponentCollection.js +187 -0
- package/weaponComponent/WeaponComponentHash.js +670 -0
- package/weaponComponent/WeaponComponentHashesByWeaponHash.d.ts +1 -1
- package/weaponComponent/WeaponComponentHashesByWeaponHash.js +864 -0
- package/weaponComponent/WeaponComponentHudStats.js +33 -0
- package/common/index.d.ts +0 -8
- package/common/utils/Vector2.d.ts +0 -1
- package/common/utils/Vector3.d.ts +0 -1
- package/common/utils/Vector4.d.ts +0 -1
- package/common/utils/index.d.ts +0 -12
- package/enums/index.d.ts +0 -42
- package/hashes/index.d.ts +0 -5
- package/index.d.ts +0 -25
- package/models/index.d.ts +0 -18
- package/ui/index.d.ts +0 -15
- package/ui/interfaces/index.d.ts +0 -2
- package/ui/menu/index.d.ts +0 -6
- package/ui/menu/items/index.d.ts +0 -6
- package/ui/menu/items/panels/index.d.ts +0 -6
- package/ui/menu/modules/index.d.ts +0 -1
- package/utils/PointF.d.ts +0 -7
- package/utils/Quaternion.d.ts +0 -10
- package/utils/enumValues.d.ts +0 -12
- package/utils/getStringFromUInt8Array.d.ts +0 -8
- package/utils/getUInt32FromUint8Array.d.ts +0 -8
- package/utils/index.d.ts +0 -9
- package/weapon/index.d.ts +0 -8
- package/weaponComponent/index.d.ts +0 -5
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { GlobalData } from "../GlobalData";
|
|
4
|
+
class NetworkedMapEventManager {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "NetworkedMapEventManager");
|
|
7
|
+
}
|
|
8
|
+
#syncedCalls = /* @__PURE__ */ new Map();
|
|
9
|
+
constructor() {
|
|
10
|
+
$SERVER: if (GlobalData.IS_SERVER) {
|
|
11
|
+
on("playerDropped", () => {
|
|
12
|
+
const src = source;
|
|
13
|
+
for (const [_k, map] of this.#syncedCalls) {
|
|
14
|
+
map.removeSubscriber(src);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
$CLIENT: {
|
|
20
|
+
RegisterResourceAsEventHandler(`${GlobalData.CurrentResource}:syncChanges`);
|
|
21
|
+
addRawEventListener(`${GlobalData.CurrentResource}:syncChanges`, (msgpack_data) => {
|
|
22
|
+
const data = msgpack_unpack(msgpack_data);
|
|
23
|
+
const syncName = data[0];
|
|
24
|
+
const syncData = data[1];
|
|
25
|
+
const map = this.#syncedCalls.get(syncName);
|
|
26
|
+
if (!map) {
|
|
27
|
+
throw new Error(`Tried to sync changes for a networked map but ${syncName} does't exist.`);
|
|
28
|
+
}
|
|
29
|
+
map.handleSync(syncData);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
addNetworkedMap(map) {
|
|
34
|
+
this.#syncedCalls.set(map.SyncName, map);
|
|
35
|
+
}
|
|
36
|
+
removeNetworkedMap(syncName) {
|
|
37
|
+
this.#syncedCalls.delete(syncName);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const netManager = new NetworkedMapEventManager();
|
|
41
|
+
class NetworkedMap extends Map {
|
|
42
|
+
static {
|
|
43
|
+
__name(this, "NetworkedMap");
|
|
44
|
+
}
|
|
45
|
+
#syncName;
|
|
46
|
+
#queuedChanges = [];
|
|
47
|
+
#changeListeners = /* @__PURE__ */ new Map();
|
|
48
|
+
#subscribers = /* @__PURE__ */ new Set();
|
|
49
|
+
constructor(syncName, initialValue) {
|
|
50
|
+
super(initialValue);
|
|
51
|
+
this.#syncName = syncName;
|
|
52
|
+
GlobalData.NetworkedTicks.push(this);
|
|
53
|
+
netManager.addNetworkedMap(this);
|
|
54
|
+
$SERVER: {
|
|
55
|
+
if (!GlobalData.NetworkTick && GlobalData.IS_SERVER) {
|
|
56
|
+
GlobalData.NetworkTick = setTick(() => {
|
|
57
|
+
for (const networkedThis of GlobalData.NetworkedTicks) {
|
|
58
|
+
networkedThis.networkTick();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
get SyncName() {
|
|
65
|
+
return this.#syncName;
|
|
66
|
+
}
|
|
67
|
+
// handles removing the player from the map whenever they're dropped
|
|
68
|
+
onPlayerDropped() {
|
|
69
|
+
this.removeSubscriber(source);
|
|
70
|
+
}
|
|
71
|
+
/*
|
|
72
|
+
* Resyncs the entire map to the client, useful for if there's a mismatch in the clients map (when multiple players change things, in cases like inventories)
|
|
73
|
+
*
|
|
74
|
+
* NOTE: This doesn't check that the player is already subscribed to the map, you should do your own due-diligence to only call this for players already subscribed
|
|
75
|
+
*/
|
|
76
|
+
resync(source2) {
|
|
77
|
+
const packed_data = msgpack_pack([this.#syncName, [[4 /* Init */, this.size === 0 ? [] : Array.from(this)]]]);
|
|
78
|
+
TriggerClientEventInternal(
|
|
79
|
+
`${GlobalData.CurrentResource}:syncChanges`,
|
|
80
|
+
source2,
|
|
81
|
+
packed_data,
|
|
82
|
+
packed_data.length
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
/*
|
|
86
|
+
* Adds a new subscriber to the map
|
|
87
|
+
*/
|
|
88
|
+
addSubscriber(source2) {
|
|
89
|
+
this.#subscribers.add(source2);
|
|
90
|
+
this.resync(source2);
|
|
91
|
+
}
|
|
92
|
+
removeSubscriber(sub) {
|
|
93
|
+
return this.#subscribers.delete(sub);
|
|
94
|
+
}
|
|
95
|
+
hasSubscriber(sub) {
|
|
96
|
+
return this.#subscribers.has(sub);
|
|
97
|
+
}
|
|
98
|
+
subscriberCount() {
|
|
99
|
+
return this.#subscribers.size;
|
|
100
|
+
}
|
|
101
|
+
handleSync(data) {
|
|
102
|
+
for (const [change_type, key, value, possibly_undefined_subvalue] of data) {
|
|
103
|
+
switch (change_type) {
|
|
104
|
+
case 1 /* Add */: {
|
|
105
|
+
this.set(key, value);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
case 2 /* Remove */: {
|
|
109
|
+
super.delete(key);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
case 3 /* Reset */: {
|
|
113
|
+
super.clear();
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
case 4 /* Init */: {
|
|
117
|
+
super.clear();
|
|
118
|
+
const key_value = key;
|
|
119
|
+
for (const [k, v] of key_value) {
|
|
120
|
+
this.set(k, v);
|
|
121
|
+
}
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
case 0 /* SubValueChanged */: {
|
|
125
|
+
const data2 = this.get(key);
|
|
126
|
+
data2[value] = possibly_undefined_subvalue;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/*
|
|
133
|
+
* Listens for the change on the specified key, it will get the resulting
|
|
134
|
+
* value on the change
|
|
135
|
+
*/
|
|
136
|
+
listenForChange(key, fn) {
|
|
137
|
+
const listener = this.#changeListeners.get(key);
|
|
138
|
+
listener ? listener.push(fn) : this.#changeListeners.set(key, [fn]);
|
|
139
|
+
}
|
|
140
|
+
#triggerEventForSubscribers(data) {
|
|
141
|
+
const packed_data = msgpack_pack([this.#syncName, data]);
|
|
142
|
+
for (const sub of this.#subscribers) {
|
|
143
|
+
TriggerClientEventInternal(
|
|
144
|
+
`${GlobalData.CurrentResource}:syncChanges`,
|
|
145
|
+
sub,
|
|
146
|
+
packed_data,
|
|
147
|
+
packed_data.length
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
#pushChangeForListener(key, value) {
|
|
152
|
+
const listener = this.#changeListeners.get(key);
|
|
153
|
+
if (!listener) return;
|
|
154
|
+
for (const ln of listener) {
|
|
155
|
+
ln(value);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
set(key, value) {
|
|
159
|
+
let v = value;
|
|
160
|
+
if (value instanceof Object) {
|
|
161
|
+
const curMap = this;
|
|
162
|
+
const objectChangeHandler = {
|
|
163
|
+
get(target, prop, reciever) {
|
|
164
|
+
return Reflect.get(target, prop, reciever);
|
|
165
|
+
},
|
|
166
|
+
set(target, p, newValue, receiver) {
|
|
167
|
+
const success = Reflect.set(target, p, newValue, receiver);
|
|
168
|
+
if (success) {
|
|
169
|
+
curMap.#pushChangeForListener(key, target);
|
|
170
|
+
$SERVER: {
|
|
171
|
+
curMap.#queuedChanges.push([0 /* SubValueChanged */, key, p, newValue]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return success;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
v = new Proxy(v, objectChangeHandler);
|
|
178
|
+
}
|
|
179
|
+
super.set(key, v);
|
|
180
|
+
this.#pushChangeForListener(key, v);
|
|
181
|
+
$SERVER: {
|
|
182
|
+
this.#queuedChanges.push([1 /* Add */, key, v]);
|
|
183
|
+
}
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
/*
|
|
187
|
+
* Resets the map to its default state
|
|
188
|
+
*/
|
|
189
|
+
clear() {
|
|
190
|
+
$CLIENT: if (GlobalData.IS_CLIENT) throw new Error(`Cannot call 'clear' on client`);
|
|
191
|
+
this.#queuedChanges = [];
|
|
192
|
+
this.#queuedChanges.push([3 /* Reset */]);
|
|
193
|
+
super.clear();
|
|
194
|
+
}
|
|
195
|
+
delete(key) {
|
|
196
|
+
$CLIENT: if (GlobalData.IS_CLIENT) throw new Error(`Cannot call 'delete' on client`);
|
|
197
|
+
this.#queuedChanges.push([2 /* Remove */, key]);
|
|
198
|
+
return super.delete(key);
|
|
199
|
+
}
|
|
200
|
+
networkTick() {
|
|
201
|
+
if (this.#queuedChanges.length !== 0) {
|
|
202
|
+
this.#triggerEventForSubscribers(this.#queuedChanges);
|
|
203
|
+
this.#queuedChanges = [];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
[Symbol.dispose]() {
|
|
207
|
+
this.#subscribers.clear();
|
|
208
|
+
this.#changeListeners.clear();
|
|
209
|
+
this.#queuedChanges = [];
|
|
210
|
+
netManager.removeNetworkedMap(this.#syncName);
|
|
211
|
+
GlobalData.NetworkedTicks.filter((v) => v !== this);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Unregisters from the tick handler and removes the event listener
|
|
215
|
+
*/
|
|
216
|
+
dispose() {
|
|
217
|
+
this[Symbol.dispose]();
|
|
218
|
+
}
|
|
219
|
+
get [Symbol.toStringTag]() {
|
|
220
|
+
return "NetworkedMap";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
export {
|
|
224
|
+
NetworkedMap
|
|
225
|
+
};
|
package/common/types.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var ClassTypes = /* @__PURE__ */ ((ClassTypes2) => {
|
|
2
|
+
ClassTypes2[ClassTypes2["Ped"] = 0] = "Ped";
|
|
3
|
+
ClassTypes2[ClassTypes2["Prop"] = 1] = "Prop";
|
|
4
|
+
ClassTypes2[ClassTypes2["Vehicle"] = 2] = "Vehicle";
|
|
5
|
+
ClassTypes2[ClassTypes2["Entity"] = 3] = "Entity";
|
|
6
|
+
ClassTypes2[ClassTypes2["Player"] = 4] = "Player";
|
|
7
|
+
ClassTypes2[ClassTypes2["Vector2"] = 5] = "Vector2";
|
|
8
|
+
ClassTypes2[ClassTypes2["Vector3"] = 6] = "Vector3";
|
|
9
|
+
ClassTypes2[ClassTypes2["Vector4"] = 7] = "Vector4";
|
|
10
|
+
ClassTypes2[ClassTypes2["Quanterion"] = 8] = "Quanterion";
|
|
11
|
+
return ClassTypes2;
|
|
12
|
+
})(ClassTypes || {});
|
|
13
|
+
export {
|
|
14
|
+
ClassTypes
|
|
15
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Color {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Color");
|
|
6
|
+
}
|
|
7
|
+
static Transparent = new Color(0, 0, 0, 0);
|
|
8
|
+
static Black = new Color(0, 0, 0);
|
|
9
|
+
static White = new Color(255, 255, 255);
|
|
10
|
+
static WhiteSmoke = new Color(245, 245, 245);
|
|
11
|
+
static fromArgb(a, r, g, b) {
|
|
12
|
+
return new Color(r, g, b, a);
|
|
13
|
+
}
|
|
14
|
+
static fromRgb(r, g, b) {
|
|
15
|
+
return new Color(r, g, b);
|
|
16
|
+
}
|
|
17
|
+
static fromArray(primitive) {
|
|
18
|
+
return new Color(primitive[0], primitive[1], primitive[2], 255);
|
|
19
|
+
}
|
|
20
|
+
a;
|
|
21
|
+
r;
|
|
22
|
+
g;
|
|
23
|
+
b;
|
|
24
|
+
constructor(r, g, b, a = 255) {
|
|
25
|
+
this.r = r;
|
|
26
|
+
this.g = g;
|
|
27
|
+
this.b = b;
|
|
28
|
+
this.a = a;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
Color
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Delay: (ms: number) => Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Maths {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Maths");
|
|
6
|
+
}
|
|
7
|
+
static clamp(num, min, max) {
|
|
8
|
+
return num <= min ? min : num >= max ? max : num;
|
|
9
|
+
}
|
|
10
|
+
static getRandomInt(min, max) {
|
|
11
|
+
min = Math.ceil(min);
|
|
12
|
+
max = Math.floor(max);
|
|
13
|
+
return Math.floor(Math.random() * (max - min)) + min;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
Maths
|
|
18
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class Point {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "Point");
|
|
6
|
+
}
|
|
7
|
+
static parse(arg) {
|
|
8
|
+
let point = new Point();
|
|
9
|
+
if (arg) {
|
|
10
|
+
if (typeof arg === "object") {
|
|
11
|
+
if (Array.isArray(arg)) {
|
|
12
|
+
if (arg.length === 2) {
|
|
13
|
+
point = new Point(arg[0], arg[1]);
|
|
14
|
+
}
|
|
15
|
+
} else if (arg.X && arg.Y) {
|
|
16
|
+
point = new Point(arg.X, arg.Y);
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
if (arg.indexOf(",") !== -1) {
|
|
20
|
+
const arr = arg.split(",");
|
|
21
|
+
point = new Point(Number.parseFloat(arr[0]), Number.parseFloat(arr[1]));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return point;
|
|
26
|
+
}
|
|
27
|
+
X;
|
|
28
|
+
Y;
|
|
29
|
+
constructor(x = 0, y = 0) {
|
|
30
|
+
this.X = x;
|
|
31
|
+
this.Y = y;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
Point
|
|
36
|
+
};
|
package/common/utils/PointF.d.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class PointF {
|
|
4
|
+
constructor(x, y, z) {
|
|
5
|
+
this.x = x;
|
|
6
|
+
this.y = y;
|
|
7
|
+
this.z = z;
|
|
8
|
+
}
|
|
9
|
+
static {
|
|
10
|
+
__name(this, "PointF");
|
|
11
|
+
}
|
|
12
|
+
static empty() {
|
|
13
|
+
return new PointF(0, 0, 0);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
PointF
|
|
18
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { Vector3 } from "./Vector";
|
|
4
|
+
class Quaternion {
|
|
5
|
+
static {
|
|
6
|
+
__name(this, "Quaternion");
|
|
7
|
+
}
|
|
8
|
+
x;
|
|
9
|
+
y;
|
|
10
|
+
z;
|
|
11
|
+
w;
|
|
12
|
+
constructor(valueXOrVector, yOrW, z, w) {
|
|
13
|
+
if (valueXOrVector instanceof Vector3) {
|
|
14
|
+
this.x = valueXOrVector.x;
|
|
15
|
+
this.y = valueXOrVector.y;
|
|
16
|
+
this.z = valueXOrVector.z;
|
|
17
|
+
this.w = yOrW ?? 0;
|
|
18
|
+
} else if (yOrW === void 0) {
|
|
19
|
+
this.x = valueXOrVector;
|
|
20
|
+
this.y = valueXOrVector;
|
|
21
|
+
this.z = valueXOrVector;
|
|
22
|
+
this.w = valueXOrVector;
|
|
23
|
+
} else {
|
|
24
|
+
this.x = valueXOrVector;
|
|
25
|
+
this.y = yOrW;
|
|
26
|
+
this.z = z ?? 0;
|
|
27
|
+
this.w = w ?? 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
Quaternion
|
|
33
|
+
};
|