Merge branch 'master' of github.com:KoffeinFlummi/ACE3

This commit is contained in:
Nicolás Badano 2015-01-17 15:19:53 -03:00
commit 6abc6073e1
79 changed files with 1599 additions and 1507 deletions

Binary file not shown.

View File

@ -1,4 +0,0 @@
// by commy2
AGM_Flashbang_CC = ppEffectCreate ["ColorCorrections", 4265];
AGM_Flashbang_CC ppEffectForceInNVG true;

View File

@ -1,272 +0,0 @@
class CfgPatches {
class AGM_Grenades {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {AGM_Core};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"commy2", "KoffeinFlummi"};
authorUrl = "https://github.com/commy2/";
};
};
class CfgFunctions {
class AGM_Grenades {
class AGM_Grenades {
file = "\AGM_Grenades\functions";
class flashbangEffect;
class nextMode;
class throwGrenade;
};
};
};
class Extended_PostInit_EventHandlers {
class AGM_Grenades {
clientInit = "call compile preprocessFileLineNumbers '\AGM_Grenades\clientInit.sqf'";
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class AGM_Grenades_ThrowGrenade {
clientFiredBIS = "if (_this select 0 == AGM_player) then {_this call AGM_Grenades_fnc_throwGrenade;};";
};
};
};
class AGM_Core_Default_Keys {
class switchGrenadeMode {
displayName = "$STR_AGM_Grenades_SwitchGrenadeMode";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "call AGM_Grenades_fnc_nextMode";
key = 9;//34;
shift = 0;
control = 0;
alt = 0;//1;
};
};
class CfgAmmo {
class FlareCore;
class FlareBase: FlareCore {
intensity = 20000;
flareSize = 12;
};
class F_40mm_White: FlareBase {
intensity = 40000;
flareSize = 12;
};
class F_20mm_White: FlareBase {
intensity = 20000;
flareSize = 12;
};
class F_Signal_Green: FlareBase {
intensity = 20000;
flareSize = 12;
};
class Flare_82mm_AMOS_White: FlareCore {
intensity = 80000;
flareSize = 12;
};
class F_20mm_Red: F_20mm_White {};
class F_20mm_Green: F_20mm_White {};
class F_20mm_Yellow: F_20mm_White {};
class AGM_F_Hand_White: F_20mm_White {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class AGM_F_Hand_Red: F_20mm_Red {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class AGM_F_Hand_Green: F_20mm_Green {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class AGM_F_Hand_Yellow: F_20mm_Yellow {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class AGM_G_M84: F_20mm_Yellow {
useFlare = 0;
flareSize = 0;
intensity = 0;
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
fuseDistance = 2.3;
model = "agm_grenades\agm_m84_thrown.p3d";
};
};
class CfgMagazines {
class HandGrenade;
class AGM_HandFlare_Base: HandGrenade {
value = 2;
nameSoundWeapon = "smokeshell";
nameSound = "smokeshell";
mass = 4;
initSpeed = 22;
};
class AGM_HandFlare_White: AGM_HandFlare_Base {
ammo = "AGM_F_Hand_White";
displayname = "$STR_AGM_Grenades_M127A1_White_Name";
descriptionshort = "$STR_AGM_Grenades_M127A1_White_Description";
displayNameShort = "$STR_AGM_Grenades_M127A1_White_NameShort";
model = "\A3\weapons_f\ammo\flare_white";
picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa";
};
class AGM_HandFlare_Red: AGM_HandFlare_Base {
ammo = "AGM_F_Hand_Red";
displayname = "$STR_AGM_Grenades_M127A1_Red_Name";
descriptionshort = "$STR_AGM_Grenades_M127A1_Red_Description";
displayNameShort = "$STR_AGM_Grenades_M127A1_Red_NameShort";
model = "\A3\weapons_f\ammo\flare_red";
picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa";
};
class AGM_HandFlare_Green: AGM_HandFlare_Base {
ammo = "AGM_F_Hand_Green";
displayname = "$STR_AGM_Grenades_M127A1_Green_Name";
descriptionshort = "$STR_AGM_Grenades_M127A1_Green_Description";
displayNameShort = "$STR_AGM_Grenades_M127A1_Green_NameShort";
model = "\A3\weapons_f\ammo\flare_green";
picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa";
};
class AGM_HandFlare_Yellow: AGM_HandFlare_Base {
ammo = "AGM_F_Hand_Yellow";
displayname = "$STR_AGM_Grenades_M127A1_Yellow_Name";
descriptionshort = "$STR_AGM_Grenades_M127A1_Yellow_Description";
displayNameShort = "$STR_AGM_Grenades_M127A1_Yellow_NameShort";
model = "\A3\weapons_f\ammo\flare_yellow";
picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa";
};
class AGM_M84: HandGrenade {
ammo = "AGM_G_M84";
displayname = "$STR_AGM_Grenades_M84_Name";
descriptionshort = "$STR_AGM_Grenades_M84_Description";
displayNameShort = "M84";
model = "agm_grenades\agm_m84.p3d";
picture = "\agm_grenades\UI\agm_m84_x_ca.paa";
};
class 3Rnd_UGL_FlareGreen_F;
class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F {
ammo = "F_40mm_Green";
initSpeed = 120;
};
class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F {
ammo = "F_40mm_Red";
initSpeed = 120;
};
};
class CfgWeapons {
class GrenadeLauncher;
class Throw: GrenadeLauncher {
muzzles[] += {"AGM_HandFlare_WhiteMuzzle", "AGM_HandFlare_RedMuzzle", "AGM_HandFlare_GreenMuzzle", "AGM_HandFlare_YellowMuzzle", "AGM_M84Muzzle"};
class ThrowMuzzle;
class AGM_HandFlare_WhiteMuzzle: ThrowMuzzle {
magazines[] = {"AGM_HandFlare_White"};
};
class AGM_HandFlare_RedMuzzle: ThrowMuzzle {
magazines[] = {"AGM_HandFlare_Red"};
};
class AGM_HandFlare_GreenMuzzle: ThrowMuzzle {
magazines[] = {"AGM_HandFlare_Green"};
};
class AGM_HandFlare_YellowMuzzle: ThrowMuzzle {
magazines[] = {"AGM_HandFlare_Yellow"};
};
class AGM_M84Muzzle: ThrowMuzzle {
magazines[] = {"AGM_M84"};
};
};
};
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class CfgVehicles {
class NATO_Box_Base;
class EAST_Box_Base;
class IND_Box_Base;
class Box_NATO_Support_F;
class Box_NATO_Grenades_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(AGM_HandFlare_White,12)
MACRO_ADDITEM(AGM_HandFlare_Green,12)
MACRO_ADDITEM(AGM_M84,12)
};
};
class Box_East_Grenades_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(AGM_HandFlare_Yellow,12)
MACRO_ADDITEM(AGM_HandFlare_Red,12)
MACRO_ADDITEM(AGM_M84,12)
};
};
class Box_IND_Grenades_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(AGM_HandFlare_Yellow,12)
MACRO_ADDITEM(AGM_HandFlare_Green,12)
MACRO_ADDITEM(AGM_M84,12)
};
};
class AGM_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(AGM_HandFlare_White,12)
MACRO_ADDITEM(AGM_HandFlare_Red,12)
MACRO_ADDITEM(AGM_HandFlare_Green,12)
MACRO_ADDITEM(AGM_HandFlare_Yellow,12)
MACRO_ADDITEM(AGM_M84,12)
};
};
};

View File

@ -1,93 +0,0 @@
/*
* Author: KoffeinFlummi
*
* Creates the flashbang effect locally/knocks out AI units.
*
* Arguments:
* 0: The unit (Object)
* 1: The grenade (Object)
*
* Return Value:
* None
*/
_this spawn {
_unit = _this select 0;
_grenade = _this select 1;
if (damage _unit >= 1) exitWith {};
_strength = 1 - ((_unit distance _grenade) min 15) / 15;
if !(isPlayer _unit) exitWith {
_unit disableAI "MOVE";
_unit disableAI "ANIM";
_unit disableAI "AUTOTARGET";
_unit disableAI "TARGET";
_unit disableAI "FSM";
_unit setSkill (skill _unit / 50);
sleep (7 * _strength);
_unit enableAI "MOVE";
_unit enableAI "ANIM";
_unit enableAI "AUTOTARGET";
_unit enableAI "TARGET";
_unit enableAI "FSM";
_unit setSkill (skill _unit * 50);
};
// is there line of sight to the grenade?
_posGrenade = getPosASL _grenade;
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
if (lineIntersects [_posGrenade, getPosASL _unit, _grenade, _unit]) then {
_strength = _strength / 10;
};
// beeeeeeeeeeeeeeeeeeeeeeeeeeeeep
if (isClass (configFile >> "CfgPatches" >> "AGM_Hearing") and _strength > 0) then {
[_unit, 0.5 + (_strength / 2)] call AGM_Hearing_fnc_earRinging;
};
// account for people looking away by slightly
// reducing the effect for visual effects.
_posUnit = getPos _unit;
_posGrenade = getPos _grenade;
_angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1));
_angleGrenade = (_angleGrenade + 360) % 360;
_angleView = (eyeDirection player select 0) atan2 (eyeDirection player select 1);
_angleView = (_angleView + 360) % 360;
_angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180);
_angleDiff = ((_angleDiff - 45) max 0);
_strength = _strength - _strength * (_angleDiff / 135);
// create flash to illuminate environment
_light = "#lightpoint" createVehicleLocal getPos _grenade;
_light setLightBrightness 200;
_light setLightAmbient [1,1,1];
_light setLightColor [1,1,1];
_light setLightDayLight true;
// blind player
if (_strength > 0.1) then {
AGM_Flashbang_CC ppEffectEnable true;
AGM_Flashbang_CC ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
AGM_Flashbang_CC ppEffectCommit 0.01;
};
sleep 0.1;
deleteVehicle _light;
sleep (7 * _strength);
if (_strength > 0.1) then {
AGM_Flashbang_CC ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
AGM_Flashbang_CC ppEffectCommit (10 * _strength);
sleep (10 * _strength);
AGM_Flashbang_CC ppEffectEnable false;
};
};

View File

@ -1,38 +0,0 @@
/*
* Author: commy2
*
* Select the next throwing mode and display message.
*
* Argument:
* Nothing
*
* Return value:
* Nothing
*/
private ["_mode", "_hint"];
_mode = missionNamespace getVariable ["AGM_Grenades_Mode", 0];
if (_mode == 4) then {
_mode = 0;
} else {
_mode = _mode + 1;
};
// ROLL GRENADE DOESN'T WORK RIGHT NOW
if (_mode == 3) then {
_mode = 4;
};
_hint = [
localize "STR_AGM_Grenades_NormalThrow",
localize "STR_AGM_Grenades_HighThrow",
localize "STR_AGM_Grenades_PreciseThrow",
localize "STR_AGM_Grenades_RollGrenade",
localize "STR_AGM_Grenades_DropGrenade"
] select _mode;
[_hint] call AGM_Core_fnc_displayTextStructured;
AGM_Grenades_Mode = _mode;

View File

@ -1,71 +0,0 @@
/*
* Author: commy2
*
* Adjust the grenades throwing direction and speed to the selected throwing mode.
*
* Argument:
* input from "Fired" eventhandler
*
* Return value:
* Nothing
*/
private ["_unit", "_weapon", "_projectile"];
_unit = _this select 0;
_weapon = _this select 1;
_projectile = _this select 6;
if (_weapon != "Throw") exitWith {};
private "_mode";
_mode = missionNamespace getVariable ["AGM_Grenades_Mode", 0];
if (_mode != 0) then {
private "_velocity";
_velocity = velocity _projectile;
switch (_mode) do {
//high throw
case 1 : {
_velocity = [
0.5 * (_velocity select 0),
0.5 * (_velocity select 1),
[0, 0, 0] distance (_velocity vectorMultiply 0.5)
];
};
//precise throw
case 2 : {
_velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity);
};
//roll grande
case 3 : {
//@todo
};
//drop grenade
case 4 : {
_velocity = [0, 0, 0];
};
};
_projectile setVelocity _velocity;
};
if (typeOf _projectile == "AGM_G_M84") then {
_this spawn {
_projectile = _this select 6;
sleep getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance");
if (alive _projectile) then {
playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400];
_affected = _projectile nearEntities ["CAManBase", 50];
{
[[_x, _projectile], "AGM_Grenades_fnc_flashbangEffect", _x] call AGM_Core_fnc_execRemoteFnc;
} forEach _affected;
};
};
};

Binary file not shown.

View File

@ -1,49 +0,0 @@
// by CAA-Picard, commy2
AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag = true;
AGM_WeaponSelect_CurrentGrenadeMuzzleFrag = "";
AGM_WeaponSelect_CurrentGrenadeMuzzleOther = "";
// Collect frag and other muzzles separately
with uiNamespace do {
if (isNil "AGM_WeaponSelect_FragMuzzles") then {
AGM_WeaponSelect_FragMuzzles = [];
AGM_WeaponSelect_NonFragMuzzles = [];
AGM_WeaponSelect_AllMuzzles = [];
AGM_WeaponSelect_FragMagazines = [];
AGM_WeaponSelect_NonFragMagazines = [];
AGM_WeaponSelect_AllMagazines = [];
{
_magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines");
_magazine = _magazines select 0;
_ammo = getText (configfile >> "CfgMagazines" >> _magazine >> "ammo");
_explosive = getNumber (configfile >> "CfgAmmo" >> _ammo >> "explosive");
if (_explosive == 0) then {
AGM_WeaponSelect_NonFragMuzzles pushBack _x;
AGM_WeaponSelect_NonFragMagazines pushBack _magazines;
} else {
AGM_WeaponSelect_FragMuzzles pushBack _x;
AGM_WeaponSelect_FragMagazines pushBack _magazines;
};
AGM_WeaponSelect_AllMuzzles pushBack _x;
AGM_WeaponSelect_AllMagazines pushBack _magazines;
} forEach getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles");
};
};
AGM_WeaponSelect_FragMuzzles = uiNamespace getVariable "AGM_WeaponSelect_FragMuzzles";
AGM_WeaponSelect_NonFragMuzzles = uiNamespace getVariable "AGM_WeaponSelect_NonFragMuzzles";
AGM_WeaponSelect_AllMuzzles = uiNamespace getVariable "AGM_WeaponSelect_AllMuzzles";
AGM_WeaponSelect_FragMagazines = uiNamespace getVariable "AGM_WeaponSelect_FragMagazines";
AGM_WeaponSelect_NonFragMagazines = uiNamespace getVariable "AGM_WeaponSelect_NonFragMagazines";
AGM_WeaponSelect_AllMagazines = uiNamespace getVariable "AGM_WeaponSelect_AllMagazines";
//AGM_WeaponSelect_AllMuzzlesCount = count AGM_WeaponSelect_AllMuzzles;
// hide grenade count if none is selected
[uiNamespace getVariable "AGM_dlgSoldier", false] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
["Soldier", {[_this select 0, call AGM_WeaponSelect_fnc_getSelectedGrenade != ""] call AGM_WeaponSelect_fnc_toggleGrenadeCount}] call AGM_Core_fnc_addInfoDisplayEventHandler; //@todo addEventHandler infoDisplayChanged with select 1 == "Soldier"

