1
0
Fork 0

Some (pretty hot) volcano code - general management routines, Kilauea and Stromboli worked out as examples, WIP

This commit is contained in:
Thorsten Renk 2017-09-24 18:08:36 +03:00
parent 4cdb08efe0
commit 91db77595d
33 changed files with 2625 additions and 0 deletions

View file

@ -502,5 +502,8 @@
<wash-strength type="float" userarchive="n">0.0</wash-strength>
</aircraft-effects>
<!-- definitions for vocanic activity -->
<volcanoes include="volcanoes.xml"/>
</PropertyList>

18
Environment/volcanoes.xml Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" ?>
<PropertyList>
<enable-volcanoes type="int" userarchive="y">0</enable-volcanoes>
<kilauea>
<halemaumau-activity type="int" userarchive="y">0</halemaumau-activity>
<puu-oo-activity type="int" userarchive="y">0</puu-oo-activity>
</kilauea>
<stromboli>
<central-activity type="int" userarchive="y">0</central-activity>
<side-activity type="int" userarchive="y">0</side-activity>
</stromboli>
</PropertyList>

View file

@ -0,0 +1,121 @@
<?xml version="1.0"?>
<PropertyList>
<nasal>
<load><![CDATA[
print ("Halemaumau model loaded");
]]></load>
</nasal>
<path>kilauea.ac</path>
<offsets>
<x-m>0.00</x-m>
<y-m>0.00</y-m>
<z-m>5.00</z-m>
</offsets>
<animation>
<type>select</type>
<object-name>Lava</object-name>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/halemaumau-activity</property>
<value>0</value>
</greater-than>
</condition>
</animation>
<effect>
<object-name>Lava</object-name>
<inherits-from>Effects/model-combined-deferred</inherits-from>
</effect>
<animation>
<type>scale</type>
<object-name>Lava</object-name>
<x-offset>330.0</x-offset>
<y-offset>330.0</y-offset>
<z-offset>1.0</z-offset>
</animation>
<animation>
<type>material</type>
<object-name>Lava</object-name>
<emission>
<red> 0.4 </red>
<green> 0.32 </green>
<blue> 0.32 </blue>
</emission>
</animation>
<model>
<path>halemaumau_smoke.xml</path>
<offsets>
<x-m>-20.0</x-m>
<y-m>20.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/halemaumau-activity</property>
<value>1</value>
</greater-than>
</condition>
</model>
<model>
<path>kilauea_lava_fountain.xml</path>
<offsets>
<x-m>-20.0</x-m>
<y-m>20.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/halemaumau-activity</property>
<value>1</value>
</greater-than>
</condition>
</model>
<model>
<path>kilauea_smoke.xml</path>
<offsets>
<x-m>160.0</x-m>
<y-m>-130.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/halemaumau-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
<model>
<path>kilauea_smoke.xml</path>
<offsets>
<x-m>180.0</x-m>
<y-m>180.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/halemaumau-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
</PropertyList>

View file

@ -0,0 +1,107 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>kilauea-smoke</name>
<texture>smoke.png</texture>
<emissive>false</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>local</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>90</theta-min-deg>
<theta-max-deg>90</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>0</phi-max-deg>
<speed-mps>
<value>15</value>
<spread>2</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>2</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.2</value>
</alpha>
</color>
<size>
<value>50.0</value>
</size>
</start>
<end>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.1</value>
</alpha>
</color>
<size>
<value>250.0</value>
</size>
</end>
<life-sec>
<value>40</value>
</life-sec>
<mass-kg>1.0</mass-kg>
<radius-m>2.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

View file

@ -0,0 +1,24 @@
AC3Db
MATERIAL "DefaultWhite" rgb 1.0000 1.0000 1.0000 amb 0.2000 0.2000 0.2000 emis 0.0000 0.0000 0.0000 spec 0.5000 0.5000 0.5000 shi 10 trans 0.0000
MATERIAL "Material.001" rgb 0.8000 0.8000 0.8000 amb 1.0000 1.0000 1.0000 emis 0.0000 0.0000 0.0000 spec 0.2500 0.2500 0.2500 shi 50 trans 0.0000
OBJECT world
name "Blender_export__kilauea.ac"
kids 1
OBJECT poly
name "Lava"
texture "lava_texture.png"
texrep 1 1
numvert 4
1.0000000 0.0000000 1.0000000
-1.0000000 0.0000000 1.0000000
1.0000000 0.0000000 -1.0000000
-1.0000000 0.0000000 -1.0000000
numsurf 1
SURF 0X20
mat 1
refs 4
1 0.00000 1.00000
0 1.00000 1.000000
2 1.00000 0.00000
3 0.00000 0.000000
kids 0

View file

