1
0
mirror of https://github.com/acemod/ACE3.git synced 2024-08-30 18:23:18 +00:00

Added action for checking ammo on others MG's belts and on Static Weapons

This commit is contained in:
Nicolás Badano 2015-03-06 01:34:38 -03:00
parent 7b4487e8fc
commit 5d68969b63
4 changed files with 57 additions and 0 deletions

@ -9,6 +9,26 @@ class CfgVehicles {
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canLinkBelt));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(startLinkingBelt));
};
class ACE_CheckAmmo {
displayName = "$STR_ACE_Reload_checkAmmo";
distance = 2.0;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canCheckAmmo));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(checkAmmo));
};
};
};
};
class LandVehicle;
class StaticWeapon: LandVehicle {
class ACE_Actions {
class ACE_MainActions {
class ACE_CheckAmmo {
displayName = "$STR_ACE_Reload_checkAmmo";
distance = 2.0;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canCheckAmmo));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(checkAmmo));
};
};
};
};

@ -2,6 +2,7 @@
ADDON = false;
PREP(canCheckAmmo);
PREP(canLinkBelt);
PREP(checkAmmo);
PREP(displayAmmo);

@ -0,0 +1,35 @@
/*
* Author: CAA-Picard
* Check if the player can check the ammo of the target.
*
* Argument:
* 0: Player <OBJECT>
* 1: Target <OBJECT>
*
* Return value:
* Can link belt<BOOL>
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_player,_target);
// Return true for static weapons if they have been fired once
if (_target isKindOf "StaticWeapon") exitWith {
(currentMagazine _target) != ""
};
// Return false for all other vehicles
if !(_target isKindOf "CAManBase") exitWith {false};
// For men
if (currentWeapon _target == "") exitWith {false};
// Check if their current magazine is a belt
_magazineType = currentMagazine _target;
_magazineCfg = configFile >> "CfgMagazines" >> _magazineType;
if (getNumber (_magazineCfg >> "ACE_isBelt") == 1) exitWith {true};
// Check for rocket launchers
if (currentWeapon _target == secondaryWeapon _target) exitWith {true};
false

@ -38,6 +38,7 @@ _maxAmmo = 0;
if (_maxAmmo == 0) exitWith {};
// Condition to call each frame
_condition = {
EXPLODE_2_PVT((_this select 0),_player,_target);