Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Setting to toggle chemical side mission and chemical weapon cache probability #1674

Merged
merged 11 commits into from
Dec 19, 2024
Merged
5 changes: 3 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ btc_p_civ_max_veh = "btc_p_civ_max_veh" call BIS_fnc_getParamValue;

//<< Gameplay options >>
btc_p_sea = ("btc_p_sea" call BIS_fnc_getParamValue) isEqualTo 1;
btc_p_chem = ("btc_p_chem" call BIS_fnc_getParamValue) isEqualTo 1;
btc_p_chem_sides = ("btc_p_chem_sides" call BIS_fnc_getParamValue) isEqualTo 1;
btc_p_chem_cache_probability = ("btc_p_chem_cache_probability" call BIS_fnc_getParamValue)/100;
btc_p_spect = ("btc_p_spect" call BIS_fnc_getParamValue) isEqualTo 1;
btc_p_side_mission_cycle = "btc_p_side_mission_cycle" call BIS_fnc_getParamValue;

Expand Down Expand Up @@ -231,7 +232,7 @@ if (isServer) then {
btc_side_ID = 0;
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.)
if (btc_p_sea) then {btc_side_list append ["civtreatment_boat", "underwater_generator"]}; // On sea
if (btc_p_chem) then {btc_side_list append ["chemicalLeak", "pandemic"]};
if (btc_p_chem_sides) then {btc_side_list append ["chemicalLeak", "pandemic"]};
btc_side_list_use = [];
btc_type_tower = ["Land_Communication_F", "Land_TTowerBig_1_F", "Land_TTowerBig_2_F"];
btc_type_barrel = ["Land_GarbageBarrel_01_F", "Land_BarrelSand_grey_F", "MetalBarrel_burning_F", "Land_BarrelWater_F", "Land_MetalBarrel_F", "Land_MetalBarrel_empty_F"];
Expand Down
10 changes: 8 additions & 2 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/def/param.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,18 @@ class Params {
texts[] = {$STR_DISABLED,$STR_ENABLED};
default = 1;
};
class btc_p_chem { // Chemical warfare
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_CHEM"]);
class btc_p_chem_sides { // Advanced Chemical warfare setting to activate / deactivate chemical side missions
TomDraal marked this conversation as resolved.
Show resolved Hide resolved
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_CHEM_SIDES"]);
values[] = {0,1};
texts[] = {$STR_DISABLED,$STR_ENABLED};
default = 1;
};
class btc_p_chem_cache_probability { // Advanced Chemical warfare setting to change probability of a chemical weapon cache
TomDraal marked this conversation as resolved.
Show resolved Hide resolved
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_CHEM_CACHE_PROBABILITY"]);
values[]={0,10,20,30,40,50,60,70,80,90,100};
texts[]={"0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%"};
default = 50;
};
class btc_p_spect { // Spectrum devices
title = __EVAL(format [" %1", localize "STR_BTC_HAM_PARAM_GAMEPLAY_SPECT"]);
values[] = {0,1};
Expand Down
8 changes: 4 additions & 4 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/cache/create.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Description:
Parameters:
_cache_pos - Position of the cache. [Array]
_p_chem - Allow chemical cache. [Boolean]
_probabilityNotChemical - Probability to not create a chemical cache. [Number]
_probabilityChemical - Probability to create a chemical cache. [Number]

Returns:

Expand All @@ -28,13 +28,13 @@ Author:

params [
["_cache_pos", btc_cache_pos, [[]]],
["_p_chem", btc_p_chem, [true]],
["_probabilityNotChemical", 0.5, [0]]
["_p_chem", (btc_p_chem_cache_probability > 0), [true]],
TomDraal marked this conversation as resolved.
Show resolved Hide resolved
["_probabilityChemical", btc_p_chem_cache_probability, [0]]
];

private _isChem = false;
if (_p_chem) then {
_isChem = random 1 > _probabilityNotChemical;
_isChem = random 1 < _probabilityChemical;
};
private _cacheType = selectRandom (btc_cache_type select 0);
btc_cache_obj = _cacheType createVehicle _cache_pos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Author:

---------------------------------------------------------------------------- */

if !(btc_p_chem) exitWith {};
private _isChem = (btc_p_chem_sides || (btc_p_chem_cache_probability > 0));
TomDraal marked this conversation as resolved.
Show resolved Hide resolved

if !(_isChem) exitWith {};

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ Author:

---------------------------------------------------------------------------- */

if !(btc_p_chem) exitWith {};
private _isChem = (btc_p_chem_sides || (btc_p_chem_cache_probability > 0));
TomDraal marked this conversation as resolved.
Show resolved Hide resolved

if !(_isChem) exitWith {};

params [
["_minDistance", 5, [2]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ Author:
params [
["_group", grpNull, [grpNull]],
["_active_city", objNull, [objNull]],
["_area", btc_patrol_area, [0]],
["_p_chem", btc_p_chem, [false]]
["_area", btc_patrol_area, [0]]
];

if (isNil "btc_civilian_id") then {btc_civilian_id = -1;};
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ btc_cache_pos = _cache_pos;
btc_cache_n = _cache_n;
btc_cache_info = _cache_info;

[_cache_pos, btc_p_chem, [1, 0] select _isChem] call btc_cache_fnc_create;
[_cache_pos, (btc_p_chem_cache_probability > 0), [1, 0] select _isChem] call btc_cache_fnc_create;
TomDraal marked this conversation as resolved.
Show resolved Hide resolved
btc_cache_obj setVariable ["btc_cache_unitsSpawned", _cache_unitsSpawned];

btc_cache_markers = [];
Expand Down
2 changes: 1 addition & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/db/load_old.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ btc_cache_pos = _cache_pos;
btc_cache_n = _cache_n;
btc_cache_info = _cache_info;

[_cache_pos, btc_p_chem, [1, 0] select _isChem] call btc_cache_fnc_create;
[_cache_pos, (btc_p_chem_cache_probability > 0), [1, 0] select _isChem] call btc_cache_fnc_create;
TomDraal marked this conversation as resolved.
Show resolved Hide resolved
btc_cache_obj setVariable ["btc_cache_unitsSpawned", _cache_unitsSpawned];

btc_cache_markers = [];
Expand Down
4 changes: 3 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/player.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ _player addEventHandler ["WeaponAssembled", {
_this remoteExecCall ["btc_log_fnc_init", 2];
}] call CBA_fnc_addEventHandler;

if (btc_p_chem) then {
private _isChem = (btc_p_chem_sides || (btc_p_chem_cache_probability > 0));
TomDraal marked this conversation as resolved.
Show resolved Hide resolved

if (_isChem) then {
// Add biopsy
[missionNamespace, "probingEnded", btc_chem_fnc_biopsy] call BIS_fnc_addScriptedEventHandler;

Expand Down
5 changes: 4 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/eh/server.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ if (btc_p_auto_db) then {
};
}];
};
if (btc_p_chem) then {

private _isChem = (btc_p_chem_sides || (btc_p_chem_cache_probability > 0));
TomDraal marked this conversation as resolved.
Show resolved Hide resolved

if (_isChem) then {
["ace_cargoLoaded", btc_chem_fnc_propagate] call CBA_fnc_addEventHandler;
["AllVehicles", "GetIn", {[_this select 0, _this select 2] call btc_chem_fnc_propagate}] call CBA_fnc_addClassEventHandler;
["DeconShower_01_F", "init", {
Expand Down
8 changes: 8 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,14 @@
<French>Guerre chimique:</French>
<Czech>Chemická válka:</Czech>
</Key>
<Key ID="STR_BTC_HAM_PARAM_GAMEPLAY_CHEM_SIDES">
<Original>Chemical side missions:</Original>
<French>Missions secondaires chimiques:</French>
TomDraal marked this conversation as resolved.
Show resolved Hide resolved
</Key>
<Key ID="STR_BTC_HAM_PARAM_GAMEPLAY_CHEM_CACHE_PROBABILITY">
<Original>Chemical weapon cache probability:</Original>
<French>Probabilité de cache d'armes chimique:</French>
TomDraal marked this conversation as resolved.
Show resolved Hide resolved
</Key>
<Key ID="STR_BTC_HAM_PARAM_GAMEPLAY_SPECT">
<Original>Spectrum devices:</Original>
<French>Appareils à spectre:</French>
Expand Down