| Line |   | 
|---|
| 1 | -- Get objects from orxonox | 
|---|
| 2 | thisscript:addObject("FogEffect", "fog") | 
|---|
| 3 | thisscript:addObject("RainEffect", "rain") | 
|---|
| 4 | thisscript:addObject("SnowEffect", "snow") | 
|---|
| 5 | thisscript:addObject("LightningEffect", "lightning") | 
|---|
| 6 | thisscript:addObject("CloudEffect", "cloud") | 
|---|
| 7 |  | 
|---|
| 8 |  | 
|---|
| 9 | -- Create the trigger | 
|---|
| 10 | trigger = ScriptTrigger() | 
|---|
| 11 | trigger:setScript("weather.lua") | 
|---|
| 12 | trigger:setFunction("tick") | 
|---|
| 13 | trigger:setActiveOnCreation(true) | 
|---|
| 14 |  | 
|---|
| 15 | --Global Variables | 
|---|
| 16 | raining = false | 
|---|
| 17 |  | 
|---|
| 18 |  | 
|---|
| 19 | function tick(timestep) | 
|---|
| 20 |  | 
|---|
| 21 | if not raining then | 
|---|
| 22 | cloud:activate() | 
|---|
| 23 | rain:startRaining() | 
|---|
| 24 | raining = true | 
|---|
| 25 | end | 
|---|
| 26 |  | 
|---|
| 27 | return false | 
|---|
| 28 | end | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.