rbxts-chrono 2.0.0-experimental.4 → 2.0.0-experimental.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.d.ts +52 -45
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rbxts-chrono",
3
- "version": "2.0.0-experimental.4",
3
+ "version": "2.0.0-experimental.5",
4
4
  "description": "TypeScript types for Chrono - Custom Character Replication for Roblox",
5
5
  "main": "src/init.lua",
6
6
  "types": "src/index.d.ts",
package/src/index.d.ts CHANGED
@@ -106,7 +106,7 @@ type EntityEventName =
106
106
  | "ModelChanged"
107
107
  | "LockChanged";
108
108
 
109
- // Entity interface
109
+ // Entity interface (data only - methods are static on EntityConstructor)
110
110
  interface Entity {
111
111
  /** Unique identifier for this entity */
112
112
  readonly id: number;
@@ -131,102 +131,109 @@ interface Entity {
131
131
 
132
132
  /** The most recent CFrame value */
133
133
  readonly latestCFrame: CFrame | undefined;
134
+ }
135
+
136
+ interface EntityConstructor {
137
+ new (
138
+ entityConfig?: string,
139
+ model?: Model | BasePart | string,
140
+ modelReplicationMode?: ModelReplicationMode,
141
+ initCFrame?: CFrame,
142
+ ): Entity;
134
143
 
135
- /** Sets or changes the model for this entity */
144
+ /** Sets or changes the model for an entity */
136
145
  SetModel(
146
+ entity: Entity,
137
147
  model?: Model | BasePart | string,
138
148
  modelReplicationMode?: ModelReplicationMode,
139
149
  noDestroy?: boolean,
140
150
  ): void;
141
151
 
142
152
  /** Sets the entity configuration type */
143
- SetConfig(entityConfig: string): void;
153
+ SetConfig(entity: Entity, entityConfig: string): void;
144
154
 
145
155
  /** Sets the broad phase collision bounds */
146
- SetBroadPhase(broadPhase?: Vector3): void;
156
+ SetBroadPhase(entity: Entity, broadPhase?: Vector3): void;
147
157
 
148
- /** Gets custom data associated with this entity */
149
- GetData<T = unknown>(): T;
158
+ /** Gets custom data associated with an entity */
159
+ GetData<T = unknown>(entity: Entity): T;
150
160
 
151
- /** Gets the model associated with this entity */
152
- GetModel(): Model | BasePart | undefined;
161
+ /** Gets the model associated with an entity */
162
+ GetModel(entity: Entity): Model | BasePart | undefined;
153
163
 
154
- /** Sets custom data for this entity */
155
- SetData(data: unknown): void;
164
+ /** Sets custom data for an entity */
165
+ SetData(entity: Entity, data: unknown): void;
156
166
 
157
167
  /** Clears the mount relationship */
158
- ClearMount(): void;
168
+ ClearMount(entity: Entity): void;
159
169
 
160
- /** Mounts this entity to a parent entity with optional offset */
161
- SetMount(parent?: Entity, offset?: CFrame): void;
170
+ /** Mounts an entity to a parent entity with optional offset */
171
+ SetMount(entity: Entity, parent?: Entity, offset?: CFrame): void;
162
172
 
163
173
  /** Sets the network owner (player who controls this entity) */
164
- SetNetworkOwner(player?: Player): void;
174
+ SetNetworkOwner(entity: Entity, player?: Player): void;
165
175
 
166
176
  /** Clears the entity's snapshot buffer */
167
- Clear(): void;
177
+ Clear(entity: Entity): void;
168
178
 
169
- /** Pauses replication for this entity */
170
- PauseReplication(): void;
179
+ /** Pauses replication for an entity */
180
+ PauseReplication(entity: Entity): void;
171
181
 
172
- /** Resumes replication for this entity */
173
- ResumeReplication(): void;
182
+ /** Resumes replication for an entity */
183
+ ResumeReplication(entity: Entity): void;
174
184
 
175
185
  /** Pushes a new CFrame snapshot at the given time */
176
- Push(time: number, value: CFrame): boolean;
186
+ Push(entity: Entity, time: number, value: CFrame): boolean;
177
187
 
178
188
  /** Gets the interpolated CFrame at a specific time */
179
- GetAt(time: number): CFrame | undefined;
189
+ GetAt(entity: Entity, time: number): CFrame | undefined;
180
190
 
181
191
  /** Gets the target render time for interpolation */
182
- GetTargetRenderTime(): number;
192
+ GetTargetRenderTime(entity: Entity): number;
183
193
 
184
194
  /** Sets whether position updates automatically */
185
- SetAutoUpdatePos(autoUpdate: boolean): void;
195
+ SetAutoUpdatePos(entity: Entity, autoUpdate: boolean): void;
186
196
 
187
197
  /** Gets the current CFrame */
188
- GetCFrame(): CFrame | undefined;
198
+ GetCFrame(entity: Entity): CFrame | undefined;
189
199
 
190
200
  /** Sets the current CFrame */
191
- SetCFrame(cframe: CFrame): void;
201
+ SetCFrame(entity: Entity, cframe: CFrame): void;
192
202
 
193
203
  /** Gets the primary part of the model */
194
- GetPrimaryPart(): BasePart | undefined;
204
+ GetPrimaryPart(entity: Entity): BasePart | undefined;
195
205
 
196
206
  /** Locks native server CFrame replication */
197
- LockNativeServerCFrameReplication(): void;
207
+ LockNativeServerCFrameReplication(entity: Entity): void;
198
208
 
199
209
  /** Unlocks native server CFrame replication */
200
- UnlockNativeServerCFrameReplication(): void;
210
+ UnlockNativeServerCFrameReplication(entity: Entity): void;
201
211
 
202
- /** Destroys this entity */
203
- Destroy(): void;
212
+ /** Destroys an entity */
213
+ Destroy(entity: Entity): void;
204
214
 
205
215
  /** Gets an event by name */
206
- GetEvent(name: "Destroying"): ChronoEvent<(entity: Entity) => void>;
216
+ GetEvent(entity: Entity, name: "Destroying"): ChronoEvent<(entity: Entity) => void>;
207
217
  GetEvent(
218
+ entity: Entity,
208
219
  name: "NetworkOwnerChanged",
209
220
  ): ChronoEvent<(entity: Entity, newOwner: Player | undefined, prevOwner: Player | undefined) => void>;
210
221
  GetEvent(
222
+ entity: Entity,
211
223
  name: "PushedSnapShot",
212
224
  ): ChronoEvent<(entity: Entity, time: number, value: CFrame, isNewest: boolean) => void>;
213
- GetEvent(name: "TickChanged"): ChronoEvent<(entity: Entity, newTickType: "NONE" | "HALF" | "NORMAL") => void>;
214
- GetEvent(name: "DataChanged"): ChronoEvent<(entity: Entity, data: unknown) => void>;
215
- GetEvent(name: "Ticked"): ChronoEvent<(entity: Entity, dt: number) => void>;
216
225
  GetEvent(
226
+ entity: Entity,
227
+ name: "TickChanged",
228
+ ): ChronoEvent<(entity: Entity, newTickType: "NONE" | "HALF" | "NORMAL") => void>;
229
+ GetEvent(entity: Entity, name: "DataChanged"): ChronoEvent<(entity: Entity, data: unknown) => void>;
230
+ GetEvent(entity: Entity, name: "Ticked"): ChronoEvent<(entity: Entity, dt: number) => void>;
231
+ GetEvent(
232
+ entity: Entity,
217
233
  name: "ModelChanged",
218
234
  ): ChronoEvent<(entity: Entity, newModel: Model | BasePart | undefined, oldModel: Model | BasePart | undefined) => void>;
219
- GetEvent(name: "LockChanged"): ChronoEvent<(entity: Entity, isLocked: boolean) => void>;
220
- GetEvent(name: EntityEventName): ChronoEvent;
221
- }
222
-
223
- interface EntityConstructor {
224
- new (
225
- entityConfig?: string,
226
- model?: Model | BasePart | string,
227
- modelReplicationMode?: ModelReplicationMode,
228
- initCFrame?: CFrame,
229
- ): Entity;
235
+ GetEvent(entity: Entity, name: "LockChanged"): ChronoEvent<(entity: Entity, isLocked: boolean) => void>;
236
+ GetEvent(entity: Entity, name: EntityEventName): ChronoEvent;
230
237
  }
231
238
 
232
239
  // Replication rule types