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