Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ColorPickButtonElement
- ConstructionScreen
- ContextActionDisplay
- ControlBarDisplay
- DialogElement
- DynamicFadedBitmapElement
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GameInfoDisplayMobile
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiTopDownCursor
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDSliderElement
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InfoDisplay
- InfoHUDBox
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputGlyphElementUI
- InputHelpDisplay
- KeyValueInfoHUDBox
- ListElement
- ListItemElement
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PictureElement
- PlatformIconElement
- PlayerControlPadDisplay
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- ScrollingLayoutElement
- SettingsModel
- SideNotification
- SideNotificationMobile
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- SpeedSliderDisplay
- StatusBar
- SteeringSliderDisplay
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TerrainLayerElement
- TextBackdropElement
- TextElement
- TextInputElement
- ThreePartBitmapElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VariableWorkWidthHUDExten...
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- WardrobeScreen
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
VehicleHUDExtension
DescriptionCustom vehicle HUD drawing extension. This serves as the base class for custom specific drawing cases of vehicles in the HUD, e.g. MixerWagon fill levels. To create new HUD extensions for vehicle specializations: 1. sub-class this base class 2. source() the sub-class module after its corresponding specialization's table has been declared 3. call VehicleHUDExtension.registerHUDExtension([specialization], [HUDextension]) in sub-class moduleFunctions
- addComponentForCleanup
- canDraw
- createHUDExtensionForSpecialization
- delete
- draw
- getDisplayHeight
- getPriority
- hasHUDExtensionForSpecialization
- new
- registerHUDExtension
- sortHUDExtensions
addComponentForCleanup
DescriptionAdd a display component for cleanup on delete(). Added components must support delete() themselves or they will be ignored.Definition
addComponentForCleanup()Code
54 | function VehicleHUDExtension:addComponentForCleanup(component) |
55 | if component.delete then |
56 | table.insert(self.displayComponents, component) |
57 | end |
58 | end |
canDraw
DescriptionDetermine if this HUD extension is in a valid state for a call to draw() in the current frame. Override in sub-classes with custom logic.Definition
canDraw()Return Values
bool | If | true, the HUD extension should be drawn in the current frame. |
71 | function VehicleHUDExtension:canDraw() |
72 | return true |
73 | end |
createHUDExtensionForSpecialization
DescriptionHUD extension factory method, creates a HUD extension for a given vehicle specialization.Definition
createHUDExtensionForSpecialization(table spec, table vehicle, float uiScale, table uiTextColor, float uiTextSize)Arguments
table | spec | Specialization reference |
table | vehicle | Vehicle which has the given specialization |
float | uiScale | Current UI scale |
table | uiTextColor | HUD text drawing color as an RGBA array |
float | uiTextSize | HUD text size |
table | HUD | extension instance or nil of no extension has been registered for the given specialization |
112 | function VehicleHUDExtension.createHUDExtensionForSpecialization(spec, vehicle, uiScale, uiTextColor, uiTextSize) |
113 | local extType = registry[spec] |
114 | local extension = nil |
115 | if extType then |
116 | extension = extType.new(vehicle, uiScale, uiTextColor, uiTextSize) |
117 | end |
118 | |
119 | return extension |
120 | end |
delete
DescriptionDelete this instance and clean up resources.Definition
delete()Code
44 | function VehicleHUDExtension:delete() |
45 | for k, component in pairs(self.displayComponents) do |
46 | component:delete() |
47 | self.displayComponents[k] = nil |
48 | end |
49 | end |
draw
DescriptionDraw HUD extension.Definition
draw(float leftPosX, float rightPosX, float posY)Arguments
float | leftPosX | Left input help panel column start position |
float | rightPosX | Right input help panel column start position |
float | posY | Current input help panel drawing vertical offset |
float | Modified | input help panel drawing vertical offset |
81 | function VehicleHUDExtension:draw(leftPosX, rightPosX, posY) |
82 | end |
getDisplayHeight
DescriptionGet this HUD extension's display height. Override in subclasses.Definition
getDisplayHeight()Code
63 | function VehicleHUDExtension:getDisplayHeight() |
64 | return 0 |
65 | end |
getPriority
DescriptionPriority index to define rendering orderDefinition
getPriority()Code
86 | function VehicleHUDExtension:getPriority() |
87 | return 0 |
88 | end |
hasHUDExtensionForSpecialization
DescriptionCheck if there is a HUD extension for a given specialization.Definition
hasHUDExtensionForSpecialization()Code
124 | function VehicleHUDExtension.hasHUDExtensionForSpecialization(spec) |
125 | return not not registry[spec] |
126 | end |
new
DescriptionBase constructor for vehicle HUD extensions.Definition
new(table class_mt, table vehicle, float uiScale, table uiTextColor, float uiTextSize)Arguments
table | class_mt | Sub-class metatable |
table | vehicle | Vehicle which has the specialization required by a sub-class |
float | uiScale | Current UI scale |
table | uiTextColor | HUD text drawing color as an RGBA array |
float | uiTextSize | HUD text size |
26 | function VehicleHUDExtension.new(class_mt, vehicle, uiScale, uiTextColor, uiTextSize) |
27 | local self = setmetatable({}, class_mt or VehicleHUDExtension_mt) |
28 | |
29 | -- vehicle specialization reference which provides the display data |
30 | self.vehicle = vehicle |
31 | |
32 | self.uiTextColor = uiTextColor |
33 | self.uiTextSize = uiTextSize |
34 | self.uiScale = uiScale |
35 | |
36 | -- array of created display components which need to be deleted |
37 | self.displayComponents = {} |
38 | |
39 | return self |
40 | end |
registerHUDExtension
DescriptionRegister a HUD extension for a specialization.Definition
registerHUDExtension(table specializationType, table hudExtensionType)Arguments
table | specializationType | Vehicle specialization class type table |
table | hudExtensionType | HUD extension class type table corresponding to the given vehicle specialization |
100 | function VehicleHUDExtension.registerHUDExtension(spec, hudExtensionType) |
101 | registry[spec] = hudExtensionType |
102 | end |
sortHUDExtensions
DescriptionSort function to sort hud extensions based on prioDefinition
sortHUDExtensions()Code
130 | function VehicleHUDExtension.sortHUDExtensions(extensionA, extensionB) |
131 | return extensionA:getPriority() > extensionB:getPriority() |
132 | end |