mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #209 from KoffeinFlummi/disposableCleanup
Disposable cleanup
This commit is contained in:
commit
08eb40a606
@ -1,44 +1,44 @@
|
||||
class Extended_PreInit_EventHandlers {
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
};
|
||||
class ADDON {
|
||||
init = QUOTE( call COMPILE_FILE(XEH_preInit) );
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_PostInit_EventHandlers {
|
||||
class ADDON {
|
||||
clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) );
|
||||
};
|
||||
class ADDON {
|
||||
clientInit = QUOTE( call COMPILE_FILE(XEH_postInitClient) );
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_FiredBIS_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE( _this call FUNC(replaceATWeapon) );
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
firedBIS = QUOTE( _this call FUNC(replaceATWeapon) );
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
// handle preloaded missile
|
||||
class Extended_Init_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
init = QUOTE( _this call FUNC(takeLoadedATWeapon) );
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
init = QUOTE( _this call FUNC(takeLoadedATWeapon) );
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Take_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
take = QUOTE( _this call FUNC(takeLoadedATWeapon); [_this select 0] call FUNC(updateInventoryDisplay); );
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
take = QUOTE( _this call FUNC(takeLoadedATWeapon); [_this select 0] call FUNC(updateInventoryDisplay); );
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Extended_Put_EventHandlers {
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
put = QUOTE( [_this select 0] call FUNC(updateInventoryDisplay); );
|
||||
class CAManBase {
|
||||
class ADDON {
|
||||
put = QUOTE( [_this select 0] call FUNC(updateInventoryDisplay); );
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,24 +1,24 @@
|
||||
class CfgMagazines {
|
||||
class NLAW_F;
|
||||
class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
scope = 1;
|
||||
displayName = "$STR_ACE_Disposable_PreloadedMissileDummy";
|
||||
picture = PATHTOEF(common,UI\blank_CO.paa);
|
||||
weaponPoolAvailable = 0;
|
||||
mass = 0;
|
||||
};
|
||||
class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy {
|
||||
count = 0;
|
||||
};
|
||||
class ACE_UsedTube_F: NLAW_F {
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
displayName = "$STR_ACE_Disposable_UsedTube";
|
||||
descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription";
|
||||
displayNameShort = "-";
|
||||
count = 0;
|
||||
weaponPoolAvailable = 0;
|
||||
modelSpecial = "";
|
||||
mass = 0;
|
||||
};
|
||||
class NLAW_F;
|
||||
class ACE_PreloadedMissileDummy: NLAW_F { // The dummy magazine
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
scope = 1;
|
||||
displayName = "$STR_ACE_Disposable_PreloadedMissileDummy";
|
||||
picture = PATHTOEF(common,UI\blank_CO.paa);
|
||||
weaponPoolAvailable = 0;
|
||||
mass = 0;
|
||||
};
|
||||
class ACE_FiredMissileDummy: ACE_PreloadedMissileDummy {
|
||||
count = 0;
|
||||
};
|
||||
class ACE_UsedTube_F: NLAW_F {
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
displayName = "$STR_ACE_Disposable_UsedTube";
|
||||
descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription";
|
||||
displayNameShort = "-";
|
||||
count = 0;
|
||||
weaponPoolAvailable = 0;
|
||||
modelSpecial = "";
|
||||
mass = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,146 +1,146 @@
|
||||
class CfgVehicles {
|
||||
#define MACRO_NONLAW \
|
||||
class TransportMagazines { \
|
||||
class _xx_NLAW_F { \
|
||||
count = 0; \
|
||||
}; \
|
||||
#define MACRO_NONLAW \
|
||||
class TransportMagazines { \
|
||||
class _xx_NLAW_F { \
|
||||
count = 0; \
|
||||
}; \
|
||||
};
|
||||
|
||||
class ReammoBox_F;
|
||||
class NATO_Box_Base: ReammoBox_F {};
|
||||
class Box_NATO_Ammo_F: NATO_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class Box_NATO_WpsLaunch_F: NATO_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class ReammoBox_F;
|
||||
class NATO_Box_Base: ReammoBox_F {};
|
||||
class Box_NATO_Ammo_F: NATO_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class Box_NATO_WpsLaunch_F: NATO_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class IND_Box_Base: ReammoBox_F {};
|
||||
class Box_IND_WpsLaunch_F: IND_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class Box_IND_Ammo_F: IND_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class IND_Box_Base: ReammoBox_F {};
|
||||
class Box_IND_WpsLaunch_F: IND_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class Box_IND_Ammo_F: IND_Box_Base {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_supplyCrate_F: ReammoBox_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_supplyCrate_F: B_supplyCrate_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class C_supplyCrate_F: ReammoBox_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class B_supplyCrate_F: ReammoBox_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_supplyCrate_F: B_supplyCrate_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class C_supplyCrate_F: ReammoBox_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_AssaultPack_rgr;
|
||||
class B_AssaultPack_rgr_LAT: B_AssaultPack_rgr {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_AssaultPack_rgr_ReconLAT: B_AssaultPack_rgr {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class B_AssaultPack_rgr;
|
||||
class B_AssaultPack_rgr_LAT: B_AssaultPack_rgr {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_AssaultPack_rgr_ReconLAT: B_AssaultPack_rgr {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_Carryall_mcamo;
|
||||
class B_AssaultPack_mcamo_Ammo: B_Carryall_mcamo {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_Carryall_oli;
|
||||
class I_Fieldpack_oli_Ammo: B_Carryall_oli {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class B_Carryall_mcamo;
|
||||
class B_AssaultPack_mcamo_Ammo: B_Carryall_mcamo {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_Carryall_oli;
|
||||
class I_Fieldpack_oli_Ammo: B_Carryall_oli {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_AssaultPack_dgtl;
|
||||
class I_Fieldpack_oli_LAT: B_AssaultPack_dgtl {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class B_AssaultPack_dgtl;
|
||||
class I_Fieldpack_oli_LAT: B_AssaultPack_dgtl {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class CargoNet_01_ammo_base_F;
|
||||
class B_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class CargoNet_01_ammo_base_F;
|
||||
class B_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_CargoNet_01_ammo_F: CargoNet_01_ammo_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class Slingload_01_Base_F;
|
||||
class B_Slingload_01_Cargo_F: Slingload_01_Base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class Slingload_01_Base_F;
|
||||
class B_Slingload_01_Cargo_F: Slingload_01_Base_F {
|
||||
class Tank_F;
|
||||
class APC_Tracked_01_base_F: Tank_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
|
||||
class Tank_F;
|
||||
class APC_Tracked_01_base_F: Tank_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
|
||||
class Car_F;
|
||||
class MRAP_01_base_F: Car_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class MRAP_01_gmg_base_F: MRAP_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_MRAP_01_F: MRAP_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_MRAP_01_gmg_F: MRAP_01_gmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_MRAP_01_hmg_F: MRAP_01_hmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
|
||||
class MRAP_03_base_F: Car_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class MRAP_03_hmg_base_F: MRAP_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_MRAP_03_F: MRAP_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_MRAP_03_hmg_F: MRAP_03_hmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_MRAP_03_gmg_F: MRAP_03_gmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
|
||||
class Wheeled_APC_F: Car_F {};
|
||||
class APC_Wheeled_03_base_F: Wheeled_APC_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class APC_Wheeled_01_base_F: Wheeled_APC_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
};
|
||||
class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_APC_Tracked_01_AA_F: B_APC_Tracked_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
|
||||
class Car_F;
|
||||
class MRAP_01_base_F: Car_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class MRAP_01_gmg_base_F: MRAP_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_MRAP_01_F: MRAP_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_MRAP_01_gmg_F: MRAP_01_gmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_MRAP_01_hmg_F: MRAP_01_hmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
|
||||
class MRAP_03_base_F: Car_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class MRAP_03_hmg_base_F: MRAP_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_MRAP_03_F: MRAP_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_MRAP_03_hmg_F: MRAP_03_hmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_MRAP_03_gmg_F: MRAP_03_gmg_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
|
||||
class Wheeled_APC_F: Car_F {};
|
||||
class APC_Wheeled_03_base_F: Wheeled_APC_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class APC_Wheeled_01_base_F: Wheeled_APC_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
/*class B_APC_Wheeled_01_base_F: APC_Wheeled_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class B_APC_Wheeled_01_cannon_F: B_APC_Wheeled_01_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_APC_Wheeled_03_base_F: APC_Wheeled_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};
|
||||
class I_APC_Wheeled_03_cannon_F: I_APC_Wheeled_03_base_F {
|
||||
MACRO_NONLAW
|
||||
};*/
|
||||
};
|
||||
|
@ -1,18 +1,18 @@
|
||||
class CfgWeapons {
|
||||
class Launcher_Base_F;
|
||||
class launch_NLAW_F: Launcher_Base_F {
|
||||
ACE_UsedTube = "ACE_launch_NLAW_Used_F"; // The class name of the used tube.
|
||||
magazines[] = {"ACE_PreloadedMissileDummy"}; // The dummy magazine
|
||||
};
|
||||
class ACE_launch_NLAW_Used_F: launch_NLAW_F { // the used tube should be a sub class of the disposable launcher
|
||||
scope = 1;
|
||||
ACE_isUsedLauncher = 1;
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
displayName = "$STR_ACE_Disposable_UsedTube";
|
||||
descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription";
|
||||
magazines[] = {"ACE_FiredMissileDummy"}; // This will disable the used launcher class from being fired again.
|
||||
//picture = ""; @todo
|
||||
//model = ""; @todo
|
||||
weaponPoolAvailable = 0;
|
||||
};
|
||||
class Launcher_Base_F;
|
||||
class launch_NLAW_F: Launcher_Base_F {
|
||||
ACE_UsedTube = "ACE_launch_NLAW_Used_F"; // The class name of the used tube.
|
||||
magazines[] = {"ACE_PreloadedMissileDummy"}; // The dummy magazine
|
||||
};
|
||||
class ACE_launch_NLAW_Used_F: launch_NLAW_F { // the used tube should be a sub class of the disposable launcher
|
||||
scope = 1;
|
||||
ACE_isUsedLauncher = 1;
|
||||
author = "$STR_ACE_Common_ACETeam";
|
||||
displayName = "$STR_ACE_Disposable_UsedTube";
|
||||
descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription";
|
||||
magazines[] = {"ACE_FiredMissileDummy"}; // This will disable the used launcher class from being fired again.
|
||||
//picture = ""; @todo
|
||||
//model = ""; @todo
|
||||
weaponPoolAvailable = 0;
|
||||
};
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
ace_disposable
|
||||
==============
|
||||
|
||||
Makes the NLAW a disposable one-way weapon.
|
||||
Makes the NLAW a disposable one-shot weapon.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
@ -4,10 +4,8 @@
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
if (isNil QGVAR(UpdateInventoryDisplay_EHID)) then {
|
||||
GVAR(UpdateInventoryDisplay_EHID) = ["inventoryDisplayLoaded",{
|
||||
["inventoryDisplayLoaded",{
|
||||
_player = ACE_player;
|
||||
[_player, secondaryWeapon _player] call FUNC(takeLoadedATWeapon);
|
||||
[_player] call FUNC(takeLoadedATWeapon);
|
||||
[_player, (_this select 0)] call FUNC(updateInventoryDisplay);
|
||||
}] call EFUNC(common,addEventHandler);
|
||||
};
|
||||
}] call EFUNC(common,addEventHandler);
|
@ -2,7 +2,6 @@
|
||||
|
||||
ADDON = false;
|
||||
|
||||
PREP(aiDropWeaponCallback);
|
||||
PREP(replaceATWeapon);
|
||||
PREP(takeLoadedATWeapon);
|
||||
PREP(updateInventoryDisplay);
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
class CfgPatches {
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author[] = {"commy2"};
|
||||
authorUrl = "https://github.com/commy2/";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
class ADDON {
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
requiredVersion = REQUIRED_VERSION;
|
||||
requiredAddons[] = {"ace_common"};
|
||||
author[] = {"commy2"};
|
||||
authorUrl = "https://github.com/commy2/";
|
||||
VERSION_CONFIG;
|
||||
};
|
||||
};
|
||||
|
||||
#include "CfgEventHandlers.hpp"
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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 ([_unit] call EFUNC(common,isPlayer)) exitWith {}; //Just in case a player took control
|
||||
if (!alive _unit) exitWith {}; //No point doing this for dead
|
||||
|
||||
//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 removeWeaponGlobal _tube;
|
||||
};
|
@ -1,38 +1,79 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Author: bux, commy2
|
||||
* Replace the disposable launcher with the used dummy.
|
||||
*
|
||||
* Argument:
|
||||
* Input from "Fired" eventhandler
|
||||
*
|
||||
* Return value:
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
* 1: weapon - Fired weapon <STRING>
|
||||
* 2: muzzle - Muzzle that was used <STRING>
|
||||
* 3: mode - Current mode of the fired weapon <STRING>
|
||||
* 4: ammo - Ammo used <STRING>
|
||||
* 5: magazine - magazine name which was used <STRING>
|
||||
* 6: projectile - Object of the projectile that was shot <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Nothing
|
||||
*
|
||||
* Example:
|
||||
* [fromBisFiredEH] call ace_disposable_fnc_replaceATWeapon;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_tube", "_projectile"];
|
||||
private ["_unit", "_weapon", "_projectile", "_replacementTube", "_items"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_tube = getText (configFile >> "CfgWeapons" >> (_this select 1) >> "ACE_UsedTube");
|
||||
_weapon = _this select 1;
|
||||
_projectile = _this select 6;
|
||||
|
||||
if (!local _unit) exitWith {};
|
||||
if (_tube == "") exitWith {};
|
||||
|
||||
private "_items";
|
||||
_replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube");
|
||||
if (_replacementTube == "") exitWith {}; //If no replacement defined just exit
|
||||
if (_weapon != (secondaryWeapon _unit)) exitWith {}; //just to be sure
|
||||
|
||||
|
||||
//Save array of items attached to launcher
|
||||
_items = secondaryWeaponItems _unit;
|
||||
|
||||
_unit addWeapon _tube;
|
||||
_unit selectWeapon _tube;
|
||||
//Replace the orginal weapon with the 'usedTube' weapon
|
||||
_unit addWeapon _replacementTube;
|
||||
//Makes sure the used tube is still equiped
|
||||
_unit selectWeapon _replacementTube;
|
||||
//Re-add all attachments to the used tube
|
||||
{
|
||||
if (_x != "") then {_unit addSecondaryWeaponItem _x};
|
||||
if (_x != "") then {_unit addSecondaryWeaponItem _x};
|
||||
} forEach _items;
|
||||
|
||||
// AI
|
||||
|
||||
// AI - Remove the ai's missle launcher tube after the missle has exploded
|
||||
if !([_unit] call EFUNC(common,isPlayer)) then {
|
||||
//waits until _projectile is null, so random 0-2 tickTime seconds after that
|
||||
[FUNC(aiDropWeaponCallback), 2, [_unit, _tube, _projectile]] call CBA_fnc_addPerFrameHandler;
|
||||
[{
|
||||
EXPLODE_2_PVT(_this,_params,_pfhId);
|
||||
EXPLODE_3_PVT(_params,_unit,_tube,_projectile);
|
||||
|
||||
//don't do anything until projectile is null (exploded/max range)
|
||||
if (isNull _projectile) then {
|
||||
//Remove PFEH:
|
||||
[_pfhId] call cba_fnc_removePerFrameHandler;
|
||||
|
||||
//If (tube is dropped) OR (is dead) OR (is player) just exit
|
||||
if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {};
|
||||
|
||||
private ["_items", "_container"];
|
||||
|
||||
// _items = secondaryWeaponItems _unit;
|
||||
_container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
|
||||
_container setPosAsl (getPosAsl _unit);
|
||||
_container addWeaponCargoGlobal [_tube, 1];
|
||||
|
||||
//This will duplicate attachements, because we will be adding a weapon that may already have attachments on it
|
||||
//We either need a way to add a clean weapon, or a way to add a fully configured weapon to a container:
|
||||
// {
|
||||
// if (_x != "") then {_container addItemCargoGlobal [_x, 1];};
|
||||
// } forEach _items;
|
||||
|
||||
_unit removeWeaponGlobal _tube;
|
||||
};
|
||||
}, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
@ -1,48 +1,50 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
*
|
||||
* Handle the take event. Add a dummy magazine if a disposable rocket launcher is taken.
|
||||
*
|
||||
* Argument:
|
||||
* Input from "Take" eventhandler
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [fromTakeEH] call ace_disposable_fnc_takeLoadedATWeapon;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_unit", "_launcher", "_config"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_launcher = secondaryWeapon _unit;
|
||||
|
||||
PARAMS_1(_unit);
|
||||
if (!local _unit) exitWith {};
|
||||
|
||||
_launcher = secondaryWeapon _unit;
|
||||
_config = configFile >> "CfgWeapons" >> _launcher;
|
||||
|
||||
if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then {
|
||||
private ["_magazine", "_isLauncherSelected"];
|
||||
private ["_magazine", "_isLauncherSelected"];
|
||||
|
||||
_magazine = getArray (_config >> "magazines") select 0;
|
||||
_magazine = getArray (_config >> "magazines") select 0;
|
||||
|
||||
_isLauncherSelected = currentWeapon _unit == _launcher;
|
||||
_isLauncherSelected = currentWeapon _unit == _launcher;
|
||||
|
||||
_unit removeMagazines _magazine;
|
||||
_unit removeMagazines _magazine;
|
||||
|
||||
if (backpack _unit == "") then {
|
||||
_unit addBackpack "Bag_Base";
|
||||
if (backpack _unit == "") then {
|
||||
_unit addBackpack "Bag_Base";
|
||||
|
||||
_unit addMagazine _magazine;
|
||||
_unit addWeapon _launcher;
|
||||
_unit addMagazine _magazine;
|
||||
_unit addWeapon _launcher;
|
||||
|
||||
removeBackpack _unit;
|
||||
} else {
|
||||
_unit addMagazine _magazine;
|
||||
_unit addWeapon _launcher;
|
||||
};
|
||||
removeBackpack _unit;
|
||||
} else {
|
||||
_unit addMagazine _magazine;
|
||||
_unit addWeapon _launcher;
|
||||
};
|
||||
|
||||
if (_isLauncherSelected) then {
|
||||
_unit selectWeapon _launcher;
|
||||
};
|
||||
if (_isLauncherSelected) then {
|
||||
_unit selectWeapon _launcher;
|
||||
};
|
||||
};
|
||||
|
@ -1,26 +1,28 @@
|
||||
/*
|
||||
* Author: bux, commy2
|
||||
*
|
||||
* Hide or show the secondary weapon magazine inventory slot to prevent unloading of dummy magazines.
|
||||
*
|
||||
* Argument:
|
||||
* 0: The player. (Object)
|
||||
*
|
||||
* Return value:
|
||||
* Nothing
|
||||
*
|
||||
* Arguments:
|
||||
* 0: unit - Object the event handler is assigned to <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player] call ace_disposable_fnc_updateInventoryDisplay;
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_player", "_display"];
|
||||
disableSerialization;
|
||||
|
||||
_player = _this select 0;
|
||||
PARAMS_1(_player);
|
||||
DEFAULT_PARAM(1,_display,(findDisplay 602));
|
||||
|
||||
_player removeMagazines "ACE_PreloadedMissileDummy";
|
||||
_player removeMagazines "ACE_FiredMissileDummy";
|
||||
|
||||
disableSerialization;
|
||||
_display = [_this, 1, (findDisplay 602)] call BIS_fnc_param;
|
||||
if (isNull _display) exitWith {};
|
||||
|
||||
private ["_launcher", "_control", "_config"];
|
||||
@ -28,21 +30,21 @@ private ["_launcher", "_control", "_config"];
|
||||
_launcher = secondaryWeapon _player;
|
||||
|
||||
if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE_UsedTube") == ""}) then {
|
||||
_control = _display displayCtrl 627;
|
||||
_config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine";
|
||||
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
|
||||
_control ctrlCommit 0;
|
||||
_control = _display displayCtrl 627;
|
||||
_config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine";
|
||||
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
|
||||
_control ctrlCommit 0;
|
||||
|
||||
_control = _display displayCtrl 1251;
|
||||
_config = configFile >> "RscDisplayInventory" >> "controls" >> "BackgroundSlotSecondaryMagazine";
|
||||
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
|
||||
_control ctrlCommit 0;
|
||||
_control = _display displayCtrl 1251;
|
||||
_config = configFile >> "RscDisplayInventory" >> "controls" >> "BackgroundSlotSecondaryMagazine";
|
||||
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
|
||||
_control ctrlCommit 0;
|
||||
} else {
|
||||
_control = _display displayCtrl 627;
|
||||
_control ctrlSetPosition [0, 0, 0, 0];
|
||||
_control ctrlCommit 0;
|
||||
_control = _display displayCtrl 627;
|
||||
_control ctrlSetPosition [0, 0, 0, 0];
|
||||
_control ctrlCommit 0;
|
||||
|
||||
_control = _display displayCtrl 1251;
|
||||
_control ctrlSetPosition [0, 0, 0, 0];
|
||||
_control ctrlCommit 0;
|
||||
_control = _display displayCtrl 1251;
|
||||
_control ctrlSetPosition [0, 0, 0, 0];
|
||||
_control ctrlCommit 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user