View File

@ -1,234 +0,0 @@
class CfgPatches {
class AGM_WeaponSelect {
units[] = {};
weapons[] = {};
requiredVersion = 0.60;
requiredAddons[] = {AGM_Core};
version = "0.95";
versionStr = "0.95";
versionAr[] = {0,95,0};
author[] = {"commy2", "KoffeinFlummi", "CAA-Picard"};
authorUrl = "https://github.com/commy2/";
};
};
class CfgFunctions {
class AGM_WeaponSelect {
class AGM_WeaponSelect {
file = "\AGM_WeaponSelect\functions";
class actionThrow;
class actionThrowCondition;
class countMagazinesForGrenadeMuzzle;
class displayGrenadeTypeAndNumber;
class findNextGrenadeMagazine;
class findNextGrenadeMuzzle;
class fireSmokeLauncher;
class getSelectedGrenade;
class getWeaponModes;
class getWeaponMuzzles;
class playChangeFiremodeSound;
class putWeaponAway;
class selectGrenadeAll;
class selectGrenadeFrag;
class selectGrenadeOther;
class selectWeaponMode;
class selectWeaponMuzzle;
class selectWeaponVehicle;
class selectMagazineVehicle;
class setNextGrenadeMuzzle;
class throwGrenade;
class toggleGrenadeCount;
};
};
};
class Extended_PostInit_EventHandlers {
class AGM_WeaponSelect {
clientInit = "call compile preprocessFileLineNumbers '\AGM_WeaponSelect\clientInit.sqf';";
};
};
class Extended_Init_EventHandlers {
class CAManBase {
class AGM_WeaponSelect_ThrowGrenade {
clientInit = "_this call compile preprocessFileLineNumbers '\AGM_WeaponSelect\initActions.sqf';";
};
};
};
class Extended_Respawn_EventHandlers {
class CAManBase {
class AGM_WeaponSelect_ThrowGrenade {
respawn = "[_this, ""{_this call compile preprocessFileLineNumbers '\AGM_WeaponSelect\initActions.sqf';}""] call AGM_Core_fnc_execRemoteFnc;";
};
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class AGM_WeaponSelect_ThrowGrenade {
clientFiredBIS = "if (_this select 0 == AGM_player) then {_this call AGM_WeaponSelect_fnc_throwGrenade;};";
};
};
};
class AGM_Core_Default_Keys {
class selectPistol {
displayName = "$STR_AGM_WeaponSelect_SelectPistol";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player, handgunWeapon _player] call AGM_WeaponSelect_fnc_selectWeaponMode";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 2;
shift = 0;
control = 0;
alt = 0;
};
class selectRifle {
displayName = "$STR_AGM_WeaponSelect_SelectRifle";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player, primaryWeapon _player] call AGM_WeaponSelect_fnc_selectWeaponMode";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 3;
shift = 0;
control = 0;
alt = 0;
};
class selectLauncher {
displayName = "$STR_AGM_WeaponSelect_SelectLauncher";
condition = "_player == _vehicle";
statement = "[_player, secondaryWeapon _player] call AGM_WeaponSelect_fnc_selectWeaponMode";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 5;
shift = 0;
control = 0;
alt = 0;
};
/*class selectPistolMuzzle {
displayName = "Select Pistol Muzzle";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player, handgunWeapon _player] call AGM_WeaponSelect_fnc_selectWeaponMuzzle";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
disabled = 1;
key = 7;
shift = 0;
control = 0;
alt = 0;
};*/
class selectRifleMuzzle {
displayName = "$STR_AGM_WeaponSelect_SelectRifleMuzzle";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player, primaryWeapon _player] call AGM_WeaponSelect_fnc_selectWeaponMuzzle";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 4;
shift = 0;
control = 0;
alt = 0;
};
/*class selectLauncherMuzzle {
displayName = "Select Launcher Muzzle";
condition = "_player == _vehicle";
statement = "[_player, secondaryWeapon _player] call AGM_WeaponSelect_fnc_selectWeaponMuzzle";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
disabled = 1;
key = 8;
shift = 0;
control = 0;
alt = 0;
};*/
class selectBinocular {
displayName = "$STR_AGM_WeaponSelect_SelectBinocular";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player, binocular _player] call AGM_WeaponSelect_fnc_selectWeaponMode";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 6;
shift = 0;
control = 0;
alt = 0;
};
class selectGrenadeFrag {
displayName = "$STR_AGM_WeaponSelect_SelectGrenadeFrag";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player] call AGM_WeaponSelect_fnc_selectGrenadeFrag";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 7;
shift = 0;
control = 0;
alt = 0;
};
class selectGrenadeOther {
displayName = "$STR_AGM_WeaponSelect_SelectGrenadeOther";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player] call AGM_WeaponSelect_fnc_selectGrenadeOther";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 8;
shift = 0;
control = 0;
alt = 0;
};
class holsterWeapon {
displayName = "$STR_AGM_WeaponSelect_HolsterWeapon";
condition = "[_player] call AGM_Core_fnc_canUseWeapon";
statement = "[_player] call AGM_WeaponSelect_fnc_putWeaponAway";
exceptions[] = {"AGM_Interaction_isNotEscorting"};
key = 11;
shift = 0;
control = 0;
alt = 0;
};
class engineOn {
displayName = "$STR_AGM_WeaponSelect_EngineOn";
condition = "_player != _vehicle && {_player == driver _vehicle} && {!isEngineOn _vehicle}";
statement = "_vehicle engineOn true";
key = 3;
shift = 0;
control = 0;
alt = 0;
};
class engineOff {
displayName = "$STR_AGM_WeaponSelect_EngineOff";
condition = "_player != _vehicle && {_player == driver _vehicle} && {isEngineOn _vehicle}";
statement = "_vehicle engineOn false";
key = 2;
shift = 0;
control = 0;
alt = 0;
};
class selectMaingun {
displayName = "$STR_AGM_WeaponSelect_SelectMainGun";
condition = "_player != _vehicle";
statement = "[_player, _vehicle, 0] call AGM_WeaponSelect_fnc_selectWeaponVehicle";
key = 4;
shift = 0;
control = 0;
alt = 0;
};
class selectMachineGun {
displayName = "$STR_AGM_WeaponSelect_SelectMachineGun";
condition = "_player != _vehicle";
statement = "[_player, _vehicle, 1] call AGM_WeaponSelect_fnc_selectWeaponVehicle";
key = 5;
shift = 0;
control = 0;
alt = 0;
};
class selectMissile {
displayName = "$STR_AGM_WeaponSelect_SelectMissiles";
condition = "_player != _vehicle";
statement = "[_player, _vehicle, 2] call AGM_WeaponSelect_fnc_selectWeaponVehicle";
key = 6;
shift = 0;
control = 0;
alt = 0;
};
class fireSmokeLauncher {
displayName = "$STR_AGM_WeaponSelect_FireSmokeLauncher";
condition = "_player != _vehicle && {_player == commander _vehicle}";
statement = "[_vehicle] call AGM_WeaponSelect_fnc_fireSmokeLauncher";
key = 10;
shift = 0;
control = 0;
alt = 0;
};
};

View File

@ -1,4 +0,0 @@
// by commy2
_text = [localize "STR_AGM_WeaponSelect_NoGrenadeSelected", [1,0,0]] call AGM_Core_fnc_stringToColoredText;
[composeText [lineBreak, _text]] call AGM_Core_fnc_displayTextStructured;

View File

@ -1,32 +0,0 @@
// by commy2
_muzzle = call AGM_WeaponSelect_fnc_getSelectedGrenade;
_isInput = inputAction "CycleThrownItems" > 0;
if !(_isInput isEqualTo (missionNamespace getVariable ["AGM_WeaponSelect_CycleThrownItemsState", false])) then {
if (_isInput) then {
if (_muzzle == "") then {
[_this select 1] spawn AGM_WeaponSelect_fnc_selectGrenadeAll;
} else {
[_this select 1] spawn AGM_WeaponSelect_fnc_selectGrenadeAll;//
};
};
AGM_WeaponSelect_CycleThrownItemsState = _isInput;
};
if !([_this select 1] call AGM_Core_fnc_canUseWeapon) exitWith {false};
if (_muzzle == "") exitWith {["All"] call AGM_WeaponSelect_fnc_findNextGrenadeMagazine != ""};
// fix auto muzzle swap after entering or leaving a vehicle
if (_this select 0 != missionNamespace getVariable ["AGM_WeaponSelect_CurrentGrenadeMuzzleVehicle", objNull]) then {
[_this select 1, _muzzle] call AGM_WeaponSelect_fnc_setNextGrenadeMuzzle;
AGM_WeaponSelect_CurrentGrenadeMuzzleVehicle = _this select 0;
};
if ((_this select 1) ammo _muzzle == 0) exitWith {
if (AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag) then {AGM_WeaponSelect_CurrentGrenadeMuzzleFrag = ""} else {AGM_WeaponSelect_CurrentGrenadeMuzzleOther = ""};
[uiNamespace getVariable "AGM_dlgSoldier", false] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
true
};
false

View File

@ -1,44 +0,0 @@
/*
* Author: CAA-Picard
*
* Count how many grenade magazines the unit has on the uniform and vest.
*
* Argument:
* 0: Muzzle name
*
* Return value:
* 0: Number of magazines
* 1: First magazine name
*/
private ["_player", "_muzzle"];
_player = _this select 0;
_muzzle = _this select 1;
_uniformMags = getMagazineCargo uniformContainer _player;
_vestMags = getMagazineCargo vestContainer _player;
_backPackMags = getMagazineCargo backpackContainer _player;
_numberOfMagazines = 0;
_magazineClasses = getArray (configFile >> "CfgWeapons" >> "Throw" >> _muzzle >> "magazines" );
_firstMagazine = _magazineClasses select 0;
{
_indexInUniform = (_uniformMags select 0) find _x;
if (_indexInUniform > -1) then {
_numberOfMagazines = _numberOfMagazines + ((_uniformMags select 1) select _indexInUniform);
_firstMagazine = _x;
};
_indexInVest = (_vestMags select 0) find _x;
if (_indexInVest > -1) then {
_numberOfMagazines = _numberOfMagazines + ((_vestMags select 1) select _indexInVest);
_firstMagazine = _x;
};
_indexInBackpack = (_backpackMags select 0) find _x;
if (_indexInBackpack > -1) then {
_numberOfMagazines = _numberOfMagazines + ((_backpackMags select 1) select _indexInBackpack);
_firstMagazine = _x;
};
} forEach _magazineClasses;
[_numberOfMagazines, _firstMagazine]

View File

@ -1,32 +0,0 @@
// by commy2
private ["_scope", "_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMagazine"];
_scope = _this select 0; //"All", "Frag" or "NonFrag"
_allMags = missionNamespace getVariable [format ["AGM_WeaponSelect_%1Magazines", _scope], []];
_allMuzzles = missionNamespace getVariable [format ["AGM_WeaponSelect_%1Muzzles", _scope], []];
_magazines = magazines AGM_player;
_start = [AGM_WeaponSelect_CurrentGrenadeMuzzleOther, AGM_WeaponSelect_CurrentGrenadeMuzzleFrag] select AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag;
_index = _allMuzzles find _start;
scopeName "SearchMain";
_nextMagazine = "";
for "_index" from (_index + 1) to (count _allMuzzles - 1) do {
{
if (_x in (_allMags select _index)) exitWith {_nextMagazine = _x; breakTo "SearchMain"};
} count _magazines;
};
if (_nextMagazine != "") exitWith {_nextMagazine};
for "_index" from 0 to _index do {
{
if (_x in (_allMags select _index)) exitWith {_nextMagazine = _x; breakTo "SearchMain"};
} count _magazines;
};
_nextMagazine

View File

@ -1,32 +0,0 @@
// by commy2
private ["_scope", "_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMuzzle"];
_scope = _this select 0; //"All", "Frag" or "NonFrag"
_allMags = missionNamespace getVariable [format ["AGM_WeaponSelect_%1Magazines", _scope], []];
_allMuzzles = missionNamespace getVariable [format ["AGM_WeaponSelect_%1Muzzles", _scope], []];
_magazines = magazines AGM_player;
_start = [AGM_WeaponSelect_CurrentGrenadeMuzzleOther, AGM_WeaponSelect_CurrentGrenadeMuzzleFrag] select AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag;
_index = _allMuzzles find _start;
scopeName "SearchMain";
_nextMuzzle = "";
for "_index" from (_index + 1) to (count _allMuzzles - 1) do {
{
if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"};
} count _magazines;
};
if (_nextMuzzle != "") exitWith {_nextMuzzle};
for "_index" from 0 to _index do {
{
if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"};
} count _magazines;
};
_nextMuzzle

View File

@ -1,37 +0,0 @@
// by commy2
private ["_vehicle", "_turret", "_weapons"];
_vehicle = _this select 0;
_turret = [typeOf _vehicle] call AGM_Core_fnc_getTurretCommander;
_weapons = _vehicle weaponsTurret _turret;
if (
count _weapons > 1
|| {count _weapons > 0 && {!(_weapons select 0 in ["SmokeLauncher", "BWA3_SmokeLauncher"])}} // @todo somebody might use custom smoke launcher weapons aswell, maybe ...
) then {
//This doesn't work reliably for vehilces with additional weapons for the commander. Select smoke launcher instead.
private "_index";
// avoid infinite loop
if !("SmokeLauncher" in _weapons) exitWith {};
_index = 0;
while {
_vehicle currentWeaponTurret _turret != "SmokeLauncher"
} do {
[commander _vehicle, _vehicle, _index] call AGM_WeaponSelect_fnc_selectWeaponVehicle;
_index = _index + 1;
};
} else {
// fire away!
private "_logic";
_logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
_logic action ["useWeapon", _vehicle, commander _vehicle, 0];
deleteVehicle _logic;
};

