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
AIJobVehicleStateEvent
DescriptionEvent for ai startParent
EventFunctions
emptyNew
DescriptionCreate instance of Event classDefinition
emptyNew()Return Values
table | self | instance of class event |
14 | function AIJobVehicleStateEvent.emptyNew() |
15 | local self = Event.new(AIJobVehicleStateEvent_mt) |
16 | return self |
17 | end |
new
DescriptionCreate new instance of eventDefinition
new(table vehicle, boolean isActive)Arguments
table | vehicle | vehicle |
boolean | isActive | is active |
23 | function AIJobVehicleStateEvent.new(vehicle, job, helperIndex, startedFarmId) |
24 | local self = AIJobVehicleStateEvent.emptyNew() |
25 | |
26 | self.vehicle = vehicle |
27 | self.job = job |
28 | self.helperIndex = helperIndex |
29 | self.startedFarmId = startedFarmId |
30 | |
31 | return self |
32 | end |
readStream
DescriptionCalled on client side on joinDefinition
readStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
38 | function AIJobVehicleStateEvent:readStream(streamId, connection) |
39 | self.vehicle = NetworkUtil.readNodeObject(streamId) |
40 | |
41 | if streamReadBool(streamId) then |
42 | local jobId = streamReadInt32(streamId) |
43 | self.job = g_currentMission.aiSystem:getJobById(jobId) |
44 | self.startedFarmId = streamReadUIntN(streamId, FarmManager.FARM_ID_SEND_NUM_BITS) |
45 | self.helperIndex = streamReadUInt8(streamId) |
46 | end |
47 | |
48 | self:run(connection) |
49 | end |
run
DescriptionRun action on receiving sideDefinition
run(integer connection)Arguments
integer | connection | connection |
69 | function AIJobVehicleStateEvent:run(connection) |
70 | if self.vehicle ~= nil then |
71 | if self.vehicle ~= nil and self.vehicle:getIsSynchronized() then |
72 | if self.job ~= nil then |
73 | self.vehicle:aiJobStarted(self.job, self.helperIndex, self.startedFarmId) |
74 | else |
75 | self.vehicle:aiJobFinished() |
76 | end |
77 | end |
78 | end |
79 | end |
writeStream
DescriptionCalled on server side on joinDefinition
writeStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
55 | function AIJobVehicleStateEvent:writeStream(streamId, connection) |
56 | assert(not connection:getIsServer(), "AIJobVehicleStateEvent is a server to client event only") |
57 | NetworkUtil.writeNodeObject(streamId, self.vehicle) |
58 | |
59 | if streamWriteBool(streamId, self.job ~= nil) then |
60 | streamWriteInt32(streamId, self.job.jobId) |
61 | streamWriteUIntN(streamId, self.startedFarmId, FarmManager.FARM_ID_SEND_NUM_BITS) |
62 | streamWriteUInt8(streamId, self.helperIndex) |
63 | end |
64 | end |