Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/common.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@
<filter>
<object-type-set>
<object-type name="Tool"/>
<object-type name="Target"/>
<object-type name="Sensor"/>
</object-type-set>
</filter>
</archive-object>
<cleanup>
<cleanup>
<type name="Device"/>
<type name="Software"/>
<type name="Target"/>
<type name="Sensor"/>
<type name="Friend"/>
<type name="Hostile"/>
</cleanup>
</cleanup>
</dmz>
8 changes: 7 additions & 1 deletion config/input.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<plugin name="dmzQtPluginButtonToChannel" scope="tool-name"/>
<plugin name="dmzInputPluginMouseEventToMessage" unique="mouse-move-event"/>
<plugin name="dmzInputPluginMouseEventToMessage" unique="move-event"/>
<!--
<plugin name="dmzInputPluginMouseEventToMessage" unique="link-event"/>
-->
<plugin name="dmzInputPluginMouseEventToMessage" unique="delete-event"/>
</plugin-list>
<key-events>
Expand Down Expand Up @@ -52,6 +54,7 @@
</action>
</toolButton>
</channel>
<!--
<channel name="link-tool" message="Update_Tool_Name" isect="false">
<attribute type="string" name="String">
<element value="Link"/>
Expand All @@ -67,6 +70,7 @@
</action>
</toolButton>
</channel>
-->
<channel name="delete-tool" message="Update_Tool_Name">
<attribute type="string" name="String">
<element value="Delete"/>
Expand All @@ -87,7 +91,7 @@
<input>
<source name="canvas"/>
<channel name="move-tool"/>
<channel name="link-tool"/>
<!-- <channel name="link-tool"/> -->
<channel name="delete-tool"/>
</input>
<target name="highlight"/>
Expand Down Expand Up @@ -155,6 +159,7 @@
</state>
</converter>
</move-event>
<!--
<link-event>
<input>
<channel name="link-tool"/>
Expand Down Expand Up @@ -233,6 +238,7 @@
</state>
</converter>
</link-event>
-->
<delete-event>
<input>
<source name="canvas"/>
Expand Down
6 changes: 4 additions & 2 deletions config/js.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<plugin name="dmzJsExtV8Script" scope="javascript"/>
<plugin name="dmzJsExtV8File" scope="javascript"/>
<plugin name="dmzJsExtV8Module" scope="javascript"/>
<plugin name="dmzJsExtV8ConfigIO" scope="javascript"/>
<plugin name="dmzJsExtV8Zip" scope="javascript"/>
</plugin-list>
<javascript>
<path value="../js/scripts"/>
Expand All @@ -24,12 +26,12 @@
<instance name="destroyerInspector"/>
<instance name="helicopterInspector"/>
<instance name="submarineInspector"/>
<!-- <instance name="fileMenu"/> -->
<instance name="fileMenu"/>
<!-- <instance name="editMenu"/> -->
<instance name="log"/>
<instance name="create"/>
<instance name="move"/>
<instance name="link"/>
<!-- <instance name="link"/> -->
<instance name="delete"/>
<instance name="highlight"/>
<instance name="carrierMain"/>
Expand Down
2 changes: 1 addition & 1 deletion config/runtime.xml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</template>
</canvas-object-basic>
</object-type>
<object-type name="Submarine" parent="Unknown">
<object-type name="Submarine" parent="Hostile">
<icon-pallet resource="submarine icon"/>
<canvas-object/>
<canvas-object-basic>
Expand Down
24 changes: 22 additions & 2 deletions scripts/capture.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,25 @@ dmz.object.create.observe(self, function (handle, type) {
else if (type.isOfType(SensorType)) { _targets.push(handle); }
});

dmz.object.destroy.observe(self, function (handle) {

if (_source == handle) { _source = 0; }
else {

var len = _targets.length
, ix = 0
;

for (ix = 0; ix < len; ix++) {

if (_targets[ix] == handle) {

_targets.splice(ix, 1); ix = len;
}
}
}
});