@ -0,0 +1,54 @@
var puu_oo_loop_flag = 1;
var puu_oo_loop = func (strength, tgt_strength) {
if (puu_oo_loop_flag == 0)
{
print("Ending Puu Oo eruption simulation.");
return;
}
if (rand() > 0.99) {tgt_strength = 100.0;}
tgt_strength = tgt_strength - 0.5;
if (tgt_strength < 40.0) {tgt_strength = 40.0;}
var step = 5.0;
if (math.abs(strength - tgt_strength) < 5.0) {step = 1.0;}
if (strength < tgt_strength)
{strength += step;}
else
{strength -= step;}
setprop("/environment/volcanoes/kilauea/puu-oo-eruption-strength", strength);
setprop("/environment/volcanoes/kilauea/puu-oo-eruption-quantity", int(0.5*strength));
settimer(func {puu_oo_loop(strength, tgt_strength);}, 0.1);
}
puu_oo_state_manager = func {
print ("Puu Oo state manager");
var state = getprop("/environment/volcanoes/kilauea/puu-oo-activity");
if (state == 3)
{
print("Starting Puu Oo eruption simulation.");
puu_oo_loop_flag = 1;
puu_oo_loop(50.0, 50.0);
}
else
{
puu_oo_loop_flag = 0;
}
}
# call state manager once to get correct autosaved behavior, otherwise use listener
puu_oo_state_manager();
setlistener("/environment/volcanoes/kilauea/puu-oo-activity", puu_oo_state_manager);

View file

@ -0,0 +1,107 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>kilauea-lava-fountain</name>
<texture>lava.png</texture>
<emissive>true</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>local</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>10</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<value>30</value>
<spread>10</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>25</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<value>1.0</value>
</red>
<green>
<value>0.2</value>
</green>
<blue>
<value>0.2</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>5.0</value>
</size>
</start>
<end>
<color>
<red>
<value>0.5</value>
</red>
<green>
<value>0.1</value>
</green>
<blue>
<value>0.1</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>7.0</value>
</size>
</end>
<life-sec>
<value>8</value>
</life-sec>
<mass-kg>200.0</mass-kg>
<radius-m>0.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

View file

@ -0,0 +1,107 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>kilauea-smoke2</name>
<texture>smoke.png</texture>
<emissive>false</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>local</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>60</theta-min-deg>
<theta-max-deg>90</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<value>20</value>
<spread>2</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>4</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.4</value>
</alpha>
</color>
<size>
<value>10.0</value>
</size>
</start>
<end>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.05</value>
</alpha>
</color>
<size>
<value>100.0</value>
</size>
</end>
<life-sec>
<value>15</value>
</life-sec>
<mass-kg>1.0</mass-kg>
<radius-m>2.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 KiB

View file