View File

@ -1,3 +0,0 @@
// by commy2
[AGM_WeaponSelect_CurrentGrenadeMuzzleOther, AGM_WeaponSelect_CurrentGrenadeMuzzleFrag] select AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag

View File

@ -1,51 +0,0 @@
/*
* Author: CAA-Picard, commy2
*
* Cycle through all grenades.
*
* Argument:
* None
*
* Return value:
* None
*/
private ["_player", "_nextMuzzle"];
_player = _this select 0;
_nextMuzzle = ["All"] call AGM_WeaponSelect_fnc_findNextGrenadeMuzzle;
if (_nextMuzzle != "") then {
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = AGM_WeaponSelect_AllMagazines select (AGM_WeaponSelect_AllMuzzles find _nextMuzzle);
reverse _magazines;
_magazine = "";
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _player;
// There is a muzzle with magazines --> cycle to it
[_player, _nextMuzzle] call AGM_WeaponSelect_fnc_setNextGrenadeMuzzle;
[_magazine, _count] call AGM_WeaponSelect_fnc_displayGrenadeTypeAndNumber;
[uiNamespace getVariable "AGM_dlgSoldier", true] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
} else {
// There is a no muzzle with magazines --> select nothing
AGM_WeaponSelect_CurrentGrenadeMuzzleFrag = ""; AGM_WeaponSelect_CurrentGrenadeMuzzleOther = "";
_text = [localize "STR_AGM_WeaponSelect_NoGrenadesLeft", [1,0,0]] call AGM_Core_fnc_stringToColoredText;
[composeText [lineBreak, _text]] call AGM_Core_fnc_displayTextStructured;
[uiNamespace getVariable "AGM_dlgSoldier", false] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
};
if (_nextMuzzle in AGM_WeaponSelect_FragMuzzles) then {
AGM_WeaponSelect_CurrentGrenadeMuzzleFrag = _nextMuzzle;
AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag = true;
} else {
AGM_WeaponSelect_CurrentGrenadeMuzzleOther = _nextMuzzle;
AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag = false;
};

View File

@ -1,45 +0,0 @@
/*
* Author: CAA-Picard, commy2
*
* Cycle through frags.
*
* Argument:
* None
*
* Return value:
* None
*/
private ["_player", "_nextMuzzle"];
_player = _this select 0;
_nextMuzzle = ["Frag"] call AGM_WeaponSelect_fnc_findNextGrenadeMuzzle;
if (_nextMuzzle != "") then {
AGM_WeaponSelect_CurrentGrenadeMuzzleFrag = _nextMuzzle;
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = AGM_WeaponSelect_FragMagazines select (AGM_WeaponSelect_FragMuzzles find _nextMuzzle);
reverse _magazines;
_magazine = "";
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _player;
// There is a muzzle with magazines --> cycle to it
[_player, _nextMuzzle] call AGM_WeaponSelect_fnc_setNextGrenadeMuzzle;
[_magazine, _count] call AGM_WeaponSelect_fnc_displayGrenadeTypeAndNumber;
[uiNamespace getVariable "AGM_dlgSoldier", true] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
} else {
// There is a no muzzle with magazines --> select nothing
AGM_WeaponSelect_CurrentGrenadeMuzzleFrag = "";
_text = [localize "STR_AGM_WeaponSelect_NoFragsLeft", [1,0,0]] call AGM_Core_fnc_stringToColoredText;
[composeText [lineBreak, _text]] call AGM_Core_fnc_displayTextStructured;
[uiNamespace getVariable "AGM_dlgSoldier", false] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
};
AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag = true;

View File

@ -1,45 +0,0 @@
/*
* Author: CAA-Picard, commy2
*
* Cycle through non explosive grenades.
*
* Argument:
* None
*
* Return value:
* None
*/
private ["_player", "_nextMuzzle"];
_player = _this select 0;
_nextMuzzle = ["NonFrag"] call AGM_WeaponSelect_fnc_findNextGrenadeMuzzle;
if (_nextMuzzle != "") then {
AGM_WeaponSelect_CurrentGrenadeMuzzleOther = _nextMuzzle;
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = AGM_WeaponSelect_NonFragMagazines select (AGM_WeaponSelect_NonFragMuzzles find _nextMuzzle);
reverse _magazines;
_magazine = "";
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _player;
// There is a muzzle with magazines --> cycle to it
[_player, _nextMuzzle] call AGM_WeaponSelect_fnc_setNextGrenadeMuzzle;
[_magazine, _count] call AGM_WeaponSelect_fnc_displayGrenadeTypeAndNumber;
[uiNamespace getVariable "AGM_dlgSoldier", true] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
} else {
// There is a no muzzle with magazines --> select nothing
AGM_WeaponSelect_CurrentGrenadeMuzzleOther = "";
_text = [localize "STR_AGM_WeaponSelect_NoMiscGrenadeLeft", [1,0,0]] call AGM_Core_fnc_stringToColoredText;
[composeText [lineBreak, _text]] call AGM_Core_fnc_displayTextStructured;
[uiNamespace getVariable "AGM_dlgSoldier", false] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
};
AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag = false;

View File

@ -1,52 +0,0 @@
// by commy2
private ["_vehicle", "_index", "_turret", "_weapon", "_magazine"];
_vehicle = _this select 0;
_index = _this select 1;
_turret = [player] call AGM_Core_fnc_getTurretIndex;
/* WIP
_weapon = currentWeapon _vehicle;
_weapons = _vehicle weaponsTurret _turret;
_magazines = _vehicle magazinesTurret _turret;
vehicle player loadMagazine [[0], "cannon_120mm", "32Rnd_120mm_APFSDS_shells_Tracer_Red"]
["cannon_105mm","LMG_M200"]
vehicle player loadMagazine [[0,0], "SmokeLauncher", "SmokeLauncherMag"]
player action ["SwitchMagazine", vehicle player, player, 1];
*/

View File

@ -1,48 +0,0 @@
/*
* Author: commy2
*
* The player will select the specified weapon or will change to the next firing mode if the weapon was already selected.
*
* Argument:
* 0: A weapon (String)
*
* Return value:
* None.
*/
private ["_player", "_weapon", "_muzzles", "_modes", "_count", "_index", "_muzzle", "_mode"];
_player = _this select 0;
_weapon = _this select 1;
if (_weapon == "") exitWith {};
if (currentWeapon _player != _weapon) exitWith {
_player selectWeapon _weapon;
};
// unlock safety
if (_weapon in (_player getVariable ["AGM_SafeMode_safedWeapons", []])) exitWith {
[_player, _weapon, _weapon] call AGM_SafeMode_fnc_unlockSafety;
};
_muzzles = [_weapon] call AGM_WeaponSelect_fnc_getWeaponMuzzles;
_modes = [_weapon] call AGM_WeaponSelect_fnc_getWeaponModes;
_count = count _modes;
_index = (_modes find currentWeaponMode _player) + 1;
if (_index > _count - 1) then {_index = 0};
_muzzle = _muzzles select 0;
_mode = _modes select _index;
_index = 0;
while {
_index < 100 && {currentMuzzle _player != _muzzle || {currentWeaponMode _player != _mode}}
} do {
_player action ["SwitchWeapon", _player, _player, _index];
_index = _index + 1;
};
// play fire mode selector sound
[_player, _weapon] call AGM_WeaponSelect_fnc_playChangeFiremodeSound;

View File

@ -1,46 +0,0 @@
/*
* Author: commy2
*
* The player will select the specified weapon and change to the first additional muzzle. E.g. the grenade launcher of a assault rifle.
*
* Argument:
* 0: A weapon (String)
*
* Return value:
* None.
*/
private ["_player", "_weapon", "_muzzles", "_count", "_index", "_muzzle"];
_player = _this select 0;
_weapon = _this select 1;
if (_weapon == "") exitWith {};
_muzzles = [_weapon] call AGM_WeaponSelect_fnc_getWeaponMuzzles;
if (currentWeapon _player != _weapon) exitWith {
if (count _muzzles > 1) then {
// unlock safety
/*if (_weapon in (_player getVariable ["AGM_SafeMode_safedWeapons", []])) exitWith {
[_player, _weapon, _muzzles select 1] call AGM_SafeMode_fnc_unlockSafety;
};*/
_player selectWeapon (_muzzles select 1);
};
};
_count = count _muzzles;
_index = (_muzzles find currentMuzzle _player) + 1;
if (_index > _count - 1) then {_index = 1};
_muzzle = _muzzles select _index;
_index = 0;
while {
_index < 100 && {currentMuzzle _player != _muzzle}
} do {
_player action ["SwitchWeapon", _player, _player, _index];
_index = _index + 1;
};

View File

@ -1,37 +0,0 @@
// by commy2
private ["_player", "_vehicle", "_index", "_turret", "_weapons", "_weapon"];
_player = _this select 0;
_vehicle = _this select 1;
_index = _this select 2;
_turret = [_player] call AGM_Core_fnc_getTurretIndex;
if (_turret isEqualTo [] && {_player == driver _vehicle}) then {
_weapons = weapons _vehicle;
if (_index > count _weapons - 1) exitWith {};
_weapon = _weapons select _index;
_index = 0;
while {
_index < 100 && {currentWeapon _vehicle != _weapon}
} do {
_player action ["SwitchWeapon", _vehicle, _player, _index];
_index = _index + 1;
};
} else {
_weapons = _vehicle weaponsTurret _turret;
if (_index > count _weapons - 1) exitWith {};
_weapon = _weapons select _index;
_index = 0;
while {
_index < 100 && {_vehicle currentWeaponTurret _turret != _weapon}
} do {
_player action ["SwitchWeapon", _vehicle, _player, _index];
_index = _index + 1;
};
};

View File

@ -1,100 +0,0 @@
/*
* Author: CAA-Picard
*
* Select the next grenade muzzle to throw.
*
* Argument:
* muzzle name
*
* Return value:
* None
*
*/
private ["_player", "_muzzle"];
_player = _this select 0;
_muzzle = _this select 1;
_uniformMags = getMagazineCargo uniformContainer _player;
_vestMags = getMagazineCargo vestContainer _player;
_backPackMags = getMagazineCargo backpackContainer _player;
_uniformMagsToRemove = [];
_vestMagsToRemove = [];
_backPackMagsToRemove = [];
_firstMagazine = "";
// Collect which magazines to remove
_throwMuzzleNames = getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles");
{
_muzzleName = _x;
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _muzzleName >> "magazines" );
if (_muzzle != _muzzleName) then {
{
_index = (_uniformMags select 0) find _x;
if (_index > -1) then {
_uniformMagsToRemove = _uniformMagsToRemove + [[_x, (_uniformMags select 1) select _index]];
};
_index = (_vestMags select 0) find _x;
if (_index > -1) then {
_vestMagsToRemove = _vestMagsToRemove + [[_x, (_vestMags select 1) select _index]];
};
_index = (_backpackMags select 0) find _x;
if (_index > -1) then {
_backpackMagsToRemove = _backpackMagsToRemove + [[_x, (_backpackMags select 1) select _index]];
};
} forEach _muzzleMagazines;
} else {
{
_index = (_uniformMags select 0) find _x;
if (_index > -1) then {
_firstMagazine = _x;
};
_index = (_vestMags select 0) find _x;
if (_index > -1) then {
_firstMagazine = _x;
};
_index = (_backpackMags select 0) find _x;
if (_index > -1) then {
_firstMagazine = _x;
};
} forEach _muzzleMagazines;
};
} forEach _throwMuzzleNames;
// Remove all magazines except those we are switching to --> this breaks the selector
{
for [{_i=0},{_i < (_x select 1)}, {_i = _i + 1}] do {
_player removeItem (_x select 0);
};
} forEach _uniformMagsToRemove;
{
for [{_i=0},{_i < (_x select 1)}, {_i = _i + 1}] do {
_player removeItem (_x select 0);
};
} forEach _vestMagsToRemove;
{
for [{_i=0},{_i < (_x select 1)}, {_i = _i + 1}] do {
_player removeItem (_x select 0);
};
} forEach _backPackMagsToRemove;
// Readd magazines
{
for [{_i=0},{_i < (_x select 1)}, {_i = _i + 1}] do {
_player addItemToUniform (_x select 0);
};
} forEach _uniformMagsToRemove;
{
for [{_i=0},{_i < (_x select 1)}, {_i = _i + 1}] do {
_player addItemToVest (_x select 0);
};
} forEach _vestMagsToRemove;
{
for [{_i=0},{_i < (_x select 1)}, {_i = _i + 1}] do {
_player addItemToBackpack (_x select 0);
};
} forEach _backPackMagsToRemove;

View File

@ -1,19 +0,0 @@
// by commy2
private ["_unit", "_weapon", "_magazine"];
_unit = _this select 0;
_weapon = _this select 1;
_magazine = _this select 5;
if (_weapon != "Throw") exitWith {};
private "_count";
_count = {_x == _magazine} count magazines _unit;
[_magazine, _count] call AGM_WeaponSelect_fnc_displayGrenadeTypeAndNumber;
if (_count == 0) then {
if (AGM_WeaponSelect_CurrentGrenadeMuzzleIsFrag) then {AGM_WeaponSelect_CurrentGrenadeMuzzleFrag = ""} else {AGM_WeaponSelect_CurrentGrenadeMuzzleOther = ""};
[uiNamespace getVariable "AGM_dlgSoldier", false] call AGM_WeaponSelect_fnc_toggleGrenadeCount;
};

View File

@ -1,23 +0,0 @@
// by commy2
private ["_dlg", "_show"];
_dlg = _this select 0;
_show = _this select 1;
if (_show) then {
private "_config";
_config = configFile >> "RscInGameUI" >> "RscUnitInfo" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_GrenadeCount";
(_dlg displayCtrl 151) ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
_config = configFile >> "RscInGameUI" >> "RscUnitInfo" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_GrenadeType";
(_dlg displayCtrl 152) ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
} else {
(_dlg displayCtrl 151) ctrlSetPosition [0,0,0,0];
(_dlg displayCtrl 152) ctrlSetPosition [0,0,0,0];
};
(_dlg displayCtrl 151) ctrlCommit 0;
(_dlg displayCtrl 152) ctrlCommit 0;

View File

