Skip to content

Commit

Permalink
Merge branch 'master' into rework-armor-penetration
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim authored Nov 21, 2024
2 parents e29afd9 + bcd026e commit 318f4b1
Show file tree
Hide file tree
Showing 32 changed files with 252 additions and 65 deletions.
2 changes: 1 addition & 1 deletion addons/ballistics/CfgAmmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ class CfgAmmo {
ACE_muzzleVelocities[]={867};
ACE_barrelLengths[]={736.6};
};
class ACE_408_Ball: BulletBase {
class ACE_408_Ball: B_408_Ball {
timeToLive=10;
airFriction=-0.00065414;
typicalSpeed=1067;
Expand Down
4 changes: 1 addition & 3 deletions addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ ACE_COUNTERS = [];
// Load ace_settings into CBA Settings
[] call FUNC(cbaSettings);

GVAR(statusEffect_Names) = [];
GVAR(statusEffect_isGlobal) = [];
GVAR(statusEffect_sendJIP) = [];
GVAR(statusEffects) = createHashMap;

GVAR(setHearingCapabilityMap) = [];

Expand Down
15 changes: 8 additions & 7 deletions addons/common/functions/fnc_statusEffect_addType.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* Arguments:
* 0: Status Effect Name, this should match a corresponding event name <STRING>
* 1: Send event globally <BOOL>
* 2: Common Effect Reaons to pre-seed durring init <ARRAY>
* 2: Common Effect Reasons to pre-seed during init <ARRAY>
* 3: Send event to JIP (requires sending event globally) <BOOL>
* 4: Event name <STRING> (default: "ace_common_<effect>")
*
* Return Value:
* None
Expand All @@ -18,16 +19,16 @@
* Public: No
*/

params [["_name", "", [""]], ["_isGlobal", false, [false]], ["_commonReasonsArray", [], [[]]], ["_sendJIP", false, [false]]];
TRACE_3("params",_name,_isGlobal,_commonReasonsArray);
params [["_name", "", [""]], ["_isGlobal", false, [false]], ["_commonReasonsArray", [], [[]]], ["_sendJIP", false, [false]], ["_eventName", "", [""]]];
TRACE_4("params",_name,_isGlobal,_commonReasonsArray,_eventName);

_name = toLowerANSI _name;
if (_name == "") exitWith {ERROR_1("addStatusEffect - Bad Name %1",_this)};
if (_name in GVAR(statusEffect_Names)) exitWith {WARNING_1("addStatusEffect - Effect Already Added (note, will not update global bit) %1",_this)};
if (_name in GVAR(statusEffects)) exitWith {WARNING_1("addStatusEffect - Effect Already Added (note, will not update global bit) %1",_this)};
if (_sendJIP && !_isGlobal) exitWith {WARNING_1("addStatusEffect - Trying to add non-global JIP effect %1",_this)};
if (_eventName == "") then { _eventName = format [QGVAR(%1), _name]; };

GVAR(statusEffect_Names) pushBack _name;
GVAR(statusEffect_isGlobal) pushBack _isGlobal;
GVAR(statusEffect_sendJIP) pushBack _sendJIP;
GVAR(statusEffects) set [_name, [_isGlobal, _sendJIP, _eventName]];

//We add reasons at any time, but more efficenet to add all common ones at one time during init
if (isServer && {_commonReasonsArray isNotEqualTo []}) then {
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_get.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Retrives list of current status effects
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: Effect Name <STRING>
*
* Return Value:
Expand Down
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_localEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Handles locality switch, runs a respawn check and then reapplies all effect events.
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: isLocal <BOOL>
*
* Return Value:
Expand Down
4 changes: 2 additions & 2 deletions addons/common/functions/fnc_statusEffect_resetVariables.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Resets all effect numbers to 0 when an object respawns (but does not apply the effect event).
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
*
* Return Value:
* None
Expand Down Expand Up @@ -39,6 +39,6 @@ if (_object == _objectRef) exitWith {};
TRACE_2("forced reset defined array on object mismatch",_x,_effectNumber);
_object setVariable [_effectVarName, 0, true]; //This always resets to 0 (not -1/nil)!
};
} forEach GVAR(statusEffect_Names);
} forEach GVAR(statusEffects);

