Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
OverlordZorn committed Nov 29, 2024
2 parents 4c4a4d3 + 61e6d10 commit 97462eb
Show file tree
Hide file tree
Showing 102 changed files with 1,453 additions and 435 deletions.
1 change: 0 additions & 1 deletion addons/advanced_throwing/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ PREP(canThrow);
PREP(drawArc);
PREP(drawThrowable);
PREP(exitThrowMode);
PREP(getMuzzle);
PREP(moduleInit);
PREP(onKeyDown);
PREP(onMouseButtonDown);
Expand Down
6 changes: 3 additions & 3 deletions addons/advanced_throwing/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (!hasInterface) exitWith {};
GVAR(tempWindInfo) = false;

// Add keybinds
["ACE3 Weapons", QGVAR(prepare), localize LSTRING(Prepare), {
["ACE3 Weapons", QGVAR(prepare), LLSTRING(Prepare), {
// Condition
if !([ACE_player] call FUNC(canPrepare)) exitWith {false};
if (EGVAR(common,isReloading)) exitWith {true};
Expand All @@ -22,7 +22,7 @@ GVAR(tempWindInfo) = false;
true
}, {false}, [34, [true, false, false]], false] call CBA_fnc_addKeybind; // Shift + G

["ACE3 Weapons", QGVAR(dropModeToggle), localize LSTRING(DropModeToggle), {
["ACE3 Weapons", QGVAR(dropModeToggle), LLSTRING(DropModeToggle), {
// Condition
if (!(ACE_player getVariable [QGVAR(inHand), false]) || {underwater ACE_player}) exitWith {false};

Expand All @@ -35,7 +35,7 @@ GVAR(tempWindInfo) = false;
true
}, {false}, [34, [false, true, false]], false] call CBA_fnc_addKeybind; // Ctrl + G

["ACE3 Weapons", QGVAR(dropModeHold), localize LSTRING(DropModeHold), {
["ACE3 Weapons", QGVAR(dropModeHold), LLSTRING(DropModeHold), {
// Condition
if !(ACE_player getVariable [QGVAR(inHand), false]) exitWith {false};

Expand Down
6 changes: 4 additions & 2 deletions addons/advanced_throwing/functions/fnc_canThrow.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ params ["_unit"];

if !(_unit getVariable [QGVAR(inHand), false]) exitWith {false};

if (!isNull objectParent _unit) exitWith {
private _vehicle = objectParent _unit;

if (!isNull _vehicle) exitWith {
private _startPos = eyePos _unit;
private _aimLinePos = AGLToASL (positionCameraToWorld [0, 0, 1]);
private _intersections = lineIntersectsSurfaces [_startPos, _aimLinePos, _unit, objNull, false];
//TRACE_1("Intersections",_intersections);

(_intersections select {(vehicle _unit) in (_x select 3)}) isEqualTo []
_intersections findIf {_vehicle in (_x select 3)} == -1
};

true
30 changes: 14 additions & 16 deletions addons/advanced_throwing/functions/fnc_drawThrowable.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,22 @@ private _primed = ACE_player getVariable [QGVAR(primed), false];
private _activeThrowable = ACE_player getVariable [QGVAR(activeThrowable), objNull];

// Exit if throwable died primed in hand
if (isNull _activeThrowable && {_primed}) exitWith {
if (_primed && {isNull _activeThrowable}) exitWith {
[ACE_player, "Throwable died primed in hand"] call FUNC(exitThrowMode);
};

private _throwable = currentThrowable ACE_player;

// Inventory check
if (_throwable isEqualTo [] && {!_primed}) exitWith {
if (!_primed && {_throwable isEqualTo []}) exitWith {
[ACE_player, "No valid throwables"] call FUNC(exitThrowMode);
};

private _throwableMag = _throwable param [0, "#none"];
_throwable params ["_throwableMag", "_muzzle"];

// If not primed, double check we actually have the magazine in inventory
if ((!_primed) && {!((_throwableMag in (uniformItems ACE_player)) || {_throwableMag in (vestItems ACE_player)} || {_throwableMag in (backpackItems ACE_player)})}) exitWith {
// Can't use ace_common_fnc_hasMagazine, as it doesn't account for empty mags (grenade is emptied so that it can't be thrown via vanilla keybind)
if (!_primed && {!(_throwableMag in (magazines [ACE_player, true]))}) exitWith {
[ACE_player, "No valid throwable (glitched currentThrowable)"] call FUNC(exitThrowMode);
};

Expand All @@ -64,34 +65,31 @@ _phi = [_phi, 360 - _phi] select (_phi > 180);
private _power = linearConversion [0, 180, _phi - 30, 1, 0.3, true];
ACE_player setVariable [QGVAR(throwSpeed), _throwSpeed * _power];

#ifdef DEBUG_MODE_FULL
hintSilent format ["Heading: %1\nPower: %2\nSpeed: %3\nThrowMag: %4\nMuzzle: %5", _phi, _power, _throwSpeed * _power, _throwableMag, ACE_player getVariable [QGVAR(activeMuzzle), ""]];
#endif
TRACE_5("",_phi,_power,_throwSpeed * _power,_throwableMag,ACE_player getVariable ARR_2([QGVAR(activeMuzzle),ARR_2(["",-1])]));

private _throwableType = getText (configFile >> "CfgMagazines" >> _throwableMag >> "ammo");

if (!([ACE_player] call FUNC(canThrow)) && {!_primed}) exitWith {
if (!_primed && {!([ACE_player] call FUNC(canThrow))}) exitWith {
if (!isNull _activeThrowable) then {
deleteVehicle _activeThrowable;
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
ACE_player setAmmo [ACE_player getVariable [QGVAR(activeMuzzle), ""], 1];
// Restore muzzle ammo (setAmmo has no impact if no applicable throwable in inventory)
ACE_player setAmmo (ACE_player getVariable [QGVAR(activeMuzzle), ["", -1]]);
};
};

if (isNull _activeThrowable || {(_throwableType != typeOf _activeThrowable) && {!_primed}}) then {
if (isNull _activeThrowable || {!_primed && {_throwableType != typeOf _activeThrowable}}) then {
if (!isNull _activeThrowable) then {
deleteVehicle _activeThrowable;
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
ACE_player setAmmo [ACE_player getVariable [QGVAR(activeMuzzle), ""], 1];
// Restore muzzle ammo (setAmmo has no impact if no applicable throwable in inventory)
ACE_player setAmmo (ACE_player getVariable [QGVAR(activeMuzzle), ["", -1]]);
};
_activeThrowable = _throwableType createVehicleLocal [0, 0, 0];
_activeThrowable enableSimulation false;
ACE_player setVariable [QGVAR(activeThrowable), _activeThrowable];

// Set muzzle ammo to 0 to block vanilla throwing (can only be 0 or 1)
private _muzzle = _throwableMag call FUNC(getMuzzle);
// Set muzzle ammo to 0 to block vanilla throwing
ACE_player setVariable [QGVAR(activeMuzzle), [_muzzle, ACE_player ammo _muzzle]];
ACE_player setAmmo [_muzzle, 0];
ACE_player setVariable [QGVAR(activeMuzzle), _muzzle];
};

// Exit in case of explosion in hand
Expand Down
10 changes: 4 additions & 6 deletions addons/advanced_throwing/functions/fnc_exitThrowMode.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ TRACE_2("params",_unit,_reason);

if !(_unit getVariable [QGVAR(inHand), false]) exitWith {};

#ifdef DEBUG_MODE_FULL
systemChat format ["Exit Throw Mode: %1", _reason];
#endif
TRACE_1("Exit Throw Mode",_reason);

private _activeThrowable = _unit getVariable [QGVAR(activeThrowable), objNull];
if !(_unit getVariable [QGVAR(primed), false]) then {
Expand All @@ -38,13 +36,13 @@ if !(_unit getVariable [QGVAR(primed), false]) then {
[QEGVAR(common,setShotParents), [_activeThrowable, _unit, _instigator]] call CBA_fnc_serverEvent;
};

// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
_unit setAmmo [_unit getVariable [QGVAR(activeMuzzle), ""], 1];
// Restore muzzle ammo (setAmmo has no impact if no applicable throwable in inventory)
_unit setAmmo (_unit getVariable [QGVAR(activeMuzzle), ["", -1]]);

_unit setVariable [QGVAR(inHand), false];
_unit setVariable [QGVAR(primed), false];
_unit setVariable [QGVAR(activeThrowable), objNull];
_unit setVariable [QGVAR(activeMuzzle), ""];
_unit setVariable [QGVAR(activeMuzzle), ["", -1]];
_unit setVariable [QGVAR(throwType), THROW_TYPE_DEFAULT];
_unit setVariable [QGVAR(throwSpeed), THROW_SPEED_DEFAULT];
_unit setVariable [QGVAR(dropMode), false];
Expand Down
25 changes: 0 additions & 25 deletions addons/advanced_throwing/functions/fnc_getMuzzle.sqf

This file was deleted.

4 changes: 2 additions & 2 deletions addons/advanced_throwing/functions/fnc_prepare.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ if (_unit getVariable [QGVAR(inHand), false]) exitWith {
TRACE_1("inHand",_unit);
if !(_unit getVariable [QGVAR(primed), false]) then {
TRACE_1("not primed",_unit);
// Restore muzzle ammo (setAmmo 1 has no impact if no appliccable throwable in inventory)
// Restore muzzle ammo (setAmmo has no impact if no applicable throwable in inventory)
// selectNextGrenade relies on muzzles array (setAmmo 0 removes the muzzle from the array and current can't be found, cycles between 0 and 1 muzzles)
ACE_player setAmmo [ACE_player getVariable [QGVAR(activeMuzzle), ""], 1];
ACE_player setAmmo (ACE_player getVariable [QGVAR(activeMuzzle), ["", -1]]);
[_unit] call EFUNC(weaponselect,selectNextGrenade);
};
};
Expand Down
34 changes: 24 additions & 10 deletions addons/advanced_throwing/functions/fnc_prime.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,32 @@ _unit setVariable [QGVAR(primed), true];

// Remove item before cooking to prevent weaponselect showing more throwables than there actually are in inventory
private _throwableMag = (currentThrowable _unit) select 0;
_unit removeItem _throwableMag;
private _config = configFile >> "CfgMagazines" >> _throwableMag;

private _throwableType = getText (configFile >> "CfgMagazines" >> _throwableMag >> "ammo");
private _muzzle = _unit getVariable [QGVAR(activeMuzzle), ""];
(_unit getVariable [QGVAR(activeMuzzle), ["", -1]]) params ["_muzzle", "_ammoCount"];

// Set muzzle ammo to 0 to block vanilla throwing (can only be 0 or 1), removeItem above resets it
// If there is 1 "round" left in the grenade, remove it from the player's inventory
if (_ammoCount == 1) then {
// Grenade has ammo set to 0, so remove that one specifically
[_unit, _throwableMag, 0] call EFUNC(common,removeSpecificMagazine);

// Get ammo count of new magazine
_unit setVariable [QGVAR(activeMuzzle), [_muzzle, _unit ammo _muzzle]];
} else {
if (_ammoCount > 1 && {getNumber (_config >> "count") > 1}) then {
_unit setVariable [QGVAR(activeMuzzle), [_muzzle, _ammoCount - 1]];
};
};

// Set muzzle ammo to 0 to block vanilla throwing, removing magazine above resets it
_unit setAmmo [_muzzle, 0];

private _throwableType = getText (_config >> "ammo");
private _ammoConfig = configFile >> "CfgAmmo" >> _throwableType;

// Handle weird scripted grenades (RHS) which could cause unexpected behaviour
private _nonInheritedCfg = configProperties [configFile >> "CfgAmmo" >> _throwableType, 'configName _x == QGVAR(replaceWith)', false];
if ((count _nonInheritedCfg) == 1) then {
_throwableType = getText (_nonInheritedCfg select 0);
if (inheritsFrom (_ammoConfig >> QGVAR(replaceWith)) isEqualTo _ammoConfig) then {
_throwableType = getText (_ammoConfig >> QGVAR(replaceWith));
};

// Create actual throwable globally
Expand All @@ -59,10 +73,10 @@ deleteVehicle _activeThrowableOld;

if (_showHint) then {
// Show primed hint
private _displayNameShort = getText (configFile >> "CfgMagazines" >> _throwableMag >> "displayNameShort");
private _picture = getText (configFile >> "CfgMagazines" >> _throwableMag >> "picture");
private _displayNameShort = getText (_config >> "displayNameShort");
private _picture = getText (_config >> "picture");

[[_displayNameShort, localize LSTRING(Primed)] joinString " ", _picture] call EFUNC(common,displayTextPicture);
[[_displayNameShort, LLSTRING(Primed)] joinString " ", _picture] call EFUNC(common,displayTextPicture);

// Change controls hint for RMB
call FUNC(updateControlsHint);
Expand Down
2 changes: 1 addition & 1 deletion addons/advanced_throwing/functions/fnc_throw.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if !(_unit getVariable [QGVAR(primed), false]) then {
};

// Calculate torque of thrown grenade
private _config = configFile >> "CfgAmmo" >> typeOf _activeThrowable;
private _config = configOf _activeThrowable;
private _torqueDir = getArray (_config >> QGVAR(torqueDirection));
_torqueDir = if (_torqueDir isEqualTypeArray [0,0,0]) then { vectorNormalized _torqueDir } else { [0,0,0] };
private _torqueMag = getNumber (_config >> QGVAR(torqueMagnitude));
Expand Down
1 change: 1 addition & 0 deletions addons/advanced_throwing/functions/fnc_throwFiredXEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
* Public: No
*/

params ["_unit", "", "_muzzle", "", "_ammo"];
TRACE_1("Fired",_this);

Expand Down
8 changes: 4 additions & 4 deletions addons/advanced_throwing/functions/fnc_updateControlsHint.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ if (!GVAR(showMouseControls)) exitWith {};

private _primed = ACE_player getVariable [QGVAR(primed), false];

private _mmb = [localize LSTRING(ChangeMode), localize LSTRING(Extend)] select (ACE_player getVariable [QGVAR(dropMode), false]);
private _mmb = [LLSTRING(ChangeMode), LLSTRING(Extend)] select (ACE_player getVariable [QGVAR(dropMode), false]);

if (!_primed) then {
_mmb = [_mmb, localize LSTRING(Cook)] joinString " / ";
_mmb = [_mmb, LLSTRING(Cook)] joinString " / ";
};

[
localize LSTRING(Throw),
[localize ELSTRING(common,Cancel), ""] select _primed,
LLSTRING(Throw),
[LELSTRING(common,Cancel), ""] select _primed,
_mmb
] call EFUNC(interaction,showMouseHint);
2 changes: 1 addition & 1 deletion addons/advanced_throwing/initSettings.inc.sqf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
private _category = format ["ACE %1", localize LSTRING(Category)];
private _category = format ["ACE %1", LLSTRING(Category)];
[
QGVAR(enabled),
"CHECKBOX",
Expand Down
13 changes: 10 additions & 3 deletions addons/arsenal/functions/fnc_addListBoxItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ if (_skip) exitWith {};
private _configPath = ([configFile, campaignConfigFile, missionConfigFile] select _configRoot) >> _configCategory >> _className;
private _dlcName = _configPath call EFUNC(common,getAddon);

// Get DLC requirements
([_configPath] call EFUNC(common,getDLC)) params ["_dlcClass", "_dlcSteamID"];
private _dlcPicture = "";
if (_dlcClass != "") then {
_dlcPicture = getText (configFile >> "CfgMods" >> _dlcClass >> "logo");
};

// If _pictureEntryName is empty, then this item has no picture (e.g. faces)
[configName _configPath, getText (_configPath >> "displayName"), if (_pictureEntryName == "") then {""} else {getText (_configPath >> _pictureEntryName)}, if (_dlcName != "") then {(modParams [_dlcName, ["logo"]]) param [0, ""]} else {""}]
}, true]) params ["_className", "_displayName", "_itemPicture", "_modPicture"];
[configName _configPath, getText (_configPath >> "displayName"), if (_pictureEntryName == "") then {""} else {getText (_configPath >> _pictureEntryName)}, if (_dlcName != "") then {(modParams [_dlcName, ["logo"]]) param [0, ""]} else {""}, _dlcPicture]
}, true]) params ["_className", "_displayName", "_itemPicture", "_modPicture", "_dlcPicture"];

private _lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _className];
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture, _dlcPicture] select GVAR(enableModIcons)];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];

if ((toLowerANSI _className) in GVAR(favorites)) then {
Expand Down
2 changes: 1 addition & 1 deletion addons/arsenal/functions/fnc_fillLeftPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private _selectedItem = if (_idxVirt != -1) then { // Items
_lbAdd = _ctrlPanel lbAdd _displayName;
_ctrlPanel lbSetData [_lbAdd, _x];
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _x]];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture, ""] select GVAR(enableModIcons)];
} forEach GVAR(faceCache); // HashMap, not array

GVAR(currentFace)
Expand Down
4 changes: 2 additions & 2 deletions addons/arsenal/initSettings.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ private _category = LLSTRING(settingCategory);

[
QGVAR(enableModIcons),
"CHECKBOX",
"LIST",
[LSTRING(modIconsSetting), LSTRING(modIconsTooltip)],
_category,
true
[[0, 1, 2], [ELSTRING(common,Disabled), ELSTRING(common,Enabled), LSTRING(DLCRequirement)], 1]
] call CBA_fnc_addSetting;

[
Expand Down
22 changes: 19 additions & 3 deletions addons/arsenal/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@
<Chinesesimp>无法开启 ACE 虚拟军火库</Chinesesimp>
<Turkish>ACE Arsenal açılamıyor</Turkish>
</Key>
<Key ID="STR_ACE_Arsenal_DLCRequirement">
<English>DLC Required</English>
<Czech>Vyžadováno DLC</Czech>
<French>DLC requis</French>
<Spanish>Requiere DLC</Spanish>
<Italian>DLC richiesto</Italian>
<Polish>Wymagane DLC</Polish>
<Portuguese>DLC necessário</Portuguese>
<Russian>Требуется DLC</Russian>
<German>DLC erforderlich</German>
<Korean>DLC 필요</Korean>
<Japanese>DLCが必要です</Japanese>
<Chinese>需要DLC</Chinese>
<Chinesesimp>需要DLC</Chinesesimp>
<Turkish>DLC gereklidir</Turkish>
</Key>
<Key ID="STR_ACE_Arsenal_DetonatesOnImpact">
<English>Detonates on impact</English>
<French>Détonation à l'impact</French>
Expand Down Expand Up @@ -209,7 +225,7 @@
<Portuguese>Atraso de detonação</Portuguese>
<Russian>Задержка детонации</Russian>
<German>Detonationsverzögerung</German>
<Korean>신관 시간</Korean>
<Korean>신관 작동 시간</Korean>
<Japanese>信管設定時間</Japanese>
<Chinesesimp>引信时间</Chinesesimp>
</Key>
Expand Down Expand Up @@ -946,7 +962,7 @@
<Portuguese>O seguinte loadout foi apagado:</Portuguese>
<Russian>Удален комплект экипировки:</Russian>
<German>Folgende Ausrüstung wurde entfernt:</German>
<Korean>다음 로드아웃이 삭제됨 :</Korean>
<Korean>다음 로드아웃이 삭제됨:</Korean>
<Japanese>装備を削除しました:</Japanese>
<Chinese>以下的裝備已被刪除:</Chinese>
<Chinesesimp>以下的负载已被删除:</Chinesesimp>
Expand Down Expand Up @@ -1026,7 +1042,7 @@
<Portuguese>O seguinte loadout não é mais público:</Portuguese>
<Russian>Этот комплект экипировки больше не публичный:</Russian>
<German>Folgende Ausrüstung ist nicht mehr öffentlich:</German>
<Korean>다음 로드아웃이 더이상 공용이 아님:</Korean>
<Korean>다음 로드아웃이 더 이상 공용이 아님:</Korean>
<Japanese>装備を非公開にしました:</Japanese>
<Chinese>以下的裝備已不再被分享:</Chinese>
<Chinesesimp>以下的负载已不再被分享:</Chinesesimp>
Expand Down
2 changes: 1 addition & 1 deletion addons/attach/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<Portuguese>Desprender item</Portuguese>
<Russian>Отсоединить</Russian>
<German>Gegenstand entfernen</German>
<Korean>떼내기</Korean>
<Korean>떼어내기</Korean>
<Japanese>アイテムを外す</Japanese>
<Chinese>取下裝備</Chinese>
<Chinesesimp>取下装备</Chinesesimp>
Expand Down
Loading

0 comments on commit 97462eb

Please sign in to comment.