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";
switch (count _objecct) do
diag_log format["getGarrisonInfo: _object = %1",format["%1",_object]];
if (_objects isEqualTo []) then
{
case 0: {_message = "No Enterable Buildings selected"};
case 1: {
if (_object getVariable["garrisoned",false]) then
{
_message = format["Building %1 IS Garrisoned",typeOf _object];
_message = "No Buildings Selected";
} else {
if (count _objects == 1) then
{
if ((_objects select 0) getVariable["garrisoned",false]) then
{
_message = format["Building %1 IS Garrisoned",typeOf (_objects select 0)];
} else {
_message = format["Building %1 is NOT Garrisoned",typeOf _object];
_message = format["Building %1 is NOT Garrisoned",typeOf (_objects select 0)];
};
};
default {_message = "Select a single building then try again"};
};
[_message,"Status"] call BIS_fnc_3DENShowMessage;
} else {
_message = format["Select a single building then try again"];
};
};
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 "_message";
switch (count _objects) do
{
case 0: {_message = "Select a vehicle and try again"};
case 1: {
if (_objects isEqualTo []) then
{
_message = "No Vehicles Selected";
} else {
if (count _objects == 1) 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 {
_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;
diag_log _message;
[_message,"Status"] call BIS_fnc_3DENShowMessage;

View File

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

View File

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

View File

@ -163,21 +163,22 @@ private _garisonedUnits = [];
private _landscape = _objects select{
!(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 _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;
// 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
_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];
private _garrisonATL = [];
{
@ -189,7 +190,7 @@ private _garrisonATL = [];
if !(_atl isEqualTo []) then {
if !((_atl select 0) isEqualTo []) then
{
_garrisonATL pushBack (_atl select 0);
_garrisonATL pushBack (format[" %1",_atl select 0]);
_garisonedBuildings pushBack _x;
_garisonedStatics append (_atl select 1);
_garisonedUnits append (_atl select 2)
@ -218,7 +219,7 @@ private _missionLootVehicles = [];
private _lootVehicles = _objects select {
((typeOf _x) isKindOf "AllVehicles") &&
!((typeOf _x) isKindOf "Man") &&
(_x get3DENAttribute "name" isEqualTo lootVehicleVariableName)
(_x getVariable["lootvehicle",false])
};
diag_log format["_lootVehicles = %1",_lootVehicles];
{
@ -289,7 +290,7 @@ private _scubaGroups = [];
} forEach _scuba;
private _lootContainers = [];
private _ammoBoxes = _objects select {
private _ammoBoxes = _objects select { // "ReammoBox_F"
(((typeOf _x) isKindOf "ReammoBox") || ((typeOf _x) isKindOf "ReammoBox_F"))
};
diag_log format["_ammoBoxes = %1",_ammoboxes];

View File

@ -85,7 +85,7 @@ class cfg3DEN
{
OnMissionLoad = "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 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;
@ -175,67 +140,6 @@ class display3DEN
{
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
{
@ -258,12 +162,12 @@ class display3DEN
"blckMissionLocation",
"blckSeparator",
"blck_setGarrison",
"blck_getGarrisonInfo",
"blck_getMissionGarrisonInfo",
//"blck_getGarrisonInfo",
//"blck_getMissionGarrisonInfo",
"blckSeparator",
"blck_markLootVehicle",
"blck_getLootVehicleInfo",
"blck_getMissionLootVehicleInfo",
//"blck_getLootVehicleInfo",
//"blck_getMissionLootVehicleInfo",
"blckSeparator",
"blckSaveStaticMission",
"blckSaveDynamicMission",
@ -472,7 +376,7 @@ class display3DEN
class blck_setGarrison
{
text = "Set as Garrisoned Building";
text = "Garrisoned Building Settings";
toolTip = "Set garrison status of selected buildings";
items[] = {
"blck_isGarrisoned",
@ -503,7 +407,7 @@ class display3DEN
};
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";
value = 0;
action = "call blck3DEN_fnc_getMissionGarrisonInfo";
@ -511,13 +415,14 @@ class display3DEN
class blck_markLootVehicle
{
text = "Designate Loot Vehicles";
text = "Loot Vehicle Settings";
value = false;
//action = "systemChat 'value toggled'";
conditionShow = "selectedObject";
items[] = {
"blck_clearLootVehicle",
"blck_designateLootVehicle"
"blck_designateLootVehicle",
"blck_clearLootVehicle",
"blck_getLootVehicleInfo"
};
};
class blck_clearLootVehicle