dmz.module.subscribe(self, "simulation", function (Mode, module) {

if (Mode === dmz.module.Activate) {
Expand Down Expand Up @@ -155,9 +174,10 @@ dmz.module.subscribe(self, "simulation", function (Mode, module) {
);
});

// module.reset(self, function () {
module.reset(self, function () {

// });
graphView.clearData ();
});

module.timeSlice(self, function (time) {

Expand Down
9 changes: 9 additions & 0 deletions scripts/carrierMain.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ _update = function (time) {
}
};

dmz.object.destroy.observe(self, function (handle) {

if (_carriers[handle]) {

_carriers.splice(handle,1);
//_carriers[handle] = 0;
}
});

dmz.module.subscribe(self, "objectInit", function (Mode, module) {

if (Mode === dmz.module.Activate) {
Expand Down
18 changes: 12 additions & 6 deletions scripts/fileMenu.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ _save = function (file) {
}
};

dmz.main.addMenu (self, "&File", "New", { shortcut: "new" }, function () {
dmz.main.insertMenu (self, "&File", "E&xit", "New", { shortcut: "new" },
function () {

_reset ();
});

dmz.main.addMenu (self, "&File", "Open", { shortcut: "open" }, function () {
dmz.main.insertMenu (self, "&File", "E&xit", "Open", { shortcut: "open" },
function () {

var data
, archive
Expand All @@ -89,7 +91,7 @@ dmz.main.addMenu (self, "&File", "Open", { shortcut: "open" }, function () {
_reset ();

file = dmz.fileDialog.getOpenFileName(
{ caption: "Load file", filter: "Data File (*.csdf)" },
{ caption: "Load file", filter: "Data File (*" + FileExt + ")" },
dmz.main.window());

if (file) {
Expand Down Expand Up @@ -117,15 +119,16 @@ dmz.main.addMenu (self, "&File", "Open", { shortcut: "open" }, function () {
else { self.log.error("No file selected"); }
});

dmz.main.addSeparator("&File");
dmz.main.insertSeparator("&File", "E&xit");

dmz.main.addMenu(self, "&File", "Save", { shortcut: "save" }, function () {
dmz.main.insertMenu(self, "&File", "E&xit", "Save", { shortcut: "save" },
function () {

if (_currentFile) { _save(_currentFile); }
else if (_saveAsAction) { _saveAsAction.trigger(); }
});

_saveAsAction = dmz.main.addMenu(self, "&File", "Save As", { shortcut: "saveas" },
_saveAsAction = dmz.main.insertMenu(self, "&File", "E&xit", "Save As", { shortcut: "saveas" },
function () {

var archive
Expand Down Expand Up @@ -155,3 +158,6 @@ function () {
_save(name);
}
});

dmz.main.insertSeparator("&File", "E&xit");

86 changes: 69 additions & 17 deletions scripts/helicopterMain.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var dmz =
, time: require("dmz/runtime/time")
, undo: require("inspectorUndo")
, vector: require("dmz/types/vector")
, mask: require("dmz/types/mask")
, util: require("dmz/types/util")
}
// Constants
Expand Down Expand Up @@ -40,16 +41,18 @@ var dmz =
, _helos = []
, _carrier
, _path =
// // Back and Forth
// [ dmz.vector.create([0.5, 0.0, 0.0])
// , dmz.vector.create([-0.5, 0.0, 0.0])
// ]
// // Sideways V
// [ dmz.vector.create([-0.5, 0.0, 0.0])
// , dmz.vector.create([0.5, 0.0, -0.5])
// , dmz.vector.create([-0.5, 0.0, 0.0])
// , dmz.vector.create([0.5, 0.0, 0.5])
// ]
/* // Back and Forth
[ dmz.vector.create([0.5, 0.0, 0.0])
, dmz.vector.create([-0.5, 0.0, 0.0])
]
*/
/* // Sideways V
[ dmz.vector.create([-0.5, 0.0, 0.0])
, dmz.vector.create([0.5, 0.0, -0.5])
, dmz.vector.create([-0.5, 0.0, 0.0])
, dmz.vector.create([0.5, 0.0, 0.5])
]
*/
// Box
[ dmz.vector.create([0.5, 0.0, 0.0])
, dmz.vector.create([0.5, 0.0, -0.5])
Expand All @@ -58,6 +61,7 @@ var dmz =
, dmz.vector.create([-0.5, 0.0, 0.5])
, dmz.vector.create([0.5, 0.0, 0.5])
]

, _pathWidth = 800
, _pathHeight = 200
, _sim
Expand Down Expand Up @@ -253,13 +257,54 @@ dmz.object.create.observe(self, function (handle, type) {

if (type.isOfType(CarrierType)) {

if (dmz.object.hil()) { dmz.object.flag(handle, dmz.object.HILAttribute, false); }
if (dmz.object.hil()) {

dmz.object.flag(handle, dmz.object.HILAttribute, false);
}

_carrier = handle;

dmz.object.flag(handle, dmz.object.HILAttribute, true);
}
});

dmz.object.destroy.observe(self, function (handle) {

if (_helos[handle]) {

dmz.object.destroy (_helos[handle].icon);

_helos.splice(handle,1);
}
else if (_carrier == handle) { _carrier = 0; }
});

/* - not necessary unless using a UI to switch path types
dmz.object.state.observe(self, function (handle, attribute, state){

var type = dmz.object.type(handle)
, obj
;

if (type.isOfType(HelicopterType) &&
attribute == dmz.seaConst.PathAtt) {

self.log.warn("Helicopter::PathAtt: ");
if (_sim && !_sim.control.isRunning()) {
}
if (handle && dmz.object.isObject(handle)) {

state = dmz.object.state(handle);

if (!state) { state = dmz.mask.create(); }

state = state.or(HighlightState);

dmz.object.state(handle, null, state);
}
}
});
*/
dmz.object.position.observe(self, function (handle, attr, pos){

var type = dmz.object.type(handle)
Expand All @@ -281,8 +326,8 @@ dmz.object.position.observe(self, function (handle, attr, pos){
dmz.object.vector(handle, dmz.seaConst.OffsetAttr, offset);

dmz.object.counter(handle, dmz.seaConst.TargetAttr, 0);
dmz.object.position(handle, dmz.seaConst.TargetAttr, _targetPosition(obj));
// _targetPosition(_helos[handle]);
dmz.object.position(
handle, dmz.seaConst.TargetAttr, _targetPosition(obj));
}
}
});
Expand Down Expand Up @@ -312,14 +357,21 @@ dmz.module.subscribe(self, "objectInit", function (Mode, module) {

dmz.object.orientation(handle, null, StartDir);
dmz.object.velocity(handle, null, [0, 0, 0]);
dmz.object.position(handle, dmz.seaConst.StartAttr, dmz.object.position(handle));
dmz.object.position(
handle, dmz.seaConst.StartAttr, dmz.object.position(handle));
dmz.object.vector(handle, dmz.seaConst.OffsetAttr, [0, 0 ,0]);
dmz.object.scalar(handle, dmz.seaConst.SpeedAttr, 0);

// dmz.object.state(handle, dmz.seaConst.PathAttr, dmz.mask.create ());

dmz.object.counter(handle, dmz.seaConst.TargetAttr, 0);
dmz.object.counter.min(handle, dmz.seaConst.TargetAttr, 0);
dmz.object.counter.max(handle, dmz.seaConst.TargetAttr, _path.length-1);
dmz.object.counter.min(
handle, dmz.seaConst.TargetAttr, 0);
dmz.object.counter.max(
handle, dmz.seaConst.TargetAttr, _path.length-1);
dmz.object.counter.rollover(handle, dmz.seaConst.TargetAttr, true);
dmz.object.position(handle, dmz.seaConst.TargetAttr, _targetPosition(obj));
dmz.object.position(
handle, dmz.seaConst.TargetAttr, _targetPosition(obj));
});
}
});
Expand Down
1 change: 1 addition & 0 deletions scripts/seaConst.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var util = require("dmz/types/util")
util.defineConst(exports, "NetLink", defs.createNamedHandle("Network Link"));
util.defineConst(exports, "EquipmentLink", defs.createNamedHandle("Equipment Link"));
util.defineConst(exports, "NameAttr", defs.createNamedHandle("Name"));
//util.defineConst(exports, "PathAttr", defs.createNamedHandle("Path"));
util.defineConst(exports, "RadiusAttr", defs.createNamedHandle("Radius"));
util.defineConst(exports, "TargetAttr", defs.createNamedHandle("Target"));
util.defineConst(exports, "StartAttr", defs.createNamedHandle("Start"));
Expand Down