Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- AdditionalFieldBuyInfoEve...
- AIConveyorBeltSetAngleEve...
- AIFieldWorkerStateEvent
- AIJobSkipTaskEvent
- AIJobStartEvent
- AIJobStartRequestEvent
- AIJobStopEvent
- AIJobVehicleStateEvent
- AITaskStartEvent
- AITaskStopEvent
- AIVehicleIsBlockedEvent
- AnimalCleanEvent
- AnimalHusbandryNoMorePall...
- AnimalNameEvent
- AnimalRidingEvent
- AnimatedVehicleStartEvent
- AnimatedVehicleStopEvent
- BaleLoaderStateEvent
- BaleOpenEvent
- BalerAutomaticDropEvent
- BalerBaleTypeEvent
- BalerCreateBaleEvent
- BalerDropFromPlatformEven...
- BalerSetBaleTimeEvent
- BalerSetIsUnloadingBaleEv...
- BaleUnpackEvent
- BaleWrapperAutomaticDropE...
- BaleWrapperStateEvent
- BunkerSiloCloseEvent
- BunkerSiloOpenEvent
- ChainsawCutEvent
- ChainsawDelimbEvent
- ChainsawStateEvent
- CombineStrawEnableEvent
- CropSensorStateEvent
- DogFetchItemEvent
- DogFollowEvent
- DogPetEvent
- DrivableToggleLowerAllEve...
- EnvironmentalScoreEvent
- ExtendedSowingMachineRate...
- ExtendedSprayerAmountEven...
- ExtendedSprayerDefaultFru...
- FarmlandStatisticsEvent
- FarmlandStatisticsResetEv...
- FillUnitUnloadEvent
- FoldableSetFoldDirectionE...
- HonkEvent
- HPWLanceStateEvent
- InlineBaleOpenEvent
- InlineWrapperPushOffEvent
- JumpEvent
- LocomotiveStateEvent
- MixerWagonBaleNotAccepted...
- MotorGearShiftEvent
- MowerToggleWindrowDropEve...
- PickupSetStateEvent
- PlaceableFenceAddGateEven...
- PlaceableFenceAddSegmentE...
- PlaceableFenceRemoveSegme...
- PlaceableHighPressureWash...
- PlaceableLightsStateEvent
- PlaceableTrainSystemRentE...
- PlaceableTrainSystemSellE...
- PlantLimitToFieldEvent
- PlayerPermissionsEvent
- PlayerPickUpObjectEvent
- PlayerRequestStyleEvent
- PlayerSetFarmAnswerEvent
- PlayerSetFarmEvent
- PlayerSetHandToolEvent
- PlayerSetNicknameEvent
- PlayerSetStyleEvent
- PlayerSwitchedFarmEvent
- PlayerTeleportEvent
- PlayerThrowObjectEvent
- PlayerToggleLightEvent
- PlowLimitToFieldEvent
- PlowPackerStateEvent
- PlowRotationEvent
- ProductionPointOutputMode...
- ProductionPointProduction...
- ProductionPointProduction...
- PurchaseSoilMapsEvent
- ReceivingHopperSetCreateB...
- RequestEnvironmentalScore...
- RequestFarmlandStatistics...
- RequestFieldBuyInfoEvent
- ResetYieldMapEvent
- ReverseDrivingSetStateEve...
- RideableStableNotificatio...
- RidgeMarkerSetStateEvent
- SetCoverStateEvent
- SetCrabSteeringEvent
- SetCruiseControlSpeedEven...
- SetCruiseControlStateEven...
- SetDischargeStateEvent
- SetFillUnitCapacityEvent
- SetFillUnitIsFillingEvent
- SetMotorTurnedOnEvent
- SetPipeDischargeToGroundE...
- SetPipeStateEvent
- SetSeedIndexEvent
- SetTurnedOnEvent
- SetWorkModeEvent
- SoilSamplerSendEvent
- SoilSamplerStartEvent
- SprayerDoubledAmountEvent
- TensionBeltsEvent
- TensionBeltsRefreshEvent
- TrailerToggleManualDoorEv...
- TrailerToggleManualTipEve...
- TrailerToggleTipSideEvent
- TreePlanterLoadPalletEven...
- VariableWorkWidthStateEve...
- VehicleAttachEvent
- VehicleAttachRequestEvent
- VehicleBrokenEvent
- VehicleBundleAttachEvent
- VehicleDetachEvent
- VehicleEnterRequestEvent
- VehicleEnterResponseEvent
- VehicleLeaveEvent
- VehicleLowerImplementEven...
- VehiclePlayerStyleChanged...
- VehicleSetBeaconLightEven...
- VehicleSetIsReconfigurati...
- VehicleSetLightEvent
- VehicleSettingsChangeEven...
- VehicleSetTurnLightEvent
- WaterTrailerSetIsFillingE...
- WearableRepaintEvent
- WearableRepairEvent
- WoodHarvesterCutTreeEvent
- WoodHarvesterOnCutTreeEve...
- WoodHarvesterOnDelimbTree...
- 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
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
PlayerToggleLightEvent
ParentEventFunctions
emptyNew
DescriptionCreate an empty instanceDefinition
emptyNew()Return Values
table | instance | Instance of object |
11 | function PlayerToggleLightEvent.emptyNew() |
12 | local self = Event.new(PlayerToggleLightEvent_mt) |
13 | return self |
14 | end |
new
DescriptionCreate an instanceDefinition
new(table player)Arguments
table | player | player instance |
table | instance | Instance of object |
20 | function PlayerToggleLightEvent.new(player, isActive) |
21 | local self = PlayerToggleLightEvent.emptyNew() |
22 | self.player = player |
23 | self.isActive = isActive |
24 | return self |
25 | end |
readStream
DescriptionReads network streamDefinition
readStream(integer streamId, table connection)Arguments
integer | streamId | network stream identification |
table | connection | connection information |
31 | function PlayerToggleLightEvent:readStream(streamId, connection) |
32 | self.player = NetworkUtil.readNodeObject(streamId) |
33 | self.isActive = streamReadBool(streamId) |
34 | self:run(connection) |
35 | end |
run
DescriptionRun eventDefinition
run(table connection)Arguments
table | connection | connection information |
49 | function PlayerToggleLightEvent:run(connection) |
50 | if not connection:getIsServer() then |
51 | g_server:broadcastEvent(self, false, connection, self.player) |
52 | end |
53 | |
54 | self.player:setLightIsActive(self.isActive, true) |
55 | end |
sendEvent
DescriptionDefinitionsendEvent()Code
59 | function PlayerToggleLightEvent.sendEvent(player, active, noEventSend) |
60 | if noEventSend == nil or noEventSend == false then |
61 | if g_server ~= nil then |
62 | g_server:broadcastEvent(PlayerToggleLightEvent.new(player, active), nil, nil, player) |
63 | else |
64 | g_client:getServerConnection():sendEvent(PlayerToggleLightEvent.new(player, active)) |
65 | end |
66 | end |
67 | end |
writeStream
DescriptionWrites network streamDefinition
writeStream(integer streamId, table connection)Arguments
integer | streamId | network stream identification |
table | connection | connection information |
41 | function PlayerToggleLightEvent:writeStream(streamId, connection) |
42 | NetworkUtil.writeNodeObject(streamId, self.player) |
43 | streamWriteBool(streamId, self.isActive) |
44 | end |