Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- AnimatedMapObject
- AnimatedObject
- Bale
- Basketball
- BgaSellStation
- BunkerSilo
- BuyingStation
- DigitalDisplay
- DogBall
- HelpIcons
- InlineBale
- InlineBaleSingle
- LoadingStation
- MountableObject
- NightIllumination
- Nightlight2
- NightlightFlicker
- PackedBale
- PhysicsObject
- ProductionPoint
- Rotator
- SellingStation
- SimParticleSystem
- Storage
- SunAdmirer
- TourIconsMobile
- UnloadingStation
- VehicleSellingPoint
- WildlifeSpawner
- 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
SunAdmirer
DescriptionClass for objects which are visible when the sun is outFunctions
delete
DescriptionRemove Object from WeatherChangeListenersDefinition
delete()Code
41 | function SunAdmirer:delete() |
42 | g_messageCenter:unsubscribeAll(self) |
43 | 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_messageCenter:subscribe(MessageType.WEATHER_CHANGED, self.onWeatherChanged, 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 |
onWeatherChanged
DescriptionChange visibility of sun objectDefinition
onWeatherChanged()Code
55 | function SunAdmirer:onWeatherChanged() |
56 | if g_currentMission ~= nil and g_currentMission.environment ~= nil then |
57 | self:setVisibility(g_currentMission.environment.isSunOn and not g_currentMission.environment.weather:getIsRaining()) |
58 | end |
59 | end |