Sprache Deutsch Language English

Script Documentation FS 2015 - VehicleSetBeaconLightEvent (Patch 1.3)

Script Documentation Overview

scripts/vehicles/specializations/VehicleSetBeaconLightEvent.lua

Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1-- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved.
2
3VehicleSetBeaconLightEvent = {};
4VehicleSetBeaconLightEvent_mt = Class(VehicleSetBeaconLightEvent, Event);
5
6InitStaticEventClass(VehicleSetBeaconLightEvent, "VehicleSetBeaconLightEvent", EventIds.EVENT_VEHICLE_SET_BEACON_LIGHT);
7
8function VehicleSetBeaconLightEvent:emptyNew()
9 local self = Event:new(VehicleSetBeaconLightEvent_mt);
10 return self;
11end;
12
13function VehicleSetBeaconLightEvent:new(object, active)
14 local self = VehicleSetBeaconLightEvent:emptyNew()
15 self.active = active;
16 self.object = object;
17 return self;
18end;
19
20function VehicleSetBeaconLightEvent:readStream(streamId, connection)
21 local id = streamReadInt32(streamId);
22 self.active = streamReadBool(streamId);
23 self.object = networkGetObject(id);
24 self:run(connection);
25end;
26
27function VehicleSetBeaconLightEvent:writeStream(streamId, connection)
28 streamWriteInt32(streamId, networkGetObjectId(self.object));
29 streamWriteBool(streamId, self.active);
30end;
31
32function VehicleSetBeaconLightEvent:run(connection)
33 self.object:setBeaconLightsVisibility(self.active, true);
34 if not connection:getIsServer() then
35 g_server:broadcastEvent(VehicleSetBeaconLightEvent:new(self.object, self.active), nil, connection, self.object);
36 end;
37end;
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
Script Documentation Overview