Skip to content

Commit

Permalink
Merge pull request #1667 from Vdauphin/Add-massacre
Browse files Browse the repository at this point in the history
Add: Massacre side mission
  • Loading branch information
Vdauphin authored Nov 17, 2024
2 parents 50dbe31 + 2db9e77 commit b76d511
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 1 deletion.
5 changes: 4 additions & 1 deletion =BTC=co@30_Hearts_and_Minds.Altis/core/def/mission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ if (isServer) then {
btc_type_bigbox = ["Box_FIA_Ammo_F", "Box_East_AmmoVeh_F", "CargoNet_01_box_F", "O_CargoNet_01_ammo_F"] + btc_type_Scrapyard;
btc_type_seat = ["Land_WoodenLog_F", "Land_CampingChair_V2_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V1_F"];
btc_type_sleepingbag = _allClassSorted select {_x isKindOf "Land_Sleeping_bag_F"};
btc_type_sleepingbag_folded = _allClassSorted select {_x isKindOf "Land_Sleeping_bag_folded_F"};
btc_type_tent = ["Land_TentA_F", "Land_TentDome_F"] + (_allClassSorted select {
_x isKindOf "Land_TentSolar_01_base_F" &&
{!(_x isKindOf "Land_TentSolar_01_folded_base_F")}
Expand All @@ -228,7 +229,7 @@ if (isServer) then {

//Side
btc_side_ID = 0;
btc_side_list = ["supply", "mines", "vehicle", "get_city", "tower", "civtreatment", "checkpoint", "convoy", "rescue", "capture_officer", "hostage", "hack", "kill", "EMP", "removeRubbish"]; // On ground (Side "convoy" and "capture_officer" are not design for map with different islands. Start and end city can be on different islands.)
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"]};
btc_side_list_use = [];
Expand Down Expand Up @@ -297,6 +298,8 @@ if (isServer) then {
btc_type_cargoEMP = _allClassSorted select {_x isKindOf "Cargo_EMP_base_F"};
btc_type_antenna = _allClassSorted select {_x isKindOf "OmniDirectionalAntenna_01_base_F"};
btc_type_solarPanel = _allClassSorted select {_x isKindOf "Land_SolarPanel_04_base_F"};
btc_type_sports = (_allClassSorted select {_x isKindOf "SportItems_base_F"}) select {"ball" in _x};
btc_type_bottles = (_allClassSorted select {_x isKindOf "Items_base_F"}) select {"Bottle" in _x and (not ("stack" in _x))};

// The two arrays below are prefixes of buildings and their multiplier.
// They will multiply the values of btc_rep_malus_building_destroyed and btc_rep_malus_building_damaged,
Expand Down
1 change: 1 addition & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/compile.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ if (isServer) then {
btc_side_fnc_EMP = compileScript ["core\fnc\side\EMP.sqf"];
btc_side_fnc_removeRubbish = compileScript ["core\fnc\side\removeRubbish.sqf"];
btc_side_fnc_pandemic = compileScript ["core\fnc\side\pandemic.sqf"];
btc_side_fnc_massacre = compileScript ["core\fnc\side\massacre.sqf"];

//TAG
btc_tag_fnc_initArea = compileScript ["core\fnc\tag\initArea.sqf"];
Expand Down
143 changes: 143 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/side/massacre.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@

/* ----------------------------------------------------------------------------
Function: btc_side_fnc_massacre
Description:
Move all dead civilians in a grave next to a church, inspired by Bucha massacre (Ukraine).
Parameters:
_taskID - Unique task ID. [String]
Returns:
Examples:
(begin example)
[false, "btc_side_fnc_massacre"] spawn btc_side_fnc_create;
(end)
Author:
Vdauphin
---------------------------------------------------------------------------- */

params [
["_taskID", "btc_side", [""]]
];

//// Choose an occupied City \\\\
private _useful = values btc_city_all select {
!((_x getVariable ["type", ""]) in ["NameLocal", "Hill", "NameMarine", "StrongpointArea"])
};
if (_useful isEqualTo []) exitWith {[] spawn btc_side_fnc_create;};
[_useful, true] call CBA_fnc_shuffle;
private _city = objNull;
private _church = objNull;
while {_useful isNotEqualTo []} do {
_city = _useful deleteAt 0;
_church = nearestTerrainObjects [_city, ["CHURCH", "CHAPEL"], 470];
if (_church isNotEqualTo []) then {
break;
};
};
if (_useful isEqualTo [] and _church isEqualTo []) exitWith {
[] spawn btc_side_fnc_create;
};

private _pos = getPos _city;
private _radius = _city getVariable ["cachingRadius", 0];
private _roads = _pos nearRoads _radius/2;
_roads = _roads select {isOnRoad _x};
if (_roads isEqualTo []) exitWith {[] spawn btc_side_fnc_create;};
private _road = selectRandom _roads;

private _churchSorted = _church apply {[_road distance _x, _x]};
_churchSorted sort true;
_church = _churchSorted select 0 select 1;
[_taskID, 42, _church, [_city getVariable "name", typeOf _church]] call btc_task_fnc_create;

private _group = createGroup civilian;
private _civilians = [];
private _composition = [];
private _tasksID = [];
private _objtTypes = btc_type_sports + ["Land_Suitcase_F"] + btc_type_sleepingbag_folded;
[_objtTypes, true] call CBA_fnc_shuffle;

for "_i" from 1 to (2 + round random 3) do {
private _roadPos = [_road, 3] call btc_ied_fnc_randomRoadPos;
_roadPos params ["_pos", "_dir"];
_pos = _pos getPos [random 5, _dir];
private _unit = _group createUnit [selectRandom btc_civ_type_units, _pos, [], 0, "CAN_COLLIDE"];
if (selectRandom [true, false]) then {
[position _unit, 0.05, 1.5] call BIS_fnc_flies;
};
_unit setDir random 360;
_unit setVariable ["btc_dont_delete", true];
_unit setDamage 1;
_civilians pushBack _unit;

private _obj = createVehicle [selectRandom (btc_type_bottles + ["Land_FMradio_F", "Land_MobilePhone_smart_F","Land_RiceBox_F", "Land_Orange_01_F"]), _pos, [], 2, "NONE"];
_obj addTorque [4,0,0];
_composition pushBack _obj;

_roadPos params ["_pos", "_dir"];
_pos = _pos getPos [random 2, _dir];
private _obj = createVehicle [selectRandom btc_type_bloods, _pos, [], 0, "CAN_COLLIDE"];
_obj setDir random 360;
_obj setVectorUp surfaceNormal _pos;
_composition pushBack _obj;

private _roadPos = [_road, 3] call btc_ied_fnc_randomRoadPos;
_roadPos params ["_pos", "_dir"];
_pos = _pos getPos [random 10, _dir];
private _obj = createVehicle [_objtTypes deleteAt 0, _pos, [], 0, "CAN_COLLIDE"];
_obj setDir random 360;
_obj addTorque [6,0,0];
_composition pushBack _obj;

private _civ_taskID = _taskID + "cv" + str _i;
_tasksID pushBack _civ_taskID;
[[_civ_taskID, _taskID], 43, _unit, [name _unit, typeOf _unit], false, false] call btc_task_fnc_create;
_unit setVariable ["btc_rep_playerKiller", _civ_taskID];
if (roadsConnectedTo _road isNotEqualTo []) then {
_road = (roadsConnectedTo _road) select 0;
};
};

["ace_placedInBodyBag", {
params ["_patient", "_bodyBag", "_isGrave", "_medic"];
if (
!(_patient in _thisArgs)
) exitWith {};

_thisArgs deleteAt (_thisArgs find _patient);
private _taskID = _patient getVariable ["btc_rep_playerKiller", ""];
if (_isGrave) then {
[{
params ["_restingPlace", "_taskID"];
private _church = nearestTerrainObjects [_restingPlace, ["CHURCH", "CHAPEL"], 50];
if (_church isEqualTo []) then {
[_taskID, "FAILED"] call BIS_fnc_taskSetState;
} else {
[_taskID, "SUCCEEDED"] call BIS_fnc_taskSetState;
};
}, [_bodyBag, _taskID], 0.2] call CBA_fnc_waitAndExecute;
} else {
_thisArgs pushBack _bodyBag;
[_taskID, _bodyBag] call BIS_fnc_taskSetDestination;
};
}, _civilians] call CBA_fnc_addEventHandlerArgs;

waitUntil {sleep 5;
_taskID call BIS_fnc_taskCompleted ||
_civilians select {!isNull _x} isEqualTo []
};

[[], _civilians + [_group] + _composition] call btc_fnc_delete;

if (_taskID call BIS_fnc_taskState isEqualTo "CANCELED") exitWith {};

if ("FAILED" in (_tasksID apply {_x call BIS_fnc_taskState})) then {
[_taskID, "FAILED"] call btc_task_fnc_setState;
} else {
[_taskID, "SUCCEEDED"] call btc_task_fnc_setState;
}
18 changes: 18 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/core/fnc/task/setDescription.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,24 @@ switch (_description) do {
];
_type = "search";
};
case 42 : {
_location params ["_name", "_typeOf_church"];
_description = [
format [localize "STR_BTC_HAM_SIDE_MASSACRE_DESC", _name] + ([_typeOf_church] call btc_fnc_typeOfPreview),
format [localize "STR_BTC_HAM_SIDE_MASSACRE_TITLE", _name],
format [localize "STR_BTC_HAM_SIDE_MASSACRE_TITLE", _name]
];
_type = "default";
};
case 43 : {
_location params ["_name", "_typeOf_civ"];
_description = [
(localize "STR_BTC_HAM_SIDE_MASSACRE_C_DESC") + ([_typeOf_civ] call btc_fnc_typeOfPreview),
format [localize "STR_BTC_HAM_SIDE_MASSACRE_C_TITLE", _name],
format [localize "STR_BTC_HAM_SIDE_MASSACRE_C_TITLE", _name]
];
_type = "interact";
};
};

[
Expand Down
12 changes: 12 additions & 0 deletions =BTC=co@30_Hearts_and_Minds.Altis/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1941,6 +1941,18 @@
<Czech>Prohledejte a dekontaminujte tohoto civilistu. Sledujte kapku červené krve a použijte svůj chemický detektor.</Czech>
<French>Recherchez et décontaminez ce civil. Suivez les gouttes de sang rouge et utilisez votre détecteur chimique.</French>
</Key>
<Key ID="STR_BTC_HAM_SIDE_MASSACRE_TITLE">
<Original>%1 massacre</Original>
</Key>
<Key ID="STR_BTC_HAM_SIDE_MASSACRE_DESC">
<Original>Civilians were brutally killed in %1. They are requesting your help to move dead bodies in a grave next to a religious building. To locate killed civilians go to the subtask.</Original>
</Key>
<Key ID="STR_BTC_HAM_SIDE_MASSACRE_C_TITLE">
<Original>%1</Original>
</Key>
<Key ID="STR_BTC_HAM_SIDE_MASSACRE_C_DESC">
<Original>Move this killed civilian next to a church and dig a grave.</Original>
</Key>
</Container>
</Package>
<Package name="Actions">
Expand Down

0 comments on commit b76d511

Please sign in to comment.