Ground target: tank

This commit is contained in:
Nikolai V. Chr 2021-04-27 18:46:29 +02:00
parent 1abd5c3417
commit 74fed9851c
5 changed files with 143 additions and 3 deletions

View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<PropertyList>
<path>m1a.ac</path>
<offsets>
<x-m> 0 </x-m><!--x-m>-4.456</x-m-->
<y-m> 0 </y-m>
<z-m> 1 </z-m><!--z-m> 0.200</z-m-->
</offsets>
</PropertyList>

View File

@ -2,7 +2,37 @@
<PropertyList>
<model>
<path>hummer.ac</path>
<name>humvee</name>
</model>
<animation>
<type>select</type>
<object-name>humvee</object-name>
<condition>
<equals>
<property>sim/multiplay/generic/int[17]</property>
<value>0</value>
</equals>
</condition>
</animation>
<model>
<path>M1/m1.xml</path>
<name>tank</name>
</model>
<animation>
<type>select</type>
<object-name>tank</object-name>
<condition>
<equals>
<property>sim/multiplay/generic/int[17]</property>
<value>1</value>
</equals>
</condition>
</animation>
<model>
<path>Aircraft/BUK-M2/Models/smoke.xml</path>

View File

@ -28,6 +28,9 @@ var heading_ps = 0.5;
time_last = 0;
sim_speed = 1;
var speed = 25;
var last_type = 0;
setprop("/carrier/pitch-deg",0);
setprop("/carrier/pitch-offset",0);
setprop("/carrier/roll-deg",0);
@ -60,7 +63,7 @@ var PositionUpdater = func () {
if ( getprop("/carrier/sunk") == 0 and getprop("/autopilot/route-manager/active") == 1 ) {
#for event
var speed = 25;
var cur_waypoint = getprop("/autopilot/route-manager/current-wp");
var cur_wp_lon = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/longitude-deg");
var cur_wp_lat = getprop("/autopilot/route-manager/route/wp[" ~ cur_waypoint ~ "]/latitude-deg");
@ -95,6 +98,19 @@ var PositionUpdater = func () {
#set roll
setprop("/orientation/roll-deg",getprop("/carrier/roll-deg") + getprop("/carrier/roll-offset"));
var type = getprop("sim/multiplay/generic/int[17]");
if (type != last_type) {
if (damage.hp_max == damage.hp) {
if (type == 0) {damage.hp_max=5;damage.hp=5;speed=25;}
if (type == 1) {damage.hp_max=100;damage.hp=100;speed=15;}
last_type = type;
} else {
print("Can only switch type when not damaged!!");
setprop("sim/multiplay/generic/int[17]", last_type);
}
}
};
PositionUpdater();

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
<name>type</name>
<layout>vbox</layout>
<width>250</width>
<resizable>false</resizable>
<group>
<layout>hbox</layout>
<empty><stretch>true</stretch></empty>
<text>
<label>Type</label>
</text>
<empty><stretch>true</stretch></empty>
<button>
<legend/>
<keynum>27</keynum>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<group>
<layout>vbox</layout>
<default-padding>6</default-padding>
<empty><stretch>true</stretch></empty>
<button>
<legend>Humvee</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>0</value>
</binding>
</button>
<button>
<legend>Tank</legend>
<binding>
<command>property-assign</command>
<property>sim/multiplay/generic/int[17]</property>
<value>1</value>
</binding>
</button>
</group>
<group>
<layout>vbox</layout>
<default-padding>6</default-padding>
<empty><stretch>true</stretch></empty>
</group>
</group>
</PropertyList>

View File

@ -106,11 +106,12 @@
</font>
</hud>
<menubar include="Dialogs/menu.xml"/>
<!--menubar include="Dialogs/menu.xml"/-->
<multiplay>
<generic>
<int n="0" type="int">0</int>
<int n="17" type="int">0</int>
</generic>
</multiplay>
@ -132,6 +133,13 @@
<menu n="100">
<label>Truck</label>
<enabled type="bool">true</enabled>
<item>
<label>Type</label>
<binding>
<command>dialog-show</command>
<dialog-name>type</dialog-name>
</binding>
</item>
<item>
<label>Event Log</label>
<binding>