_object setVariable [QGVAR(statusEffect_object), _object, true];
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_respawnEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Handles the Respawn Event Handler to reset effects.
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
*
* Return Value:
* None
Expand Down
53 changes: 28 additions & 25 deletions addons/common/functions/fnc_statusEffect_sendEffects.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,34 @@ TRACE_2("params",_object,_effectName);

if (isNull _object) exitWith {};

{
if ((_effectName == "") || {_effectName == _x}) then {
private _effectVarName = format [QGVAR(effect_%1), _x];
private _effectNumber = _object getVariable [_effectVarName, -1];
if (_effectName == "") exitWith { // Recurse through all possible effects
{
[_object, _x] call FUNC(statusEffect_sendEffects)
} forEach (keys GVAR(statusEffects));
};

//We only do anything if the effect has been defined at some point in the game for this unit
TRACE_2("checking if event is nil",_x,_effectNumber);
if (_effectNumber != -1) then {
private _eventName = format [QGVAR(%1), _x];
switch (true) do {
case (GVAR(statusEffect_sendJIP) select _forEachIndex): {
TRACE_2("Sending Global JIP Event",_object,_effectNumber);
private _jipID = format [QGVAR(effect_%1_%2), _eventName, hashValue _object];
[_eventName, [_object, _effectNumber], _jipID] call CBA_fnc_globalEventJIP;
[_jipID, _object] call CBA_fnc_removeGlobalEventJIP;
};
case (GVAR(statusEffect_isGlobal) select _forEachIndex): {
TRACE_2("Sending Global Event",_object,_effectNumber);
[_eventName, [_object, _effectNumber]] call CBA_fnc_globalEvent;
};
default {
TRACE_2("Sending Target Event",_object,_effectNumber);
[_eventName, [_object, _effectNumber], _object] call CBA_fnc_targetEvent;
};
};

private _effectVarName = format [QGVAR(effect_%1), _effectName];
private _effectNumber = _object getVariable [_effectVarName, -1];

// We only do anything if the effect has been defined at some point in the game for this unit
TRACE_2("checking if event is nil",_effectName,_effectNumber);
if (_effectNumber != -1) then {
(GVAR(statusEffects) get toLowerANSI _effectName) params ["_isGlobal", "_sendJIP", "_eventName"];
switch (true) do {
case (_sendJIP): {
TRACE_2("Sending Global JIP Event",_object,_effectNumber);
private _jipID = format [QGVAR(effect_%1_%2), _eventName, hashValue _object];
[_eventName, [_object, _effectNumber], _jipID] call CBA_fnc_globalEventJIP;
[_jipID, _object] call CBA_fnc_removeGlobalEventJIP;
};
case (_isGlobal): {
TRACE_2("Sending Global Event",_object,_effectNumber);
[_eventName, [_object, _effectNumber]] call CBA_fnc_globalEvent;
};
default {
TRACE_2("Sending Target Event",_object,_effectNumber);
[_eventName, [_object, _effectNumber], _object] call CBA_fnc_targetEvent;
};
};
} forEach GVAR(statusEffect_Names);
};
2 changes: 1 addition & 1 deletion addons/common/functions/fnc_statusEffect_set.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Adds or removes an id to a status effect and will send an event to apply.
*
* Arguments:
* 0: vehicle that it will be attached to (player or vehicle) <OBJECT>
* 0: Vehicle that it will be attached to (player or vehicle) <OBJECT>
* 1: Effect Name <STRING>
* 2: Unique Reason ID <STRING>
* 3: Is Set (true adds/false removes) <BOOL>
Expand Down
4 changes: 2 additions & 2 deletions addons/cookoff/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (isServer) then {
{
deleteVehicle _x;
} forEach ((_this select 0) getVariable [QGVAR(effects), []]);
}, true, ["CAManBase", "StaticWeapon"], true] call CBA_fnc_addClassEventHandler;
}, true, ["Man", "StaticWeapon"], true] call CBA_fnc_addClassEventHandler; // Use "Man" to exclude animals as well

