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
PlayerSetFarmAnswerEvent
DescriptionPlayer farm setting answer event. Triggered in response to PlayerSetFarmEvent.Parent
EventFunctions
emptyNew
DescriptionCreate an empty instanceDefinition
emptyNew()Return Values
table | instance | Instance of object |
28 | function PlayerSetFarmAnswerEvent.emptyNew() |
29 | local self = Event.new(PlayerSetFarmAnswerEvent_mt) |
30 | return self |
31 | end |
new
DescriptionCreate an instance of PlayerSetFarmAnswerEvent.Definition
new(int answerState, int farmId, string password)Arguments
int | answerState | |
int | farmId | Farm ID |
string | password | Password used for PlayerSetFarmEvent |
table | instance | Instance of PlayerSetFarmAnswerEvent |
39 | function PlayerSetFarmAnswerEvent.new(answerState, farmId, password) |
40 | local self = PlayerSetFarmAnswerEvent.emptyNew() |
41 | |
42 | self.answerState = answerState |
43 | self.farmId = farmId |
44 | self.password = password |
45 | |
46 | return self |
47 | end |
readStream
DescriptionReads network streamDefinition
readStream(integer streamId, table connection)Arguments
integer | streamId | network stream identification |
table | connection | connection information |
68 | function PlayerSetFarmAnswerEvent:readStream(streamId, connection) |
69 | self.answerState = streamReadUIntN(streamId, PlayerSetFarmAnswerEvent.SEND_NUM_BITS) |
70 | self.farmId = streamReadUIntN(streamId, FarmManager.FARM_ID_SEND_NUM_BITS) |
71 | |
72 | if streamReadBool(streamId) then |
73 | self.password = streamReadString(streamId) |
74 | end |
75 | |
76 | self:run(connection) |
77 | end |
run
DescriptionRun eventDefinition
run(table connection)Arguments
table | connection | connection information |
82 | function PlayerSetFarmAnswerEvent:run(connection) |
83 | if not connection:getIsServer() then -- server side, should not happen |
84 | Logging.devWarning("PlayerSetFarmAnswerEvent is a server to client only event") |
85 | else -- client side |
86 | if self.answerState == PlayerSetFarmAnswerEvent.STATE.OK then |
87 | g_messageCenter:publish(PlayerSetFarmAnswerEvent, self.answerState, self.farmId, self.password) |
88 | elseif self.answerState == PlayerSetFarmAnswerEvent.STATE.PASSWORD_REQUIRED then |
89 | g_messageCenter:publish(PlayerSetFarmAnswerEvent, self.answerState, self.farmId) |
90 | end |
91 | end |
92 | end |
writeStream
DescriptionWrites network streamDefinition
writeStream(integer streamId, table connection)Arguments
integer | streamId | network stream identification |
table | connection | connection information |
53 | function PlayerSetFarmAnswerEvent:writeStream(streamId, connection) |
54 | streamWriteUIntN(streamId, self.answerState, PlayerSetFarmAnswerEvent.SEND_NUM_BITS) |
55 | streamWriteUIntN(streamId, self.farmId, FarmManager.FARM_ID_SEND_NUM_BITS) |
56 | |
57 | local passwordCorrect = self.answerState == PlayerSetFarmAnswerEvent.STATE.OK |
58 | local passwordSet = self.password ~= nil |
59 | if streamWriteBool(streamId, passwordCorrect and passwordSet) then |
60 | streamWriteString(streamId, self.password) |
61 | end |
62 | end |