@ -1,25 +0,0 @@
// by commy2
private ["_unit", "_id"];
_unit = _this select 0;
/*_id = [
_unit,
format ["<t color=""#FFFFFF"" >%1</t>", localize "STR_AGM_WeaponSelect_ReadyGrenade"],
"Throw",
AGM_WeaponSelect_fnc_actionThrowCondition,
AGM_WeaponSelect_fnc_actionThrow,
{true},
{[_this select 1] call AGM_WeaponSelect_fnc_selectGrenadeAll},
2
] call AGM_Core_fnc_addActionMenuEventHandler;*/
_id = [
_unit,
"Throw",
AGM_WeaponSelect_fnc_actionThrowCondition,
AGM_WeaponSelect_fnc_actionThrow
] call AGM_Core_fnc_addActionEventHandler;
_unit setVariable ["AGM_WeaponSelect_ThrowActionID", _id];

View File

@ -0,0 +1 @@
z\ace\addons\grenades

View File

@ -0,0 +1,89 @@
class CfgAmmo {
class FlareCore;
class FlareBase: FlareCore {
intensity = 20000;
flareSize = 12;
};
class F_40mm_White: FlareBase {
intensity = 40000;
flareSize = 12;
};
class F_20mm_White: FlareBase {
intensity = 20000;
flareSize = 12;
};
class F_Signal_Green: FlareBase {
intensity = 20000;
flareSize = 12;
};
class Flare_82mm_AMOS_White: FlareCore {
intensity = 80000;
flareSize = 12;
};
class F_20mm_Red: F_20mm_White {};
class F_20mm_Green: F_20mm_White {};
class F_20mm_Yellow: F_20mm_White {};
class ACE_F_Hand_White: F_20mm_White {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class ACE_F_Hand_Red: F_20mm_Red {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class ACE_F_Hand_Green: F_20mm_Green {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class ACE_F_Hand_Yellow: F_20mm_Yellow {
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
};
class ACE_G_M84: F_20mm_Yellow {
useFlare = 0;
flareSize = 0;
intensity = 0;
grenadeBurningSound[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
grenadeFireSound[] = {"SmokeShellSoundHit1",0.25,"SmokeShellSoundHit2",0.25,"SmokeShellSoundHit3",0.5};
soundTrigger[] = {"SmokeShellSoundLoop1",0.5,"SmokeShellSoundLoop2",0.5};
SmokeShellSoundHit1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_1",1.25893,1,100};
SmokeShellSoundHit2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_2",1.25893,1,100};
SmokeShellSoundHit3[] = {"A3\Sounds_F\weapons\smokeshell\smoke_3",1.25893,1,100};
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
timeToLive = 60;
fuseDistance = 2.3;
model = PATHTOF(models\ACE_m84_thrown.p3d);
};
};

View File

@ -0,0 +1,19 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
};
};
class Extended_PostInit_EventHandlers {
class ADDON {
clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) );
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class ADDON {
clientFiredBIS = QUOTE( _this call FUNC(throwGrenade) );
};
};
};

View File

@ -0,0 +1,60 @@
class CfgMagazines {
class HandGrenade;
class ACE_HandFlare_Base: HandGrenade {
value = 2;
nameSoundWeapon = "smokeshell";
nameSound = "smokeshell";
mass = 4;
initSpeed = 22;
};
class ACE_HandFlare_White: ACE_HandFlare_Base {
ammo = "ACE_F_Hand_White";
displayname = "$STR_ACE_Grenades_M127A1_White_Name";
descriptionshort = "$STR_ACE_Grenades_M127A1_White_Description";
displayNameShort = "$STR_ACE_Grenades_M127A1_White_NameShort";
model = "\A3\weapons_f\ammo\flare_white";
picture = "\A3\Weapons_F\Data\UI\gear_flare_white_ca.paa";
};
class ACE_HandFlare_Red: ACE_HandFlare_Base {
ammo = "ACE_F_Hand_Red";
displayname = "$STR_ACE_Grenades_M127A1_Red_Name";
descriptionshort = "$STR_ACE_Grenades_M127A1_Red_Description";
displayNameShort = "$STR_ACE_Grenades_M127A1_Red_NameShort";
model = "\A3\weapons_f\ammo\flare_red";
picture = "\A3\Weapons_F\Data\UI\gear_flare_red_ca.paa";
};
class ACE_HandFlare_Green: ACE_HandFlare_Base {
ammo = "ACE_F_Hand_Green";
displayname = "$STR_ACE_Grenades_M127A1_Green_Name";
descriptionshort = "$STR_ACE_Grenades_M127A1_Green_Description";
displayNameShort = "$STR_ACE_Grenades_M127A1_Green_NameShort";
model = "\A3\weapons_f\ammo\flare_green";
picture = "\A3\Weapons_F\Data\UI\gear_flare_green_ca.paa";
};
class ACE_HandFlare_Yellow: ACE_HandFlare_Base {
ammo = "ACE_F_Hand_Yellow";
displayname = "$STR_ACE_Grenades_M127A1_Yellow_Name";
descriptionshort = "$STR_ACE_Grenades_M127A1_Yellow_Description";
displayNameShort = "$STR_ACE_Grenades_M127A1_Yellow_NameShort";
model = "\A3\weapons_f\ammo\flare_yellow";
picture = "\A3\Weapons_F\Data\UI\gear_flare_yellow_ca.paa";
};
class ACE_M84: HandGrenade {
ammo = "ACE_G_M84";
displayname = "$STR_ACE_Grenades_M84_Name";
descriptionshort = "$STR_ACE_Grenades_M84_Description";
displayNameShort = "M84";
model = PATHTOF(models\ACE_m84.p3d);
picture = PATHTOF(UI\ACE_m84_x_ca.paa);
};
class 3Rnd_UGL_FlareGreen_F;
class 6Rnd_GreenSignal_F: 3Rnd_UGL_FlareGreen_F {
ammo = "F_40mm_Green";
initSpeed = 120;
};
class 6Rnd_RedSignal_F: 6Rnd_GreenSignal_F {
ammo = "F_40mm_Red";
initSpeed = 120;
};
};

View File

@ -0,0 +1,45 @@
#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \
name = #ITEM; \
count = COUNT; \
};
class CfgVehicles {
class NATO_Box_Base;
class EAST_Box_Base;
class IND_Box_Base;
class Box_NATO_Support_F;
class Box_NATO_Grenades_F: NATO_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_White,12)
MACRO_ADDITEM(ACE_HandFlare_Green,12)
MACRO_ADDITEM(ACE_M84,12)
};
};
class Box_East_Grenades_F: EAST_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_Yellow,12)
MACRO_ADDITEM(ACE_HandFlare_Red,12)
MACRO_ADDITEM(ACE_M84,12)
};
};
class Box_IND_Grenades_F: IND_Box_Base {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_Yellow,12)
MACRO_ADDITEM(ACE_HandFlare_Green,12)
MACRO_ADDITEM(ACE_M84,12)
};
};
class ACE_Box_Misc: Box_NATO_Support_F {
class TransportItems {
MACRO_ADDITEM(ACE_HandFlare_White,12)
MACRO_ADDITEM(ACE_HandFlare_Red,12)
MACRO_ADDITEM(ACE_HandFlare_Green,12)
MACRO_ADDITEM(ACE_HandFlare_Yellow,12)
MACRO_ADDITEM(ACE_M84,12)
};
};
};

View File

@ -0,0 +1,23 @@
class CfgWeapons {
class GrenadeLauncher;
class Throw: GrenadeLauncher {
muzzles[] += {"ACE_HandFlare_WhiteMuzzle", "ACE_HandFlare_RedMuzzle", "ACE_HandFlare_GreenMuzzle", "ACE_HandFlare_YellowMuzzle", "ACE_M84Muzzle"};
class ThrowMuzzle;
class ACE_HandFlare_WhiteMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_White"};
};
class ACE_HandFlare_RedMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_Red"};
};
class ACE_HandFlare_GreenMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_Green"};
};
class ACE_HandFlare_YellowMuzzle: ThrowMuzzle {
magazines[] = {"ACE_HandFlare_Yellow"};
};
class ACE_M84Muzzle: ThrowMuzzle {
magazines[] = {"ACE_M84"};
};
};
};

View File

@ -0,0 +1,13 @@
// by commy2
#include "script_component.hpp"
GVAR(flashbangPPEffectCC) = ppEffectCreate ["ColorCorrections", 4265];
GVAR(flashbangPPEffectCC) ppEffectForceInNVG true;
["ACE3",
localize "STR_ACE_Grenades_SwitchGrenadeMode",
{_this call FUNC(nextMode)},
[9, [false, false, false]], //8 key
false,
"keydown"] call cba_fnc_registerKeybind;

View File

@ -0,0 +1,9 @@
#include "script_component.hpp"
PREP(flashbangEffectStages);
PREP(flashbangExplosionEH);
PREP(flashbangThrownFuze);
PREP(nextMode);
PREP(throwGrenade);
["flashbangExplosion", { _this call DFUNC(flashbangExplosionEH) }] call EFUNC(common,addEventHandler);

View File

@ -0,0 +1,19 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"commy2", "KoffeinFlummi"};
authorUrl = "https://github.com/commy2/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgAmmo.hpp"
#include "CfgWeapons.hpp"
#include "CfgMagazines.hpp"
#include "CfgVehicles.hpp"

View File

@ -0,0 +1,57 @@
/*
* Author: KoffeinFlummi, Pabst Mirror
*
* Handles the different stages of the flash bang effect recovery
*
* Arguments:
* ARRAY[
* 0-ARRAY - PARAMS:
* 0: NUMBER - Stage, controls a case statement
* 1: NUMBER - Time To Wait Until
* 2: VARIES - Stage's Variable
* 1-NUMBER perFrame handle
* Return Value:
* None
*/
#include "script_component.hpp"
private ["_stage", "_waitUntilTime"];
_stage = (_this select 0) select 0;
_waitUntilTime = (_this select 0) select 1;
if (_waitUntilTime > time) exitWith {};
//remove frameEH
[(_this select 1)] call cba_fnc_removePerFrameHandler;
switch (_stage) do {
case(EFFECT_STAGE_RESETAI): {
private "_unit";
_unit = (_this select 0) select 2;
_unit enableAI "MOVE";
_unit enableAI "ANIM";
_unit enableAI "AUTOTARGET";
_unit enableAI "TARGET";
_unit enableAI "FSM";
_unit setSkill (skill _unit * 50);
};
case(EFFECT_STAGE_DELETELIGHT): {
private "_light";
_light = (_this select 0) select 2;
deleteVehicle _light;
};
case(EFFECT_STAGE_PARTIALRECOVERY): {
private "_strength";
_strength = (_this select 0) select 2;
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
};
case(EFFECT_STAGE_FULLRECOVERY): {
GVAR(flashbangPPEffectCC) ppEffectEnable false;
};
default {
TRACE_1("EffectStage Bad Stage", _stage);
};
};

View File

@ -0,0 +1,85 @@
/*
* Author: KoffeinFlummi
*
* Creates the flashbang effect and knock out AI units.
*
* Arguments:
* 0: The grenade (Object)
*
* Return Value:
* None
*/
#include "script_component.hpp"
private ["_grenade", "_affected", "_strength", "_posGrenade", "_posUnit", "_angleGrenade", "_angleView", "_angleDiff", "_light"];
_grenade = _this select 0;
_affected = _grenade nearEntities ["CAManBase", 50];
{
if ((local _x) && {alive _x}) then {
_strength = 1 - ((_x distance _grenade) min 15) / 15;
if (_x != ACE_player) then {
//must be AI
_x disableAI "MOVE";
_x disableAI "ANIM";
_x disableAI "AUTOTARGET";
_x disableAI "TARGET";
_x disableAI "FSM";
_x setSkill ((skill _x) / 50);
[FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_RESETAI, (time + (7 * _strength)), _x]] call CBA_fnc_addPerFrameHandler;
} else {
//Do effects for player
// is there line of sight to the grenade?
_posGrenade = getPosASL _grenade;
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
if (lineIntersects [_posGrenade, getPosASL _x, _grenade, _x]) then {
_strength = _strength / 10;
};
// beeeeeeeeeeeeeeeeeeeeeeeeeeeeep
if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then {
[_x, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging);
};
// account for people looking away by slightly
// reducing the effect for visual effects.
_posUnit = getPos _x;
_posGrenade = getPos _grenade;
_angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1));
_angleGrenade = (_angleGrenade + 360) % 360;
_angleView = (eyeDirection player select 0) atan2 (eyeDirection player select 1);
_angleView = (_angleView + 360) % 360;
_angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180);
_angleDiff = ((_angleDiff - 45) max 0);
_strength = _strength - _strength * (_angleDiff / 135);
// create flash to illuminate environment
_light = "#lightpoint" createVehicleLocal getPos _grenade;
_light setLightBrightness 200;
_light setLightAmbient [1,1,1];
_light setLightColor [1,1,1];
_light setLightDayLight true;
[FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_DELETELIGHT, (time + (0.1)), _light]] call CBA_fnc_addPerFrameHandler;
// blind player
if (_strength > 0.1) then {
GVAR(flashbangPPEffectCC) ppEffectEnable true;
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
GVAR(flashbangPPEffectCC) ppEffectCommit 0.01;
[FUNC(flashbangEffectStages), 0, [EFFECT_STAGE_PARTIALRECOVERY, (time + (7 * _strength)), _strength]] call CBA_fnc_addPerFrameHandler;
[FUNC(flashbangEffectStages), 0, [ EFFECT_STAGE_FULLRECOVERY, (time + (17 * _strength))]] call CBA_fnc_addPerFrameHandler;
};
};
};
} forEach _affected;

View File

@ -0,0 +1,18 @@
//Waits for the grenade fuze to trigger and 'explode'
#include "script_component.hpp"
_projectile = (_this select 0) select 0;
_waitUntilTime = (_this select 0) select 1;
if (_waitUntilTime > time) exitWith {};
//remove frameEH
[(_this select 1)] call cba_fnc_removePerFrameHandler;
if (alive _projectile) then {
playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400];
_affected = _projectile nearEntities ["CAManBase", 50];
["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent);
};

View File

