@@ -5,6 +5,11 @@ import (
5
5
"image/color"
6
6
)
7
7
8
+ const (
9
+ AimAssistTargetModeAngle = iota
10
+ AimAssistTargetModeDistance
11
+ )
12
+
8
13
const (
9
14
AudioListenerCamera = iota
10
15
AudioListenerPlayer
@@ -163,8 +168,10 @@ type CameraPreset struct {
163
168
HorizontalRotationLimit Optional [mgl32.Vec2 ]
164
169
// VerticalRotationLimit is the vertical rotation limit of the camera.
165
170
VerticalRotationLimit Optional [mgl32.Vec2 ]
166
- // ContinueTargeting determines whether the camera should continue targeting the entity or not .
171
+ // ContinueTargeting determines whether the camera should continue targeting when using aim assist .
167
172
ContinueTargeting Optional [bool ]
173
+ // TrackingRadius is the radius around the camera that the aim assist should track targets.
174
+ TrackingRadius Optional [float32 ]
168
175
// ViewOffset is only used in a follow_orbit camera and controls an offset based on a pivot point to the
169
176
// player, causing it to be shifted in a certain direction.
170
177
ViewOffset Optional [mgl32.Vec2 ]
@@ -181,6 +188,8 @@ type CameraPreset struct {
181
188
// AlignTargetAndCameraForward determines whether the camera should align the target and the camera forward
182
189
// or not.
183
190
AlignTargetAndCameraForward Optional [bool ]
191
+ // AimAssist defines the aim assist to use when using this preset.
192
+ AimAssist Optional [CameraPresetAimAssist ]
184
193
}
185
194
186
195
// Marshal encodes/decodes a CameraPreset.
@@ -197,10 +206,147 @@ func (x *CameraPreset) Marshal(r IO) {
197
206
OptionalFunc (r , & x .HorizontalRotationLimit , r .Vec2 )
198
207
OptionalFunc (r , & x .VerticalRotationLimit , r .Vec2 )
199
208
OptionalFunc (r , & x .ContinueTargeting , r .Bool )
209
+ OptionalFunc (r , & x .TrackingRadius , r .Float32 )
200
210
OptionalFunc (r , & x .ViewOffset , r .Vec2 )
201
211
OptionalFunc (r , & x .EntityOffset , r .Vec3 )
202
212
OptionalFunc (r , & x .Radius , r .Float32 )
203
213
OptionalFunc (r , & x .AudioListener , r .Uint8 )
204
214
OptionalFunc (r , & x .PlayerEffects , r .Bool )
205
215
OptionalFunc (r , & x .AlignTargetAndCameraForward , r .Bool )
206
216
}
217
+
218
+ // CameraPresetAimAssist represents a preset for aim assist settings.
219
+ type CameraPresetAimAssist struct {
220
+ // Preset is the ID of the preset that has previously been defined in the CameraAimAssistPresets packet.
221
+ Preset Optional [string ]
222
+ // TargetMode is the mode that the camera should use for detecting targets. This is one of the constants
223
+ // above.
224
+ TargetMode Optional [int32 ]
225
+ // Angle is the maximum angle around the playes's cursor that the aim assist should check for a target,
226
+ // if TargetMode is set to protocol.AimAssistTargetModeAngle.
227
+ Angle Optional [mgl32.Vec2 ]
228
+ // Distance is the maximum distance from the player's cursor should check for a target, if TargetMode is
229
+ // set to protocol.AimAssistTargetModeDistance.
230
+ Distance Optional [float32 ]
231
+ }
232
+
233
+ // Marshal encodes/decodes a CameraPresetAimAssist.
234
+ func (x * CameraPresetAimAssist ) Marshal (r IO ) {
235
+ OptionalFunc (r , & x .Preset , r .String )
236
+ OptionalFunc (r , & x .TargetMode , r .Int32 )
237
+ OptionalFunc (r , & x .Angle , r .Vec2 )
238
+ OptionalFunc (r , & x .Distance , r .Float32 )
239
+ }
240
+
241
+ // CameraAimAssistCategoryGroup is a group of categories which can be used by a CameraAimAssistPreset.
242
+ type CameraAimAssistCategoryGroup struct {
243
+ // Identifier is the unique identifier of the group.
244
+ Identifier string
245
+ // Categories is a list of categories within this group.
246
+ Categories []CameraAimAssistCategory
247
+ }
248
+
249
+ // Marshal encodes/decodes a CameraAimAssistCategoryGroup.
250
+ func (x * CameraAimAssistCategoryGroup ) Marshal (r IO ) {
251
+ r .String (& x .Identifier )
252
+ Slice (r , & x .Categories )
253
+ }
254
+
255
+ // CameraAimAssistCategory is an aim assist category that defines priorities for specific blocks and entities.
256
+ type CameraAimAssistCategory struct {
257
+ // Name is the name of the category which can be used by a CameraAimAssistPreset.
258
+ Name string
259
+ // Priorities represents the block and entity specific priorities as well as the default priorities for
260
+ // this category.
261
+ Priorities CameraAimAssistPriorities
262
+ }
263
+
264
+ // Marshal encodes/decodes a CameraAimAssistCategory.
265
+ func (x * CameraAimAssistCategory ) Marshal (r IO ) {
266
+ r .String (& x .Name )
267
+ Single (r , & x .Priorities )
268
+ }
269
+
270
+ // CameraAimAssistPriorities represents the block and entity specific priorities for targetting. The aim
271
+ // assist will select the block or entity with the highest priority within the specified thresholds.
272
+ type CameraAimAssistPriorities struct {
273
+ // Entities is a list of priorities for specific entity identifiers.
274
+ Entities []CameraAimAssistPriority
275
+ // Blocks is a list of priorities for specific block identifiers.
276
+ Blocks []CameraAimAssistPriority
277
+ // EntityDefault is the default priority for entities.
278
+ EntityDefault Optional [int32 ]
279
+ // BlockDefault is the default priority for blocks.
280
+ BlockDefault Optional [int32 ]
281
+ }
282
+
283
+ // Marshal encodes/decodes a CameraAimAssistPriorities.
284
+ func (x * CameraAimAssistPriorities ) Marshal (r IO ) {
285
+ Slice (r , & x .Entities )
286
+ Slice (r , & x .Blocks )
287
+ OptionalFunc (r , & x .EntityDefault , r .Int32 )
288
+ OptionalFunc (r , & x .BlockDefault , r .Int32 )
289
+ }
290
+
291
+ // CameraAimAssistPriority represents a non-default priority for a specific target.
292
+ type CameraAimAssistPriority struct {
293
+ // Identifier is the identifier of a target to define the priority for.
294
+ Identifier string
295
+ // Priority is the priority for this specific target.
296
+ Priority int32
297
+ }
298
+
299
+ // Marshal encodes/decodes a CameraAimAssistPriority.
300
+ func (x * CameraAimAssistPriority ) Marshal (r IO ) {
301
+ r .String (& x .Identifier )
302
+ r .Int32 (& x .Priority )
303
+ }
304
+
305
+ // CameraAimAssistPreset defines a base preset that can be extended upon when sending an aim assist.
306
+ type CameraAimAssistPreset struct {
307
+ // Identifier represents the identifier of this preset.
308
+ Identifier string
309
+ // CategoryGroup is the name of a CameraAimAssistCategoryGroup to use for the preset.
310
+ CategoryGroup string
311
+ // BlockExclusions is a list of block identifiers that should be ignored by the aim assist.
312
+ BlockExclusions []string
313
+ // LiquidTargets is a list of entity identifiers that should be targetted when inside of a liquid.
314
+ LiquidTargets []string
315
+ // ItemSettings is a list of settings for specific item identifiers. If an item is not listed here, it
316
+ // will fallback to DefaultItemSettings or HandSettings if no item is held.
317
+ ItemSettings []CameraAimAssistItemSettings
318
+ // DefaultItemSettings is the identifier of a category to use when the player is not holding an item
319
+ // listed in ItemSettings. This must be the identifier of a category within the
320
+ // CameraAimAssistCategoryGroup references by CategoryGroup.
321
+ DefaultItemSettings Optional [string ]
322
+ // HandSettings is the identifier of a category to use when the player is not holding an item. This must
323
+ // be the identifier of a category within the CameraAimAssistCategoryGroup references by CategoryGroup.
324
+ HandSettings Optional [string ]
325
+ }
326
+
327
+ // Marshal encodes/decodes a CameraAimAssistPreset.
328
+ func (x * CameraAimAssistPreset ) Marshal (r IO ) {
329
+ r .String (& x .Identifier )
330
+ r .String (& x .CategoryGroup )
331
+ FuncSlice (r , & x .BlockExclusions , r .String )
332
+ FuncSlice (r , & x .LiquidTargets , r .String )
333
+ Slice (r , & x .ItemSettings )
334
+ OptionalFunc (r , & x .DefaultItemSettings , r .String )
335
+ OptionalFunc (r , & x .HandSettings , r .String )
336
+ }
337
+
338
+ // CameraAimAssistItemSettings defines settings for how specific items should behave when using aim assist.
339
+ type CameraAimAssistItemSettings struct {
340
+ // Item is the identifier of the item to apply the settings to.
341
+ Item string
342
+ // Category is the identifier of a category to use which has been defined by a CameraAimAssistCategory.
343
+ // Only categories defined in the CameraAimAssistCategoryGroup used by the CameraAimAssistPreset can be
344
+ // used here.
345
+ Category string
346
+ }
347
+
348
+ // Marshal encodes/decodes a CameraAimAssistItemSettings.
349
+ func (x * CameraAimAssistItemSettings ) Marshal (r IO ) {
350
+ r .String (& x .Item )
351
+ r .String (& x .Category )
352
+ }
0 commit comments