@ -0,0 +1,187 @@
<?xml version="1.0"?>
<!-- Lava fountain and sulfur smoke at the Puu Oo crater of Kilauea -->
<PropertyList>
<!--<nasal>
<load><![CDATA[
var puu_oo_loop_flag = 1;
var puu_oo_loop = func (strength, tgt_strength) {
if (puu_oo_loop_flag == 0)
{
print("Ending Puu Oo eruption simulation.");
return;
}
if (rand() > 0.99) {tgt_strength = 100.0;}
tgt_strength = tgt_strength - 0.5;
if (tgt_strength < 40.0) {tgt_strength = 40.0;}
var step = 5.0;
if (math.abs(strength - tgt_strength) < 5.0) {step = 1.0;}
if (strength < tgt_strength)
{strength += step;}
else
{strength -= step;}
setprop("/environment/volcanoes/kilauea/puu-oo-eruption-strength", strength);
setprop("/environment/volcanoes/kilauea/puu-oo-eruption-quantity", int(0.5*strength));
settimer(func {puu_oo_loop(strength, tgt_strength);}, 0.1);
}
puu_oo_state_manager = func {
print ("Puu Oo state manager");
var state = getprop("/environment/volcanoes/kilauea/puu-oo-activity");
if (state == 3)
{
print("Starting Puu Oo eruption simulation.");
puu_oo_loop_flag = 1;
puu_oo_loop(50.0, 50.0);
}
else
{
puu_oo_loop_flag = 0;
}
}
# call state manager once to get correct autosaved behavior, otherwise use listener
puu_oo_state_manager();
setlistener("/environment/volcanoes/kilauea/puu-oo-activity", puu_oo_state_manager);
]]>
</load>
<unload><![CDATA[
print("Unloading Puu Oo volcano management.");
pu_oo_loop_flag = 0;
]]>
</unload>
</nasal>-->
<path>kilauea.ac</path>
<offsets>
<x-m>0.00</x-m>
<y-m>0.00</y-m>
<z-m>8.00</z-m>
</offsets>
<animation>
<type>select</type>
<object-name>Lava</object-name>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/puu-oo-activity</property>
<value>0</value>
</greater-than>
</condition>
</animation>
<effect>
<object-name>Lava</object-name>
<inherits-from>Effects/model-combined-deferred</inherits-from>
</effect>
<animation>
<type>scale</type>
<object-name>Lava</object-name>
<x-offset>120.0</x-offset>
<y-offset>120.0</y-offset>
<z-offset>2.0</z-offset>
</animation>
<animation>
<type>material</type>
<object-name>Lava</object-name>
<emission>
<red> 0.4 </red>
<green> 0.32 </green>
<blue> 0.32 </blue>
</emission>
</animation>
<model>
<path>puu_oo_smoke.xml</path>
<offsets>
<x-m>-20.0</x-m>
<y-m>20.0</y-m>
<z-m>140.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/puu-oo-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
<model>
<path>puu_oo_lava_fountain.xml</path>
<offsets>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/puu-oo-activity</property>
<value>2</value>
</greater-than>
</condition>
</model>
<model>
<path>puu_oo_lava_fountain2.xml</path>
<offsets>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/puu-oo-activity</property>
<value>2</value>
</greater-than>
</condition>
</model>
<model>
<path>kilauea_lava_fountain.xml</path>
<offsets>
<x-m>30.0</x-m>
<y-m>-20.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/kilauea/puu-oo-activity</property>
<value>1</value>
</greater-than>
</condition>
</model>
</PropertyList>

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>puu-oo-lava-fountain</name>
<texture>lava.png</texture>
<emissive>true</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>local</attach>
<placer>
<type>sector</type>
<radius-min-m>0.0</radius-min-m>
<radius-max-m>15.0</radius-max-m>
<phi-min-deg>0.0</phi-min-deg>
<phi-max-deg>360.0</phi-max-deg>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>8</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<!--<value>60</value>-->
<property>/environment/volcanoes/kilauea/puu-oo-eruption-strength</property>
<spread>50.0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<property>/environment/volcanoes/kilauea/puu-oo-eruption-quantity</property>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<value>1.0</value>
</red>
<green>
<value>0.2</value>
</green>
<blue>
<value>0.2</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>10.0</value>
</size>
</start>
<end>
<color>
<red>
<value>0.5</value>
</red>
<green>
<value>0.1</value>
</green>
<blue>
<value>0.1</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>10.0</value>
</size>
</end>
<life-sec>
<value>25</value>
</life-sec>
<mass-kg>200.0</mass-kg>
<radius-m>0.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>puu-oo-lava-fountain</name>
<texture>lava.png</texture>
<emissive>true</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>local</attach>
<placer>
<type>sector</type>
<radius-min-m>0.0</radius-min-m>
<radius-max-m>15.0</radius-max-m>
<phi-min-deg>0.0</phi-min-deg>
<phi-max-deg>360.0</phi-max-deg>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>12</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<!--<value>60</value>-->
<property>/environment/volcanoes/kilauea/puu-oo-eruption-strength</property>
<spread>30</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<property>/environment/volcanoes/kilauea/puu-oo-eruption-quantity</property>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<value>1.0</value>
</red>
<green>
<value>0.2</value>
</green>
<blue>
<value>0.2</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>3.0</value>
</size>
</start>
<end>
<color>
<red>
<value>0.5</value>
</red>
<green>
<value>0.1</value>
</green>
<blue>
<value>0.1</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>3.0</value>
</size>
</end>
<life-sec>
<value>20</value>
</life-sec>
<mass-kg>200.0</mass-kg>
<radius-m>0.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

View file