@ -0,0 +1,44 @@
/*
* Author: commy2
*
* Select the next throwing mode and display message.
*
* Argument:
* Nothing
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
private ["_mode", "_hint"];
if (!([ACE_player] call EFUNC(common,canUseWeapon))) exitWith {false};
_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
if (_mode == 4) then {
_mode = 0;
} else {
_mode = _mode + 1;
};
// ROLL GRENADE DOESN'T WORK RIGHT NOW
if (_mode == 3) then {
_mode = 4;
};
_hint = [
localize "STR_ACE_Grenades_NormalThrow",
localize "STR_ACE_Grenades_HighThrow",
localize "STR_ACE_Grenades_PreciseThrow",
localize "STR_ACE_Grenades_RollGrenade",
localize "STR_ACE_Grenades_DropGrenade"
] select _mode;
[_hint] call EFUNC(common,displayTextStructured);
GVAR(currentThrowMode) = _mode;
true

View File

@ -0,0 +1,61 @@
/*
* Author: commy2
*
* Adjust the grenades throwing direction and speed to the selected throwing mode.
*
* Argument:
* input from "Fired" eventhandler
*
* Return value:
* Nothing
*/
#include "script_component.hpp"
private ["_unit", "_weapon", "_projectile", "_mode", "_fuzeTime"];
_unit = _this select 0;
_weapon = _this select 1;
_projectile = _this select 6;
if (_unit != ACE_player) exitWith {};
if (_weapon != "Throw") exitWith {};
_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0];
if (_mode != 0) then {
private "_velocity";
_velocity = velocity _projectile;
switch (_mode) do {
//high throw
case 1 : {
_velocity = [
0.5 * (_velocity select 0),
0.5 * (_velocity select 1),
[0, 0, 0] distance (_velocity vectorMultiply 0.5)
];
};
//precise throw
case 2 : {
_velocity = (_unit weaponDirection _weapon) vectorMultiply (vectorMagnitude _velocity);
};
//roll grande
case 3 : {
//@todo
};
//drop grenade
case 4 : {
_velocity = [0, 0, 0];
};
};
_projectile setVelocity _velocity;
};
if (typeOf _projectile == "ACE_G_M84") then {
_fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance");
// _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance
[FUNC(flashbangThrownFuze), 0, [_projectile, (time + _fuzeTime)]] call CBA_fnc_addPerFrameHandler;
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\grenades\script_component.hpp"

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
#define COMPONENT grenades
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
#ifdef DEBUG_ENABLED_GRENADES
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_GRENADES
#define DEBUG_SETTINGS DEBUG_SETTINGS_GRENADES
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#define EFFECT_STAGE_RESETAI 0
#define EFFECT_STAGE_DELETELIGHT 1
#define EFFECT_STAGE_PARTIALRECOVERY 2
#define EFFECT_STAGE_FULLRECOVERY 3

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-09-11 --> <!-- Edited with tabler - 2014-09-11 -->
<Project name="AGM"> <Project name="ACE">
<Package name="Grenades"> <Package name="Grenades">
<Key ID="STR_AGM_Grenades_SwitchGrenadeMode"> <Key ID="STR_ACE_Grenades_SwitchGrenadeMode">
<English>Switch Grenade Mode</English> <English>Switch Grenade Mode</English>
<German>Granaten-Modus wechseln</German> <German>Granaten-Modus wechseln</German>
<Spanish>Cambiar modo de granada</Spanish> <Spanish>Cambiar modo de granada</Spanish>
@ -14,7 +14,7 @@
<Italian>Cambia tipo di granata</Italian> <Italian>Cambia tipo di granata</Italian>
<Portuguese>Alternar Modo de Granada</Portuguese> <Portuguese>Alternar Modo de Granada</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_NormalThrow"> <Key ID="STR_ACE_Grenades_NormalThrow">
<English>Normal Throw</English> <English>Normal Throw</English>
<German>Normaler Wurf</German> <German>Normaler Wurf</German>
<Spanish>Lanzamiento normal</Spanish> <Spanish>Lanzamiento normal</Spanish>
@ -26,7 +26,7 @@
<Italian>Lancio normale</Italian> <Italian>Lancio normale</Italian>
<Portuguese>Arremesso Normal</Portuguese> <Portuguese>Arremesso Normal</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_HighThrow"> <Key ID="STR_ACE_Grenades_HighThrow">
<English>High Throw</English> <English>High Throw</English>
<German>Hoher Wurf</German> <German>Hoher Wurf</German>
<Spanish>Lanzamiento alto</Spanish> <Spanish>Lanzamiento alto</Spanish>
@ -38,7 +38,7 @@
<Italian>Lancio verso l'alto</Italian> <Italian>Lancio verso l'alto</Italian>
<Portuguese>Arremesso Alto</Portuguese> <Portuguese>Arremesso Alto</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_PreciseThrow"> <Key ID="STR_ACE_Grenades_PreciseThrow">
<English>Precise Throw</English> <English>Precise Throw</English>
<German>Präziser Wurf</German> <German>Präziser Wurf</German>
<Spanish>Lanzamiento preciso</Spanish> <Spanish>Lanzamiento preciso</Spanish>
@ -50,7 +50,7 @@
<Italian>Lancio preciso</Italian> <Italian>Lancio preciso</Italian>
<Portuguese>Arremesso Preciso</Portuguese> <Portuguese>Arremesso Preciso</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_RollGrenade"> <Key ID="STR_ACE_Grenades_RollGrenade">
<English>Roll Grenade</English> <English>Roll Grenade</English>
<German>Granate rollen</German> <German>Granate rollen</German>
<Spanish>Rodar granada</Spanish> <Spanish>Rodar granada</Spanish>
@ -62,7 +62,7 @@
<Italian>Fai rotolare la granata</Italian> <Italian>Fai rotolare la granata</Italian>
<Portuguese>Rolar Granada</Portuguese> <Portuguese>Rolar Granada</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_DropGrenade"> <Key ID="STR_ACE_Grenades_DropGrenade">
<English>Drop Grenade</English> <English>Drop Grenade</English>
<German>Granate fallenlassen</German> <German>Granate fallenlassen</German>
<Spanish>Soltar granada</Spanish> <Spanish>Soltar granada</Spanish>
@ -74,7 +74,7 @@
<Italian>Lascia la granata</Italian> <Italian>Lascia la granata</Italian>
<Portuguese>Largar Granada</Portuguese> <Portuguese>Largar Granada</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M84_Name"> <Key ID="STR_ACE_Grenades_M84_Name">
<English>M84 Stun Grenade</English> <English>M84 Stun Grenade</English>
<German>M84 Blendgranate</German> <German>M84 Blendgranate</German>
<Spanish>Granada aturdidora M84</Spanish> <Spanish>Granada aturdidora M84</Spanish>
@ -86,7 +86,7 @@
<Italian>Granata Stordente M84</Italian> <Italian>Granata Stordente M84</Italian>
<Portuguese>M84 granada de atordoamento</Portuguese> <Portuguese>M84 granada de atordoamento</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M84_Description"> <Key ID="STR_ACE_Grenades_M84_Description">
<English>Also known as flashbang. Causes immediate flash blindness, deafness, tinnitus, and inner ear disturbance.</English> <English>Also known as flashbang. Causes immediate flash blindness, deafness, tinnitus, and inner ear disturbance.</English>
<German>Verursacht temporäre Blind- und Taubheit.</German> <German>Verursacht temporäre Blind- und Taubheit.</German>
<Spanish>Produce de manera inmediata ceguera, sordera, tinitus y afecta el oído interior.</Spanish> <Spanish>Produce de manera inmediata ceguera, sordera, tinitus y afecta el oído interior.</Spanish>
@ -98,7 +98,7 @@
<Italian>Anche conosciuta come flashbang. Causa accecamento immediato, sensazioni di sposatezza, mancanza d'equilibrio e disturbi al timpano.</Italian> <Italian>Anche conosciuta come flashbang. Causa accecamento immediato, sensazioni di sposatezza, mancanza d'equilibrio e disturbi al timpano.</Italian>
<Portuguese>Um tipo de granada não-letal destinado a confundir, desorientar e distrair uma potencial ameaça.</Portuguese> <Portuguese>Um tipo de granada não-letal destinado a confundir, desorientar e distrair uma potencial ameaça.</Portuguese>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_White_Name"> <Key ID="STR_ACE_Grenades_M127A1_White_Name">
<English>M127A1 Hand Held Signal (White)</English> <English>M127A1 Hand Held Signal (White)</English>
<German>M127A1 Leuchtmittel (Weiß)</German> <German>M127A1 Leuchtmittel (Weiß)</German>
<Czech> M127A1 Světlice (Bílá)</Czech> <Czech> M127A1 Světlice (Bílá)</Czech>
@ -110,7 +110,7 @@
<Spanish>Bengala M127A1 (Blanca)</Spanish> <Spanish>Bengala M127A1 (Blanca)</Spanish>
<French>M127A1 Feux à main (Blanc)</French> <French>M127A1 Feux à main (Blanc)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Red_Name"> <Key ID="STR_ACE_Grenades_M127A1_Red_Name">
<English>M127A1 Hand Held Signal (Red)</English> <English>M127A1 Hand Held Signal (Red)</English>
<German>M127A1 Leuchtmittel (Rot)</German> <German>M127A1 Leuchtmittel (Rot)</German>
<Czech>M127A1 Světlice (Červená)</Czech> <Czech>M127A1 Světlice (Červená)</Czech>
@ -122,7 +122,7 @@
<Spanish>Bengala M127A1 (Roja)</Spanish> <Spanish>Bengala M127A1 (Roja)</Spanish>
<French>M127A1 Feux à main (Rouge)</French> <French>M127A1 Feux à main (Rouge)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Green_Name"> <Key ID="STR_ACE_Grenades_M127A1_Green_Name">
<English>M127A1 Hand Held Signal (Green)</English> <English>M127A1 Hand Held Signal (Green)</English>
<German>M127A1 Leuchtmittel (Grün)</German> <German>M127A1 Leuchtmittel (Grün)</German>
<Czech>M127A1 Světlice (Zelená)</Czech> <Czech>M127A1 Světlice (Zelená)</Czech>
@ -134,7 +134,7 @@
<Spanish>Bengala M127A1 (Verde)</Spanish> <Spanish>Bengala M127A1 (Verde)</Spanish>
<French>M127A1 Feux à main (Vert)</French> <French>M127A1 Feux à main (Vert)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Yellow_Name"> <Key ID="STR_ACE_Grenades_M127A1_Yellow_Name">
<English>M127A1 Hand Held Signal (Yellow)</English> <English>M127A1 Hand Held Signal (Yellow)</English>
<German>M127A1 Leuchtmittel (Gelb)</German> <German>M127A1 Leuchtmittel (Gelb)</German>
<Czech>M127A1 Světlice (Žlutá)</Czech> <Czech>M127A1 Světlice (Žlutá)</Czech>
@ -146,7 +146,7 @@
<Spanish>Bengala M127A1 (Amarilla)</Spanish> <Spanish>Bengala M127A1 (Amarilla)</Spanish>
<French>M127A1 Feux à main (Jaune)</French> <French>M127A1 Feux à main (Jaune)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_White_Description"> <Key ID="STR_ACE_Grenades_M127A1_White_Description">
<English>White Hand Flare</English> <English>White Hand Flare</English>
<German>Weiße Leuchtkugel, wird wie eine Granate geworfen.</German> <German>Weiße Leuchtkugel, wird wie eine Granate geworfen.</German>
<Czech>Světlice (Bílá)</Czech> <Czech>Světlice (Bílá)</Czech>
@ -158,7 +158,7 @@
<Spanish>Bengala (Blanca)</Spanish> <Spanish>Bengala (Blanca)</Spanish>
<French>Feux à main (Blanc)</French> <French>Feux à main (Blanc)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Red_Description"> <Key ID="STR_ACE_Grenades_M127A1_Red_Description">
<English>Red Hand Flare</English> <English>Red Hand Flare</English>
<German>Rote Leuchtkugel, wird wie eine Granate geworfen.</German> <German>Rote Leuchtkugel, wird wie eine Granate geworfen.</German>
<Czech>Světlice (Červená)</Czech> <Czech>Světlice (Červená)</Czech>
@ -170,7 +170,7 @@
<Spanish>Bengala (Roja)</Spanish> <Spanish>Bengala (Roja)</Spanish>
<French>Feux à main (Rouge)</French> <French>Feux à main (Rouge)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Green_Description"> <Key ID="STR_ACE_Grenades_M127A1_Green_Description">
<English>Green Hand Flare</English> <English>Green Hand Flare</English>
<German>Grüne Leuchtkugel, wird wie eine Granate geworfen.</German> <German>Grüne Leuchtkugel, wird wie eine Granate geworfen.</German>
<Czech>Světlice (Zelená)</Czech> <Czech>Světlice (Zelená)</Czech>
@ -182,7 +182,7 @@
<Spanish>Bengala (Verde)</Spanish> <Spanish>Bengala (Verde)</Spanish>
<French>Feux à main (Vert)</French> <French>Feux à main (Vert)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Yellow_Description"> <Key ID="STR_ACE_Grenades_M127A1_Yellow_Description">
<English>Yellow Hand Flare</English> <English>Yellow Hand Flare</English>
<German>Gelbe Leuchtkugel, wird wie eine Granate geworfen.</German> <German>Gelbe Leuchtkugel, wird wie eine Granate geworfen.</German>
<Czech>Světlice Žlutá</Czech> <Czech>Světlice Žlutá</Czech>
@ -194,7 +194,7 @@
<Spanish>Bengala (Amarilla)</Spanish> <Spanish>Bengala (Amarilla)</Spanish>
<French>Feux à main (Jaune)</French> <French>Feux à main (Jaune)</French>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_White_NameShort"> <Key ID="STR_ACE_Grenades_M127A1_White_NameShort">
<English>M127A1 (White)</English> <English>M127A1 (White)</English>
<German>M127A1 (Weiß)</German> <German>M127A1 (Weiß)</German>
<Czech>M127A1 (Bílá)</Czech> <Czech>M127A1 (Bílá)</Czech>
@ -206,7 +206,7 @@
<Russian>M127A1 (Белый)</Russian> <Russian>M127A1 (Белый)</Russian>
<Spanish>M127A1 (Blanca)</Spanish> <Spanish>M127A1 (Blanca)</Spanish>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Red_NameShort"> <Key ID="STR_ACE_Grenades_M127A1_Red_NameShort">
<English>M127A1 (Red)</English> <English>M127A1 (Red)</English>
<German>M127A1 (Rot)</German> <German>M127A1 (Rot)</German>
<Czech>M127A1 (Červená)</Czech> <Czech>M127A1 (Červená)</Czech>
@ -218,7 +218,7 @@
<Russian>M127A1 (Красный)</Russian> <Russian>M127A1 (Красный)</Russian>
<Spanish>M127A1 (Roja)</Spanish> <Spanish>M127A1 (Roja)</Spanish>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Green_NameShort"> <Key ID="STR_ACE_Grenades_M127A1_Green_NameShort">
<English>M127A1 (Green)</English> <English>M127A1 (Green)</English>
<German>M127A1 (Grün)</German> <German>M127A1 (Grün)</German>
<Czech>M127A1 (Zelená)</Czech> <Czech>M127A1 (Zelená)</Czech>
@ -230,7 +230,7 @@
<Russian>M127A1 (Зелёный)</Russian> <Russian>M127A1 (Зелёный)</Russian>
<Spanish>M127A1 (Verde)</Spanish> <Spanish>M127A1 (Verde)</Spanish>
</Key> </Key>
<Key ID="STR_AGM_Grenades_M127A1_Yellow_NameShort"> <Key ID="STR_ACE_Grenades_M127A1_Yellow_NameShort">
<English>M127A1 (Yellow)</English> <English>M127A1 (Yellow)</English>
<German>M127A1 (Gelb)</German> <German>M127A1 (Gelb)</German>
<Czech>M127A1 (Žlutá)</Czech> <Czech>M127A1 (Žlutá)</Czech>

View File

@ -0,0 +1,92 @@
ambient[] = {1.0,1.0,1.0,1.0};
diffuse[] = {1.0,1.0,1.0,1.0};
forcedDiffuse[] = {0.0,0.0,0.0,0.0};
emmisive[] = {0.0,0.0,0.0,1.0};
specular[] = {0.1,0.1,0.1,1.0};
specularPower = 95;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1
{
texture = "z\ace\addons\grenades\textures\ace_m84_nohq.paa";
uvSource = "tex";
class uvTransform
{
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage2
{
texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
uvSource = "tex";
class uvTransform
{
aside[] = {0,9,0};
up[] = {4.5,0,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage3
{
texture = "#(argb,8,8,3)color(0.5,0.5,0.5,0,MC)";
uvSource = "tex";
class uvTransform
{
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage4
{
texture = "#(argb,8,8,3)color(1,1,1,1,AS)";
uvSource = "tex";
class uvTransform
{
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage5
{
texture = "z\ace\addons\grenades\textures\ace_m84_smdi.paa";
uvSource = "tex";
class uvTransform
{
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};
class Stage6
{
texture = "#(ai,16,2,2)fresnel(10.4,8.3)";
uvSource = "tex";
class uvTransform
{
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,1};
pos[] = {0,0,0};
};
};
class Stage7
{
texture = "a3\data_f\env_land_co.paa";
uvSource = "tex";
class uvTransform
{
aside[] = {1,0,0};
up[] = {0,1,0};
dir[] = {0,0,0};
pos[] = {0,0,0};
};
};

View File

@ -99,16 +99,16 @@ class ACE_Parameters_Boolean {
}; };
class ACE_canInteractConditions { class ACE_canInteractConditions {
class ACE_Interaction_isNotEscorting { class GVAR(isNotEscorting) {
condition = QUOTE( !(_player getVariable ['ACE_isEscorting', false]) ); condition = QUOTE( !(_player getVariable ['ACE_isEscorting', false]) );
}; };
class ACE_Interaction_isNotCaptive { class GVAR(isNotCaptive) {
condition = QUOTE( !(_player getVariable ['ACE_isCaptive', false]) ); condition = QUOTE( !(_player getVariable ['ACE_isCaptive', false]) );
}; };
class ACE_Interaction_isNotSurrendering { class GVAR(isNotSurrendering) {
condition = QUOTE( !(_player getVariable ['ACE_isSurrender', false]) ); condition = QUOTE( !(_player getVariable ['ACE_isSurrender', false]) );
}; };
class ACE_Interaction_isNotSwimming { class GVAR(isNotSwimming) {
condition = QUOTE( !underwater _player ); condition = QUOTE( !underwater _player );
}; };
}; };

View File

@ -0,0 +1 @@
z\ace\addons\weaponselect

View File

@ -0,0 +1,14 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_FiredBIS_EventHandlers {
class CAManBase {
class GVAR(ThrowGrenade) {
clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)};);
};
};
};

View File

@ -0,0 +1,65 @@
#include "script_component.hpp"
PREP(countMagazinesForGrenadeMuzzle);
PREP(displayGrenadeTypeAndNumber);
PREP(findNextGrenadeMagazine);
PREP(findNextGrenadeMuzzle);
PREP(fireSmokeLauncher);
PREP(getSelectedGrenade);
PREP(getWeaponModes);
PREP(getWeaponMuzzles);
PREP(playChangeFiremodeSound);
PREP(putWeaponAway);
PREP(selectGrenadeAll);
PREP(selectGrenadeFrag);
PREP(selectGrenadeOther);
PREP(selectWeaponMode);
PREP(selectWeaponMuzzle);
PREP(selectWeaponVehicle);
PREP(setNextGrenadeMuzzle);
PREP(throwGrenade);
// prepare grenades from config
GVAR(CurrentGrenadeMuzzleIsFrag) = true;
GVAR(CurrentGrenadeMuzzleFrag) = "";
GVAR(CurrentGrenadeMuzzleOther) = "";
// Collect frag and other muzzles separately
with uiNamespace do {
if (isNil QGVAR(FragMuzzles)) then {
GVAR(FragMuzzles) = [];
GVAR(NonFragMuzzles) = [];
GVAR(AllMuzzles) = [];
GVAR(FragMagazines) = [];
GVAR(NonFragMagazines) = [];
GVAR(AllMagazines) = [];
{
_magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines");
_magazine = _magazines select 0;
_ammo = getText (configfile >> "CfgMagazines" >> _magazine >> "ammo");
_explosive = getNumber (configfile >> "CfgAmmo" >> _ammo >> "explosive");
if (_explosive == 0) then {
GVAR(NonFragMuzzles) pushBack _x;
GVAR(NonFragMagazines) pushBack _magazines;
} else {
GVAR(FragMuzzles) pushBack _x;
GVAR(FragMagazines) pushBack _magazines;
};
GVAR(AllMuzzles) pushBack _x;
GVAR(AllMagazines) pushBack _magazines;
} forEach getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles");
};
};
GVAR(FragMuzzles) = uiNamespace getVariable QGVAR(FragMuzzles);
GVAR(NonFragMuzzles) = uiNamespace getVariable QGVAR(NonFragMuzzles);
GVAR(AllMuzzles) = uiNamespace getVariable QGVAR(AllMuzzles);
GVAR(FragMagazines) = uiNamespace getVariable QGVAR(FragMagazines);
GVAR(NonFragMagazines) = uiNamespace getVariable QGVAR(NonFragMagazines);
GVAR(AllMagazines) = uiNamespace getVariable QGVAR(AllMagazines);

View File

@ -0,0 +1,177 @@
#include "script_component.hpp"
class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common"};
author[] = {"commy2","KoffeinFlummi","CAA-Picard"};
authorUrl = "https://github.com/commy2/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
class ACE_Default_Keys {
class selectPistol {
displayName = "$STR_ACE_WeaponSelect_SelectPistol";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([ARR_2(_player, handgunWeapon _player)] call FUNC(selectWeaponMode););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 2;
shift = 0;
control = 0;
alt = 0;
};
class selectRifle {
displayName = "$STR_ACE_WeaponSelect_SelectRifle";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([ARR_2(_player, primaryWeapon _player)] call FUNC(selectWeaponMode););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 3;
shift = 0;
control = 0;
alt = 0;
};
class selectLauncher {
displayName = "$STR_ACE_WeaponSelect_SelectLauncher";
condition = QUOTE(_player == _vehicle);
statement = QUOTE([ARR_2(_player, secondaryWeapon _player)] call FUNC(selectWeaponMode););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 5;
shift = 0;
control = 0;
alt = 0;
};
/*class selectPistolMuzzle {
displayName = "Select Pistol Muzzle";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([ARR_2(_player, handgunWeapon _player)] call FUNC(selectWeaponMuzzle););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
disabled = 1;
key = 7;
shift = 0;
control = 0;
alt = 0;
};*/
class selectRifleMuzzle {
displayName = "$STR_ACE_WeaponSelect_SelectRifleMuzzle";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([ARR_2(_player, primaryWeapon _player)] call FUNC(selectWeaponMuzzle););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 4;
shift = 0;
control = 0;
alt = 0;
};
/*class selectLauncherMuzzle {
displayName = "Select Launcher Muzzle";
condition = QUOTE(_player == _vehicle);
statement = QUOTE([ARR_2(_player, secondaryWeapon _player)] call FUNC(selectWeaponMuzzle););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
disabled = 1;
key = 8;
shift = 0;
control = 0;
alt = 0;
};*/
class selectBinocular {
displayName = "$STR_ACE_WeaponSelect_SelectBinocular";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([ARR_2(_player, binocular _player)] call FUNC(selectWeaponMode););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 6;
shift = 0;
control = 0;
alt = 0;
};
class selectGrenadeFrag {
displayName = "$STR_ACE_WeaponSelect_SelectGrenadeFrag";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([_player] call FUNC(selectGrenadeFrag););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 7;
shift = 0;
control = 0;
alt = 0;
};
class selectGrenadeOther {
displayName = "$STR_ACE_WeaponSelect_SelectGrenadeOther";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([_player] call FUNC(selectGrenadeOther););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 8;
shift = 0;
control = 0;
alt = 0;
};
class holsterWeapon {
displayName = "$STR_ACE_WeaponSelect_HolsterWeapon";
condition = QUOTE([_player] call EFUNC(common,canUseWeapon));
statement = QUOTE([_player] call FUNC(putWeaponAway););
exceptions[] = {QEGVAR(interaction,isNotEscorting)};
key = 11;
shift = 0;
control = 0;
alt = 0;
};
class engineOn {
displayName = "$STR_ACE_WeaponSelect_EngineOn";
condition = QUOTE(_player != _vehicle && {_player == driver _vehicle} && {!isEngineOn _vehicle});
statement = QUOTE(_vehicle engineOn true;);
key = 3;
shift = 0;
control = 0;
alt = 0;
};
class engineOff {
displayName = "$STR_ACE_WeaponSelect_EngineOff";
condition = QUOTE(_player != _vehicle && {_player == driver _vehicle} && {isEngineOn _vehicle});
statement = QUOTE(_vehicle engineOn false;);
key = 2;
shift = 0;
control = 0;
alt = 0;
};
class selectMaingun {
displayName = "$STR_ACE_WeaponSelect_SelectMainGun";
condition = QUOTE(_player != _vehicle);
statement = QUOTE([ARR_3(_player, _vehicle, 0)] call FUNC(selectWeaponVehicle););
key = 4;
shift = 0;
control = 0;
alt = 0;
};
class selectMachineGun {
displayName = "$STR_ACE_WeaponSelect_SelectMachineGun";
condition = QUOTE(_player != _vehicle);
statement = QUOTE([ARR_3(_player, _vehicle, 1)] call FUNC(selectWeaponVehicle););
key = 5;
shift = 0;
control = 0;
alt = 0;
};
class selectMissile {
displayName = "$STR_ACE_WeaponSelect_SelectMissiles";
condition = QUOTE(_player != _vehicle);
statement = QUOTE([ARR_3(_player, _vehicle, 2)] call FUNC(selectWeaponVehicle););
key = 6;
shift = 0;
control = 0;
alt = 0;
};
class fireSmokeLauncher {
displayName = "$STR_ACE_WeaponSelect_FireSmokeLauncher";
condition = QUOTE(_player != _vehicle && {_player == commander _vehicle});
statement = QUOTE([_vehicle] call FUNC(fireSmokeLauncher););
key = 10;
shift = 0;
control = 0;
alt = 0;
};
};

View File

@ -0,0 +1,55 @@
/*
* Author: CAA-Picard
*
* Count how many grenade magazines the unit has on the uniform and vest.
*
* Argument:
* 0: Muzzle name
*
* Return value:
* 0: Number of magazines
* 1: First magazine name
*/
#include "script_component.hpp"
private ["_unit", "_muzzle"];
_unit = _this select 0;
_muzzle = _this select 1;
private ["_uniformMags", "_vestMags", "_backPackMags"];
_uniformMags = getMagazineCargo uniformContainer _unit;
_vestMags = getMagazineCargo vestContainer _unit;
_backPackMags = getMagazineCargo backpackContainer _unit;
private ["_numberOfMagazines", "_magazineClasses", "_firstMagazine"];
_numberOfMagazines = 0;
_magazineClasses = getArray (configFile >> "CfgWeapons" >> "Throw" >> _muzzle >> "magazines");
_firstMagazine = _magazineClasses select 0;
{
private ["_indexInUniform", "_indexInVest", "_indexInBackpack"];
_indexInUniform = (_uniformMags select 0) find _x;
if (_indexInUniform > -1) then {
_numberOfMagazines = _numberOfMagazines + ((_uniformMags select 1) select _indexInUniform);
_firstMagazine = _x;
};
_indexInVest = (_vestMags select 0) find _x;
if (_indexInVest > -1) then {
_numberOfMagazines = _numberOfMagazines + ((_vestMags select 1) select _indexInVest);
_firstMagazine = _x;
};
_indexInBackpack = (_backpackMags select 0) find _x;
if (_indexInBackpack > -1) then {
_numberOfMagazines = _numberOfMagazines + ((_backpackMags select 1) select _indexInBackpack);
_firstMagazine = _x;
};
} forEach _magazineClasses;
[_numberOfMagazines, _firstMagazine]

View File

@ -10,18 +10,19 @@
* Return value: * Return value:
* None * None
*/ */
#include "script_component.hpp"
private ["_magazine", "_numberofMagazines"];
_magazine = _this select 0; _magazine = _this select 0;
_numberofMagazines = _this select 1; _numberofMagazines = _this select 1;
_color = []; private ["_color", "_name", "_text", "_picture"];
if (_numberOfMagazines > 0) then {
_color = [1,1,1];
} else {
_color = [1,0,0];
};
_color = [[1,0,0], [1,1,1]] select (_numberOfMagazines > 0);
_name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort");
_text = [format["%1 x%2", _name, _numberOfMagazines], _color] call EFUNC(common,stringToColoredText);
_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture");
_text = [format["%1 x%2", _name, _numberOfMagazines], _color] call AGM_Core_fnc_stringToColoredText;
[_text, _picture] call AGM_Core_fnc_displayTextPicture; [_text, _picture] call EFUNC(common,displayTextPicture);

View File

@ -0,0 +1,35 @@
// by commy2
#include "script_component.hpp"
private ["_type", "_allMags", "_allMuzzles", "_magazines"];
_type = _this select 0; //"All", "Frag" or "NonFrag"
_allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []];
_allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []];
_magazines = magazines ACE_player;
private ["_start", "_index", "_nextMagazine"];
_start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag);
_index = _allMuzzles find _start;
scopeName "SearchMain";
_nextMagazine = "";
for "_index" from (_index + 1) to (count _allMuzzles - 1) do {
{
if (_x in (_allMags select _index)) exitWith {_nextMagazine = _x; breakTo "SearchMain"};
} count _magazines;
};
if (_nextMagazine != "") exitWith {_nextMagazine};
for "_index" from 0 to _index do {
{
if (_x in (_allMags select _index)) exitWith {_nextMagazine = _x; breakTo "SearchMain"};
} count _magazines;
};
_nextMagazine

View File

@ -0,0 +1,35 @@
// by commy2
#include "script_component.hpp"
private ["_type", "_allMags", "_allMuzzles", "_magazines"];
_type = _this select 0; //"All", "Frag" or "NonFrag"
_allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []];
_allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []];
_magazines = magazines ACE_player;
private ["_start", "_index", "_nextMuzzle"];
_start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag);
_index = _allMuzzles find _start;
scopeName "SearchMain";
_nextMuzzle = "";
for "_index" from (_index + 1) to (count _allMuzzles - 1) do {
{
if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"};
} count _magazines;
};
if (_nextMuzzle != "") exitWith {_nextMuzzle};
for "_index" from 0 to _index do {
{
if (_x in (_allMags select _index)) exitWith {_nextMuzzle = _allMuzzles select _index; breakTo "SearchMain"};
} count _magazines;
};
_nextMuzzle

