Skip to content

Commit 876e261

Browse files
committed
added main functions
1 parent be5f45a commit 876e261

23 files changed

Lines changed: 7177 additions & 6 deletions

.hemtt/project.toml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,62 @@ name = "DiGii - Fast Reload"
22
author = "DiGii"
33
prefix = "digii"
44
mainprefix = "z"
5+
6+
#modname = "{{prefix}}_mods"
7+
#key_name = "{{prefix}}_{{version}}"
8+
#authority = "{{prefix}}_{{version}}"
9+
10+
[files]
11+
include = [
12+
"mod.cpp",
13+
# "README.md",
14+
# "LICENSE.md",
15+
# "KAMLogoLowRes.paa",
16+
# "KAMLogoHighRes.paa",
17+
# "AUTHORS.txt"
18+
]
19+
20+
[version]
21+
git_hash = 0
22+
23+
#[properties]
24+
#version = "{{git \"id 8\"}}"
25+
26+
[lint.sqf]
27+
enabled = true # Default: true
28+
exclude = [
29+
"a3/3DEN/UI/macroexecs.inc",
30+
"a3/ui_f/hpp/defineResincl.inc",
31+
"a3/ui_f/hpp/defineDIKCodes.inc",
32+
"a3/ui_f/hpp/defineCommonGrids.inc",
33+
"a3/ui_f/hpp/defineCommonColors.inc",
34+
]
35+
36+
37+
38+
[asc]
39+
enabled = true
40+
exclude = [
41+
"/initsettings.sqf",
42+
"/initkeybinds.sqf",
43+
"/xeh_prep.sqf"
44+
]
45+
46+
[hemtt.config]
47+
preset = "Hemtt"
48+
49+
[hemtt.launch]
50+
workshop = [
51+
"450814997", # CBA_A3's Workshop ID
52+
"463939057", # ACE3's Workshop ID
53+
"1779063631",
54+
"2018593688",
55+
"2369477168"
56+
]
57+
parameters = [
58+
"-skipIntro", # These parameters are passed to the Arma 3 executable
59+
"-noSplash", # They do not need to be added to your list
60+
"-showScriptErrors", # You can add additional parameters here
61+
"-filePatching",
62+
"-window",
63+
]

addons/main/XEH_PREP.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// FUNCTION PREPS
22
PREP(init);
3-
PREP(test);
3+
PREP(fastReload);

addons/main/XEH_postInit.sqf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,29 @@
11
#include "script_component.hpp"
2+
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
23

