Bug Fixes for the 3DEN Plugin

This commit is contained in:
Chris Cardozo 2020-09-06 12:30:56 -04:00
parent 873026090d
commit 1203f03044
8 changed files with 70 additions and 155 deletions

View File

@ -1,19 +1,23 @@
private _object = get3DENSelected "object" select {((typeOf _x) isKindOf "House") && [_x] call BIS_fnc_isBuildingEnterable}; private _objects = get3DENSelected "object";
private "_message"; private "_message";
switch (count _objecct) do diag_log format["getGarrisonInfo: _object = %1",format["%1",_object]];
if (_objects isEqualTo []) then
{ {
case 0: {_message = "No Enterable Buildings selected"}; _message = "No Buildings Selected";
case 1: { } else {
if (_object getVariable["garrisoned",false]) then if (count _objects == 1) then
{ {
_message = format["Building %1 IS Garrisoned",typeOf _object]; if ((_objects select 0) getVariable["garrisoned",false]) then
{
_message = format["Building %1 IS Garrisoned",typeOf (_objects select 0)];
} else { } else {
_message = format["Building %1 is NOT Garrisoned",typeOf _object]; _message = format["Building %1 is NOT Garrisoned",typeOf (_objects select 0)];
}; };
}; } else {
default {_message = "Select a single building then try again"}; _message = format["Select a single building then try again"];
}; };
[_message,"Status"] call BIS_fnc_3DENShowMessage; };
systemChat _message; systemChat _message;
diag_log _message; diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;

View File

@ -2,21 +2,24 @@
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car"}; private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car"};
private "_message"; private "_message";
switch (count _objects) do if (_objects isEqualTo []) then
{ {
case 0: {_message = "Select a vehicle and try again"}; _message = "No Vehicles Selected";
case 1: { } else {
if (count _objects == 1) then
{
if ((_objects select 0) getVariable["lootvehicle",false]) then if ((_objects select 0) getVariable["lootvehicle",false]) then
{ {
_message = format["Vehicle %1 IS a loot vehicle",typeOf (_objects select 0)]; _message = format["Vehicle %1 IS a Loot Vehicle",typeOf (_objects select 0)];
} else { } else {
_message = format["Vehicle %1 is NOT a loot vehicle",typeOf (_objects select 0)]; _message = format["Vehicle %1 is NOT a Loot Vehicle",typeOf (_objects select 0)];
}; };
} else {
_message = format["% Vehicles Selected. Select a single vehicle then try again",count _objects];
}; };
default {_message = "Select a single vehicle and try again"};
}; };
[_message,"Status"] call BIS_fnc_3DENShowMessage;
systemChat _message; systemChat _message;
diag_log _message; diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;

View File

@ -2,25 +2,26 @@
params["_state"]; params["_state"];
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "House"}; private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "House"};
private "_message";
if (_objects isEqualTo []) exitWith if (_objects isEqualTo []) exitWith
{ {
_m = "Select one or more buildings to configure"; _message = "Select one or more buildings to configure";
systemChat _m; systemChat _message;
}; };
{ {
if ([_x] call BIS_fnc_isBuildingEnterable) then if ([_x] call BIS_fnc_isBuildingEnterable) then
{ {
_x setVariable["garrisoned",_state]; _x setVariable["garrisoned",_state];
_m = format["building of type %1 had garrison state set to %2",typeOf _x,_state]; _message = format["building of type %1 had garrison state set to %2",typeOf _x,_state];
systemChat _m; systemChat _message;
diag_log _m; diag_log _message;
} else { } else {
_m = format["Object type %1 ignored: only enterable buildings can be garrisoned",typeOf _x]; _message = format["Object type %1 ignored: only enterable buildings can be garrisoned",typeOf _x];
systemChat _x; systemChat _x;
diag_log _x; diag_log _x;
}; };
} forEach _objects; } forEach _objects;
_m = format["Garrison State of %1 buildings updated to %2",count _objects,_state]; _message = format["Garrison State of %1 buildings updated to %2",count _objects,_state];
systemChat _m; systemChat _message;

