Skip to content

Commit

Permalink
revert advanced compositions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kexanone committed Oct 1, 2017
1 parent ae7f3f6 commit 9b736db
Showing 1 changed file with 13 additions and 60 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

#define IDD_COMPOSITION_GUI 133799
#define IDC_TREE_CTRL 1400
#define IDC_EDIT_BUTTON 3030
#define IDC_DEL_BUTTON 3020
#define IDC_ADD_BUTTON 3040
#define IDC_OK_BUTTON 3000
#define IDC_CANCLE_BUTTON 3010
#define IDD_MESSAGE 999
Expand All @@ -25,25 +22,25 @@

disableSerialization;

private ["_comboIndex","_item_name","_item_details","_categoryName"];
private ["_mode", "_ctrl", "_comboIndex","_item_name","_item_details","_categoryName"];

private _mode = _this select 0;
private _ctrl = param [1,controlNull,[controlNull]];
private _treePathSelection = param [2,[],[[]]];
_mode = _this select 0;
_ctrl = param [1,controlNull,[controlNull]];
_treePathSelection = param [2,[],[[]]];

private _dialog = findDisplay IDD_COMPOSITION_GUI;
_dialog = findDisplay IDD_COMPOSITION_GUI;

switch (_mode) do
{
case "LOADED":
{
private _ok_ctrl = _dialog displayCtrl IDC_OK_BUTTON;
_ok_ctrl ctrlRemoveAllEventHandlers "ButtonClick";
_ok_ctrl ctrlAddEventHandler ["ButtonClick", "([""SPAWN""] + _this) call Achilles_fnc_RscDisplayAttributes_spawnAdvancedComposition;"];

private _cancle_ctrl = _dialog displayCtrl IDC_CANCLE_BUTTON;
_cancle_ctrl = _dialog displayCtrl IDC_CANCLE_BUTTON;
_cancle_ctrl ctrlRemoveAllEventHandlers "ButtonClick";
_cancle_ctrl ctrlAddEventHandler ["ButtonClick", "closeDialog 2"];
_cancle_ctrl ctrlAddEventHandler ["ButtonClick", "saveProfileNamespace; hint localize ""STR_CHANGES_SAVED""; closeDialog 2;"];
_dialog displayAddEventHandler ["KeyDown", "if (_this select 1 == 1) then {saveProfileNamespace; hint localize ""STR_CHANGES_SAVED"";}"];

_button = _dialog displayCtrl IDC_OK_BUTTON;
_button ctrlShow false;

_tree_ctrl = _dialog displayCtrl IDC_TREE_CTRL;

Expand Down Expand Up @@ -243,7 +240,7 @@ switch (_mode) do
_custom_categories set [_category_index,_category_details];
};
profileNamespace setVariable ["Achilles_var_compositions",_custom_compositions];
saveProfileNamespace;

};
case "REMOVE":
{
Expand Down Expand Up @@ -272,51 +269,7 @@ switch (_mode) do
_category_items = _category_items - [-1];
_custom_compositions set [_categoryIndex, [_category_name,_category_items]];
};
profileNamespace setVariable ["Achilles_var_compositions",_custom_compositions];
saveProfileNamespace;
};
case "SPAWN":
{
_objects_info = [] call compile Ares_var_current_composition;
if (count _objects_info == 0) exitWith {[localize "STR_NO_OBJECT_SELECTED"] call Ares_fnc_ShowZeusMessage; playSound "FD_Start_F"};
_center_object_info = _objects_info select 0;
_objects_info = _objects_info - [_center_object_info];

_type = _center_object_info select 0;
_center_dir = _center_object_info select 2;
_allow_sim = _center_object_info select 3;

_center_object = _type createVehicle [0,0,0];
[_center_object,false] remoteExec ["enableSimulationGlobal",2];
_center_object setPosATL [-500,-500,0];
_center_object setDir _center_dir;

[[_center_object], true] call Ares_fnc_AddUnitsToCurator;
_attached_objects = [];
{
_object_info = _x;

_type = _object_info select 0;
_pos = _object_info select 1;
_dir = _object_info select 2;
_pos = (getPosWorld _center_object) vectorAdd _pos;
_dir = _dir - (getDir _center_object);
_allow_sim = _object_info select 3;

_object = _type createVehicle [0,0,0];
[_object,_allow_sim] remoteExec ["enableSimulationGlobal",2];
_object setPosWorld _pos;
_object attachTo [_center_object];
[_object, _dir] remoteExec ['setDir',0,true];
_attached_objects pushBack _object;
} forEach _objects_info;
_center_object setPos position Achilles_var_latestModuleLogic;
[_center_object,true] remoteExec ["enableSimulationGlobal",2];
_center_object setVariable ["ACS_attached_objects",_attached_objects];
_center_object setVariable ["ACS_center_dir", _center_dir];
_center_object addEventHandler ["Deleted", {_attached_objects = (_this select 0) getVariable ["ACS_attached_objects", []]; {deleteVehicle _x} forEach _attached_objects}];

closeDialog 1;
profileNamespace setVariable ["Achilles_var_compositions",_custom_compositions];
};
case "UNLOAD" : {};
};

0 comments on commit 9b736db

Please sign in to comment.