mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
convert spawn to perFrame
This commit is contained in:
parent
78d9ce6d7d
commit
de51a61180
@ -13,7 +13,6 @@ class Extended_PostInit_EventHandlers {
|
|||||||
class Extended_FiredBIS_EventHandlers {
|
class Extended_FiredBIS_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
// firedBIS = "if (local (_this select 0)) then {_this call AGM_Disposable_fnc_replaceATWeapon};";
|
|
||||||
firedBIS = QUOTE( _this call FUNC(replaceATWeapon) );
|
firedBIS = QUOTE( _this call FUNC(replaceATWeapon) );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -23,7 +22,6 @@ class Extended_FiredBIS_EventHandlers {
|
|||||||
class Extended_Init_EventHandlers {
|
class Extended_Init_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
// init = "if (local (_this select 0)) then {_this spawn {[_this select 0, secondaryWeapon (_this select 0)] call AGM_Disposable_fnc_takeLoadedATWeapon}};";
|
|
||||||
init = QUOTE( _this call FUNC(takeLoadedATWeapon) );
|
init = QUOTE( _this call FUNC(takeLoadedATWeapon) );
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -32,8 +30,7 @@ class Extended_Init_EventHandlers {
|
|||||||
class Extended_Take_EventHandlers {
|
class Extended_Take_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
// take = "if (local (_this select 0)) then {[_this select 0, _this select 2] call AGM_Disposable_fnc_takeLoadedATWeapon; [_this select 0, findDisplay 602] call AGM_Disposable_fnc_updateInventoryDisplay};";
|
take = QUOTE( _this call FUNC(takeLoadedATWeapon); [_this select 0] call FUNC(updateInventoryDisplay); );
|
||||||
take = QUOTE( _this call FUNC(takeLoadedATWeapon); _this call FUNC(updateInventoryDisplay); );
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -41,8 +38,7 @@ class Extended_Take_EventHandlers {
|
|||||||
class Extended_Put_EventHandlers {
|
class Extended_Put_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
// put = "if (local (_this select 0)) then {[_this select 0, findDisplay 602] call AGM_Disposable_fnc_updateInventoryDisplay};";
|
put = QUOTE( [_this select 0] call FUNC(updateInventoryDisplay); );
|
||||||
take = QUOTE( _this call FUNC(updateInventoryDisplay); );
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,6 @@ if (isNil QGVAR(UpdateInventoryDisplay_EHID)) then {
|
|||||||
GVAR(UpdateInventoryDisplay_EHID) = [{
|
GVAR(UpdateInventoryDisplay_EHID) = [{
|
||||||
_player = ACE_player;
|
_player = ACE_player;
|
||||||
[_player, secondaryWeapon _player] call FUNC(takeLoadedATWeapon);
|
[_player, secondaryWeapon _player] call FUNC(takeLoadedATWeapon);
|
||||||
[_player, _this select 0] spawn FUNC(updateInventoryDisplay);
|
[_player, (_this select 0)] call FUNC(updateInventoryDisplay);
|
||||||
}] call EFUNC(common,addInventoryDisplayLoadedEventHandler);
|
}] call EFUNC(common,addInventoryDisplayLoadedEventHandler);
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
PREP(aiDropWeaponCallback);
|
||||||
PREP(replaceATWeapon);
|
PREP(replaceATWeapon);
|
||||||
PREP(takeLoadedATWeapon);
|
PREP(takeLoadedATWeapon);
|
||||||
PREP(updateInventoryDisplay);
|
PREP(updateInventoryDisplay);
|
||||||
|
29
addons/disposable/functions/fnc_aiDropWeaponCallback.sqf
Normal file
29
addons/disposable/functions/fnc_aiDropWeaponCallback.sqf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Author: bux, commy2
|
||||||
|
*
|
||||||
|
* Remove the ai's missle launcher tube
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* Nothing
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit", "_tube", "_projectile", "_logic"];
|
||||||
|
|
||||||
|
_unit = (_this select 0) select 0;
|
||||||
|
_tube = (_this select 0) select 1;
|
||||||
|
_projectile = (_this select 0) select 2;
|
||||||
|
|
||||||
|
if (!isNull _projectile) exitWith {};
|
||||||
|
|
||||||
|
//remove frameEH
|
||||||
|
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||||
|
|
||||||
|
//If AI still has tube, throw it on ground
|
||||||
|
if (secondaryWeapon _unit == _tube) then {
|
||||||
|
_logic = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
|
||||||
|
_logic addWeaponCargoGlobal [_tube, 1]; // @todo secondary weapon items
|
||||||
|
|
||||||
|
_unit removeWeapon _tube;
|
||||||
|
};
|
@ -33,19 +33,6 @@ _unit selectWeapon _tube;
|
|||||||
|
|
||||||
// AI
|
// AI
|
||||||
if !([_unit] call EFUNC(common,isPlayer)) then {
|
if !([_unit] call EFUNC(common,isPlayer)) then {
|
||||||
[_unit, _tube, _projectile] spawn {
|
//waits until _projectile is null, so random 0-2 seconds after that
|
||||||
_unit = _this select 0;
|
[FUNC(aiDropWeaponCallback), 2, [_unit, _tube, _projectile]] call CBA_fnc_addPerFrameHandler;
|
||||||
_tube = _this select 1;
|
|
||||||
_projectile = _this select 2;
|
|
||||||
|
|
||||||
waitUntil {isNull _projectile};
|
|
||||||
sleep 1;
|
|
||||||
|
|
||||||
if (secondaryWeapon _unit == _tube) then {
|
|
||||||
_logic = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
|
|
||||||
_logic addWeaponCargoGlobal [_tube, 1]; // @todo secondary weapon items
|
|
||||||
|
|
||||||
_unit removeWeapon _tube;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
@ -9,20 +9,19 @@
|
|||||||
* Return value:
|
* Return value:
|
||||||
* Nothing
|
* Nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_player", "_display"];
|
private ["_player", "_display"];
|
||||||
|
|
||||||
_player = _this select 0;
|
_player = _this select 0;
|
||||||
if (!local _player) exitWith {};
|
|
||||||
|
|
||||||
_player removeMagazines "ACE_PreloadedMissileDummy";
|
_player removeMagazines "ACE_PreloadedMissileDummy";
|
||||||
_player removeMagazines "ACE_FiredMissileDummy";
|
_player removeMagazines "ACE_FiredMissileDummy";
|
||||||
|
|
||||||
disableSerialization;
|
disableSerialization;
|
||||||
_display = findDisplay 602;
|
_display = [_this, 1, (findDisplay 602)] call BIS_fnc_param;
|
||||||
if (isNull _display) exitWith {systemChat "null";};
|
if (isNull _display) exitWith {};
|
||||||
|
|
||||||
private ["_launcher", "_control", "_config"];
|
private ["_launcher", "_control", "_config"];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user