LUADOC - Farming Simulator 17

Printable Version

Script v1.4.4.0

Engine v7.0.0.2

Foundation Reference

ChainsawCutEvent

Description
Event for cutting
Functions

emptyNew

Description
Create instance of Event class
Definition
emptyNew()
Return Values
tableselfinstance of class event
Code
14function ChainsawCutEvent:emptyNew()
15 local self = Event:new(ChainsawCutEvent_mt);
16 return self;
17end;

new

Description
Create new instance of event
Definition
new(integer splitShapeId, float x, float y, float z, float nx, float ny, float nz, float yx, float yy, float yz, float cutSizeY, float cutSizeZ)
Arguments
integersplitShapeIdid of split shape
floatxx
floatyy
floatzz
floatnxnx
floatnyny
floatnznz
floatyxyx
floatyyyy
floatyzyz
floatcutSizeYy cut size
floatcutSizeZz cut size
Return Values
tableinstanceinstance of event
Code
34function ChainsawCutEvent:new(splitShapeId, x,y,z, nx,ny,nz, yx,yy,yz, cutSizeY, cutSizeZ)
35 local self = ChainsawCutEvent:emptyNew()
36 self.splitShapeId = splitShapeId;
37 self.x,self.y,self.z = x,y,z;
38 self.nx,self.ny,self.nz = nx,ny,nz;
39 self.yx,self.yy,self.yz = yx,yy,yz;
40 self.cutSizeY,self.cutSizeZ = cutSizeY,cutSizeZ;
41 return self;
42end;

readStream

Description
Called on client side on join
Definition
readStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
48function ChainsawCutEvent:readStream(streamId, connection)
49 if not connection:getIsServer() then
50 local splitShapeId = readSplitShapeIdFromStream(streamId);
51 local x = streamReadFloat32(streamId);
52 local y = streamReadFloat32(streamId);
53 local z = streamReadFloat32(streamId);
54 local nx = streamReadFloat32(streamId);
55 local ny = streamReadFloat32(streamId);
56 local nz = streamReadFloat32(streamId);
57 local yx = streamReadFloat32(streamId);
58 local yy = streamReadFloat32(streamId);
59 local yz = streamReadFloat32(streamId);
60 local cutSizeY = streamReadFloat32(streamId);
61 local cutSizeZ = streamReadFloat32(streamId);
62 if splitShapeId ~= 0 then
63 ChainsawUtil.cutSplitShape(splitShapeId, x,y,z, nx,ny,nz, yx,yy,yz, cutSizeY, cutSizeZ);
64 end
65 end
66end;

writeStream

Description
Called on server side on join
Definition
writeStream(integer streamId, integer connection)
Arguments
integerstreamIdstreamId
integerconnectionconnection
Code
72function ChainsawCutEvent:writeStream(streamId, connection)
73 if connection:getIsServer() then
74 writeSplitShapeIdToStream(streamId, self.splitShapeId);
75 streamWriteFloat32(streamId, self.x);
76 streamWriteFloat32(streamId, self.y);
77 streamWriteFloat32(streamId, self.z);
78 streamWriteFloat32(streamId, self.nx);
79 streamWriteFloat32(streamId, self.ny);
80 streamWriteFloat32(streamId, self.nz);
81 streamWriteFloat32(streamId, self.yx);
82 streamWriteFloat32(streamId, self.yy);
83 streamWriteFloat32(streamId, self.yz);
84 streamWriteFloat32(streamId, self.cutSizeY);
85 streamWriteFloat32(streamId, self.cutSizeZ);
86 end
87end;

run

Description
Run action on receiving side
Definition
run(integer connection)
Arguments
integerconnectionconnection
Code
92function ChainsawCutEvent:run(connection)
93 print("Error: ChainsawCutEvent is not allowed to be executed on a local client");
94end;