View File

@ -0,0 +1,39 @@
// by commy2
#include "script_component.hpp"
private ["_vehicle", "_turret", "_weapons"];
_vehicle = _this select 0;
_turret = [typeOf _vehicle] call EFUNC(common,getTurretCommander);
_weapons = _vehicle weaponsTurret _turret;
if (
count _weapons > 1
|| {count _weapons > 0 && {!(_weapons select 0 in ["SmokeLauncher", "BWA3_SmokeLauncher"])}} // @todo somebody might use custom smoke launcher weapons aswell, maybe ...
) then {
//This doesn't work reliably for vehilces with additional weapons for the commander. Select smoke launcher instead.
private "_index";
// avoid infinite loop
if !("SmokeLauncher" in _weapons) exitWith {};
_index = 0;
while {
_vehicle currentWeaponTurret _turret != "SmokeLauncher"
} do {
[commander _vehicle, _vehicle, _index] call FUNC(selectWeaponVehicle);
_index = _index + 1;
};
} else {
// fire away!
private "_logic";
_logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"];
_logic action ["useWeapon", _vehicle, commander _vehicle, 0];
deleteVehicle _logic;
};

View File

@ -0,0 +1,4 @@
// by commy2
#include "script_component.hpp"
[GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag)

View File

@ -9,6 +9,7 @@
* Return value: * Return value:
* All firing modes (Array) * All firing modes (Array)
*/ */
#include "script_component.hpp"
private ["_weapon", "_modes"]; private ["_weapon", "_modes"];
@ -16,11 +17,14 @@ _weapon = _this select 0;
_modes = []; _modes = [];
{ {
if (getNumber (configFile >> "CfgWeapons" >> _weapon >> _x >> "showToPlayer") == 1) then { if (getNumber (configFile >> "CfgWeapons" >> _weapon >> _x >> "showToPlayer") == 1) then {
_modes pushBack _x; _modes pushBack _x;
}; };
if (_x == "this") then {
_modes pushBack _weapon; if (_x == "this") then {
}; _modes pushBack _weapon;
};
} forEach getArray (configfile >> "CfgWeapons" >> _weapon >> "modes"); } forEach getArray (configfile >> "CfgWeapons" >> _weapon >> "modes");
_modes _modes