View File

@ -1,22 +1,23 @@
params["_state"]; params["_state"];
private "_message";
private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car"}; private _objects = get3DENSelected "object" select {(typeOf _x) isKindOf "Car"};
if (_objects isEqualTo []) exitWith if (_objects isEqualTo []) exitWith
{ {
_m = "Select one or more vehicles to configure"; _message = "Select one or more vehicles to configure";
systemChat _m; systemChat _message;
}; };
{ {
if ((typeOf _x) isKindOf "Car") then if ((typeOf _x) isKindOf "Car") then
{ {
_x setVariable["lootvehicle",_state]; _x setVariable["lootvehicle",_state];
_m = format["Vehicle type %1 set to Loot Vehilce = %1",typeOf _x,_state]; _message = format["Vehicle type %1 set to Loot Vehilce = %1",typeOf _x,_state];
systemChat _m; systemChat _message;
diag_log _m; diag_log _message;
} else { } else {
_m = format["Object with type %1 ignored:: only objects of type Car can be used as loot vehicles",typeOf _x]; _message = format["Object with type %1 ignored:: only objects of type Car can be used as loot vehicles",typeOf _x];
diag_log _m; diag_log _message;
systemChat _m; systemChat _message;
}; };
} forEach _objects; } forEach _objects;
_m = format["Loot Vehicle State of %1 vehicles updated to %2",count _objects,_state]; _message = format["Loot Vehicle State of %1 vehicles updated to %2",count _objects,_state];
systemChat _m; systemChat _m;

View File

