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

Added self-revive and modified damage system #2890

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions A3A/addons/core/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,14 @@ class CfgFunctions
file = QPATHTOFOLDER(functions\Revive);
class actionRevive {};
class carry {};
class calcVestDamageAdj {};
class fatalWound {};
class handleDamage {};
class handleDamageAAF {};
class initRevive {};
class isMedic {};
class selfRevive {};
class selfReviveReset {};
class respawn {};
class unconscious {};
class unconsciousAAF {};
Expand Down
7 changes: 7 additions & 0 deletions A3A/addons/core/Params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ class Params
texts[] = {"5 seconds","10 seconds","15 seconds"};
default = 10;
};
class A3A_selfReviveMethods
{
title = "Self-revive methods enabled";
values[] = {0,1};
texts[] = {"Disabled", "Withstand"};
default = 0;
};

class SpacerMembership
{
Expand Down
17 changes: 17 additions & 0 deletions A3A/addons/core/Stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5362,6 +5362,23 @@
<Spanish>El Seguimiento del Limpiador de Basura llevó a cabo una limpieza porque el umbral de tiempo fue superado. Mantén supervisado el Limpiador de Basura.</Spanish>
</Key>
</Container>
<Container name="A3A_selfRevive">
<Key ID="STR_A3A_selfRevive_title">
<Original>Self Revive</Original>
</Key>
<Key ID="STR_A3A_selfRevive_noFAK">
<Original>You don't have a first aid kit for self-revive.</Original>
</Key>
<Key ID="STR_A3A_selfRevive_recent">
<Original>You have already revived yourself recently.</Original>
</Key>
<Key ID="STR_A3A_selfRevive_success">
<Original>You shake off the injury, but you're not feeling great.</Original>
</Key>
<Key ID="STR_A3A_selfRevive_timeout">
<Original>You are feeling much better.</Original>
</Key>
</Container>
<Container name="A3A_customHint">
<Key ID="STR_A3A_customHint_dismiss_no_key">
<Original>&lt;br/&gt;&lt;t size='0.8' color='#e5b348' shadow='1' shadowColor='#000000' valign='top'&gt;%1 Previous Hints&lt;br/&gt;Bind dismiss key by: &lt;t color='#f0d498'&gt;Escape Menu&lt;/t&gt; &gt; &lt;t color='#f0d498'&gt;CONFIGURE&lt;/t&gt; &gt; &lt;t color='#f0d498'&gt;CONTROLS&lt;/t&gt; &gt; &lt;t color='#f0d498'&gt;SHOW: Antistasi&lt;/t&gt; &gt; &lt;t color='#f0d498'&gt;Dismiss Previous Hint&lt;/t&gt;&lt;/t&gt;</Original>
Expand Down
3 changes: 3 additions & 0 deletions A3A/addons/core/functions/Base/fn_vehicleBoxRestore.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ private _rebelPlayers = allUnits select {side _x in [teamPlayer, civilian] && {_
_x setDamage 0;
_x setVariable ["incapacitated",false,true];
_x setVariable ["compromised", 0, true];
if !(A3A_hasACEMedical) then {
[true] remoteExecCall ["A3A_fnc_selfReviveReset", 0];
};
} forEach _rebelPlayers;

private _hqVehicles = (vehicles inAreaArray [_posHQ, 150, 150]) select {
Expand Down
18 changes: 13 additions & 5 deletions A3A/addons/core/functions/EventHandler/fn_enemyUnitKilledEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ if (A3A_hasACE) then
{
_killer = _victim getVariable ["ace_medical_lastDamageSource", _killer];
};
}
else
{
if (_victim getVariable ["incapacitated", false]) then {
private _downedBy = _victim getVariable "A3A_downedBy";
if (!isNil "_downedBy") then {
_killer = _downedBy;
};
};
};

if (_victimSide == Occupants or _victimSide == Invaders) then {
Expand All @@ -44,7 +53,6 @@ if (side (group _killer) == teamPlayer) then
[_killer,false] remoteExec ["setCaptive",_killer];
};
};
_killer addRating 1000;
};
if (vehicle _killer isKindOf "StaticMortar") then
{
Expand All @@ -61,25 +69,25 @@ if (side (group _killer) == teamPlayer) then
Debug("aggroEvent | Rebels killed a surrendered unit");
if (_victimSide == Occupants) then
{
[0,-2,getPos _victim] remoteExec ["A3A_fnc_citySupportChange",2];
[0,-2,getPosATL _victim] remoteExec ["A3A_fnc_citySupportChange",2];
jaj22 marked this conversation as resolved.
Show resolved Hide resolved
};
[_victimSide, 20, 30] remoteExec ["A3A_fnc_addAggression", 2];
}
else
{
[-1,1,getPos _victim] remoteExec ["A3A_fnc_citySupportChange",2];
[-1,1,getPosATL _victim] remoteExec ["A3A_fnc_citySupportChange",2];
[_victimSide, 0.5, 45] remoteExec ["A3A_fnc_addAggression", 2];
};
}
else
{
if (_victimSide == Occupants) then
{
[-0.25,0,getPos _victim] remoteExec ["A3A_fnc_citySupportChange",2];
[-0.25,0,getPosATL _victim] remoteExec ["A3A_fnc_citySupportChange",2];
}
else
{
[0.25,0,getPos _victim] remoteExec ["A3A_fnc_citySupportChange",2];
[0.25,0,getPosATL _victim] remoteExec ["A3A_fnc_citySupportChange",2];
};
};

