diff --git a/tower/Dialogs/control-panel.xml b/tower/Dialogs/control-panel.xml new file mode 100644 index 0000000..e6a5f9e --- /dev/null +++ b/tower/Dialogs/control-panel.xml @@ -0,0 +1,330 @@ + + + + + + + control-panel + vbox + 250 + false + + + hbox + + true + + + + true + + + + + + + + vbox + 6 + + + + + + table + + + + 0 + 1 + + + + + + + + + + 2 + 1 + + + + + + + + + + 4 + 0 + + + + + 4 + 1 + + + + + + + + + + + + + + + + + vbox + 6 + + + + + + vbox + + + left + + /controls/lighting/deck-lights + true + + dialog-apply + + + property-toggle + + + + + left + + /carrier/antennas/enabled + true + + dialog-apply + + + property-toggle + + + + + + + + + vbox + 6 + + + + + + vbox + + + left + + /carrier/fdm/settings/movement + true + + dialog-apply + + + property-toggle + + + + + left + + /carrier/phalanx/settings/show-debug-aim + true + + dialog-apply + + + property-toggle + + + + + + + + + hbox + 6 + + true + + + + + diff --git a/tower/Dialogs/menu.xml b/tower/Dialogs/menu.xml new file mode 100644 index 0000000..a34d397 --- /dev/null +++ b/tower/Dialogs/menu.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + true + + + + + dialog-show + control-panel + + + + + + + diff --git a/tower/Models/smoke.png b/tower/Models/smoke.png new file mode 100644 index 0000000..d2a4d96 Binary files /dev/null and b/tower/Models/smoke.png differ diff --git a/tower/Models/smoke.xml b/tower/Models/smoke.xml new file mode 100644 index 0000000..3607612 --- /dev/null +++ b/tower/Models/smoke.xml @@ -0,0 +1,84 @@ + + + + smoke + + smoke.png + + + + sim/multiplay/generic/int[0] + 1 + + + + false + false + billboard + world + + + point + + + 20 + 35 + -15 + 15 + + 0 + 0 + + + 0 + 0 + -180 + 0 + 0 + 180 + + + + + 1 + 20 + + + + + + 0.0 + 0.0 + 0.0 + 1 + + + 20.0 + + + + + 0.0 + 0.0 + 0.0 + 0.0 + + + 60.0 + + + + 60 + + 0.0075 + 0.40 + + + air + true + true + + + + + \ No newline at end of file diff --git a/tower/Models/tower.xml b/tower/Models/tower.xml new file mode 100644 index 0000000..fec0288 --- /dev/null +++ b/tower/Models/tower.xml @@ -0,0 +1,17 @@ + + + + + towerSnowy1.ac + + + Aircraft/tower/Models/smoke.xml + + 1.2 + 0.00 + -0.68 + 0 + + + + \ No newline at end of file diff --git a/tower/Models/towerSnowy1.ac b/tower/Models/towerSnowy1.ac new file mode 100644 index 0000000..423ec0d --- /dev/null +++ b/tower/Models/towerSnowy1.ac @@ -0,0 +1,563 @@ +AC3Db +MATERIAL "Color_M07" rgb 0.227 0.227 0.227 amb 1.000 1.000 1.000 emis 0.000 0.000 0.000 spec 0.500 0.500 0.500 shi 12 trans 0.000 +MATERIAL "Color_M03" rgb 0.667 0.667 0.667 amb 1.000 1.000 1.000 emis 0.000 0.000 0.000 spec 0.500 0.500 0.500 shi 12 trans 0.000 +MATERIAL "Translucent_Glass_Blue" rgb 0.392 0.584 0.929 amb 1.000 1.000 1.000 emis 0.000 0.000 0.000 spec 0.500 0.500 0.500 shi 12 trans 0.502 +OBJECT world +name "Blender_exporter_v2.17__towerSnowy1.ac" +kids 5 +OBJECT poly +name "door" +data 4 +ID11 +crease 40.0 +numvert 4 +2 2 0 +1 0 0 +2 0 0 +1 2 0 +numsurf 2 +SURF 0X10 +mat 0 +refs 3 +0 0 0 +1 0 0 +2 0 0 +SURF 0X10 +mat 0 +refs 3 +1 0 0 +0 0 0 +3 0 0 +kids 0 +OBJECT poly +name "floor" +data 4 +ID33 +crease 40.0 +numvert 32 +3.75 13 -7.25 +4 12 -3 +3.75 13 -2.75 +4 12 -7 +4 12 -7 +3.75 13 -7.25 +4 12 -3 +3.75 13 -2.75 +8.25 13 -2.75 +4 12 -3 +8 12 -3 +3.75 13 -2.75 +3.75 13 -2.75 +8.25 13 -2.75 +4 12 -3 +8 12 -3 +3.75 13 -7.25 +8 12 -7 +4 12 -7 +8.25 13 -7.25 +8.25 13 -7.25 +3.75 13 -7.25 +8 12 -7 +4 12 -7 +8 12 -3 +8.25 13 -7.25 +8.25 13 -2.75 +8 12 -7 +8 12 -7 +8 12 -3 +8.25 13 -7.25 +8.25 13 -2.75 +numsurf 16 +SURF 0X10 +mat 1 +refs 3 +0 0 0 +1 0 0 +2 0 0 +SURF 0X10 +mat 1 +refs 3 +1 0 0 +0 0 0 +3 0 0 +SURF 0X10 +mat 1 +refs 3 +4 0 0 +5 0 0 +6 0 0 +SURF 0X10 +mat 1 +refs 3 +7 0 0 +6 0 0 +5 0 0 +SURF 0X10 +mat 1 +refs 3 +8 0 0 +9 0 0 +10 0 0 +SURF 0X10 +mat 1 +refs 3 +9 0 0 +8 0 0 +11 0 0 +SURF 0X10 +mat 1 +refs 3 +12 0 0 +13 0 0 +14 0 0 +SURF 0X10 +mat 1 +refs 3 +15 0 0 +14 0 0 +13 0 0 +SURF 0X10 +mat 1 +refs 3 +16 0 0 +17 0 0 +18 0 0 +SURF 0X10 +mat 1 +refs 3 +17 0 0 +16 0 0 +19 0 0 +SURF 0X10 +mat 1 +refs 3 +20 0 0 +21 0 0 +22 0 0 +SURF 0X10 +mat 1 +refs 3 +23 0 0 +22 0 0 +21 0 0 +SURF 0X10 +mat 1 +refs 3 +24 0 0 +25 0 0 +26 0 0 +SURF 0X10 +mat 1 +refs 3 +25 0 0 +24 0 0 +27 0 0 +SURF 0X10 +mat 1 +refs 3 +28 0 0 +29 0 0 +30 0 0 +SURF 0X10 +mat 1 +refs 3 +31 0 0 +30 0 0 +29 0 0 +kids 0 +OBJECT poly +name "glass" +data 4 +ID19 +crease 40.0 +numvert 32 +3 16 -8 +8.25 13 -7.25 +3.75 13 -7.25 +9 16 -8 +9 16 -8 +3 16 -8 +8.25 13 -7.25 +3.75 13 -7.25 +8.25 13 -2.75 +9 16 -8 +9 16 -2 +8.25 13 -7.25 +8.25 13 -7.25 +8.25 13 -2.75 +9 16 -8 +9 16 -2 +3 16 -8 +3.75 13 -2.75 +3 16 -2 +3.75 13 -7.25 +3.75 13 -7.25 +3 16 -8 +3.75 13 -2.75 +3 16 -2 +9 16 -2 +3.75 13 -2.75 +8.25 13 -2.75 +3 16 -2 +3 16 -2 +9 16 -2 +3.75 13 -2.75 +8.25 13 -2.75 +numsurf 16 +SURF 0X10 +mat 2 +refs 3 +0 0 0 +1 0 0 +2 0 0 +SURF 0X10 +mat 2 +refs 3 +1 0 0 +0 0 0 +3 0 0 +SURF 0X10 +mat 2 +refs 3 +4 0 0 +5 0 0 +6 0 0 +SURF 0X10 +mat 2 +refs 3 +7 0 0 +6 0 0 +5 0 0 +SURF 0X10 +mat 2 +refs 3 +8 0 0 +9 0 0 +10 0 0 +SURF 0X10 +mat 2 +refs 3 +9 0 0 +8 0 0 +11 0 0 +SURF 0X10 +mat 2 +refs 3 +12 0 0 +13 0 0 +14 0 0 +SURF 0X10 +mat 2 +refs 3 +15 0 0 +14 0 0 +13 0 0 +SURF 0X10 +mat 2 +refs 3 +16 0 0 +17 0 0 +18 0 0 +SURF 0X10 +mat 2 +refs 3 +17 0 0 +16 0 0 +19 0 0 +SURF 0X10 +mat 2 +refs 3 +20 0 0 +21 0 0 +22 0 0 +SURF 0X10 +mat 2 +refs 3 +23 0 0 +22 0 0 +21 0 0 +SURF 0X10 +mat 2 +refs 3 +24 0 0 +25 0 0 +26 0 0 +SURF 0X10 +mat 2 +refs 3 +25 0 0 +24 0 0 +27 0 0 +SURF 0X10 +mat 2 +refs 3 +28 0 0 +29 0 0 +30 0 0 +SURF 0X10 +mat 2 +refs 3 +31 0 0 +30 0 0 +29 0 0 +kids 0 +OBJECT poly +name "roof" +data 4 +ID27 +crease 40.0 +numvert 4 +9 16 -2 +3 16 -8 +3 16 -2 +9 16 -8 +numsurf 2 +SURF 0X10 +mat 1 +refs 3 +0 0 0 +1 0 0 +2 0 0 +SURF 0X10 +mat 1 +refs 3 +1 0 0 +0 0 0 +3 0 0 +kids 0 +OBJECT poly +name "structure" +data 3 +ID3 +crease 40.0 +numvert 48 +8 0 -7 +0 0 0 +0 0 -7 +1 0 0 +2 0 0 +8 0 0 +8 3 0 +2 0 0 +8 0 0 +2 2 0 +1 2 0 +0 0 0 +1 0 0 +0 3 0 +0 3 -7 +0 0 0 +0 3 0 +0 0 -7 +0 3 -7 +8 0 -7 +0 0 -7 +4 3 -7 +8 12 -7 +4 12 -7 +8 0 -7 +8 3 0 +8 0 0 +8 3 -3 +8 12 -3 +8 12 -7 +0 3 0 +4 3 -3 +0 3 -7 +8 3 0 +8 3 -3 +4 3 -7 +4 12 -7 +4 3 -3 +4 12 -3 +4 3 -7 +8 12 -3 +4 12 -7 +4 12 -3 +8 12 -7 +8 12 -3 +4 3 -3 +8 3 -3 +4 12 -3 +numsurf 30 +SURF 0X10 +mat 1 +refs 3 +0 0 0 +1 0 0 +2 0 0 +SURF 0X10 +mat 1 +refs 3 +1 0 0 +0 0 0 +3 0 0 +SURF 0X10 +mat 1 +refs 3 +3 0 0 +0 0 0 +4 0 0 +SURF 0X10 +mat 1 +refs 3 +4 0 0 +0 0 0 +5 0 0 +SURF 0X10 +mat 1 +refs 3 +6 0 0 +7 0 0 +8 0 0 +SURF 0X10 +mat 1 +refs 3 +7 0 0 +6 0 0 +9 0 0 +SURF 0X10 +mat 1 +refs 3 +9 0 0 +6 0 0 +10 0 0 +SURF 0X10 +mat 1 +refs 3 +10 0 0 +11 0 0 +12 0 0 +SURF 0X10 +mat 1 +refs 3 +11 0 0 +10 0 0 +13 0 0 +SURF 0X10 +mat 1 +refs 3 +13 0 0 +10 0 0 +6 0 0 +SURF 0X10 +mat 1 +refs 3 +14 0 0 +15 0 0 +16 0 0 +SURF 0X10 +mat 1 +refs 3 +15 0 0 +14 0 0 +17 0 0 +SURF 0X10 +mat 1 +refs 3 +18 0 0 +19 0 0 +20 0 0 +SURF 0X10 +mat 1 +refs 3 +19 0 0 +18 0 0 +21 0 0 +SURF 0X10 +mat 1 +refs 3 +19 0 0 +21 0 0 +22 0 0 +SURF 0X10 +mat 1 +refs 3 +22 0 0 +21 0 0 +23 0 0 +SURF 0X10 +mat 1 +refs 3 +24 0 0 +25 0 0 +26 0 0 +SURF 0X10 +mat 1 +refs 3 +25 0 0 +24 0 0 +27 0 0 +SURF 0X10 +mat 1 +refs 3 +27 0 0 +24 0 0 +28 0 0 +SURF 0X10 +mat 1 +refs 3 +28 0 0 +24 0 0 +29 0 0 +SURF 0X10 +mat 1 +refs 3 +30 0 0 +31 0 0 +32 0 0 +SURF 0X10 +mat 1 +refs 3 +31 0 0 +30 0 0 +33 0 0 +SURF 0X10 +mat 1 +refs 3 +31 0 0 +33 0 0 +34 0 0 +SURF 0X10 +mat 1 +refs 3 +35 0 0 +32 0 0 +31 0 0 +SURF 0X10 +mat 1 +refs 3 +36 0 0 +37 0 0 +38 0 0 +SURF 0X10 +mat 1 +refs 3 +37 0 0 +36 0 0 +39 0 0 +SURF 0X10 +mat 1 +refs 3 +40 0 0 +41 0 0 +42 0 0 +SURF 0X10 +mat 1 +refs 3 +41 0 0 +40 0 0 +43 0 0 +SURF 0X10 +mat 1 +refs 3 +44 0 0 +45 0 0 +46 0 0 +SURF 0X10 +mat 1 +refs 3 +45 0 0 +44 0 0 +47 0 0 +kids 0 diff --git a/tower/Nasal/damage.nas b/tower/Nasal/damage.nas new file mode 100644 index 0000000..848eaaf --- /dev/null +++ b/tower/Nasal/damage.nas @@ -0,0 +1,126 @@ +var clamp = func(v, min, max) { v < min ? min : v > max ? max : v } + +var TRUE = 1; +var FALSE = 0; + +# +# Install: Include this code into an aircraft to make it damagable. (remember to add it to the -set file) +# +# Author: Nikolai V. Chr. (with some improvement by Onox and Pinto) +# +# + +var cannon_types = { + " M70 rocket hit": 0.25, #135mm + " M55 cannon shell hit": 0.10, # 30mm + " KCA cannon shell hit": 0.10, # 30mm + " Gun Splash On ": 0.10, # 30mm + " M61A1 shell hit": 0.05, # 20mm + " GAU-8/A hit": 0.10, # 30mm + " BK27 cannon hit": 0.07, # 27mm + " GSh-30 hit": 0.10, # 30mm + " 7.62 hit": 0.30, #UH-1 + " 50 BMG hit": 0.20, #p-47 +}; + +var players = { + "pinto": 1, + "OPFOR77": 2, + "Leto": 1, + "swamp": 2, +}; + +var incoming_listener = func { + var history = getprop("/sim/multiplay/chat-history"); + var hist_vector = split("\n", history); + if (size(hist_vector) > 0) { + var last = hist_vector[size(hist_vector)-1]; + var last_vector = split(":", last); + var author = last_vector[0]; + var callsign = getprop("sim/multiplay/callsign"); + if (size(last_vector) > 1 and author != callsign) { + # not myself + #print("not me"); + if (1==1) { # mirage: getprop("/controls/armament/mp-messaging") + # latest version of failure manager and taking damage enabled + #print("damage enabled"); + var last1 = split(" ", last_vector[1]); + if (cannon_types[last_vector[1]] != nil) { + # cannon hitting someone + print("cannon"); + if (size(last_vector) > 2 and last_vector[2] == " "~callsign) { + print("cannon hit us"); + process_hit(author); + } + } + } + } + } +} + +var last_update_time = "/aa_tower/last-update-time"; +var owning_team = "/aa_tower/owning_team"; +var score_team_1 = "/aa_tower/score-team-1"; +var score_team_2 = "/aa_tower/score-team-2"; +setprop(last_update_time, -1); +setprop(owning_team, 0); +setprop(score_team_1, 0); +setprop(score_team_2, 0); + +var process_hit = func (perp) { + print("processing hit by: " ~ perp); + if ( players[perp] != nil ) { + if ( players[perp] != getprop(owning_team) ) { + setprop(last_update_time,systime()); + setprop(owning_team, players[perp]); + setprop("/aa_tower/score-team-" ~ players[perp], getprop("/aa_tower/score-team-" ~ players[perp]) + 1); + setprop("/sim/multiplay/chat","Ownership transferred to team: " ~ players[perp]); + write_xml(); + } + } +} + +var update = func () { + var o_t = getprop(owning_team); + if(o_t > 0) { + if(systime() > getprop(last_update_time) + 300) { + print("Adding point to team: " ~ o_t); + setprop("/sim/multiplay/chat","Adding point to team: " ~ o_t); + setprop("/aa_tower/score-team-" ~ o_t, getprop("/aa_tower/score-team-" ~ o_t) + 1); + setprop(last_update_time, systime()); + write_xml(); + } + } + settimer(func(){update();},10); +} + +update(); + +var twr_base = "/aa_tower/"; +var filename_base = getprop("/sim/fg-home") ~ "/Export/tower-"; +var write_xml = func() { + io.write_properties( path: filename_base ~ rand() ~ ".xml", prop: twr_base ); +} + +var callsign_struct = {}; +var getCallsign = func (callsign) { + var node = callsign_struct[callsign]; + return node; +} + +var processCallsigns = func () { + callsign_struct = {}; + var players = props.globals.getNode("ai/models").getChildren(); + foreach (var player; players) { + if(player.getChild("valid") != nil and player.getChild("valid").getValue() == TRUE and player.getChild("callsign") != nil and player.getChild("callsign").getValue() != "" and player.getChild("callsign").getValue() != nil) { + var callsign = player.getChild("callsign").getValue(); + callsign_struct[callsign] = player; + } + } + settimer(processCallsigns, 1.5); +} + +processCallsigns(); + + +setlistener("/sim/multiplay/chat-history", incoming_listener, 0, 0); \ No newline at end of file diff --git a/tower/Nasal/fdm.nas b/tower/Nasal/fdm.nas new file mode 100644 index 0000000..1ae09d0 --- /dev/null +++ b/tower/Nasal/fdm.nas @@ -0,0 +1,44 @@ +# Copyright (C) 2015 onox +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +#io.include("Aircraft/ExpansionPack/Nasal/init.nas"); + +#with("updateloop"); + +# Number of iterations per second +var frequency = 60.0; + +# Change in heading per second at full rudder deflection +var heading_ps = 0.5; + +time_last = 0; +sim_speed = 1; + +setprop("/carrier/pitch-deg",0); +setprop("/carrier/pitch-offset",0); +setprop("/carrier/roll-deg",0); +setprop("/carrier/roll-offset",0); +setprop("/carrier/sunk",0); + +var PositionUpdater = func () { + + # does a building need an FDM? + # nawwwwwww + + settimer( PositionUpdater, 1/frequency ); + +}; + +PositionUpdater(); \ No newline at end of file diff --git a/tower/Sounds/sound.xml b/tower/Sounds/sound.xml new file mode 100644 index 0000000..f42ec74 --- /dev/null +++ b/tower/Sounds/sound.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/tower/Systems/fbw.xml b/tower/Systems/fbw.xml new file mode 100644 index 0000000..107c064 --- /dev/null +++ b/tower/Systems/fbw.xml @@ -0,0 +1,46 @@ + + + + + + + + FBW Throttle + gain + 80.0 + + /controls/engines/engine[0]/throttle + + + /carrier/fbw/target/groundspeed-kt + + + + + FBW Rudder + gain + 8.0 + + /controls/flight/rudder + + + /surface-positions/rudder-pos-norm + + + + diff --git a/tower/Systems/fdm.xml b/tower/Systems/fdm.xml new file mode 100644 index 0000000..7a847c8 --- /dev/null +++ b/tower/Systems/fdm.xml @@ -0,0 +1,69 @@ + + + + + + + + + FDM Groundspeed + noise-spike + + /carrier/fbw/target/groundspeed-kt + + + /velocities/groundspeed-kt + + + + 7 + + + + + FDM True Heading For Flags + gain + + /orientation/heading-deg + + + /orientation/true-heading-deg + + + + + + + + + + diff --git a/tower/splash1.png b/tower/splash1.png new file mode 100644 index 0000000..8df9b7b Binary files /dev/null and b/tower/splash1.png differ diff --git a/tower/tower-set.xml b/tower/tower-set.xml new file mode 100644 index 0000000..a47d77c --- /dev/null +++ b/tower/tower-set.xml @@ -0,0 +1,125 @@ + + + + + + + + false + + + + + + + 15.0 + + + 0.5 + 4.0 + + + 0.32 + 0.45 + + + 30.0 + + + 20.0 + + true + + + + + + pinto + tower + alpha + 0.1 + + null + + KPN-D + KPN + + + Aircraft/tower/Models/tower.xml + + + true + + + + Sounds/sound.xml + + + + true + + + + Aircraft/tower/splash1.png + + + + true + + 0.0 + 0.0 + false + + 100.0 + 2000.0 + + + + + Systems/fbw.xml + + + Systems/fdm.xml + + + + + 0 + + + + + + + Aircraft/tower/Nasal/fdm.nas + + + Aircraft/tower/Nasal/damage.nas + + + +