LUADOC - Farming Simulator 19

Script v1.7.1.0

Engine v1.7.1.0

Foundation Reference

ChainsawCutEvent

Description
Event for cutting
Parent
Event
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, farmId)
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 self.farmId = farmId
42 return self;
43end

readStream

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

run

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

writeStream

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