@ -0,0 +1,107 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>puu-oo-smoke</name>
<texture>smoke_turbulent.png</texture>
<emissive>false</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>local</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>90</theta-min-deg>
<theta-max-deg>90</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>0</phi-max-deg>
<speed-mps>
<value>20</value>
<spread>10</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>-40</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>1</value>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.6</value>
</alpha>
</color>
<size>
<value>50.0</value>
</size>
</start>
<end>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.1</value>
</alpha>
</color>
<size>
<value>250.0</value>
</size>
</end>
<life-sec>
<value>60</value>
</life-sec>
<mass-kg>1.0</mass-kg>
<radius-m>2.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,80 @@
<?xml version="1.0"?>
<!-- Stromboli central crater activity -->
<PropertyList>
<model>
<path>stromboli_smoke_main.xml</path>
<offsets>
<x-m>-50.0</x-m>
<y-m>50.0</y-m>
<z-m>20.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/central-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
<model>
<path>stromboli_smoke_minor.xml</path>
<offsets>
<x-m>50.0</x-m>
<y-m>100.0</y-m>
<z-m>20.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/central-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
<model>
<path>central_crater_lava_fountain.xml</path>
<offsets>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<heading-deg>170</heading-deg>
<pitch-deg>10</pitch-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/central-activity</property>
<value>1</value>
</greater-than>
</condition>
</model>
<model>
<path>central_crater_lava_fountain_inner.xml</path>
<offsets>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<heading-deg>170</heading-deg>
<pitch-deg>10</pitch-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/central-activity</property>
<value>1</value>
</greater-than>
</condition>
</model>
</PropertyList>

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>stromboli-lava-foundain</name>
<texture>lava.png</texture>
<emissive>true</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>global</attach>
<placer>
<type>sector</type>
<radius-min-m>0.0</radius-min-m>
<radius-max-m>25.0</radius-max-m>
<phi-min-deg>0.0</phi-min-deg>
<phi-max-deg>360.0</phi-max-deg>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>15</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<!--<value>60</value>-->
<property>/environment/volcanoes/stromboli/stromboli-eruption-strength</property>
<spread>150.0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<property>/environment/volcanoes/stromboli/stromboli-eruption-quantity</property>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<value>1.0</value>
</red>
<green>
<value>0.2</value>
</green>
<blue>
<value>0.2</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>4.0</value>
</size>
</start>
<end>
<color>
<red>
<value>0.5</value>
</red>
<green>
<value>0.1</value>
</green>
<blue>
<value>0.1</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>4.0</value>
</size>
</end>
<life-sec>
<value>22</value>
</life-sec>
<mass-kg>200.0</mass-kg>
<radius-m>0.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>stromboli-lava-foundain-inner</name>
<texture>lava.png</texture>
<emissive>true</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>global</attach>
<placer>
<type>sector</type>
<radius-min-m>0.0</radius-min-m>
<radius-max-m>10.0</radius-max-m>
<phi-min-deg>0.0</phi-min-deg>
<phi-max-deg>360.0</phi-max-deg>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>3</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<!--<value>60</value>-->
<property>/environment/volcanoes/stromboli/stromboli-eruption-strength-inner</property>
<spread>150.0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<property>/environment/volcanoes/stromboli/stromboli-eruption-quantity-inner</property>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<value>1.0</value>
</red>
<green>
<value>0.2</value>
</green>
<blue>
<value>0.2</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>6.0</value>
</size>
</start>
<end>
<color>
<red>
<value>0.5</value>
</red>
<green>
<value>0.1</value>
</green>
<blue>
<value>0.1</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>6.0</value>
</size>
</end>
<life-sec>
<value>22</value>
</life-sec>
<mass-kg>200.0</mass-kg>
<radius-m>0.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,97 @@
<?xml version="1.0"?>
<!-- Stromboli side crater activity -->
<PropertyList>
<model>
<path>stromboli_smoke_minor.xml</path>
<offsets>
<x-m>50.0</x-m>
<y-m>-100.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/side-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
<model>
<path>stromboli_smoke_minor.xml</path>
<offsets>
<x-m>-50.0</x-m>
<y-m>-120.0</y-m>
<z-m>0.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/side-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
<model>
<path>stromboli_smoke_main.xml</path>
<offsets>
<x-m>0.0</x-m>
<y-m>60.0</y-m>
<z-m>20.0</z-m>
<heading-deg>0</heading-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/side-activity</property>
<value>0</value>
</greater-than>
</condition>
</model>
<model>
<path>side_crater_lava_fountain.xml</path>
<offsets>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<heading-deg>180.0</heading-deg>
<pitch-deg>40.0</pitch-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/side-activity</property>
<value>1</value>
</greater-than>
</condition>
</model>
<model>
<path>side_crater_lava_fountain_inner.xml</path>
<offsets>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<heading-deg>180.0</heading-deg>
<pitch-deg>40.0</pitch-deg>
</offsets>
<condition>
<greater-than>
<property>/environment/volcanoes/stromboli/side-activity</property>
<value>1</value>
</greater-than>
</condition>
</model>
</PropertyList>

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>stromboli-sec-lava-foundain</name>
<texture>lava.png</texture>
<emissive>true</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>global</attach>
<placer>
<type>sector</type>
<radius-min-m>0.0</radius-min-m>
<radius-max-m>20.0</radius-max-m>
<phi-min-deg>0.0</phi-min-deg>
<phi-max-deg>360.0</phi-max-deg>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>15</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<!--<value>60</value>-->
<property>/environment/volcanoes/stromboli/stromboli-eruption-strength-sec</property>
<spread>150.0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<property>/environment/volcanoes/stromboli/stromboli-eruption-quantity-sec</property>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<value>1.0</value>
</red>
<green>
<value>0.2</value>
</green>
<blue>
<value>0.2</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>4.0</value>
</size>
</start>
<end>
<color>
<red>
<value>0.5</value>
</red>
<green>
<value>0.1</value>
</green>
<blue>
<value>0.1</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>4.0</value>
</size>
</end>
<life-sec>
<value>22</value>
</life-sec>
<mass-kg>200.0</mass-kg>
<radius-m>0.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>stromboli-sec-lava-foundain-inner</name>
<texture>lava.png</texture>
<emissive>true</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>global</attach>
<placer>
<type>sector</type>
<radius-min-m>0.0</radius-min-m>
<radius-max-m>5.0</radius-max-m>
<phi-min-deg>0.0</phi-min-deg>
<phi-max-deg>360.0</phi-max-deg>
</placer>
<shooter>
<theta-min-deg>0</theta-min-deg>
<theta-max-deg>5</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>360</phi-max-deg>
<speed-mps>
<!--<value>60</value>-->
<property>/environment/volcanoes/stromboli/stromboli-eruption-strength-sec-inner</property>
<spread>150.0</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>10</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<property>/environment/volcanoes/stromboli/stromboli-eruption-quantity-sec-inner</property>
<spread>0</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<value>1.0</value>
</red>
<green>
<value>0.2</value>
</green>
<blue>
<value>0.2</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>6.0</value>
</size>
</start>
<end>
<color>
<red>
<value>0.5</value>
</red>
<green>
<value>0.1</value>
</green>
<blue>
<value>0.1</value>
</blue>
<alpha>
<value>1.0</value>
</alpha>
</color>
<size>
<value>6.0</value>
</size>
</end>
<life-sec>
<value>22</value>
</life-sec>
<mass-kg>200.0</mass-kg>
<radius-m>0.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,122 @@
var stromboli_loop_flag = 1;
var stromboli_central_factor = 1.0;
var stromboli_side_factor = 1.0;
var stromboli_central_probability = 0.99;
var stromboli_side_probability = 0.99;
var stromboli_loop = func (timer, strength, timer_sec, strength_sec) {
if (stromboli_loop_flag == 0)
{
print("Ending Stromboli simulation.");
return;
}
if ((timer <= 0.0) and (rand() > stromboli_central_probability))
{
strength = 180.0 + 70.0 * rand();
strength *= stromboli_central_factor;
timer = 0.3 + 0.3 * rand();
}
else if (timer <= 0.0)
{
strength = strength - 3.0;
}
else
{
strength = strength - 0.5;
}
if (strength < 10.0) {strength = 10.0;}
setprop("/environment/volcanoes/stromboli/stromboli-eruption-strength", strength );
setprop("/environment/volcanoes/stromboli/stromboli-eruption-strength-inner", 0.95 * strength );
setprop("/environment/volcanoes/stromboli/stromboli-eruption-quantity", int(5.0*strength + rand()));
setprop("/environment/volcanoes/stromboli/stromboli-eruption-quantity-inner", int(1.0*strength + 0.2 * rand()));
timer = timer - 0.1;
if ((timer_sec <= 0.0) and (rand() > stromboli_side_probability))
{
strength_sec = 140.0 + 60.0 * rand();
strength_sec *= stromboli_side_factor;
timer_sec = 0.2 + 0.2 * rand();
}
else if (timer_sec <= 0.0)
{
strength_sec = strength_sec - 3.0;
}
else
{
strength_sec = strength_sec - 0.5;
}
if (strength_sec < 10.0) {strength_sec = 10.0;}
setprop("/environment/volcanoes/stromboli/stromboli-eruption-strength-sec", 0.95 * ((0.9 + 0.1 * rand()) * strength_sec) );
setprop("/environment/volcanoes/stromboli/stromboli-eruption-strength-sec-inner", ((0.9 + 0.1 * rand()) * strength_sec) );
setprop("/environment/volcanoes/stromboli/stromboli-eruption-quantity-sec", int(5.0*strength_sec + rand()));
setprop("/environment/volcanoes/stromboli/stromboli-eruption-quantity-sec-inner", int(1.0*strength_sec + 0.2 * rand()));
timer_sec = timer_sec - 0.1;
settimer(func {stromboli_loop(timer, strength, timer_sec, strength_sec);}, 0.1);
}
stromboli_state_manager = func {
print ("Stromboli state manager");
var state1 = getprop("/environment/volcanoes/stromboli/central-activity");
var state2 = getprop("/environment/volcanoes/stromboli/side-activity");
if (state1 > 2)
{
stromboli_central_probability = 0.99;
stromboli_central_factor = 1.0;
}
else
{
stromboli_central_probability = 0.998;
stromboli_central_factor = 0.6;
}
if (state2 > 2)
{
stromboli_side_probability = 0.99;
stromboli_side_factor = 1.0;
}
else
{
stromboli_side_probability = 0.998;
stromboli_side_factor = 0.6;
}
var state = state1;
if (state2 > state) {state = state2;}
if (state > 1)
{
print("Starting Stromboli eruption simulation.");
stromboli_loop_flag = 1;
stromboli_loop(0.0, 0.0, 0.0, 0.0);
}
else
{
stromboli_loop_flag = 0;
}
}
# call state manager once to get correct autosaved behavior, otherwise use listener
stromboli_state_manager();
setlistener("/environment/volcanoes/stromboli/central-activity", stromboli_state_manager);
setlistener("/environment/volcanoes/stromboli/side-activity", stromboli_state_manager);

