Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- streamGetNumOfUnreadBits
- streamGetReadOffset
- streamGetWriteOffset
- streamReadBool
- streamReadFloat32
- streamReadInt16
- streamReadInt32
- streamReadInt8
- streamReadIntN
- streamReadManualTimestamp
- streamReadString
- streamReadUInt16
- streamReadUInt8
- streamReadUIntN
- streamSetReadOffset
- streamSetWriteOffset
- streamWriteBool
- streamWriteFloat32
- streamWriteInt16
- streamWriteInt32
- streamWriteInt8
- streamWriteIntN
- streamWriteManualTimestamp
- streamWriteStream
- streamWriteString
- streamWriteUInt16
- streamWriteUInt8
- streamWriteUIntN
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
CombineStrawEnableEvent
DescriptionEvent for straw enable stateParent
EventFunctions
emptyNew
DescriptionCreate instance of Event classDefinition
emptyNew()Return Values
table | self | instance of class event |
13 | function CombineStrawEnableEvent:emptyNew() |
14 | local self = Event:new(CombineStrawEnableEvent_mt); |
15 | return self; |
16 | end |
new
DescriptionCreate new instance of eventDefinition
new(table vehicle, boolean isSwathActive)Arguments
table | vehicle | vehicle |
boolean | isSwathActive | is straw enabled |
22 | function CombineStrawEnableEvent:new(vehicle, isSwathActive) |
23 | local self = CombineStrawEnableEvent:emptyNew() |
24 | self.vehicle = vehicle; |
25 | self.isSwathActive = isSwathActive; |
26 | return self; |
27 | end |
readStream
DescriptionCalled on client side on joinDefinition
readStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
33 | function CombineStrawEnableEvent:readStream(streamId, connection) |
34 | self.vehicle = NetworkUtil.readNodeObject(streamId); |
35 | self.isSwathActive = streamReadBool(streamId); |
36 | self:run(connection); |
37 | end |
run
DescriptionRun action on receiving sideDefinition
run(integer connection)Arguments
integer | connection | connection |
51 | function CombineStrawEnableEvent:run(connection) |
52 | self.vehicle:setIsSwathActive(self.isSwathActive, true); |
53 | if not connection:getIsServer() then |
54 | g_server:broadcastEvent(CombineStrawEnableEvent:new(self.vehicle, self.isSwathActive), nil, connection, self.vehicle); |
55 | end; |
56 | end |
sendEvent
DescriptionBroadcast event from server to all clients, if called on client call function on server and broadcast it to all clientsDefinition
sendEvent(table vehicle, boolean isSwathActive, boolean noEventSend)Arguments
table | vehicle | vehicle |
boolean | isSwathActive | is straw enabled |
boolean | noEventSend | no event send |
63 | function CombineStrawEnableEvent.sendEvent(vehicle, isSwathActive, noEventSend) |
64 | if noEventSend == nil or noEventSend == false then |
65 | if g_server ~= nil then |
66 | g_server:broadcastEvent(CombineStrawEnableEvent:new(vehicle, isSwathActive), nil, nil, vehicle); |
67 | else |
68 | g_client:getServerConnection():sendEvent(CombineStrawEnableEvent:new(vehicle, isSwathActive)); |
69 | end; |
70 | end; |
71 | end |
writeStream
DescriptionCalled on server side on joinDefinition
writeStream(integer streamId, integer connection)Arguments
integer | streamId | streamId |
integer | connection | connection |
43 | function CombineStrawEnableEvent:writeStream(streamId, connection) |
44 | NetworkUtil.writeNodeObject(streamId, self.vehicle); |
45 | streamWriteBool(streamId, self.isSwathActive); |
46 | end |