View File

@ -9,6 +9,7 @@
* Return value: * Return value:
* All weapon muzzles (Array) * All weapon muzzles (Array)
*/ */
#include "script_component.hpp"
private ["_weapon", "_muzzles"]; private ["_weapon", "_muzzles"];
@ -17,6 +18,7 @@ _weapon = _this select 0;
_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
if ("this" in _muzzles) then { if ("this" in _muzzles) then {
_muzzles set [_muzzles find "this", _weapon]; _muzzles set [_muzzles find "this", _weapon];
}; };
_muzzles _muzzles

View File

@ -1,4 +1,5 @@
// by commy2 // by commy2
#include "script_component.hpp"
private ["_unit", "_weapon", "_sound"]; private ["_unit", "_weapon", "_sound"];
@ -11,12 +12,12 @@ if (count _sound == 0) exitWith {};
// add file extension // add file extension
if call { if call {
{ {
if (toLower (_sound select 0) find _x == count toArray (_sound select 0) - count toArray _x - 1) exitWith {false}; if (toLower (_sound select 0) find _x == count toArray (_sound select 0) - count toArray _x - 1) exitWith {false};
true true
} forEach [".wav", ".ogg", ".wss"]; } forEach [".wav", ".ogg", ".wss"];
} then { } then {
_sound set [0, (_sound select 0) + ".wss"]; _sound set [0, (_sound select 0) + ".wss"];
}; };
// add default volume, pitch and distance // add default volume, pitch and distance

View File

@ -9,11 +9,12 @@
* Return value: * Return value:
* None. * None.
*/ */
#include "script_component.hpp"
private "_player"; private "_unit";
_player = _this select 0; _unit = _this select 0;
[_player] call AGM_Core_fnc_fixLoweredRifleAnimation; [_unit] call EFUNC(common,fixLoweredRifleAnimation);
_player action ["SwitchWeapon", _player, _player, 99]; _unit action ["SwitchWeapon", _unit, _unit, 99];

View File

@ -0,0 +1,50 @@
/*
* Author: CAA-Picard, commy2
*
* Cycle through all grenades.
*
* Argument:
* None
*
* Return value:
* None
*/
#include "script_component.hpp"
private ["_unit", "_nextMuzzle"];
_unit = _this select 0;
_nextMuzzle = ["All"] call FUNC(findNextGrenadeMuzzle);
if (_nextMuzzle != "") then {
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = GVAR(AllMagazines) select (GVAR(AllMuzzles) find _nextMuzzle);
reverse _magazines;
_magazine = "";
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit;
// There is a muzzle with magazines --> cycle to it
[_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle);
[_magazine, _count] call FUNC(displayGrenadeTypeAndNumber);
} else {
// There is a no muzzle with magazines --> select nothing
GVAR(CurrentGrenadeMuzzleFrag) = ""; GVAR(CurrentGrenadeMuzzleOther) = "";
_text = [localize "STR_ACE_WeaponSelect_NoGrenadesLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
};
if (_nextMuzzle in GVAR(FragMuzzles)) then {
GVAR(CurrentGrenadeMuzzleFrag) = _nextMuzzle;
GVAR(CurrentGrenadeMuzzleIsFrag) = true;
} else {
GVAR(CurrentGrenadeMuzzleOther) = _nextMuzzle;
GVAR(CurrentGrenadeMuzzleIsFrag) = false;
};

View File

@ -0,0 +1,44 @@
/*
* Author: CAA-Picard, commy2
*
* Cycle through frags.
*
* Argument:
* None
*
* Return value:
* None
*/
#include "script_component.hpp"
private ["_unit", "_nextMuzzle"];
_unit = _this select 0;
_nextMuzzle = ["Frag"] call FUNC(findNextGrenadeMuzzle);
if (_nextMuzzle != "") then {
GVAR(CurrentGrenadeMuzzleFrag) = _nextMuzzle;
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = GVAR(FragMagazines) select (GVAR(FragMuzzles) find _nextMuzzle);
reverse _magazines;
_magazine = "";
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit;
// There is a muzzle with magazines --> cycle to it
[_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle);
[_magazine, _count] call FUNC(displayGrenadeTypeAndNumber);
} else {
// There is a no muzzle with magazines --> select nothing
GVAR(CurrentGrenadeMuzzleFrag) = "";
_text = [localize "STR_ACE_WeaponSelect_NoFragsLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
};
GVAR(CurrentGrenadeMuzzleIsFrag) = true;

View File

@ -0,0 +1,44 @@
/*
* Author: CAA-Picard, commy2
*
* Cycle through non explosive grenades.
*
* Argument:
* None
*
* Return value:
* None
*/
#include "script_component.hpp"
private ["_unit", "_nextMuzzle"];
_unit = _this select 0;
_nextMuzzle = ["NonFrag"] call FUNC(findNextGrenadeMuzzle);
if (_nextMuzzle != "") then {
GVAR(CurrentGrenadeMuzzleOther) = _nextMuzzle;
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = GVAR(NonFragMagazines) select (GVAR(NonFragMuzzles) find _nextMuzzle);
reverse _magazines;
_magazine = "";
_count = {_return = _x in _magazines; if (_return) then {_magazine = _x}; _return} count magazines _unit;
// There is a muzzle with magazines --> cycle to it
[_unit, _nextMuzzle] call FUNC(setNextGrenadeMuzzle);
[_magazine, _count] call FUNC(displayGrenadeTypeAndNumber);
} else {
// There is a no muzzle with magazines --> select nothing
GVAR(CurrentGrenadeMuzzleOther) = "";
_text = [localize "STR_ACE_WeaponSelect_NoMiscGrenadeLeft", [1,0,0]] call EFUNC(common,stringToColoredText);
[composeText [lineBreak, _text]] call EFUNC(common,displayTextStructured);
};
GVAR(CurrentGrenadeMuzzleIsFrag) = false;

View File

@ -0,0 +1,53 @@
/*
* Author: commy2
*
* The player will select the specified weapon or will change to the next firing mode if the weapon was already selected.
*
* Argument:
* 0: A weapon (String)
*
* Return value:
* None.
*/
#include "script_component.hpp"
private ["_unit", "_weapon"];
_unit = _this select 0;
_weapon = _this select 1;
if (_weapon == "") exitWith {};
if (currentWeapon _unit != _weapon) exitWith {
_unit selectWeapon _weapon;
};
// unlock safety
if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith {
[_unit, _weapon, _weapon] call EFUNC(safemode,unlockSafety);
};
private ["_muzzles", "_modes"];
_muzzles = [_weapon] call FUNC(getWeaponMuzzles);
_modes = [_weapon] call FUNC(getWeaponModes);
private ["_index", "_muzzle", "_mode"];
_index = (_modes find currentWeaponMode _unit) + 1;
if (_index > count _modes - 1) then {_index = 0};
_muzzle = _muzzles select 0;
_mode = _modes select _index;
_index = 0;
while {
_index < 100 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}}
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};
// play fire mode selector sound
[_unit, _weapon] call FUNC(playChangeFiremodeSound);

View File

@ -0,0 +1,50 @@
/*
* Author: commy2
*
* The player will select the specified weapon and change to the first additional muzzle. E.g. the grenade launcher of a assault rifle.
*
* Argument:
* 0: A weapon (String)
*
* Return value:
* None.
*/
#include "script_component.hpp"
private ["_unit", "_weapon"];
_unit = _this select 0;
_weapon = _this select 1;
if (_weapon == "") exitWith {};
private "_muzzles";
_muzzles = [_weapon] call FUNC(getWeaponMuzzles);
if (currentWeapon _unit != _weapon) exitWith {
if (count _muzzles > 1) then {
// unlock safety
/*if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith {
[_unit, _weapon, _muzzles select 1] call EFUNC(safemode,unlockSafety);
};*/
_unit selectWeapon (_muzzles select 1);
};
};
private ["_index", "_muzzle"];
_index = (_muzzles find currentMuzzle _unit) + 1;
if (_index > count _muzzles - 1) then {_index = 1};
_muzzle = _muzzles select _index;
_index = 0;
while {
_index < 100 && {currentMuzzle _unit != _muzzle}
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};

View File

@ -0,0 +1,45 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_vehicle", "_index"];
_unit = _this select 0;
_vehicle = _this select 1;
_index = _this select 2;
private "_turret";
_turret = [_unit] call EFUNC(common,getTurretIndex);
if (_turret isEqualTo [] && {_unit == driver _vehicle}) then {
private ["_weapons", "_weapon"];
_weapons = weapons _vehicle;
if (_index > count _weapons - 1) exitWith {};
_weapon = _weapons select _index;
_index = 0;
while {
_index < 100 && {currentWeapon _vehicle != _weapon}
} do {
_unit action ["SwitchWeapon", _vehicle, _unit, _index];
_index = _index + 1;
};
} else {
private ["_weapons", "_weapon"];
_weapons = _vehicle weaponsTurret _turret;
if (_index > count _weapons - 1) exitWith {};
_weapon = _weapons select _index;
_index = 0;
while {
_index < 100 && {_vehicle currentWeaponTurret _turret != _weapon}
} do {
_unit action ["SwitchWeapon", _vehicle, _unit, _index];
_index = _index + 1;
};
};

View File

@ -0,0 +1,121 @@
/*
* Author: CAA-Picard
*
* Select the next grenade muzzle to throw.
*
* Argument:
* muzzle name
*
* Return value:
* None
*
*/
#include "script_component.hpp"
private ["_unit", "_muzzle"];
_unit = _this select 0;
_muzzle = _this select 1;
private ["_uniformMags", "_vestMags", "_backPackMags"];
_uniformMags = getMagazineCargo uniformContainer _unit;
_vestMags = getMagazineCargo vestContainer _unit;
_backPackMags = getMagazineCargo backpackContainer _unit;
private ["_uniformMagsToRemove", "_vestMagsToRemove", "_backPackMagsToRemove"];
_uniformMagsToRemove = [];
_vestMagsToRemove = [];
_backPackMagsToRemove = [];
private ["_firstMagazine", "_throwMuzzleNames"];
_firstMagazine = "";
_throwMuzzleNames = getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles");
// Collect which magazines to remove
{
private "_muzzleMagazines";
_muzzleMagazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines" );
if (_x != _muzzle) then {
{
private "_index";
_index = (_uniformMags select 0) find _x;
if (_index > -1) then {
_uniformMagsToRemove = _uniformMagsToRemove + [[_x, (_uniformMags select 1) select _index]];
};
_index = (_vestMags select 0) find _x;
if (_index > -1) then {
_vestMagsToRemove = _vestMagsToRemove + [[_x, (_vestMags select 1) select _index]];
};
_index = (_backpackMags select 0) find _x;
if (_index > -1) then {
_backpackMagsToRemove = _backpackMagsToRemove + [[_x, (_backpackMags select 1) select _index]];
};
} forEach _muzzleMagazines;
} else {
{
private "_index";
_index = (_uniformMags select 0) find _x;
if (_index > -1) then {
_firstMagazine = _x;
};
_index = (_vestMags select 0) find _x;
if (_index > -1) then {
_firstMagazine = _x;
};
_index = (_backpackMags select 0) find _x;
if (_index > -1) then {
_firstMagazine = _x;
};
} forEach _muzzleMagazines;
};
} forEach _throwMuzzleNames;
// Remove all magazines except those we are switching to --> this breaks the selector
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do {
_unit removeItem (_x select 0);
};
} forEach _uniformMagsToRemove;
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do {
_unit removeItem (_x select 0);
};
} forEach _vestMagsToRemove;
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do {
_unit removeItem (_x select 0);
};
} forEach _backPackMagsToRemove;
// Readd magazines
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do {
_unit addItemToUniform (_x select 0);
};
} forEach _uniformMagsToRemove;
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do {
_unit addItemToVest (_x select 0);
};
} forEach _vestMagsToRemove;
{
for [{_i = 0}, {_i < (_x select 1)}, {_i = _i + 1}] do {
_unit addItemToBackpack (_x select 0);
};
} forEach _backPackMagsToRemove;