View file

@ -0,0 +1,107 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>stromboli-smoke</name>
<texture>smoke_turbulent.png</texture>
<emissive>false</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>local</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>90</theta-min-deg>
<theta-max-deg>90</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>0</phi-max-deg>
<speed-mps>
<value>20</value>
<spread>10</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>-40</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>1</value>
<spread>1</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.6</value>
</alpha>
</color>
<size>
<value>50.0</value>
</size>
</start>
<end>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.1</value>
</alpha>
</color>
<size>
<value>350.0</value>
</size>
</end>
<life-sec>
<value>120</value>
</life-sec>
<mass-kg>1.0</mass-kg>
<radius-m>2.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

View file

@ -0,0 +1,107 @@
<?xml version="1.0"?>
<PropertyList>
<particlesystem>
<name>stromboli-smoke-minor</name>
<texture>smoke_turbulent.png</texture>
<emissive>false</emissive>
<lighting>false</lighting>
<x-m>0.0</x-m>
<y-m>0.0</y-m>
<z-m>0.0</z-m>
<roll-deg>0.0</roll-deg>
<pitch-deg>0.0</pitch-deg>
<heading-deg>0.0</heading-deg>
<attach>global</attach>
<placer>
<type>point</type>
</placer>
<shooter>
<theta-min-deg>90</theta-min-deg>
<theta-max-deg>90</theta-max-deg>
<phi-min-deg>0</phi-min-deg>
<phi-max-deg>0</phi-max-deg>
<speed-mps>
<value>20</value>
<spread>10</spread>
</speed-mps>
<rotation-speed>
<x-min-deg-sec>0</x-min-deg-sec>
<y-min-deg-sec>0</y-min-deg-sec>
<z-min-deg-sec>-40</z-min-deg-sec>
<x-max-deg-sec>0</x-max-deg-sec>
<y-max-deg-sec>0</y-max-deg-sec>
<z-max-deg-sec>40</z-max-deg-sec>
</rotation-speed>
</shooter>
<counter>
<particles-per-sec>
<value>4</value>
<spread>1</spread>
</particles-per-sec>
</counter>
<align>billboard</align>
<particle>
<start>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.6</value>
</alpha>
</color>
<size>
<value>10.0</value>
</size>
</start>
<end>
<color>
<red>
<property>/rendering/scene/diffuse/green</property>
</red>
<green>
<property>/rendering/scene/diffuse/green</property>
</green>
<blue>
<property>/rendering/scene/diffuse/green</property>
</blue>
<alpha>
<value>0.1</value>
</alpha>
</color>
<size>
<value>50.0</value>
</size>
</end>
<life-sec>
<value>30</value>
</life-sec>
<mass-kg>1.0</mass-kg>
<radius-m>2.50</radius-m>
</particle>
<program>
<fluid>air</fluid>
<gravity type="bool">true</gravity>
<wind type="bool">true</wind>
</program>
</particlesystem>
</PropertyList>