4+
//////////////////////////////////////////////////
5+
// CBA key input handling
6+
//////////////////////////////////////////////////
7+
8+
//Device Handler:
9+
GVAR(deviceKeyHandlingArray) = [];
10+
GVAR(deviceKeyCurrentIndex) = -1;
11+
12+
// Register localizations for the Keybinding categories
13+
["DiGii Reload", "DIGII - FastReload"] call CBA_fnc_registerKeybindModPrettyName;
14+
15+
["DiGii Reload", QGVAR(unloadWeapon), "Fast Reload", {
16+
// Conditions:
17+
if !([ACE_player, objNull, ["isNotInside"]] call ACEFUNC(common,canInteractWith)) exitWith {false};
18+
19+
private _currentWeapon = currentWeapon ACE_player;
20+
if !(_currentWeapon != primaryWeapon _unit && {_currentWeapon != handgunWeapon _unit} && {_currentWeapon != secondaryWeapon _unit}) exitWith {false};
21+
22+
private _currentMuzzle = currentMuzzle ACE_player;
23+
private _currentAmmoCount = ACE_player ammo _currentMuzzle;
24+
if (_currentAmmoCount < 1) exitWith {false};
25+
26+
// Statement:
27+
[ACE_player, _currentWeapon, _currentMuzzle, _currentAmmoCount] call FUNC(fastReload);
28+
true
29+
}, {false}, [DIK_R, [true, false, false], true]] call CBA_fnc_addKeybind; //Shift + R Key
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#include "script_component.hpp"
2+
/*
3+
* Author: DiGii
4+
* Drop current weapon magazine on the ground and reload from inventory
5+
*
6+
* Arguments:
7+
* 0: Player <OBJECT>
8+
* 1: Weapon <STRING>
9+
* 2: Muzzle (optional, default: Weapon)<STRING>
10+
* 3: Ammo count (optional, default: ammo currentMuzzle Player) <NUMBER>
11+
*
12+
* Return Value:
13+
* None
14+
*
15+
* Example:
16+
* [ACE_player, currentWeapon ACE_player, currentMuzzle ACE_player, 23] call digii_main_fnc_fastReload;
17+
*
18+
* Public: No
19+
*/
20+
21+
22+
params ["_unit", "_weapon", ["_muzzle", _weapon], ["_ammoCount", _unit ammo _muzzle ]];
23+
24+
private _delay = 2;
25+
[_unit, "ReloadMagazine", 1] call ACEFUNC(common,doGesture);
26+
27+
[{
28+
params ["_unit", "_weapon", "_ammoCount", "_muzzle"];
29+
30+
// remove weapon item
31+
private _magazineClass = currentMagazine _unit;
32+
33+
switch true do {
34+
case (_weapon == primaryWeapon _unit): {
35+
_unit removePrimaryWeaponItem _magazineClass;
36+
};
37+
case (_weapon == handgunWeapon _unit): {
38+
_unit removeHandgunItem _magazineClass;
39+
};
40+
case (_weapon == secondaryWeapon _unit): {
41+
_unit removeSecondaryWeaponItem _magazineClass;
42+
};
43+
};
44+
45+
private _weaponHolder = createVehicle ["Weapon_Empty", getPosATL _unit, [], 0, "CAN_COLLIDE"];
46+
_weaponHolder addMagazineAmmoCargo [_magazineClass, 1, _ammoCount];
47+
48+
49+
private _currentMagazines = magazinesAmmo _unit;
50+
private _compatibleMagazines = compatibleMagazines _weapon;
51+
52+
// Load new magazine from inventory
53+
{
54+
if ((_x select 0) in _compatibleMagazines) exitWith
55+
{
56+
_unit addWeaponItem [_weapon, [_x select 0, _x select 1, _muzzle], true];
57+
_unit removeMagazineGlobal (_x select 0);
58+
}
59+
} forEach _currentMagazines
60+
61+
}, [_unit, _weapon, _ammoCount, _muzzle], _delay] call CBA_fnc_waitAndExecute;
62+

addons/main/functions/fnc_init.sqf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@
1717
params ["_unit", ["_isRespawn", true]];
1818

1919
if (!local _unit) exitWith {};
20-
21-
[_unit] call FUNC(test);

addons/main/functions/fnc_test.sqf

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
surfaceInfo="A3\data_f\Penetration\cloth.bisurf";
2+
diffuse[]={0.75,0.80000001,0.30000001,1};
3+
ambient[]={0.75,0.80000001,0.30000001,1};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
surfaceInfo="A3\data_f\Penetration\default.bisurf";
2+
ambient[]={0.48699999,0.32800001,0.249,1};
3+
diffuse[]={0.48699999,0.32800001,0.249,1};
4+
forcedDiffuse[]={0,0,0,0};
5+
emmisive[]={0,0,0,1};
6+
specular[]={0,0,0,1};
7+
specularPower=1;
8+
PixelShaderID="Normal";
9+
VertexShaderID="Basic";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
surfaceInfo="A3\data_f\Penetration\metal.bisurf";
2+
ambient[]={0.69999999,0.80000001,0.77999997,1};
3+
diffuse[]={0.69999999,0.80000001,0.77999997,1};
4+
forcedDiffuse[]={0,0,0,0};
5+
emmisive[]={0,0,0,1};
6+
specular[]={0,0,0,1};
7+
specularPower=1;
8+
PixelShaderID="Normal";
9+
VertexShaderID="Basic";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
surfaceInfo="A3\data_f\Penetration\metal_plate.bisurf";
2+
ambient[]={0.69999999,0.80000001,0.77999997,1};
3+
diffuse[]={0.69999999,0.80000001,0.77999997,1};
4+
forcedDiffuse[]={0,0,0,0};
5+
emmisive[]={0,0,0,1};
6+
specular[]={0,0,0,1};
7+
specularPower=1;
8+
PixelShaderID="Normal";
9+
VertexShaderID="Basic";

0 commit comments

Comments
 (0)