Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- 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
- getMaterialCustomShaderFilename
- getMaterialCustomShaderVariation
- getMaterialDiffuseMapFilename
- getMaterialDiffuseMapHasAlpha
- getMaterialEmissiveMapFilename
- getMaterialEmissiveMapHasAlpha
- getMaterialGlossMapFilename
- getMaterialHasRefractionMap
- getMaterialIsAlphaBlended
- getMaterialIsAlphaTested
- getMaterialNormalMapFilename
- getMaterialNormalMapFormat
- getMaterialReflectionMapScaling
- setMaterialCustomMapFromFile
- setMaterialCustomShaderVariation
- setMaterialDiffuseMapFromFile
- setMaterialGlossMapFromFile
- setMaterialNormalMapFromFile
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
VehicleAttachEvent
DescriptionEvent for attachingParent
EventFunctions
emptyNew
DescriptionCreate instance of Event classDefinition
emptyNew()Return Values
table | self | instance of class event |
14 | function VehicleAttachEvent.emptyNew() |
15 | local self = Event.new(VehicleAttachEvent_mt) |
16 | return self |
17 | end |
new
DescriptionCreate new instance of eventDefinition
new(table vehicle, table implement, integer inputJointIndex, integer jointIndex, boolean startLowered)Arguments
table | vehicle | vehicle |
table | implement | implement |
integer | inputJointIndex | index of input attacher joint |
integer | jointIndex | index of attacher joint |
boolean | startLowered | start in lowered state |
table | instance | instance of event |
27 | function VehicleAttachEvent.new(vehicle, implement, inputJointIndex, jointIndex, startLowered) |
28 | local self = VehicleAttachEvent.emptyNew() |
29 | self.jointIndex = jointIndex |
30 | self.inputJointIndex = inputJointIndex |
31 | self.vehicle = vehicle |
32 | self.implement = implement |
33 | self.startLowered = startLowered |
34 | assert(self.jointIndex >= 0 and self.jointIndex < 127) |
35 | return self |
36 | end |
readStream
DescriptionCalled on client side on joinDefinition
readStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
42 | function VehicleAttachEvent:readStream(streamId, connection) |
43 | self.vehicle = NetworkUtil.readNodeObject(streamId) |
44 | self.implement = NetworkUtil.readNodeObject(streamId) |
45 | self.jointIndex = streamReadUIntN(streamId, 7) |
46 | self.inputJointIndex = streamReadUIntN(streamId, 7) |
47 | self.startLowered = streamReadBool(streamId) |
48 | self:run(connection) |
49 | end |
run
DescriptionRun action on receiving sideDefinition
run(integer connection)Arguments
integer | connection | connection |
66 | function VehicleAttachEvent:run(connection) |
67 | if self.vehicle ~= nil and self.vehicle:getIsSynchronized() then |
68 | if self.implement == nil then |
69 | Logging.error("Failed to attach unknown implement to vehicle '%s' between joints '%d' and '%d'", self.vehicle.configFileName, self.jointIndex, self.inputJointIndex) |
70 | return |
71 | end |
72 | |
73 | self.vehicle:attachImplement(self.implement, self.inputJointIndex, self.jointIndex, true, nil, self.startLowered) |
74 | end |
75 | if not connection:getIsServer() then |
76 | g_server:broadcastEvent(self, nil, connection, self.object) |
77 | end |
78 | end |
writeStream
DescriptionCalled on server side on joinDefinition
writeStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
55 | function VehicleAttachEvent:writeStream(streamId, connection) |
56 | NetworkUtil.writeNodeObject(streamId, self.vehicle) |
57 | NetworkUtil.writeNodeObject(streamId, self.implement) |
58 | streamWriteUIntN(streamId, self.jointIndex, 7) |
59 | streamWriteUIntN(streamId, self.inputJointIndex, 7) |
60 | streamWriteBool(streamId, self.startLowered) |
61 | end |