This repository was archived by the owner on Aug 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathvehicle_model_info.go
More file actions
78 lines (69 loc) · 1.9 KB
/
Copy pathvehicle_model_info.go
File metadata and controls
78 lines (69 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package altv
/*
#include <stdlib.h>
#include "capi.h"
*/
import "C"
type VehicleModelType = uint8
const (
VehicleInvalid VehicleModelType = iota
VehiclePed
VehicleAutomobile
VehiclePlane
VehicleTrailer
VehicleQuadBike
VehicleSubmarineCar
VehicleAmphibiousAutomobile
VehicleAmphibiousQuadBike
VehicleHeli
VehicleBlimp
VehicleAutogyro
VehicleBike
VehicleBMX
VehicleBoat
VehicleTrain
VehicleSubmarine
VehicleObject
)
type VehicleModelInfo struct {
Title string
ModelType VehicleModelType
WheelsCount uint8
ArmoredWindows bool
AutoAttachTrailer bool
Bones []BoneInfo
PrimaryColor uint8
SecondaryColor uint8
PearlColor uint8
WheelsColor uint8
InteriorColor uint8
DashboardColor uint8
ModKits [2]uint16
Extras uint16
DefaultExtras uint16
}
func (v *VehicleModelInfo) DoesExtraExist(extraId uint8) bool {
return ((v.Extras & (1 << extraId)) != 0)
}
func (v *VehicleModelInfo) DoesExtraDefault(extraId uint8) bool {
return ((v.DefaultExtras & (1 << extraId)) != 0)
}
func newVehicleModelInfo(info C.struct_vehicleModelInfo) VehicleModelInfo {
return VehicleModelInfo{
Title: C.GoString(info.title),
ModelType: VehicleModelType(info.modelType),
WheelsCount: uint8(info.wheelsCount),
ArmoredWindows: uint8(info.hasArmoredWindows) == 1,
AutoAttachTrailer: uint8(info.hasAutoAttachTrailer) == 1,
Bones: createBoneSlice(info.bones),
PrimaryColor: uint8(info.primaryColor),
SecondaryColor: uint8(info.secondaryColor),
PearlColor: uint8(info.pearlColor),
WheelsColor: uint8(info.wheelsColor),
InteriorColor: uint8(info.interiorColor),
DashboardColor: uint8(info.dashboardColor),
ModKits: [2]uint16{uint16(info.modKits[0]), uint16(info.modKits[1])},
Extras: uint16(info.extras),
DefaultExtras: uint16(info.defaultExtras),
}
}