Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- Handtools
- I3d
- Materials
- Misc
- Objects
- AnimatedMapObject
- AnimatedObject
- AnimatedObjectEvent
- Bale
- Basketball
- Bga
- BgaSellStation
- BunkerSilo
- BuyingStation
- DigitalDisplay
- DogBall
- HelpIcons
- LoadingStation
- NightIllumination
- Nightlight2
- NightlightFlicker
- PhysicsObject
- Rotator
- SellingStation
- SimParticleSystem
- Storage
- StorageSystem
- SunAdmirer
- TourIcons
- UnloadingStation
- VehicleSellingPoint
- WildlifeSpawner
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
SunAdmirer
DescriptionClass for objects which are visible when the sun is outFunctions
delete
DescriptionRemove Object from WeatherChangeListenersDefinition
delete()Code
41 | function SunAdmirer:delete() |
42 | if g_currentMission.environment ~= nil then |
43 | g_currentMission.environment:removeWeatherChangeListener(self) |
44 | end |
45 | end |
new
DescriptionCreating nightlight objectDefinition
new(integer name)Arguments
integer | name | ID of the node |
table | instance | Instance of object |
21 | function SunAdmirer:new(id) |
22 | local self = {} |
23 | setmetatable(self, SunAdmirer_mt) |
24 | |
25 | self.id = id |
26 | self.switchCollision = Utils.getNoNil(getUserAttribute(id, "switchCollision"), false) |
27 | |
28 | if self.switchCollision then |
29 | self.collisionMask = getCollisionMask(id) |
30 | end |
31 | |
32 | self:setVisibility(true) |
33 | |
34 | g_currentMission.environment:addWeatherChangeListener(self) |
35 | |
36 | return self |
37 | end |
onCreate
DescriptionCreating sun admirer objectDefinition
onCreate(integer id)Arguments
integer | id | ID of the node |
13 | function SunAdmirer:onCreate(id) |
14 | g_currentMission:addNonUpdateable(SunAdmirer:new(id)) |
15 | end |
weatherChanged
DescriptionChange visibility of sun objectDefinition
weatherChanged()Code
57 | function SunAdmirer:weatherChanged() |
58 | if g_currentMission ~= nil and g_currentMission.environment ~= nil then |
59 | self:setVisibility(g_currentMission.environment.isSunOn and not g_currentMission.environment.weather:getIsRaining()) |
60 | end |
61 | end |