136
Nasal/volcano.nas Normal file
View file

@ -0,0 +1,136 @@
# volcano management routines
# Thorsten Renk 2017
var volcano = {
new: func(name, lat, lon) {
var v = { parents: [volcano] };
v.lat = lat;
v.lon = lon;
v.pos = geo.Coord.new().set_latlon(lat, lon);
v.name = name;
v.loaded = 0;
return v;
},
};
var volcano_manager = {
dist_to_load: 100000.0,
active: 0,
init: func {
me.volcano_array = [];
me.pos = {};
me.init_state();
},
start: func {
if (me.active == 1)
{
me.run(0);
}
},
init_state: func {
var state = getprop("/environment/volcanoes/enable-volcanoes");
me.active = state;
if (state == 1)
{print("Volcanic activity on.");}
else {print ("Volcanic activity off.");}
},
set_state: func {
var state = getprop("/environment/volcanoes/enable-volcanoes");
me.active = state;
if (state == 1)
{
print("Volcanic activity on.");
me.run(0);
}
else {print ("Volcanic activity off.");}
},
run: func (index) {
if (me.active == 0) {return;}
if (index > size(me.volcano_array) - 1) {index = 0;}
if (me.volcano_array[index].loaded == 0)
{
me.pos = geo.aircraft_position();
var dist = me.pos.distance_to(me.volcano_array[index].pos);
#print ("Distance is now: ", dist);
var visibility = getprop("/environment/visibility-m");
if ((dist < me.dist_to_load) and (dist < visibility))
{
print("Loading ", me.volcano_array[index].name, ".");
me.volcano_array[index].set();
me.volcano_array[index].loaded = 1;
}
}
index += 1;
settimer( func { me.run(index);}, 1.0);
},
};
volcano_manager.init();
# setter functions for volcano sceneries
var set_kilauea = func {
io.include("Models/Volcanoes/Kilauea/kilauea.nas");
geo.put_model("Models/Volcanoes/Kilauea/halemaumau.xml", 19.4062038, -155.2840123);
geo.put_model("Models/Volcanoes/Kilauea/puu_oo.xml", 19.38881767, -155.10669939);
}
var set_stromboli = func {
io.include("Models/Volcanoes/Stromboli/stromboli.nas");
geo.put_model("Models/Volcanoes/Stromboli/central_crater.xml", 38.7892, 15.2105);
geo.put_model("Models/Volcanoes/Stromboli/side_crater.xml", 38.7950, 15.2139);
}
# volcano definitions
var kilauea = volcano.new("Kilauea", 19.39, -155.20);
kilauea.set = set_kilauea;
append(volcano_manager.volcano_array, kilauea);
var stromboli = volcano.new("Stromboli", 38.78, 15.21);
stromboli.set = set_stromboli;
append(volcano_manager.volcano_array, stromboli);
# start the manager when autosaved (need some delay for terrain loading to finish)
settimer(func {volcano_manager.start();}, 5.0);
# set the relevant listeners
setlistener("/environment/volcanoes/enable-volcanoes", func {volcano_manager.set_state();},0,0 );