["ReammoBox_F", "Deleted", {
{
Expand Down Expand Up @@ -58,7 +58,7 @@ if (isServer) then {
random [MIN_AMMO_DETONATION_START_DELAY, (MIN_AMMO_DETONATION_START_DELAY + MAX_AMMO_DETONATION_START_DELAY) / 2, MAX_AMMO_DETONATION_START_DELAY]
]] call CBA_fnc_serverEvent;
};
}, true, ["CAManBase", "StaticWeapon"], true] call CBA_fnc_addClassEventHandler;
}, true, ["Man", "StaticWeapon"], true] call CBA_fnc_addClassEventHandler; // Use "Man" to exclude animals as well

if (hasInterface) then {
// Plays a sound locally, so that different sounds can be used for various distances
Expand Down
2 changes: 1 addition & 1 deletion addons/explosives/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@
<Russian>Увеличивать время завершения действий для не-специалистов? По умолчанию: Нет</Russian>
<German>Entschärfungszeit für Nicht-Sprengstoffexperten erhöhen? Standard: Ja</German>
<Korean>비전문가가 폭발물을 해체 시 더욱 많은 시간을 소요합니까? 기본설정: 예</Korean>
<Japanese>専門兵以外がアクション完了するのに必要な時間を増加しますか? デフォルト: 有効</Japanese>
<Japanese>専門兵以外がアクションを完了するのに必要な時間を増加しますか? デフォルト: 有効</Japanese>
<Chinese>增加非專業人員相關操作的時間? 預設: 是</Chinese>
<Chinesesimp>增加非专业人员相关操作的时间? 预设:是</Chinesesimp>
<Hungarian>Nem-specialisták esetén több ideig tartson a cselekvés befejezése? Alapértelmezett: Igen</Hungarian>
Expand Down
9 changes: 9 additions & 0 deletions addons/field_rations/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ if !(hasInterface) exitWith {};
// Add respawn eventhandler to reset necessary variables, done through script so only added if field rations is enabled
["CAManBase", "respawn", LINKFUNC(handleRespawn)] call CBA_fnc_addClassEventHandler;

// Add status effect to block hunger/thirst updates
["field_rations_blockUpdates", false, [], false, QGVAR(blockUpdates)] call EFUNC(common,statusEffect_addType);

[QGVAR(blockUpdates), {
params ["_object", "_set"];
TRACE_2("blockUpdates EH",_object,_set);
_object setVariable [QGVAR(blockUpdates), _set > 0];
}] call CBA_fnc_addEventHandler;

// Start update loop
[LINKFUNC(update), CBA_missionTime + MP_SYNC_INTERVAL, 1] call CBA_fnc_waitAndExecute;

Expand Down
9 changes: 7 additions & 2 deletions addons/field_rations/functions/fnc_update.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@ params ["_nextMpSync"];
// Access global variable once
private _player = ACE_player;

// Exit if player is not alive or a virtual unit
if (!alive _player || {_player isKindOf "VirtualMan_F"}) exitWith {
// Exit if player is not alive, a virtual unit, or is in Zeus interface (if setting is enabled)
if (
!alive _player ||
{_player isKindOf "VirtualMan_F"} ||
{!GVAR(zeusUpdates) && {!isNull findDisplay 312}} ||
{_player getVariable [QGVAR(blockUpdates), false]}
) exitWith {
[LINKFUNC(update), _nextMpSync, 1] call CBA_fnc_waitAndExecute;
QGVAR(hud) cutFadeOut 0.5;
};
Expand Down
9 changes: 9 additions & 0 deletions addons/field_rations/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,12 @@
[[-1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], [LSTRING(Dynamic), "0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", 0], 0],
false
] call CBA_fnc_addSetting;

[
QGVAR(zeusUpdates),
"CHECKBOX",
[LSTRING(ZeusUpdates_DisplayName), LSTRING(ZeusUpdates_Description)],
LSTRING(DisplayName),
false,
1
] call CBA_fnc_addSetting;
6 changes: 6 additions & 0 deletions addons/field_rations/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1282,5 +1282,11 @@
<Chinese>飲用水補給</Chinese>
<Chinesesimp>饮用水补给</Chinesesimp>
</Key>
<Key ID="STR_ACE_Field_Rations_ZeusUpdates_Description">
<English>If enabled, hunger and thirst will continue to increase while the Zeus interface is open.</English>
</Key>
<Key ID="STR_ACE_Field_Rations_ZeusUpdates_DisplayName">
<English>Update Hunger and Thirst in Zeus</English>
</Key>
</Package>
</Project>
17 changes: 9 additions & 8 deletions addons/goggles/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<Chinesesimp>护目镜</Chinesesimp>
<Turkish>Gözlük</Turkish>
</Key>
<Key ID="STR_ACE_Goggles_SettingDrawOverlay">
<English>Show Goggles Overlay</English>
<Japanese>ゴーグルのオーバーレイを表示する</Japanese>
</Key>
<Key ID="STR_ACE_Goggles_SettingShowClearGlasses">
<English>Show Wipe Goggles self interaction</English>
<Czech>Ukaž Vyčistit brýle v menu Interakce (vlastní)</Czech>
Expand All @@ -28,7 +32,7 @@
<Russian>Показывать действие Протереть очки</Russian>
<German>Zeige "Brille abwischen" im Selbstinteraktionsmenü</German>
<Korean>자기상호작용에 고글 닦기 선택 보이기</Korean>
<Japanese>ゴーグル拭き取りのアクションを表示</Japanese>
<Japanese>ゴーグルを拭うセルフ・インタラクションを表示する</Japanese>
<Chinese>在自我互動中顯示擦拭護目鏡的動作</Chinese>
<Chinesesimp>在自我互动中显示擦拭护目镜的动作</Chinesesimp>
<Turkish>Kendi etkileşim menüsün de gözlük camlarını silmeyi göster</Turkish>
Expand Down Expand Up @@ -60,7 +64,7 @@
<Russian>Вкл. эффект очков от 3-го лица</Russian>
<German>Brilleneffekt in dritter Person anzeigen</German>
<Korean>3인칭 시에도 고글 효과를 보이게 하기</Korean>
<Japanese>三人称視点でもゴーグルによる効果を表示</Japanese>
<Japanese>三人称視点でもゴーグルによるエフェクトを表示する</Japanese>
<Chinese>在第三人稱視角顯示護目鏡效果</Chinese>
<Chinesesimp>在第三人称视角显示护目镜效果</Chinesesimp>
<Turkish>Gözlük efektlerini 3. şahıs görünümün de göster</Turkish>
Expand All @@ -77,7 +81,7 @@
<Russian>Протереть очки</Russian>
<German>Brille abwischen</German>
<Korean>고글 닦기</Korean>
<Japanese>ゴーグルを拭く</Japanese>
<Japanese>ゴーグルを拭う</Japanese>
<Chinese>擦拭護目鏡</Chinese>
<Chinesesimp>擦拭护目镜</Chinesesimp>
<Turkish>Gözlük Camlarını Sil</Turkish>
Expand All @@ -94,7 +98,7 @@
<Russian>Эффект очков</Russian>
<German>Brilleneffekt</German>
<Korean>고글 효과</Korean>
<Japanese>ゴーグルによる効果</Japanese>
<Japanese>ゴーグルによるエフェクト</Japanese>
<Chinese>護目鏡效果</Chinese>
<Chinesesimp>护目镜效果</Chinesesimp>
<Turkish>Gözlük efektleri</Turkish>
Expand All @@ -110,7 +114,7 @@
<Russian>Эффекты</Russian>
<German>Effekte</German>
<Korean>효과</Korean>
<Japanese>エフェクト</Japanese>
<Japanese>エフェクトのみ</Japanese>
<Chinese>影響</Chinese>
<Chinesesimp>影响</Chinesesimp>
<Turkish>Efektler</Turkish>
Expand Down Expand Up @@ -147,8 +151,5 @@
<Chinesesimp>着色 + 效果</Chinesesimp>
<Turkish>Ton + Efektler</Turkish>
</Key>
<Key ID="STR_ACE_Goggles_SettingDrawOverlay">
<English>Show Goggles Overlay</English>
</Key>
</Package>
</Project>
2 changes: 1 addition & 1 deletion addons/interact_menu/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
<Russian>Добавляет действия открывания дверей и залезания на лестницы для зданий. (Примечание: возможно падение производительности при открытии меню взаимодействия, особенно в городах)</Russian>
<German>Fügt Aktionen zum Türöffnen oder für eine Leiter zum Besteigen von Gebäuden hinzu. (Hinweis: Verschlechtert die Leistung wenn das Interaktionsmenü geöffnet wird. Insbesondere in Städten)</German>
<Korean>건물의 문을 열거나 사다리에 오르는 상호작용 행동을 추가합니다. (주의: 상호작용 메뉴를 열 경우 성능하락이 있을 수 있음, 특히 마을 내부에서)</Korean>
<Japanese>建物にドアを開閉したり梯子を昇降するためのインタラクション アクションを追加します。\n(注: 街中でインタラクション メニューを開く際には特に描画パフォーマンスに影響を及ぼします)</Japanese>
<Japanese>建物にドアを開閉したり梯子を昇降するためのインタラクション アクションを追加します。\n(注: インタラクション メニューを開く際には描画パフォーマンスに影響を及ぼします。街中などでは顕著です)</Japanese>
<Chinese>增加互動選單的功能在可開啟的門與建築物的梯子上。(注意: 此功能有可能會降低系統效能,特別是在城鎮區更明顯)</Chinese>
<Chinesesimp>增加互动菜单的功能在可开启的门与建筑物的梯子上。(注意:此功能有可能会降低系统效能,特别是在城镇区更明显)</Chinesesimp>
<Turkish>Binalara kapıları açmak ve merdivenleri monte etmek için etkileşim eylemleri ekler. (Not: Etkileşim menüsünü açarken, özellikle şehirlerde bir performansı etkiler)</Turkish>
Expand Down
9 changes: 9 additions & 0 deletions addons/interaction/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ class CfgVehicles {
};
};

