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
AIJobStartRequestEvent
ParentEventFunctions
emptyNew
DescriptionDefinitionemptyNew()Code
12 | function AIJobStartRequestEvent.emptyNew() |
13 | local self = Event.new(AIJobStartRequestEvent_mt) |
14 | return self |
15 | end |
new
DescriptionDefinitionnew()Code
19 | function AIJobStartRequestEvent.new(job, startFarmId) |
20 | local self = AIJobStartRequestEvent.emptyNew() |
21 | |
22 | self.job = job |
23 | self.startFarmId = startFarmId |
24 | |
25 | return self |
26 | end |
newServerToClient
DescriptionDefinitionnewServerToClient()Code
30 | function AIJobStartRequestEvent.newServerToClient(state, jobTypeIndex) |
31 | local self = AIJobStartRequestEvent.emptyNew() |
32 | self.state = state |
33 | self.jobTypeIndex = jobTypeIndex |
34 | |
35 | return self |
36 | end |
readStream
DescriptionDefinitionreadStream()Code
40 | function AIJobStartRequestEvent:readStream(streamId, connection) |
41 | if not connection:getIsServer() then |
42 | self.startFarmId = streamReadUInt8(streamId) |
43 | local jobTypeIndex = streamReadUInt16(streamId) |
44 | self.job = g_currentMission.aiJobTypeManager:createJob(jobTypeIndex) |
45 | self.job:readStream(streamId, connection) |
46 | else |
47 | self.state = streamReadUInt8(streamId) |
48 | self.jobTypeIndex = streamReadUInt16(streamId) |
49 | end |
50 | |
51 | self:run(connection) |
52 | end |
run
DescriptionDefinitionrun()Code
70 | function AIJobStartRequestEvent:run(connection) |
71 | if not connection:getIsServer() then |
72 | local jobTypeIndex = g_currentMission.aiJobTypeManager:getJobTypeIndex(self.job) |
73 | |
74 | local startable, state = self.job:getIsStartable(connection) |
75 | |
76 | if not startable then |
77 | connection:sendEvent(AIJobStartRequestEvent.newServerToClient(state, jobTypeIndex)) |
78 | return |
79 | end |
80 | |
81 | connection:sendEvent(AIJobStartRequestEvent.newServerToClient(0, jobTypeIndex)) |
82 | g_currentMission.aiSystem:startJob(self.job, self.startFarmId) |
83 | else |
84 | g_messageCenter:publish(AIJobStartRequestEvent, self.state, self.jobTypeIndex) |
85 | end |
86 | end |
writeStream
DescriptionDefinitionwriteStream()Code
56 | function AIJobStartRequestEvent:writeStream(streamId, connection) |
57 | if connection:getIsServer() then |
58 | streamWriteUInt8(streamId, self.startFarmId) |
59 | local jobTypeIndex = g_currentMission.aiJobTypeManager:getJobTypeIndex(self.job) |
60 | streamWriteUInt16(streamId, jobTypeIndex) |
61 | self.job:writeStream(streamId, connection) |
62 | else |
63 | streamWriteUInt8(streamId, self.state) |
64 | streamWriteUInt16(streamId, self.jobTypeIndex) |
65 | end |
66 | end |