LUADOC - Farming Simulator 22

Script v1_7_1_0

Engine v1_7_1_0

Foundation Reference

PlayerRequestStyleEvent

Parent
Event
Functions

emptyNew

Description
Create an empty instance
Definition
emptyNew()
Return Values
tableinstanceInstance of object
Code
11function PlayerRequestStyleEvent.emptyNew()
12 local self = Event.new(PlayerRequestStyleEvent_mt)
13 return self
14end

new

Description
Create an instance
Definition
new()
Code
18function PlayerRequestStyleEvent.new(playerObjectId)
19 local self = PlayerRequestStyleEvent.emptyNew()
20
21 self.playerObjectId = playerObjectId
22
23 return self
24end

readStream

Description
Reads network stream
Definition
readStream(integer streamId, table connection)
Arguments
integerstreamIdnetwork stream identification
tableconnectionconnection information
Code
38function PlayerRequestStyleEvent:readStream(streamId, connection)
39 self.playerObjectId = NetworkUtil.readNodeObjectId(streamId)
40 self.player = NetworkUtil.getObject(self.playerObjectId)
41
42 self:run(connection)
43end

run

Description
Run event
Definition
run(table connection)
Arguments
tableconnectionconnection information
Code
48function PlayerRequestStyleEvent:run(connection)
49 if not connection:getIsServer() then --server side
50 local style = g_currentMission.playerInfoStorage:getPlayerStyle(self.player.userId)
51 connection:sendEvent(PlayerSetStyleEvent.new(self.player, style))
52 end
53end

writeStream

Description
Writes network stream
Definition
writeStream(integer streamId, table connection)
Arguments
integerstreamIdnetwork stream identification
tableconnectionconnection information
Code
30function PlayerRequestStyleEvent:writeStream(streamId, connection)
31 NetworkUtil.writeNodeObjectId(streamId, self.playerObjectId)
32end