View file

@ -0,0 +1,152 @@
<?xml version="1.0"?>
<PropertyList>
<name>Kilauea</name>
<layout>vbox</layout>
<default-padding>1</default-padding>
<modal>false</modal>
<width>400</width>
<empty>
<pref-height>6</pref-height>
</empty>
<text>
<label>Kilauea activity</label>
</text>
<empty>
<pref-height>4</pref-height>
</empty>
<hrule/>
<group>
<layout>table</layout>
<text>
<label>Halemaumau activity</label>
<halign>left</halign>
<row>0</row>
<col>0</col>
</text>
<text>
<label>dormant</label>
<row>0</row>
<col>1</col>
</text>
<slider>
<name>halemaumau</name>
<row>0</row>
<col>2</col>
<min>0</min>
<max>2</max>
<step>1</step>
<live>true</live>
<property>/environment/volcanoes/kilauea/halemaumau-activity</property>
<binding>
<command>dialog-apply</command>
<object-name>halemaumau</object-name>
</binding>
</slider>
<text>
<label>active</label>
<row>0</row>
<col>3</col>
</text>
<text>
<label>Puu Oo activity</label>
<halign>left</halign>
<row>1</row>
<col>0</col>
</text>
<text>
<label>dormant</label>
<row>1</row>
<col>1</col>
</text>
<slider>
<name>puu-oo</name>
<row>1</row>
<col>2</col>
<min>0</min>
<max>3</max>
<step>1</step>
<live>true</live>
<property>/environment/volcanoes/kilauea/puu-oo-activity</property>
<binding>
<command>dialog-apply</command>
<object-name>puu-oo</object-name>
</binding>
</slider>
<text>
<label>active</label>
<row>1</row>
<col>3</col>
</text>
</group>
<empty>
<pref-height>12</pref-height>
</empty>
<hrule/>
<empty>
<pref-height>20</pref-height>
</empty>
<group>
<layout>table</layout>
<button>
<row>0</row>
<col>0</col>
<legend>OK</legend>
<default>true</default>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>nasal</command>
<script>
var obj_dlg_id = getprop("/environment/volcanoes/volcano-selected");
var dlg = gui.Dialog.new(obj_dlg_id);
dlg.open();
</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<row>0</row>
<col>1</col>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View file

