mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Fix pick up delay and IR chemlights, prevent picking up GL and mortar smoke shells (#4336)
* Fix pick up interaction not rendering right after throw, Prevent GL rounds from being picked up * Prevent picking up GL and mortar smoke shells * Fix pick up delay properly, Add separate define for quick throwing (for use when debugging) * Fix forgotten rename in IR chemlight handling
This commit is contained in:
@ -58,7 +58,7 @@ class CfgVehicles {
|
|||||||
class ACE_Actions {
|
class ACE_Actions {
|
||||||
class GVAR(pickUp) {
|
class GVAR(pickUp) {
|
||||||
displayName = CSTRING(PickUp);
|
displayName = CSTRING(PickUp);
|
||||||
condition = QUOTE(_player call FUNC(canPrepare));
|
condition = QUOTE([ARR_2(_player,true)] call FUNC(canPrepare));
|
||||||
statement = QUOTE(_this call FUNC(pickUp));
|
statement = QUOTE(_this call FUNC(pickUp));
|
||||||
distance = 1.8; // Requires >1.7 to work when standing with weapon on back
|
distance = 1.8; // Requires >1.7 to work when standing with weapon on back
|
||||||
icon = "\a3\ui_f\data\igui\cfg\actions\obsolete\ui_action_takemine_ca.paa";
|
icon = "\a3\ui_f\data\igui\cfg\actions\obsolete\ui_action_takemine_ca.paa";
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit <OBJECT>
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Pick Up <BOOL> (default: false)
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* Can Prepare <BOOL>
|
* Can Prepare <BOOL>
|
||||||
@ -15,14 +16,19 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit"];
|
params ["_unit", ["_pickUp", false]];
|
||||||
|
|
||||||
|
// Don't delay when picking up
|
||||||
|
if (_pickUp) then {
|
||||||
|
_unit setVariable [QGVAR(lastThrownTime), -1];
|
||||||
|
};
|
||||||
|
|
||||||
GVAR(enabled) &&
|
GVAR(enabled) &&
|
||||||
|
|
||||||
#ifndef DEBUG_MODE_FULL
|
#ifdef ALLOW_QUICK_THROW
|
||||||
{_unit getVariable [QGVAR(lastThrownTime), CBA_missionTime - 3] < CBA_missionTime - 2} && // Prevent throwing in quick succession
|
|
||||||
#else
|
|
||||||
{true} &&
|
{true} &&
|
||||||
|
#else
|
||||||
|
{_unit getVariable [QGVAR(lastThrownTime), CBA_missionTime - 3] < CBA_missionTime - 2} && // Prevent throwing in quick succession
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{!(call EFUNC(common,isFeatureCameraActive))} &&
|
{!(call EFUNC(common,isFeatureCameraActive))} &&
|
||||||
|
@ -22,15 +22,19 @@
|
|||||||
|
|
||||||
// isNull is necessarry to prevent rare error when ending mission with interact key down
|
// isNull is necessarry to prevent rare error when ending mission with interact key down
|
||||||
if (EGVAR(interact_menu,keyDown) && {!isNull ACE_player}) then {
|
if (EGVAR(interact_menu,keyDown) && {!isNull ACE_player}) then {
|
||||||
// Rescan when player moved >5 meters from last pos, nearObjects is costly
|
// Rescan when player moved >5 meters from last pos, nearObjects can be costly with a lot of objects around
|
||||||
if ((getPosASL ACE_player) distance _setPosition > 5) then {
|
if ((getPosASL ACE_player) distance _setPosition > 5) then {
|
||||||
// IR throwbles inherit from GrenadeCore, others from GrenadeHand, IR Chemlights are special snowflakes
|
// Grenades inherit from GrenadeHand, IR throwbles from IRStrobeBase, IR Chemlights are special snowflakes
|
||||||
|
// nearEntities does not see throwables
|
||||||
_nearThrowables = ACE_player nearObjects ["GrenadeHand", PICK_UP_DISTANCE];
|
_nearThrowables = ACE_player nearObjects ["GrenadeHand", PICK_UP_DISTANCE];
|
||||||
_nearThrowables append (ACE_player nearObjects ["GrenadeCore", PICK_UP_DISTANCE]);
|
_nearThrowables append (ACE_player nearObjects ["IRStrobeBase", PICK_UP_DISTANCE]);
|
||||||
_nearThrowables append (ACE_player nearObjects ["ACE_Chemlight_IR_Dummy", PICK_UP_DISTANCE]);
|
_nearThrowables append (ACE_player nearObjects ["ACE_Chemlight_IR_Dummy", PICK_UP_DISTANCE]);
|
||||||
|
|
||||||
{
|
{
|
||||||
if (!(_x in _throwablesHelped) && {GVAR(enablePickUpAttached) || {!GVAR(enablePickUpAttached) && {isNull (attachedTo _x)}}}) then {
|
if (!(_x in _throwablesHelped) &&
|
||||||
|
{!(_x isKindOf "SmokeShellArty")} && {!(_x isKindOf "G_40mm_Smoke")} && // All smokes inherit from "GrenadeHand" >> "SmokeShell"
|
||||||
|
{GVAR(enablePickUpAttached) || {!GVAR(enablePickUpAttached) && {isNull (attachedTo _x)}}}
|
||||||
|
) then {
|
||||||
TRACE_2("Making PickUp Helper",_x,typeOf _x);
|
TRACE_2("Making PickUp Helper",_x,typeOf _x);
|
||||||
private _pickUpHelper = QGVAR(pickUpHelper) createVehicleLocal [0, 0, 0];
|
private _pickUpHelper = QGVAR(pickUpHelper) createVehicleLocal [0, 0, 0];
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "\z\ace\addons\main\script_mod.hpp"
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
// #define DRAW_THROW_PATH
|
// #define DRAW_THROW_PATH
|
||||||
|
// #define ALLOW_QUICK_THROW
|
||||||
// #define DEBUG_MODE_FULL
|
// #define DEBUG_MODE_FULL
|
||||||
// #define DISABLE_COMPILE_CACHE
|
// #define DISABLE_COMPILE_CACHE
|
||||||
// #define CBA_DEBUG_SYNCHRONOUS
|
// #define CBA_DEBUG_SYNCHRONOUS
|
||||||
|
@ -27,8 +27,8 @@ if (isNull _projectile) then {
|
|||||||
|
|
||||||
if (local _unit) then {
|
if (local _unit) then {
|
||||||
if ([_ammo] call FUNC(isIRClass)) then {
|
if ([_ammo] call FUNC(isIRClass)) then {
|
||||||
// Handle advancedThrowing:
|
// Handle Advanced Throwing
|
||||||
if ((ace_player getVariable [QEGVAR(advancedThrowing,activeThrowable), objNull]) == _projectile) then {
|
if ((ACE_player getVariable [QEGVAR(advanced_throwing,activeThrowable), objNull]) == _projectile) then {
|
||||||
[_projectile, _ammo, true] call FUNC(throwIR); // direct call if we are priming with adv throw
|
[_projectile, _ammo, true] call FUNC(throwIR); // direct call if we are priming with adv throw
|
||||||
} else {
|
} else {
|
||||||
[{_this call FUNC(throwIR)}, [_projectile, _ammo]] call CBA_fnc_execNextFrame;
|
[{_this call FUNC(throwIR)}, [_projectile, _ammo]] call CBA_fnc_execNextFrame;
|
||||||
|
@ -32,5 +32,5 @@ _dummy setPosATL _pos;
|
|||||||
_dummy setVelocity _velocity;
|
_dummy setVelocity _velocity;
|
||||||
|
|
||||||
if (_replaceAdvThrowable) then {
|
if (_replaceAdvThrowable) then {
|
||||||
ace_player setVariable [QEGVAR(advancedThrowing,activeThrowable), _dummy];
|
ACE_player setVariable [QEGVAR(advanced_throwing,activeThrowable), _dummy];
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user