class ACE_PassThrowable {
displayName = CSTRING(PassThrowable);
condition = QUOTE([ARR_3(_player,_target,(currentThrowable _player) param [ARR_2(0,'')])] call FUNC(canPassThrowable));
statement = QUOTE([ARR_3(_player,_target,(currentThrowable _player) param [ARR_2(0,'')])] call FUNC(passThrowable));
exceptions[] = {"isNotSwimming"};
showDisabled = 0;
modifierFunction = QUOTE(_this select 3 set [ARR_2(2,getText (configFile >> 'CfgMagazines' >> (currentThrowable (_this select 1)) param [ARR_2(0,'HandGrenade')] >> 'picture'))];); // Set picture of the current throwable
};

class ACE_TeamManagement {
displayName = CSTRING(TeamManagement);
condition = QUOTE([ARR_2(_player,_target)] call DFUNC(canJoinTeam) && {GVAR(EnableTeamManagement)});
Expand Down
2 changes: 2 additions & 0 deletions addons/interaction/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ PREP(modifyTeamManagementAction);
PREP(canJoinTeam);
PREP(joinTeam);
PREP(canPassMagazine);
PREP(canPassThrowable);
PREP(passMagazine);
PREP(passThrowable);
PREP(canBecomeLeader);
PREP(doBecomeLeader);
PREP(doRemoteControl);
Expand Down
28 changes: 28 additions & 0 deletions addons/interaction/functions/fnc_canPassThrowable.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "..\script_component.hpp"
/*
* Author: Timi007
* Checks if target unit can accept given throwable.
* Does not check if the throwable exists in the inventory of the player.
*
* Arguments:
* 0: Unit that passes the throwable <OBJECT>
* 1: Unit to pass the throwable to <OBJECT>
* 2: Throwable classname <STRING>
*
* Return Value:
* Unit can pass throwable <BOOL>
*
* Example:
* [_player, _target, "HandGrenade"] call ace_interaction_fnc_canPassThrowable
*
* Public: No
*/

params ["_player", "_target", "_throwable"];

if (!GVAR(enableThrowablePassing)) exitWith {false};
if (_throwable isEqualTo "") exitWith {false};
if !(_target call EFUNC(common,isAwake)) exitWith {false};
if ((!isNull objectParent _target) && {(vehicle _target) isNotEqualTo (vehicle _player)}) exitWith {false};

[_target, _throwable] call CBA_fnc_canAddItem
Loading

0 comments on commit 318f4b1

Please sign in to comment.