Script Dokumentation LS 2015 - Nightlight2 (Patch 1.3)
scripts/objects/Nightlight2.lua
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de
1 | -- Nightlight2 class |
2 | -- |
3 | -- Copyright (C) GIANTS Software GmbH, Confidential, All Rights Reserved. |
4 | |
5 | Nightlight2 = {} |
6 | |
7 | local Nightlight2_mt = Class(Nightlight2); |
8 | |
9 | function Nightlight2:onCreate(id) |
10 | g_currentMission:addNonUpdateable(Nightlight2:new(id)); |
11 | end; |
12 | |
13 | function Nightlight2:new(id) |
14 | local self = {}; |
15 | setmetatable(self, Nightlight2_mt); |
16 | |
17 | g_currentMission.environment:addWeatherChangeListener(self); |
18 | |
19 | self.id = id; |
20 | setVisibility(self.id, false); |
21 | |
22 | return self; |
23 | end; |
24 | |
25 | function Nightlight2:delete() |
26 | if g_currentMission.environment ~= nil then |
27 | g_currentMission.environment:removeWeatherChangeListener(self); |
28 | end; |
29 | end; |
30 | |
31 | function Nightlight2:weatherChanged() |
32 | if g_currentMission ~= nil and g_currentMission.environment ~= nil then |
33 | setVisibility(self.id, not (g_currentMission.environment.isSunOn and g_currentMission.environment.currentRain == nil)); |
34 | end; |
35 | end;
|
Copyright (c) 2008-2015 GIANTS Software GmbH, Confidential, All Rights Reserved.
This document is to be published solely by ls-mods.de