@ -0,0 +1,141 @@
<?xml version="1.0"?>
<PropertyList>
<name>Stromboli</name>
<layout>vbox</layout>
<default-padding>1</default-padding>
<modal>false</modal>
<width>400</width>
<empty>
<pref-height>6</pref-height>
</empty>
<text>
<label>Stromboli activity</label>
</text>
<empty>
<pref-height>4</pref-height>
</empty>
<hrule/>
<group>
<layout>table</layout>
<text>
<label>Central crater activity</label>
<halign>left</halign>
<row>0</row>
<col>0</col>
</text>
<text>
<label>dormant</label>
<row>0</row>
<col>1</col>
</text>
<slider>
<name>central</name>
<row>0</row>
<col>2</col>
<min>0</min>
<max>3</max>
<step>1</step>
<live>true</live>
<property>/environment/volcanoes/stromboli/central-activity</property>
<binding>
<command>dialog-apply</command>
<object-name>central</object-name>
</binding>
</slider>
<text>
<label>active</label>
<row>0</row>
<col>3</col>
</text>
<text>
<label>Side crater activity</label>
<halign>left</halign>
<row>1</row>
<col>0</col>
</text>
<text>
<label>dormant</label>
<row>1</row>
<col>1</col>
</text>
<slider>
<name>side</name>
<row>1</row>
<col>2</col>
<min>0</min>
<max>3</max>
<step>1</step>
<live>true</live>
<property>/environment/volcanoes/stromboli/side-activity</property>
<binding>
<command>dialog-apply</command>
<object-name>side</object-name>
</binding>
</slider>
<text>
<label>active</label>
<row>1</row>
<col>3</col>
</text>
</group>
<empty>
<pref-height>12</pref-height>
</empty>
<hrule/>
<empty>
<pref-height>20</pref-height>
</empty>
<group>
<layout>table</layout>
<button>
<row>0</row>
<col>0</col>
<legend>OK</legend>
<default>true</default>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<row>0</row>
<col>1</col>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

131
gui/dialogs/volcanoes.xml Normal file
View file

@ -0,0 +1,131 @@
<?xml version="1.0"?>
<PropertyList>
<name>volcanoes</name>
<layout>vbox</layout>
<default-padding>1</default-padding>
<modal>false</modal>
<width>400</width>
<empty>
<pref-height>6</pref-height>
</empty>
<text>
<label>Nearby volcanic activity</label>
</text>
<empty>
<pref-height>4</pref-height>
</empty>
<hrule/>
<group>
<layout>table</layout>
<checkbox>
<name>enable-volcanoes</name>
<row>0</row>
<col>0</col>
<halign>left</halign>
<property>/environment/volcanoes/enable-volcanoes</property>
<label>enable volcanic activity</label>
<live>true</live>
<binding>
<command>dialog-apply</command>
<object-name>enable-volcanoes</object-name>
</binding>
</checkbox>
</group>
<empty>
<pref-height>8</pref-height>
</empty>
<group>
<layout>table</layout>
<text>
<label>Select a nearby volcano from the list to set its activity</label>
<halign>left</halign>
<row>0</row>
<col>0</col>
</text>
<combo>
<row>2</row>
<col>0</col>
<name>object-selection</name>
<halign>left</halign>
<stretch>true</stretch>
<pref-width>380</pref-width>
<property>/environment/volcanoes/volcano-selected</property>
<properties>/environment/volcanoes/volcanoes-nearby/</properties>
<value>Kilauea</value>
<binding>
<command>dialog-apply</command>
<object-name>object-selection</object-name>
</binding>
</combo>
</group>
<empty>
<pref-height>12</pref-height>
</empty>
<hrule/>
<empty>
<pref-height>20</pref-height>
</empty>
<group>
<layout>table</layout>
<button>
<row>0</row>
<col>0</col>
<legend>OK</legend>
<default>true</default>
<equal>true</equal>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>nasal</command>
<script>
var obj_dlg_id = getprop("/environment/volcanoes/volcano-selected");
var dlg = gui.Dialog.new(obj_dlg_id);
dlg.open();
</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<row>0</row>
<col>1</col>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View file

@ -330,6 +330,51 @@
<script>wildfire.dialog.show()</script>
</binding>
</item>
<item>
<label>Volcanoes</label>
<name>volcanoes</name>
<binding>
<command>nasal</command>
<script>
<![CDATA[
var varray = volcano.volcano_manager.volcano_array;
var n = size(varray);
var aircraft_pos = geo.aircraft_position();
var j = 0;
for (var i = 0; i< n; i=i+1)
{
#print(i, " ", varray[i].name);
var distance = aircraft_pos.distance_to(varray[i].pos);
if (distance < 150000.0) # only add nearby objects
{
var name = varray[i].name;
setprop("/environment/volcanoes/volcanoes-nearby/value["~j~"]", name);
if (j==0)
{setprop("/environment/volcanoes/volcano-selected", name);}
j=j+1;
}
}
]]>
</script>
</binding>
<binding>
<command>dialog-show</command>
<dialog-name>volcanoes</dialog-name>
</binding>
</item>
</menu>
<menu>