Skip to content

Commit a8b975e

Browse files
authored
Merge pull request #1674 from TomDraal/TomDraal-AdvChem
Add: Setting to toggle chemical side mission and chemical weapon cache probability
2 parents b76d511 + 4341a99 commit a8b975e

File tree

11 files changed

+31
-16
lines changed

11 files changed

+31
-16
lines changed

=BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ btc_p_civ_max_veh = "btc_p_civ_max_veh" call BIS_fnc_getParamValue;
8484

8585
//<< Gameplay options >>
8686
btc_p_sea = ("btc_p_sea" call BIS_fnc_getParamValue) isEqualTo 1;
87-
btc_p_chem = ("btc_p_chem" call BIS_fnc_getParamValue) isEqualTo 1;
87+
btc_p_chem_sides = ("btc_p_chem_sides" call BIS_fnc_getParamValue) isEqualTo 1;
88+
btc_p_chem_cache_probability = ("btc_p_chem_cache_probability" call BIS_fnc_getParamValue)/100;
8889
btc_p_spect = ("btc_p_spect" call BIS_fnc_getParamValue) isEqualTo 1;
8990
btc_p_side_mission_cycle = "btc_p_side_mission_cycle" call BIS_fnc_getParamValue;
9091

@@ -231,7 +232,7 @@ if (isServer) then {
231232
btc_side_ID = 0;
232233
btc_side_list = ["supply", "mines", "vehicle", "get_city", "tower", "civtreatment", "checkpoint", "convoy", "rescue", "capture_officer", "hostage", "hack", "kill", "EMP", "removeRubbish", "massacre"]; // On ground (Side "convoy" and "capture_officer" are not design for map with different islands. Start and end city can be on different islands.)
233234
if (btc_p_sea) then {btc_side_list append ["civtreatment_boat", "underwater_generator"]}; // On sea
234-
if (btc_p_chem) then {btc_side_list append ["chemicalLeak", "pandemic"]};
235+
if (btc_p_chem_sides) then {btc_side_list append ["chemicalLeak", "pandemic"]};
235236
btc_side_list_use = [];
236237
btc_type_tower = ["Land_Communication_F", "Land_TTowerBig_1_F", "Land_TTowerBig_2_F"];
237238
btc_type_barrel = ["Land_GarbageBarrel_01_F", "Land_BarrelSand_grey_F", "MetalBarrel_burning_F", "Land_BarrelWater_F", "Land_MetalBarrel_F", "Land_MetalBarrel_empty_F"];

=BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,18 @@ class Params {
401401
texts[] = {$STR_DISABLED,$STR_ENABLED};
402402
default = 1;
403403
};
404-
class btc_p_chem { // Chemical warfare
405-
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_CHEM"]);
404+
class btc_p_chem_sides { // Toggle chemical side missions:
405+
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_CHEM_SIDES"]);
406406
values[] = {0,1};
407407
texts[] = {$STR_DISABLED,$STR_ENABLED};
408408
default = 1;
409409
};
410+
class btc_p_chem_cache_probability { // Chemical weapon cache probability:
411+
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_CHEM_CACHE_PROBABILITY"]);
412+
values[]={0,10,20,30,40,50,60,70,80,90,100};
413+
texts[]={"0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"};
414+
default = 50;
415+
};
410416
class btc_p_spect { // Spectrum devices
411417
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_SPECT"]);
412418
values[] = {0,1};

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/cache/create.sqf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Description:
88
Parameters:
99
_cache_pos - Position of the cache. [Array]
1010
_p_chem - Allow chemical cache. [Boolean]
11-
_probabilityNotChemical - Probability to not create a chemical cache. [Number]
11+
_probabilityChemical - Probability to create a chemical cache. [Number]
1212
1313
Returns:
1414
@@ -28,13 +28,13 @@ Author:
2828

2929
params [
3030
["_cache_pos", btc_cache_pos, [[]]],
31-
["_p_chem", btc_p_chem, [true]],
32-
["_probabilityNotChemical", 0.5, [0]]
31+
["_p_chem", btc_p_chem_cache_probability > 0, [true]],
32+
["_probabilityChemical", btc_p_chem_cache_probability, [0]]
3333
];
3434

3535
private _isChem = false;
3636
if (_p_chem) then {
37-
_isChem = random 1 > _probabilityNotChemical;
37+
_isChem = random 1 < _probabilityChemical;
3838
};
3939
private _cacheType = selectRandom (btc_cache_type select 0);
4040
btc_cache_obj = _cacheType createVehicle _cache_pos;

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/chem/checkLoop.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Author:
1919
2020
---------------------------------------------------------------------------- */
2121

22-
if !(btc_p_chem) exitWith {};
22+
if !(btc_p_chem_sides || (btc_p_chem_cache_probability > 0)) exitWith {};
2323

2424
private _bodyParts = ["head","body","hand_l","hand_r","leg_l","leg_r"];
2525

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/chem/handleShower.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Author:
2020
2121
---------------------------------------------------------------------------- */
2222

23-
if !(btc_p_chem) exitWith {};
23+
if !(btc_p_chem_sides || (btc_p_chem_cache_probability > 0)) exitWith {};
2424

2525
params [
2626
["_minDistance", 5, [2]]

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/civ/create_patrol.sqf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ Author:
2626
params [
2727
["_group", grpNull, [grpNull]],
2828
["_active_city", objNull, [objNull]],
29-
["_area", btc_patrol_area, [0]],
30-
["_p_chem", btc_p_chem, [false]]
29+
["_area", btc_patrol_area, [0]]
3130
];
3231

3332
if (isNil "btc_civilian_id") then {btc_civilian_id = -1;};

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ btc_cache_pos = _cache_pos;
102102
btc_cache_n = _cache_n;
103103
btc_cache_info = _cache_info;
104104

105-
[_cache_pos, btc_p_chem, [1, 0] select _isChem] call btc_cache_fnc_create;
105+
[_cache_pos, btc_p_chem_cache_probability > 0, [1, 0] select _isChem] call btc_cache_fnc_create;
106106
btc_cache_obj setVariable ["btc_cache_unitsSpawned", _cache_unitsSpawned];
107107

108108
btc_cache_markers = [];

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load_old.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ btc_cache_pos = _cache_pos;
100100
btc_cache_n = _cache_n;
101101
btc_cache_info = _cache_info;
102102

103-
[_cache_pos, btc_p_chem, [1, 0] select _isChem] call btc_cache_fnc_create;
103+
[_cache_pos, btc_p_chem_cache_probability > 0, [1, 0] select _isChem] call btc_cache_fnc_create;
104104
btc_cache_obj setVariable ["btc_cache_unitsSpawned", _cache_unitsSpawned];
105105

106106
btc_cache_markers = [];

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/player.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ _player addEventHandler ["WeaponAssembled", {
7171
_this remoteExecCall ["btc_log_fnc_init", 2];
7272
}] call CBA_fnc_addEventHandler;
7373

74-
if (btc_p_chem) then {
74+
if (btc_p_chem_sides || (btc_p_chem_cache_probability > 0)) then {
7575
// Add biopsy
7676
[missionNamespace, "probingEnded", btc_chem_fnc_biopsy] call BIS_fnc_addScriptedEventHandler;
7777

=BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/server.sqf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ if (btc_p_auto_db) then {
8585
};
8686
}];
8787
};
88-
if (btc_p_chem) then {
88+
89+
if (btc_p_chem_sides || (btc_p_chem_cache_probability > 0)) then {
8990
["ace_cargoLoaded", btc_chem_fnc_propagate] call CBA_fnc_addEventHandler;
9091
["AllVehicles", "GetIn", {[_this select 0, _this select 2] call btc_chem_fnc_propagate}] call CBA_fnc_addClassEventHandler;
9192
["DeconShower_01_F", "init", {

0 commit comments

Comments
 (0)