@ -163,21 +163,22 @@ private _garisonedUnits = [];
private _landscape = _objects select{ private _landscape = _objects select{
!(isSimpleObject _x) && !(isSimpleObject _x) &&
((typeOf _x) isKindOf "Static") ((typeOf _x) isKindOf "Static") ||
( (typeOf _x) isKindOf "ThingX" && (!((typeOf _x) isKindOf "ReammoBox_F") && !(_x getVariable["isLootContainer",false])))
}; };
private _garisonedPos = []; private _garisonedPos = [];
private _helpers = _objects select {((typeOf _x) isEqualTo garisonMarkerObject)}; private _helpers = _objects select {((typeOf _x) isEqualTo garisonMarkerObject)};
diag_log format["garisonMarkerObject = %1 | _helpers = %2",garisonMarkerObject,_helpers];
{ {
if ([_x] call blck3DEN_fnc_isInside) then if (_x getVariable["garrisoned",false]) then
{ {
_building = [_x] call blck3DEN_fnc_buildingContainer;
_garisonedBuildings pushbackunique _building; _garisonedBuildings pushbackunique _building;
// data structure ["building Classname",[/*building pos*/],/*building dir*/,/*odds of garrison*/, /*Max Statics*/,/*types statics*/,/*max units*/], // data structure ["building Classname",[/*building pos*/],/*building dir*/,/*odds of garrison*/, /*Max Statics*/,/*types statics*/,/*max units*/],
// 1 2 3 4 5 6 7 8 9 // 1 2 3 4 5 6 7 8 9
_garisonedPos pushBack format[' ["%1",%2,%3,%4,%5,%6,%7,%8,%9]',typeOf _building,(getPosATL _building) vectorDiff CENTER,getDir _building, 'true','true',oddsOfGarrison,maxGarrisonStatics,typesGarrisonStatics,maxGarrisonUnits]; _garisonedPos pushBack format[' [" %1",%2,%3,%4,%5,%6,%7,%8,%9]',typeOf _building,(getPosATL _building) vectorDiff CENTER,getDir _building, 'true','true',oddsOfGarrison,maxGarrisonStatics,typesGarrisonStatics,maxGarrisonUnits];
}; };
} forEach _helpers; } forEach _landscape;
//diag_log format["CENTER = %1 | _landscape = %2",CENTER,_landscape]; //diag_log format["CENTER = %1 | _landscape = %2",CENTER,_landscape];
private _garrisonATL = []; private _garrisonATL = [];
{ {
@ -189,7 +190,7 @@ private _garrisonATL = [];
if !(_atl isEqualTo []) then { if !(_atl isEqualTo []) then {
if !((_atl select 0) isEqualTo []) then if !((_atl select 0) isEqualTo []) then
{ {
_garrisonATL pushBack (_atl select 0); _garrisonATL pushBack (format[" %1",_atl select 0]);
_garisonedBuildings pushBack _x; _garisonedBuildings pushBack _x;
_garisonedStatics append (_atl select 1); _garisonedStatics append (_atl select 1);
_garisonedUnits append (_atl select 2) _garisonedUnits append (_atl select 2)
@ -218,7 +219,7 @@ private _missionLootVehicles = [];
private _lootVehicles = _objects select { private _lootVehicles = _objects select {
((typeOf _x) isKindOf "AllVehicles") && ((typeOf _x) isKindOf "AllVehicles") &&
!((typeOf _x) isKindOf "Man") && !((typeOf _x) isKindOf "Man") &&
(_x get3DENAttribute "name" isEqualTo lootVehicleVariableName) (_x getVariable["lootvehicle",false])
}; };
diag_log format["_lootVehicles = %1",_lootVehicles]; diag_log format["_lootVehicles = %1",_lootVehicles];
{ {
@ -289,7 +290,7 @@ private _scubaGroups = [];
} forEach _scuba; } forEach _scuba;
private _lootContainers = []; private _lootContainers = [];
private _ammoBoxes = _objects select { private _ammoBoxes = _objects select { // "ReammoBox_F"
(((typeOf _x) isKindOf "ReammoBox") || ((typeOf _x) isKindOf "ReammoBox_F")) (((typeOf _x) isKindOf "ReammoBox") || ((typeOf _x) isKindOf "ReammoBox_F"))
}; };
diag_log format["_ammoBoxes = %1",_ammoboxes]; diag_log format["_ammoBoxes = %1",_ammoboxes];

View File

@ -85,7 +85,7 @@ class cfg3DEN
{ {
OnMissionLoad = "call blck3DEN_fnc_initializeAttributes"; OnMissionLoad = "call blck3DEN_fnc_initializeAttributes";
OnMissionNew = "call blck3DEN_fnc_initializeAttributes"; OnMissionNew = "call blck3DEN_fnc_initializeAttributes";
onHistoryChange = "call blck3DEN_fnc_updateObjects"; //onHistoryChange = "call blck3DEN_fnc_updateObjects";
}; };
}; };
@ -110,24 +110,6 @@ class cfg3DEN
}; };
}; };
class blck_garison: Combo
{
class Value
{
text = "Set Garison State";
items[] = {"No_Garison","Has_garison"};
};
class no_garison
{
text = "No Garison";
//action = "_this setVariable['garison',0];";
};
class has_garison
{
text = "Has Garison";
//action = "_this setVariable['garison',1];";
};
};
}; };
@ -148,24 +130,7 @@ class cfg3DEN
class CfgVehicles class CfgVehicles
{ {
class House;
class blck_House: House
{
class Attributes
{
class blck_garisoned
{
displayName = "Garrison";
toolTip = "Define Garrisoned Buildings";
control = "blck_garison";
expression = "_this setVariable ['garrisoned',_value];";
defaultValue = false;
unique = 0;
};
};
};
}; };
class ctrlMenuStrip; class ctrlMenuStrip;
@ -175,67 +140,6 @@ class display3DEN
{ {
class Controls class Controls
{ {
/*
class ContextMenu: ctrlMenu
{
class Items
{
items[] += {
"blck_markLootVehicle",
"blck_markGarisonBuildingPos"
};
class blck_markLootVehicle
{
text = "Designate Loot Vehicles";
value = false;
//action = "systemChat 'value toggled'";
conditionShow = "selectedObject";
items[] = {
"blck_clearLootVehicle",
"blck_designateLootVehicle"
};
};
class blck_clearLootVehicle
{
text = "Clear Loot Vehicle Settings";
value = false;
action = "[false] call blck3DEN_fnc_setLootVehicleStatus";
};
class blck_deisgnateLootVehicle
{
text = "Desinate Loot Vehicle";
value = true;
action = "[true] call blck3DEN_fnc_setLootVehicleStatus";
};
class blck_markGarisonBuildingPos
{
text = "Designate Garisoned Buildings";
value = false;
conditionShow = "selectedObject";
items[] = {
"blck_clearGarisonSettings",
"blck_designateGarisonedBuilding"
};
};
class blck_clearGarisonSettings
{
text = "Clear Garison Settings";
value = false;
conditionShow = "selectedObject";
action = "[false] call blck3DEN_fnc_setGarison";
};
class blck_designateGarisonedBuilding
{
text = "Set as Garisoned Building";
value = true;
conditionShow = "SelectedObject";
action = "[true] call blck3DEN_fnc_setGarison";
};
};
};
*/
class MenuStrip: ctrlMenuStrip class MenuStrip: ctrlMenuStrip
{ {
@ -258,12 +162,12 @@ class display3DEN
"blckMissionLocation", "blckMissionLocation",
"blckSeparator", "blckSeparator",
"blck_setGarrison", "blck_setGarrison",
"blck_getGarrisonInfo", //"blck_getGarrisonInfo",
"blck_getMissionGarrisonInfo", //"blck_getMissionGarrisonInfo",
"blckSeparator", "blckSeparator",
"blck_markLootVehicle", "blck_markLootVehicle",
"blck_getLootVehicleInfo", //"blck_getLootVehicleInfo",
"blck_getMissionLootVehicleInfo", //"blck_getMissionLootVehicleInfo",
"blckSeparator", "blckSeparator",
"blckSaveStaticMission", "blckSaveStaticMission",
"blckSaveDynamicMission", "blckSaveDynamicMission",
@ -472,7 +376,7 @@ class display3DEN
class blck_setGarrison class blck_setGarrison
{ {
text = "Set as Garrisoned Building"; text = "Garrisoned Building Settings";
toolTip = "Set garrison status of selected buildings"; toolTip = "Set garrison status of selected buildings";
items[] = { items[] = {
"blck_isGarrisoned", "blck_isGarrisoned",
@ -503,7 +407,7 @@ class display3DEN
}; };
class getMissionGarrisonInfo class getMissionGarrisonInfo
{ {
text = "Get garrison flag for selected buildings"; text = "Get garrison flag for the selected building";
toolTip = "The garrisoned flag state will be displayed for selected bulidings"; toolTip = "The garrisoned flag state will be displayed for selected bulidings";
value = 0; value = 0;
action = "call blck3DEN_fnc_getMissionGarrisonInfo"; action = "call blck3DEN_fnc_getMissionGarrisonInfo";
@ -511,13 +415,14 @@ class display3DEN
class blck_markLootVehicle class blck_markLootVehicle
{ {
text = "Designate Loot Vehicles"; text = "Loot Vehicle Settings";
value = false; value = false;
//action = "systemChat 'value toggled'"; //action = "systemChat 'value toggled'";
conditionShow = "selectedObject"; conditionShow = "selectedObject";
items[] = { items[] = {
"blck_designateLootVehicle",
"blck_clearLootVehicle", "blck_clearLootVehicle",
"blck_designateLootVehicle" "blck_getLootVehicleInfo"
}; };
}; };
class blck_clearLootVehicle class blck_clearLootVehicle