View File

@ -0,0 +1,19 @@
// by commy2
#include "script_component.hpp"
private ["_unit", "_weapon", "_magazine"];
_unit = _this select 0;
_weapon = _this select 1;
_magazine = _this select 5;
if (_weapon != "Throw") exitWith {};
private "_count";
_count = {_x == _magazine} count magazines _unit;
[_magazine, _count] call FUNC(displayGrenadeTypeAndNumber);
if (_count == 0) then {
if (GVAR(CurrentGrenadeMuzzleIsFrag)) then {GVAR(CurrentGrenadeMuzzleFrag) = ""} else {GVAR(CurrentGrenadeMuzzleOther) = ""};
};

View File

@ -0,0 +1 @@
#include "\z\ace\addons\weaponselect\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT weaponselect
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_WEAPONSELECT
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_ENABLED_WEAPONSELECT
#define DEBUG_SETTINGS DEBUG_ENABLED_WEAPONSELECT
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Edited with tabler - 2014-12-20 --> <!-- Edited with tabler - 2014-12-20 -->
<Project name="AGM"> <Project name="ACE">
<Package name="WeaponSelect"> <Package name="WeaponSelect">
<Key ID="STR_AGM_WeaponSelect_SelectPistol"> <Key ID="STR_ACE_WeaponSelect_SelectPistol">
<English>Select Pistol</English> <English>Select Pistol</English>
<German>Pistole auswählen</German> <German>Pistole auswählen</German>
<Spanish>Seleccionar pistola</Spanish> <Spanish>Seleccionar pistola</Spanish>
@ -14,7 +14,7 @@
<Portuguese>Selecionar Pistola</Portuguese> <Portuguese>Selecionar Pistola</Portuguese>
<Italian>Seleziona la Pistola</Italian> <Italian>Seleziona la Pistola</Italian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectRifle"> <Key ID="STR_ACE_WeaponSelect_SelectRifle">
<English>Select Rifle</English> <English>Select Rifle</English>
<German>Gewehr auswählen</German> <German>Gewehr auswählen</German>
<Spanish>Seleccionar fusil</Spanish> <Spanish>Seleccionar fusil</Spanish>
@ -26,7 +26,7 @@
<Portuguese>Selecionar Rifle</Portuguese> <Portuguese>Selecionar Rifle</Portuguese>
<Italian>Seleziona il Fucile</Italian> <Italian>Seleziona il Fucile</Italian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectLauncher"> <Key ID="STR_ACE_WeaponSelect_SelectLauncher">
<English>Select Launcher</English> <English>Select Launcher</English>
<German>Raketenwerfer auswählen</German> <German>Raketenwerfer auswählen</German>
<Spanish>Seleccionar lanzador</Spanish> <Spanish>Seleccionar lanzador</Spanish>
@ -38,7 +38,7 @@
<Portuguese>Selecionar Lançador</Portuguese> <Portuguese>Selecionar Lançador</Portuguese>
<Italian>Seleziona il Lanciatore</Italian> <Italian>Seleziona il Lanciatore</Italian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectRifleMuzzle"> <Key ID="STR_ACE_WeaponSelect_SelectRifleMuzzle">
<English>Select Grenade Launcher</English> <English>Select Grenade Launcher</English>
<German>Granatwerfer auswählen</German> <German>Granatwerfer auswählen</German>
<Spanish>Seleccionar lanzador de granadas</Spanish> <Spanish>Seleccionar lanzador de granadas</Spanish>
@ -50,7 +50,7 @@
<Portuguese>Selecionar Lança-Granadas</Portuguese> <Portuguese>Selecionar Lança-Granadas</Portuguese>
<Italian>Seleziona il Lanciagranate</Italian> <Italian>Seleziona il Lanciagranate</Italian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectBinocular"> <Key ID="STR_ACE_WeaponSelect_SelectBinocular">
<English>Select Binoculars</English> <English>Select Binoculars</English>
<German>Fernglas auswählen</German> <German>Fernglas auswählen</German>
<Spanish>Seleccionar prismáticos</Spanish> <Spanish>Seleccionar prismáticos</Spanish>
@ -62,7 +62,7 @@
<Portuguese>Selecionar Binóculos</Portuguese> <Portuguese>Selecionar Binóculos</Portuguese>
<Italian>Seleziona il Binocolo</Italian> <Italian>Seleziona il Binocolo</Italian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_HolsterWeapon"> <Key ID="STR_ACE_WeaponSelect_HolsterWeapon">
<English>Holster Weapon</English> <English>Holster Weapon</English>
<German>Waffe holstern</German> <German>Waffe holstern</German>
<Spanish>Enfundar el arma</Spanish> <Spanish>Enfundar el arma</Spanish>
@ -74,7 +74,7 @@
<Portuguese>Guardar Arma</Portuguese> <Portuguese>Guardar Arma</Portuguese>
<Italian>Nascondi l'arma</Italian> <Italian>Nascondi l'arma</Italian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_EngineOn"> <Key ID="STR_ACE_WeaponSelect_EngineOn">
<English>Engine on</English> <English>Engine on</English>
<German>Motor an</German> <German>Motor an</German>
<Spanish>Encender motor</Spanish> <Spanish>Encender motor</Spanish>
@ -86,7 +86,7 @@
<Italian>Motore acceso</Italian> <Italian>Motore acceso</Italian>
<Russian>Включить двигатель</Russian> <Russian>Включить двигатель</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_EngineOff"> <Key ID="STR_ACE_WeaponSelect_EngineOff">
<English>Engine off</English> <English>Engine off</English>
<German>Motor aus</German> <German>Motor aus</German>
<Spanish>Apagar motor</Spanish> <Spanish>Apagar motor</Spanish>
@ -98,7 +98,7 @@
<Italian>Motore spento</Italian> <Italian>Motore spento</Italian>
<Russian>Выключить двигатель</Russian> <Russian>Выключить двигатель</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectMainGun"> <Key ID="STR_ACE_WeaponSelect_SelectMainGun">
<English>Select Main Gun</English> <English>Select Main Gun</English>
<German>Hauptgeschütz auswählen</German> <German>Hauptgeschütz auswählen</German>
<Spanish>Seleccionar arma principal</Spanish> <Spanish>Seleccionar arma principal</Spanish>
@ -110,7 +110,7 @@
<Italian>Seleziona Arma Primaria</Italian> <Italian>Seleziona Arma Primaria</Italian>
<Russian>Выбрать основное оружие</Russian> <Russian>Выбрать основное оружие</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectMachineGun"> <Key ID="STR_ACE_WeaponSelect_SelectMachineGun">
<English>Select Machine Gun</English> <English>Select Machine Gun</English>
<German>Maschinengewehr auswählen</German> <German>Maschinengewehr auswählen</German>
<Spanish>Seleccionar ametralladora</Spanish> <Spanish>Seleccionar ametralladora</Spanish>
@ -122,7 +122,7 @@
<Italian>Seleziona Mitragliatrice</Italian> <Italian>Seleziona Mitragliatrice</Italian>
<Russian>Выбрать пулемёт</Russian> <Russian>Выбрать пулемёт</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectMissiles"> <Key ID="STR_ACE_WeaponSelect_SelectMissiles">
<English>Select Missiles</English> <English>Select Missiles</English>
<German>Raketen auswählen</German> <German>Raketen auswählen</German>
<Spanish>Seleccionar misiles</Spanish> <Spanish>Seleccionar misiles</Spanish>
@ -134,7 +134,7 @@
<Italian>Seleziona Missili</Italian> <Italian>Seleziona Missili</Italian>
<Russian>Выбрать ракеты</Russian> <Russian>Выбрать ракеты</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_LoadGrenade"> <Key ID="STR_ACE_WeaponSelect_LoadGrenade">
<English>Grenade %1</English> <English>Grenade %1</English>
<German>Granate %1</German> <German>Granate %1</German>
<Spanish>Granada %1</Spanish> <Spanish>Granada %1</Spanish>
@ -143,7 +143,7 @@
<Hungarian>Gránát Kiválasztása</Hungarian> <Hungarian>Gránát Kiválasztása</Hungarian>
<Russian>Граната %1</Russian> <Russian>Граната %1</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_ReadyGrenade"> <Key ID="STR_ACE_WeaponSelect_ReadyGrenade">
<English>Ready Grenade</English> <English>Ready Grenade</English>
<German>Granate nehmen</German> <German>Granate nehmen</German>
<Spanish>Granada lista</Spanish> <Spanish>Granada lista</Spanish>
@ -152,7 +152,7 @@
<Hungarian>Kész Gránát</Hungarian> <Hungarian>Kész Gránát</Hungarian>
<Russian>Подготовить гранату</Russian> <Russian>Подготовить гранату</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectGrenadeFrag"> <Key ID="STR_ACE_WeaponSelect_SelectGrenadeFrag">
<English>Select Frag Grenade</English> <English>Select Frag Grenade</English>
<German>Explosive Granate auswählen</German> <German>Explosive Granate auswählen</German>
<Spanish>Seleccionar granada de fragmenación</Spanish> <Spanish>Seleccionar granada de fragmenación</Spanish>
@ -164,7 +164,7 @@
<Italian>Seleziona Granata a Frammentazione</Italian> <Italian>Seleziona Granata a Frammentazione</Italian>
<Russian>Выбрать осколочную гранату</Russian> <Russian>Выбрать осколочную гранату</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_SelectGrenadeOther"> <Key ID="STR_ACE_WeaponSelect_SelectGrenadeOther">
<English>Select Non-Frag Grenade</English> <English>Select Non-Frag Grenade</English>
<German>Nichtexplosive Granate auswählen</German> <German>Nichtexplosive Granate auswählen</German>
<Spanish>Seleccionar granada de no fragmentación</Spanish> <Spanish>Seleccionar granada de no fragmentación</Spanish>
@ -176,7 +176,7 @@
<Italian>Seleziona Altre Granate</Italian> <Italian>Seleziona Altre Granate</Italian>
<Russian>Выбрать гранату</Russian> <Russian>Выбрать гранату</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_ThrowGrenade"> <Key ID="STR_ACE_WeaponSelect_ThrowGrenade">
<English>Throw Selected Grenade</English> <English>Throw Selected Grenade</English>
<German>Gewählte Granate werfen</German> <German>Gewählte Granate werfen</German>
<Spanish>Arrojar granada seleccionada</Spanish> <Spanish>Arrojar granada seleccionada</Spanish>
@ -188,7 +188,7 @@
<Italian>Lancia la Granata Selezionata</Italian> <Italian>Lancia la Granata Selezionata</Italian>
<Russian>Бросить выбранную гранату</Russian> <Russian>Бросить выбранную гранату</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_NoGrenadesLeft"> <Key ID="STR_ACE_WeaponSelect_NoGrenadesLeft">
<English>No grenades left</English> <English>No grenades left</English>
<German>Keine Granaten übrig</German> <German>Keine Granaten übrig</German>
<Spanish>No quedan granadas</Spanish> <Spanish>No quedan granadas</Spanish>
@ -198,7 +198,7 @@
<Hungarian>Nincs több gránát</Hungarian> <Hungarian>Nincs több gránát</Hungarian>
<Russian>Гранат не осталось</Russian> <Russian>Гранат не осталось</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_NoFragsLeft"> <Key ID="STR_ACE_WeaponSelect_NoFragsLeft">
<English>No frags left</English> <English>No frags left</English>
<German>Keine explosiven Granaten übrig</German> <German>Keine explosiven Granaten übrig</German>
<Spanish>Sin granadas de fragmentación</Spanish> <Spanish>Sin granadas de fragmentación</Spanish>
@ -210,7 +210,7 @@
<Italian>Nessuna granata a frammentazione rimanente</Italian> <Italian>Nessuna granata a frammentazione rimanente</Italian>
<Russian>Осколочныких гранат нет</Russian> <Russian>Осколочныких гранат нет</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_NoMiscGrenadeLeft"> <Key ID="STR_ACE_WeaponSelect_NoMiscGrenadeLeft">
<English>No misc. grenades left</English> <English>No misc. grenades left</English>
<German>Keine nichtexplosiven Granaten übrig</German> <German>Keine nichtexplosiven Granaten übrig</German>
<Spanish>Sin granadas de varias</Spanish> <Spanish>Sin granadas de varias</Spanish>
@ -222,7 +222,7 @@
<Italian>Nessun'altra granata rimanente.</Italian> <Italian>Nessun'altra granata rimanente.</Italian>
<Russian>Невзрывоопасные гранаты закончились</Russian> <Russian>Невзрывоопасные гранаты закончились</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_NoGrenadeSelected"> <Key ID="STR_ACE_WeaponSelect_NoGrenadeSelected">
<English>No grenade selected</English> <English>No grenade selected</English>
<German>Keine Granate ausgewählt</German> <German>Keine Granate ausgewählt</German>
<Spanish>Granada no seleccionada</Spanish> <Spanish>Granada no seleccionada</Spanish>
@ -234,7 +234,7 @@
<Italian>Nessuna granata selezionata</Italian> <Italian>Nessuna granata selezionata</Italian>
<Russian>Нет выбранной гранаты</Russian> <Russian>Нет выбранной гранаты</Russian>
</Key> </Key>
<Key ID="STR_AGM_WeaponSelect_FireSmokeLauncher"> <Key ID="STR_ACE_WeaponSelect_FireSmokeLauncher">
<English>Fire Smoke Launcher</English> <English>Fire Smoke Launcher</English>
<German>Rauchwand abfeuern</German> <German>Rauchwand abfeuern</German>
<Spanish>Disparar lanzador de humo</Spanish> <Spanish>Disparar lanzador de humo</Spanish>