2019-12-11 16:17:23 +00:00
|
|
|
package sii
|
|
|
|
|
2019-12-24 17:46:03 +00:00
|
|
|
import (
|
|
|
|
"regexp"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2019-12-11 16:17:23 +00:00
|
|
|
func init() {
|
|
|
|
RegisterBlock(&Trailer{})
|
|
|
|
}
|
|
|
|
|
|
|
|
type Trailer struct {
|
|
|
|
TrailerDefinition Ptr `sii:"trailer_definition"`
|
2019-12-23 20:19:32 +00:00
|
|
|
CargoMass float32 `sii:"cargo_mass"`
|
2019-12-11 16:17:23 +00:00
|
|
|
CargoDamage float32 `sii:"cargo_damage"` // Needs verification
|
|
|
|
VirtualRearWheelsOffset int64 `sii:"virtual_rear_wheels_offset"` // Needs verification
|
|
|
|
SlaveTrailer Ptr `sii:"slave_trailer"`
|
|
|
|
IsPrivate bool `sii:"is_private"`
|
|
|
|
Accessories []Ptr `sii:"accessories"`
|
|
|
|
Odometer int64 `sii:"odometer"`
|
|
|
|
OdometerFloatPart float32 `sii:"odometer_float_part"`
|
|
|
|
TripFuelL int64 `sii:"trip_fuel_l"` // Needs verification
|
|
|
|
TripFuel int64 `sii:"trip_fuel"` // Needs verification
|
|
|
|
TripDistanceKM int64 `sii:"trip_distance_km"` // Needs verification
|
|
|
|
TripDistance int64 `sii:"trip_distance"` // Needs verification
|
|
|
|
LicensePlate string `sii:"license_plate"`
|
|
|
|
|
|
|
|
blockName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Trailer) Class() string { return "trailer" }
|
|
|
|
|
|
|
|
func (t *Trailer) Init(class, name string) {
|
|
|
|
t.blockName = name
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t Trailer) Name() string { return t.blockName }
|
2019-12-24 17:46:03 +00:00
|
|
|
|
|
|
|
func (t Trailer) CleanedLicensePlate() string {
|
|
|
|
return regexp.MustCompile(` +`).ReplaceAllString(
|
|
|
|
regexp.MustCompile(`<[^>]+>`).ReplaceAllString(
|
|
|
|
strings.Split(t.LicensePlate, "|")[0],
|
|
|
|
" ",
|
|
|
|
),
|
|
|
|
" ",
|
|
|
|
)
|
|
|
|
}
|