Skip to content

Commit

Permalink
add par grave toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
tbox1911 committed May 2, 2024
1 parent 62c84c3 commit cefe3fc
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 22 deletions.
8 changes: 4 additions & 4 deletions core.liberation/addons/PAR/PAR_ActionManager.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private _checkAction = {
while {true} do {
_wnded_list = (getPos player) nearEntities ["CAManBase", 30];
_wnded_list = _wnded_list select {
side _x == GRLIB_side_civilian &&
alive _x && side _x == GRLIB_side_civilian &&
(_x getVariable ["PAR_wounded", false]) &&
([_x] call _checkAction) &&
isNull objectParent _x &&
Expand All @@ -22,19 +22,19 @@ while {true} do {
if (count _wnded_list > 0) then {
{
_unit = _x;
_id1 = _unit addAction ["<t color='#C90000'>" + localize "STR_PAR_AC_02" + "</t>", "addons\PAR\PAR_fn_drag.sqf", ["action_drag"], 9, false, true, "", "(_target getVariable ['PAR_isUnconscious', false]) && !PAR_isDragging", 3];
_id1 = _unit addAction ["<t color='#C90000'>" + localize "STR_PAR_AC_02" + "</t>", "addons\PAR\PAR_fn_drag.sqf", ["action_drag"], 9, false, true, "", "alive _target && (_target getVariable ['PAR_isUnconscious', false]) && !PAR_isDragging", 3];
_id2 = _unit addAction ["<t color='#C90000'>" + localize "STR_PAR_AC_03" + "</t>", { PAR_isDragging = false }, ["action_release"], 10, true, true, "", "PAR_isDragging"];
_id3 = [
_unit,
"<t color='#00C900'>" + localize "STR_PAR_AC_01" + "</t>",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa","\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"
(_this distance _target <= 3) &&
(alive _target && _this distance _target <= 3) &&
(_target getVariable ['PAR_isUnconscious', false]) &&
(_target getVariable ['PAR_isDragged',0] == 0) &&
([_this] call PAR_has_medikit || [_this] call PAR_is_medic)
",
"(_caller distance _target < 3)",
"(alive _target && _caller distance _target < 3)",
{
[(_target getVariable ["PAR_myMedic", objNull]), _target] call PAR_fn_medicRelease;
if (local _caller) then { _target setVariable ["PAR_myMedic", _caller] };
Expand Down
39 changes: 22 additions & 17 deletions core.liberation/addons/PAR/PAR_fn_death.sqf
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
params ["_unit"];
private ["_pos", "_grave", "_grave_box", "_old_graves", "_uniform", "_vest", "_backpack" ];

_unit connectTerminalToUAV objNull;
[(_unit getVariable ['PAR_myMedic', objNull]), _unit] call PAR_fn_medicRelease;
_unit setVariable ['PAR_wounded', false];

removeAllWeapons _unit;
if (_unit == player) then {
titleText ["" ,"BLACK FADED", 100];
_unit connectTerminalToUAV objNull;

// Grave + Save Stuff
_pos = getPosATL _unit;
if ( isNull objectParent player &&
private _pos = getPosATL _unit;
if ( PAR_grave == 1 && isNull objectParent player &&
!([_unit, "LHD", GRLIB_capture_size] call F_check_near) &&
(_pos select 2) <= 2 && !(surfaceIsWater _pos)
) then {
// Clean body
removeAllActions _unit;
removeAllWeapons _unit;
_unit setPosATL ((markerPos GRLIB_respawn_marker) vectorAdd [floor random 5, floor random 5, 0.5]);

// Save Stuff
[PAR_grave_box] call F_clearCargo;
[PAR_grave_box, PAR_backup_loadout] call F_setCargo;

//_unit hideObject true;
_unit setPosATL ((markerPos GRLIB_respawn_marker) vectorAdd [floor(random 5), floor(random 5), 1]);

// create grave
_grave = (selectRandom PAR_graves) createVehicle _pos;
private _grave = (selectRandom PAR_graves) createVehicle _pos;
_grave allowDamage false;
_grave setPosATL _pos;
_grave setvariable ["PAR_grave_message", format ["- R.I.P - %1", name player], true];
_grave_dir = getDir _grave;

// remove old grave (max: 3)
_old_graves = _unit getVariable ["PAR_player_graves", []];
private _old_graves = _unit getVariable ["PAR_player_graves", []];
_old_graves pushback _grave;
if (count _old_graves > 3) then {
deleteVehicle (_old_graves select 0);
Expand All @@ -37,13 +38,16 @@ if (_unit == player) then {
_unit setvariable ["PAR_player_graves", _old_graves];

// attach grave box
_grave_box_pos = (getposATL _grave) vectorAdd ([[-1.75, 0, 0], -_grave_dir] call BIS_fnc_rotateVector2D);
private _grave_box_pos = (getposATL _grave) vectorAdd ([[-1.75, 0, 0], -(getDir _grave)] call BIS_fnc_rotateVector2D);
PAR_grave_box enableSimulationGlobal true;
PAR_grave_box setPosATL _grave_box_pos;
PAR_grave_box attachto [_grave];
"player_grave_box" setMarkerPosLocal _grave;
_pos = _grave_box_pos;
};

// Marker
"player_grave_box" setMarkerPosLocal _pos;

// Respawn Penalty
if ([_unit] call F_getScore > (GRLIB_perm_log + 50)) then { [_unit, -10] remoteExec ["F_addScore", 2] };

Expand All @@ -54,8 +58,9 @@ if (_unit == player) then {
titleText ["" ,"BLACK FADED", 100];
} else {
gamelogic globalChat (format [localize "STR_PAR_DE_01", name _unit]);
removeAllActions _unit;
removeAllWeapons _unit;
hideBody _unit;
sleep 5;
deleteVehicle _unit;
};

hideBody _unit;
sleep 5;
deleteVehicle _unit;
3 changes: 3 additions & 0 deletions core.liberation/mission_params.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ LRX_Mission_Params = [
["PAR_Revive", 3], // PAR revive - [default 3] - values = [3,2,1,0] - Text {Enabled - Everyone can revive,Enabled - Everyone can revive using Medikit/FAK,Enabled - Only medics can revive,Disabled}
["PAR_AI_Revive", 7], // PAR AI revive limit - [default 0] - values = [0,3,5,7,10,15,20]
["PAR_BleedOut", 300], // PAR revive Bleedout timer - [default 300] - values = [100,200,300,400,500,600]
["PAR_Grave", 1], // PAR grave with stuuf in box - [default 1] - values [1,0] - Text {Enabled,Disabled}
["Respawn", 20], // Cooldown before can player respawn - [default 20] - values = [0,xxx] - Text {Disabled,Enabled}
["SquadSize", 2], // AI per squad at startup [default 2] - values = {0,1,2,3,4,5,6}
["MaxSquadSize", 5], // AI recruitment limit per squad [default 5] - values = {0,1,2,3,4,5,6,7,8,9,10}
Expand Down Expand Up @@ -189,6 +190,8 @@ LRX_Mission_Params_Def = [
["100", "200", "300", "400", "500", "600"],
[100, 200, 300, 400, 500, 600]
],
["PAR_Grave", localize "STR_PARAMS_PAR_GRAVE", [localize "STR_PARAMS_DISABLED",localize "STR_PARAMS_ENABLED"]],

["Respawn", localize "STR_RESPAWN",
["5", "10", "20", "25", "30", "60"],
[5, 10, 20, 25, 30, 60]
Expand Down
2 changes: 1 addition & 1 deletion core.liberation/onPlayerRespawn.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ waitUntil {sleep 0.1; !isNil "GRLIB_init_server"};
if (!GRLIB_init_server) exitWith {};
waitUntil {sleep 0.1; !isNil "GRLIB_LRX_params_loaded"};

deleteVehicle _oldUnit;
if (PAR_grave == 1) then { deleteVehicle _oldUnit };
_unit allowDamage false;
_unit setPosATL ((markerPos GRLIB_respawn_marker) vectorAdd [floor(random 5), floor(random 5), 1]);

Expand Down
1 change: 1 addition & 0 deletions core.liberation/scripts/shared/fetch_params.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ GRLIB_despawn_tickets = ["SectorDespawn"] call lrx_getParamValue;
PAR_revive = ["PAR_Revive"] call lrx_getParamValue;
PAR_ai_revive = ["PAR_AI_Revive"] call lrx_getParamValue;
PAR_bleedout = ["PAR_BleedOut"] call lrx_getParamValue;
PAR_grave = ["PAR_Grave"] call lrx_getParamValue;

// Hardcoded
GRLIB_endgame = 0;
Expand Down
4 changes: 4 additions & 0 deletions core.liberation/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,10 @@
<Original>PAR: Bleedout Timer</Original>
<French>PAR: Durée Attente Blessé</French>
</Key>
<Key ID="STR_PARAMS_PAR_GRAVE">
<Original>PAR: Grave + Stuff in a box</Original>
<French>PAR: Tombe + Stuff dans une boite</French>
</Key>
<Key ID="STR_PARAMS_REVIVE1">
<Original>Enabled - Only medics can revive</Original>
<French>Activé - Seuls les medics peuvent ressusciter</French>
Expand Down

0 comments on commit cefe3fc

Please sign in to comment.