Expand Down
4 changes: 2 additions & 2 deletions A3A/addons/core/functions/Revive/fn_actionRevive.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
params ["_cured", "_medic"];

private _player = isPlayer _medic;
private _inPlayerGroup = if !(_player) then {if ({isPlayer _x} count (units group _medic) > 0) then {true} else {false}} else {false};
private _inPlayerGroup = !_player and ({isPlayer _x} count (units group _medic) > 0);
private _isMedic = [_medic] call A3A_fnc_isMedic;

if (captive _medic) then { _medic setCaptive false }; // medic is will be local
Expand Down Expand Up @@ -42,7 +42,7 @@ if (!_hasMedkit && {count _medicFAKs == 0 && count _curedFAKs == 0}) exitWith
false
};

private _timer = [10, A3A_reviveTime] select _inPlayerGroup;
private _timer = [10, A3A_reviveTime] select (_player or _inPlayerGroup);
jaj22 marked this conversation as resolved.
Show resolved Hide resolved
if ([_cured] call A3A_fnc_fatalWound) then { _timer = _timer * 2 };
if (!_isMedic) then { _timer = _timer * 2 };
_timer = (_timer * (1 + random 0.5)) + time;
Expand Down
43 changes: 43 additions & 0 deletions A3A/addons/core/functions/Revive/fn_calcVestDamageAdj.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
Calculate vest damage adjustment for low-armoured body hits

Reads _unit and _hitpoint as local vars from caller
Used with getDefaultOrCall so can't use exitWith
*/

#define NEWMIN 10 // new body armour baseline (original is 2)
#define UNCHANGED 16 // vest armor level where damage is unchanged
#define SCALEFACT ((NEWMIN-2) / UNCHANGED)

// vestpart hashmap version
//diag_log format ["calcVestDamageAdj called with unit %1, vest %2, part %3", _unit, vest _unit, _hitpoint];
if (vest _unit == "") then {2 / NEWMIN} else {
private _configs = "_hitpoint == getText (_x >> 'hitpointName')" configClasses (configfile >> "CfgWeapons" >> vest _unit >> "ItemInfo" >> "HitpointsProtectionInfo");
if (_configs isEqualTo []) exitWith {2 / NEWMIN};
private _armour = getNumber (_configs#0 >> "Armor");
if (_armour >= UNCHANGED) exitWith {1};
(2 + _armour) / (NEWMIN + SCALEFACT*_armour);
};

// three cases then...
// 1. no vest => 2/NEWMIN adj
// 2. 18+ total => 1
// 3. oldarmor (2 + armor) / newarmor (NEWMIN + (UNCHANGED - NEWMIN) / (UNCHANGED - 2)


/*
// vest hashmap -> part hashmap version
if (vest _unit == "") exitWith { ["spine1","spine2","spine3"] createHashMapFromArray [0.2,0.2,0.2] };
private _output = createHashMap;
private _config = configfile >> "CfgWeapons" >> vest _unit >> "ItemInfo" >> "HitpointsProtectionInfo";
{
_x params ["_hitpoint", "_hitpart"];
private _adj = call {
if !(isClass (_config >> _hitpoint)) exitWith {0.2};
private _armour = getNumber (_config >> _hitpoint >> "Armor");
(2 + _armour) / (10 + _armour/2);
};
_output set [_hitpart, _adj];
} forEach [["Chest","spine1"], ["Diaphragm","spine2"], ["Abdomen","spine3"]];
_output;
*/
4 changes: 2 additions & 2 deletions A3A/addons/core/functions/Revive/fn_fatalWound.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
private _unit = _this select 0;

if (_unit getHit "head" >= 0.9) exitWith {true};
if (_unit getHit "body" >= 0.9) exitWith {true};
if (_unit getHitPointDamage "hitface" >= 0.9) exitWith {true};
//if (_unit getHit "body" >= 0.9) exitWith {true};
false
Loading