Skip to content

Commit

Permalink
fix for vehicle init, add dshkm
Browse files Browse the repository at this point in the history
  • Loading branch information
nomisum committed Jul 10, 2020
1 parent 56b52c7 commit bd6e5fa
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion BC_buyables/factions/mudscha.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class mudscha {
displayName = "Static Dshkm";
description = "Spawns in Radio Truck Cargo.";
stock = 1;
code = "diag_log str (_this); private _dshkm = 'rhsgref_nat_DSHKM' createVehicle [0,0,0]; [_dshkm, _this select 1] call ace_cargo_fnc_loadItem;";
code = "diag_log str (_this); ['rhsgref_nat_DSHKM', _this select 1] call ace_cargo_fnc_loadItem;";
spawnEmpty = 1;
};
};
Expand Down
8 changes: 4 additions & 4 deletions BC_buyables/factions/sovjetGM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,21 @@ class sovjetGM {

class gm_gc_airforce_mi2t {
displayName = "Mi-2 PKM";
description = "Light Armed Helicopter.";
description = "Light Armed Helicopter. No Cargo Seats!";
price = 10;
stock = 1;
wheelCargo = 2;
spawnEmpty = 1;
condition = "true";
vehicleInit = "[['gm_gc_brb',1],['cablecutter_unhide',0,'fan_unhide',0,'plugs_unhide',0,'skids_unhide',0,'winch_unhide',0,'fueltank_left_unhide',0,'fueltank_right_unhide',0]]";
crewHelmet = "gm_gc_army_headgear_crewhat_80_blk";
code = "if (!BC_IS_WOODLAND) then {(_this select 0) setObjectTextureGlobal [0, '#(rgb,8,8,3)color(0.25,0.2,0.1,1)']; (_this select 0) setObjectTextureGlobal [1, '#(rgb,8,8,3)color(0.25,0.2,0.1,1)'];}; [_this select 0,'gm_insignia_ur_star_01',5,0] call gm_core_vehicles_fnc_vehicleMarkingsUpdateAttributes;";
code = "(_this select 0) lockCargo true; if (!BC_IS_WOODLAND) then {(_this select 0) setObjectTextureGlobal [0, '#(rgb,8,8,3)color(0.25,0.2,0.1,1)']; (_this select 0) setObjectTextureGlobal [1, '#(rgb,8,8,3)color(0.25,0.2,0.1,1)'];}; [_this select 0,'gm_insignia_ur_star_01',5,0] call gm_core_vehicles_fnc_vehicleMarkingsUpdateAttributes;";

};

class gm_gc_airforce_mi2p {
class gm_pl_airforce_mi2p {
displayName = "Mi-2 Transport";
description = "Light Transport Helicopter";
description = "Light Transport Helicopter with 7 Cargo Seats.";
price = 10;
stock = 1;
wheelCargo = 2;
Expand Down
3 changes: 3 additions & 0 deletions BC_buymenu/functions/fn_buyVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ _vehicle setPos _spawnPosition;
//bis vehicle init
private _init = [(missionConfigFile >> "CfgGradBuymenu" >> _baseConfigName >> _categoryConfigName >> _itemConfigName >> "vehicleInit"), "text", "[[],[]]"] call CBA_fnc_getConfigEntry;
private _compiledInit = call compile _init;

diag_log ("categoryConfigName: " + _categoryConfigName);
diag_log ("compiled init: " + str _compiledInit);
_compiledInit params ["_initTexture", "_initAnimationsource"];

[_vehicle, _initTexture, _initAnimationsource] call BIS_fnc_initVehicle;
Expand Down
22 changes: 12 additions & 10 deletions BC_buymenu/functions/fn_createGUI.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ private _categoriesExtracted = [];
_categoryConfigName = configName _categoryConfig
};

diag_log ("_categoryConfigName " + _categoryConfigName);

private _valueMaxInThisCat = [(_categoryConfig >> "maxBuyCount"), "number", 0] call CBA_fnc_getConfigEntry;
private _isSpecial = ([(_categoryConfig >> "kindOf"), "text", ""] call CBA_fnc_getConfigEntry) isEqualTo "Special";
private _minPlayerCount = [(_categoryConfig >> "minPlayerCount"), "number", 0] call CBA_fnc_getConfigEntry;
Expand All @@ -41,7 +43,7 @@ private _categoriesExtracted = [];
if (call compile _condition) then {
private _itemConfigName = configName _itemConfig;

private _data = [_baseConfig, _itemConfig, false] call BC_buymenu_fnc_getVehicleParams;
private _data = [_baseConfig, _categoryConfig, _itemConfig, false] call BC_buymenu_fnc_getVehicleParams;
_allItemsExtracted pushBack _data;
// diag_log str (_allItemsExtracted);
// copyToClipboard str (_allItemsExtracted);
Expand Down Expand Up @@ -133,7 +135,7 @@ for "_i" from 0 to (count _categoriesExtracted - 1) do {
private _multiplicator = _i * 5;

private _baseConfigName = _categoriesExtracted select _i select 0;
private _categoryName = _categoriesExtracted select _i select 1;
private _categoryConfigName = _categoriesExtracted select _i select 1;
private _minPlayerCount = _categoriesExtracted select _i select 2;
private _valueMaxInThisCat = _categoriesExtracted select _i select 3;
private _spawnCone = _categoriesExtracted select _i select 4;
Expand Down Expand Up @@ -165,7 +167,7 @@ for "_i" from 0 to (count _categoriesExtracted - 1) do {
_headline ctrlsetFont "RobotoCondensedBold";
_headline ctrlSetBackgroundColor [0,0,0,0];
_headline ctrlSetTextColor [1,1,1,1];
_headline ctrlSetStructuredText parseText ("<t size='2' align='center' color='#666666'>" + _categoryName + "</t>");
_headline ctrlSetStructuredText parseText ("<t size='2' align='center' color='#666666'>" + _categoryConfigName + "</t>");
_headline ctrlSetPosition [
_columnWidth * _multiplicator + safezoneX + _columnWidth,
_rowHeight * 4 + safezoneY,
Expand All @@ -181,7 +183,7 @@ for "_i" from 0 to (count _categoriesExtracted - 1) do {



private _valueChosenInThisCat = [_baseConfigName, _categoryName] call BC_buymenu_fnc_getCatGlobalCount;
private _valueChosenInThisCat = [_baseConfigName, _categoryConfigName] call BC_buymenu_fnc_getCatGlobalCount;
_ctrlChosenInThisCat setVariable ["value", _valueChosenInThisCat];

private _formatting = "<t size='1' align='center' color='#333333'>";
Expand Down Expand Up @@ -244,7 +246,7 @@ for "_i" from 0 to (count _categoriesExtracted - 1) do {
_ctrlItemCount setVariable ["valueMaxInThisCat", _valueMaxInThisCat];
_ctrlItemCount setVariable ["baseConfigName", _baseConfigName];
_ctrlItemCount setVariable ["itemConfigName", _itemConfigName];
_ctrlItemCount setVariable ["categoryName", _categoryName];
_ctrlItemCount setVariable ["categoryConfigName", _categoryConfigName];
_ctrlItemCount setVariable ["crew", _crew];
_ctrlItemCount setVariable ["cargo", _cargo];
_ctrlItemCount setVariable ["ctrlCrew", _ctrlCrewCount];
Expand Down Expand Up @@ -419,7 +421,7 @@ if (player getVariable ["BC_potentToBuy", false]) then {
private _button = _display ctrlCreate ["RscStructuredText", -1];
_button ctrlsetFont "RobotoCondensedBold";
_button ctrlSetBackgroundColor [108/255,170/255,204/255,1]; // 108, 170, 204
_button ctrlSetStructuredText parseText "<t size='2.5' align='center' shadow='0' color='#20333D'>S P A W N</t>";
_button ctrlSetStructuredText parseText "<t size='2' align='center' shadow='0' color='#20333D'>S P A W N</t>";
_button ctrlSetPosition [
safezoneX + _columnWidth,
_rowHeight * 35 + safezoneY,
Expand Down Expand Up @@ -470,7 +472,7 @@ if (player getVariable ["BC_potentToBuy", false]) then {

for "_i" from 0 to (count _categoriesExtracted - 1) do {
private _baseConfigName = _categoriesExtracted select _i select 0;
private _categoryName = _categoriesExtracted select _i select 1;
private _categoryConfigName = _categoriesExtracted select _i select 1;
private _data = _categoriesExtracted select _i select 5;

if (count _data < 1) exitWith {};
Expand Down Expand Up @@ -522,13 +524,13 @@ if (player getVariable ["BC_potentToBuy", false]) then {
};

// category values
private _catCacheIdentifier = format ["BC_buymenu_catValueCache_%1_%2", _baseConfigName, _categoryName];
private _catCacheIdentifier = format ["BC_buymenu_catValueCache_%1_%2", _baseConfigName, _categoryConfigName];
private _catCacheValue = missionNamespace getVariable [_catCacheIdentifier, 0];

// diag_log format ["getting cache for %1, %2", _catCacheIdentifier, _catCacheValue];

// store values for future usage
private _catValueIdentifier = format ["BC_buymenu_catValueValues_%1_%2", _baseConfigName, _categoryName];
private _catValueIdentifier = format ["BC_buymenu_catValueValues_%1_%2", _baseConfigName, _categoryConfigName];
private _existingCatCountValue = missionNamespace getVariable [_catValueIdentifier, 0];

// diag_log format ["getting value for %1, %2", _catValueIdentifier, _existingCatCountValue];
Expand All @@ -542,7 +544,7 @@ if (player getVariable ["BC_potentToBuy", false]) then {
if (_exitCode == 2) then {
// delete spawn queue
private _identifier = format ["BC_buymenu_spawnQueue_%1", _baseConfigName];
private _currentQueue = missionNamespace setVariable [_identifier, []];
missionNamespace setVariable [_identifier, []];
};
};
}];
Expand Down
7 changes: 3 additions & 4 deletions BC_buymenu/functions/fn_getVehicleParams.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
params ["_baseConfig", "_itemConfig", "_isStartVehicle"];
params ["_baseConfig", "_categoryConfig", "_itemConfig", "_isStartVehicle"];

private _baseConfigName = configName _baseConfig;
private _categoryConfig = (([_itemConfig, false] call BIS_fnc_returnParents) select 0);
private _categoryConfigName = configName _categoryConfig;
private _itemConfigName = configName _itemConfig;

Expand All @@ -10,7 +9,7 @@ private _driverGPS = [(_categoryConfig >> "driverGPS"), "text", "true"] call CBA
private _crewHelmet = [(_categoryConfig >> "crewHelmet"), "text", ""] call CBA_fnc_getConfigEntry;
private _disableTIEquipment = [(_categoryConfig >> "disableTIEquipment"), "text", "true"] call CBA_fnc_getConfigEntry;

diag_log format ["_baseConfig %1, _itemConfig %2, _isStartVehicle %3", _baseConfig, _itemConfig, _isStartVehicle];
diag_log format ["_baseConfig %1, _categoryConfigName %2, _itemConfig %3, _isStartVehicle %4", _baseConfig, _categoryConfigName, _itemConfig, _isStartVehicle];


private _canMoveDuringTransmission = [(_baseConfig >> "StartVehicle" >> "canMoveDuringTransmission"), "text", "false"] call CBA_fnc_getConfigEntry isEqualTo "true";
Expand Down Expand Up @@ -51,7 +50,7 @@ if (!isNull (configFile >> "CfgVehicles" >> _itemConfigName >> "maxSpeed")) then
};

// add missing stuff
private _categoryConfigName = if (_isStartVehicle) then { "StartVehicle" } else { _baseConfigName };
private _categoryConfigName = if (_isStartVehicle) then { "StartVehicle" } else { _categoryConfigName };
private _baseConfigName = configName (([_baseConfig, false] call BIS_fnc_returnParents) select 0);


Expand Down
2 changes: 1 addition & 1 deletion BC_buymenu/functions/fn_spawnStartVehicles.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ diag_log format ["fn_spawnStartVehicles: got positions %1 - %2", _opforPosition,
diag_log format ["_buyables %1", _buyables];

private _type = [_buyables] call BC_buymenu_fnc_getStartVehicleClassname;
private _data = [_buyables, _type, true] call BC_buymenu_fnc_getVehicleParams;
private _data = [_buyables, (missionConfigFile >> "CfgGradBuymenu" >> (configName _buyables) >> "StartVehicle"), _type, true] call BC_buymenu_fnc_getVehicleParams;

diag_log format ["call to buyvehicle: %1 - %2 - %3", _side, _position, _data];
// todo set dir according to roads
Expand Down
10 changes: 5 additions & 5 deletions mission.sqm
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ class EditorData
toggles=1;
class ItemIDProvider
{
nextID=1546;
nextID=1622;
};
class MarkerIDProvider
{
nextID=16;
};
class Camera
{
pos[]={1678.2623,9.266777,5524.7427};
dir[]={-0.77485776,-0.38192493,-0.50394505};
up[]={-0.32026142,0.92413688,-0.20829108};
aside[]={-0.54526657,-8.0451719e-007,0.83839589};
pos[]={1654.0718,27.026608,5580.4976};
dir[]={0.59885079,-0.34613436,0.72237325};
up[]={0.2209906,0.93812895,0.26657429};
aside[]={0.76994479,-4.2637112e-008,-0.63829017};
};
};
binarizationWanted=0;
Expand Down

0 comments on commit bd6e5fa

Please sign in to comment.