Code cleanup of Disposable module

This commit is contained in:
jokoho48 2015-08-09 05:25:19 +02:00
parent 7624a459eb
commit b23f9c0de2
4 changed files with 14 additions and 17 deletions

View File

@ -5,6 +5,7 @@ if (!hasInterface) exitWith {};
["inventoryDisplayLoaded", {[ACE_player, _this select 0] call FUNC(updateInventoryDisplay)}] call EFUNC(common,addEventHandler); ["inventoryDisplayLoaded", {[ACE_player, _this select 0] call FUNC(updateInventoryDisplay)}] call EFUNC(common,addEventHandler);
["playerInventoryChanged", { ["playerInventoryChanged", {
[_this select 0, _this select 1 select 11] call FUNC(takeLoadedATWeapon); params ["_unit"];
[_this select 0] call FUNC(updateInventoryDisplay); [_unit, _this select 1 select 11] call FUNC(takeLoadedATWeapon);
[_unit] call FUNC(updateInventoryDisplay);
}] call EFUNC(common,addEventHandler); }] call EFUNC(common,addEventHandler);

View File

@ -21,11 +21,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_weapon", "_projectile", "_replacementTube", "_items"]; private ["_replacementTube", "_items"];
params ["_unit", "_weapon", "", "", "", "", "_projectile"];
_unit = _this select 0;
_weapon = _this select 1;
_projectile = _this select 6;
if (!local _unit) exitWith {}; if (!local _unit) exitWith {};
@ -43,19 +40,19 @@ _unit selectWeapon _replacementTube;
//Re-add all attachments to the used tube //Re-add all attachments to the used tube
{ {
if (_x != "") then {_unit addSecondaryWeaponItem _x}; if (_x != "") then {_unit addSecondaryWeaponItem _x};
} forEach _items; } count _items;
// AI - Remove the ai's missle launcher tube after the missle has exploded // AI - Remove the ai's missle launcher tube after the missle has exploded
if !([_unit] call EFUNC(common,isPlayer)) then { if !([_unit] call EFUNC(common,isPlayer)) then {
[{ [{
EXPLODE_2_PVT(_this,_params,_pfhId); params ["args","_idPFH"];
EXPLODE_3_PVT(_params,_unit,_tube,_projectile); _args params ["_unit", "_tube", "_projectile"];
//don't do anything until projectile is null (exploded/max range) //don't do anything until projectile is null (exploded/max range)
if (isNull _projectile) then { if (isNull _projectile) then {
//Remove PFEH: //Remove PFEH:
[_pfhId] call cba_fnc_removePerFrameHandler; [_idPFH] call cba_fnc_removePerFrameHandler;
//If (tube is dropped) OR (is dead) OR (is player) just exit //If (tube is dropped) OR (is dead) OR (is player) just exit
if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {}; if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {};
@ -66,13 +63,13 @@ if !([_unit] call EFUNC(common,isPlayer)) then {
_container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"]; _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
_container setPosAsl (getPosAsl _unit); _container setPosAsl (getPosAsl _unit);
_container addWeaponCargoGlobal [_tube, 1]; _container addWeaponCargoGlobal [_tube, 1];
//This will duplicate attachements, because we will be adding a weapon that may already have attachments on it //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: //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];}; // if (_x != "") then {_container addItemCargoGlobal [_x, 1];};
// } forEach _items; // } forEach _items;
_unit removeWeaponGlobal _tube; _unit removeWeaponGlobal _tube;
}; };
}, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler; }, 1, [_unit, _replacementTube, _projectile]] call CBA_fnc_addPerFrameHandler;

View File

@ -17,7 +17,8 @@
private ["_unit", "_launcher", "_config"]; private ["_unit", "_launcher", "_config"];
PARAMS_1(_unit); params ["_unit"];
if (!local _unit) exitWith {}; if (!local _unit) exitWith {};
_launcher = secondaryWeapon _unit; _launcher = secondaryWeapon _unit;

View File

@ -16,9 +16,7 @@
#include "script_component.hpp" #include "script_component.hpp"
disableSerialization; disableSerialization;
params ["_player",["_display",(findDisplay 602),[(findDisplay 602)]]]
PARAMS_1(_player);
DEFAULT_PARAM(1,_display,(findDisplay 602));
_player removeMagazines "ACE_PreloadedMissileDummy"; _player removeMagazines "ACE_PreloadedMissileDummy";
_player removeMagazines "ACE_FiredMissileDummy"; _player removeMagazines "ACE_FiredMissileDummy";