Base Cleanup

Headers
Formating
Small optimizations
This commit is contained in:
PabstMirror 2015-02-19 19:32:41 -06:00
parent a8e269bc18
commit 9935ac57bd
11 changed files with 310 additions and 292 deletions

View File

@ -1,7 +1,7 @@
ace_disposable
==============
Makes the NLAW a disposable one-way weapon.
Makes the NLAW a disposable one-shot weapon.
## Maintainers

View File

@ -7,7 +7,7 @@
if (isNil QGVAR(UpdateInventoryDisplay_EHID)) then {
GVAR(UpdateInventoryDisplay_EHID) = ["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);
};

View File

@ -1,32 +1,36 @@
/*
* Author: bux, commy2
* Remove the ai's missle launcher tube after the missle has exploded
*
* Remove the ai's missle launcher tube
* Arguments:
* 0: Params [unit<OBJECT>, Tube<STRING>, Projectile<OBJECT>] <ARRAY>
* 1: CBA PFH ID <NUMBER>
*
* Return value:
* Return Value:
* Nothing
*
* Example:
* [[someAI, "emptyTube", theRocket], 55] call ace_disposable_fnc_aiDropWeaponCallback;
*
* Public: No
*/
#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;
EXPLODE_2_PVT(_this,_params,_pfhId);
EXPLODE_3_PVT(_params,_unit,_tube,_projectile);
if (!isNull _projectile) exitWith {};
//remove frameEH
[(_this select 1)] call cba_fnc_removePerFrameHandler;
[_pfhId] 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 {
private ["_logic"];
_logic = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"];
_logic addWeaponCargoGlobal [_tube, 1]; // @todo secondary weapon items
_unit removeWeaponGlobal _tube;
};

View File

@ -1,26 +1,36 @@
/*
* Author: commy2
*
* Author: bux, commy2
* Replace the disposable launcher with the used dummy.
*
* Argument:
* Input from "Fired" eventhandler
* 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:
* Return Value:
* Nothing
*
* Example:
* [fromBisFiredEH] call ace_disposable_fnc_replaceATWeapon;
*
* Public: No
*/
#include "script_component.hpp"
private ["_unit", "_tube", "_projectile"];
_unit = _this select 0;
_tube = getText (configFile >> "CfgWeapons" >> (_this select 1) >> "ACE_UsedTube");
_projectile = _this select 6;
if (!local _unit) exitWith {};
_tube = getText (configFile >> "CfgWeapons" >> (_this select 1) >> "ACE_UsedTube");
if (_tube == "") exitWith {};
_projectile = _this select 6;
private "_items";
_items = secondaryWeaponItems _unit;

View File

@ -1,24 +1,26 @@
/*
* Author: commy2
*
* Handle the take event. Add a dummy magazine if a disposable rocket launcher is taken.
*
* Argument:
* Input from "Take" eventhandler
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
*
* Return value:
* Return Value:
* Nothing
*
* 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 {

View File

@ -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)
* Arguments:
* 0: unit - Object the event handler is assigned to <OBJECT>
*
* Return value:
* Return Value:
* Nothing
*
* 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"];