Updated parameterization in Weaponselect module.

This commit is contained in:
Michael Braun 2015-08-04 03:08:21 +02:00
parent 275b0c4300
commit d51d87ba2c
16 changed files with 116 additions and 48 deletions

View File

@ -12,10 +12,10 @@
*/
#include "script_component.hpp"
PARAMS_2(_unit,_muzzle);
private ["_uniformMags", "_vestMags", "_backpackMags", "_numberOfMagazines", "_magazineClasses", "_firstMagazine"];
params ["_unit", "_muzzle"];
_uniformMags = getMagazineCargo uniformContainer _unit;
_vestMags = getMagazineCargo vestContainer _unit;
_backpackMags = getMagazineCargo backpackContainer _unit;

View File

@ -12,11 +12,11 @@
*/
#include "script_component.hpp"
private ["_color", "_name", "_text", "_picture"];
if !(GVAR(DisplayText)) exitwith {};
PARAMS_2(_magazine,_numberofMagazines);
private ["_color", "_name", "_text", "_picture"];
params ["_magazine", "_numberofMagazines"];
_color = [[1,0,0], [1,1,1]] select (_numberofMagazines > 0);
_name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort");

View File

@ -1,17 +1,25 @@
// by commy2
/*
* Author: commy2
*
* Find the next Grenade Magazine.
*
* Argument:
* 0: Grenade Type ("All", "Frag", "NonFrag") <STRING>
*
* Return value:
* Magazine classname <STRING>
*/
#include "script_component.hpp"
private ["_allMags", "_allMuzzles", "_magazines"];
private ["_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMagazine"];
PARAMS_1(_type); //"All", "Frag" or "NonFrag"
params ["_type"];
_allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []];
_allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []];
_magazines = magazines ACE_player;
private ["_start", "_index", "_nextMagazine"];
_start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag);
_index = _allMuzzles find _start;

View File

@ -1,17 +1,25 @@
// by commy2
/*
* Author: commy2
*
* Find the next Grenade Muzzle.
*
* Argument:
* 0: Grenade Type ("All", "Frag", "NonFrag") <STRING>
*
* Return value:
* Class name of next throw muzzle <STRING>
*/
#include "script_component.hpp"
private ["_allMags", "_allMuzzles", "_magazines"];
private ["_allMags", "_allMuzzles", "_magazines", "_start", "_index", "_nextMuzzle"];
PARAMS_1(_type); //"All", "Frag" or "NonFrag"
params ["_type"];
_allMags = missionNamespace getVariable [format [QGVAR(%1Magazines), _type], []];
_allMuzzles = missionNamespace getVariable [format [QGVAR(%1Muzzles), _type], []];
_magazines = magazines ACE_player;
private ["_start", "_index", "_nextMuzzle"];
_start = [GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag);
_index = _allMuzzles find _start;

View File

@ -1,9 +1,19 @@
// by commy2
/*
* Author: commy2
*
* Fire Vehicle Smoke Launcher.
*
* Argument:
* 0: Vehicle <OBJECT>
*
* Return value:
* None
*/
#include "script_component.hpp"
private ["_turret", "_weapons"];
PARAMS_1(_vehicle);
params ["_vehicle"];
_turret = [_vehicle] call EFUNC(common,getTurretCommander);

View File

@ -1,4 +1,14 @@
// by commy2
/*
* Author: commy2
*
* Returns the selected Grenade Muzzle.
*
* Argument:
* None
*
* Return value:
* Class name of selected throw muzzle. <STRING>
*/
#include "script_component.hpp"
[GVAR(CurrentGrenadeMuzzleOther), GVAR(CurrentGrenadeMuzzleFrag)] select GVAR(CurrentGrenadeMuzzleIsFrag)

View File

@ -1,9 +1,20 @@
// by commy2
/*
* Author: commy2
*
* Play the change firemode sound for specified weapon at units position.
*
* Argument:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return value:
* None
*/
#include "script_component.hpp"
private ["_sound"];
PARAMS_2(_unit,_weapon);
params ["_unit", "_weapon"];
_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");

View File

@ -4,14 +4,14 @@
* The unit will put its current weapon away.
*
* Argument:
* 0: What unit should put the current weapon on back? (Object)
* 0: Unit <OBJECT>
*
* Return value:
* None.
* None
*/
#include "script_component.hpp"
PARAMS_1(_unit);
params ["_unit"];
[_unit] call EFUNC(common,fixLoweredRifleAnimation);

View File

@ -4,7 +4,7 @@
* Cycle through all grenades.
*
* Argument:
* None
* 0: Unit <OBJECT>
*
* Return value:
* None
@ -13,13 +13,12 @@
private ["_text", "_nextMuzzle"];
PARAMS_1(_unit);
params ["_unit"];
_nextMuzzle = ["All"] call FUNC(findNextGrenadeMuzzle);
if (_nextMuzzle != "") then {
private ["_magazines", "_magazine", "_count", "_return"];
_magazines = GVAR(AllMagazines) select (GVAR(AllMuzzles) find _nextMuzzle);
reverse _magazines;

View File

@ -4,7 +4,7 @@
* Cycle through frags.
*
* Argument:
* None
* 0: Unit <OBJECT>
*
* Return value:
* None
@ -13,7 +13,7 @@
private ["_text", "_nextMuzzle"];
PARAMS_1(_unit);
params ["_unit"];
_nextMuzzle = ["Frag"] call FUNC(findNextGrenadeMuzzle);

View File

@ -4,7 +4,7 @@
* Cycle through non explosive grenades.
*
* Argument:
* None
* 0: Unit <OBJECT>
*
* Return value:
* None
@ -13,7 +13,7 @@
private ["_nextMuzzle", "_text"];
PARAMS_1(_unit);
params ["_unit"];
_nextMuzzle = ["NonFrag"] call FUNC(findNextGrenadeMuzzle);

View File

@ -4,14 +4,15 @@
* The player will select the specified weapon or will change to the next firing mode if the weapon was already selected.
*
* Argument:
* 0: A weapon (String)
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return value:
* None.
* None
*/
#include "script_component.hpp"
PARAMS_2(_unit,_weapon);
params ["_unit", "_weapon"];
if (_weapon == "") exitWith {};

View File

@ -4,14 +4,15 @@
* The player will select the specified weapon and change to the first additional muzzle. E.g. the grenade launcher of a assault rifle.
*
* Argument:
* 0: A weapon (String)
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return value:
* None.
* None
*/
#include "script_component.hpp"
PARAMS_2(_unit,_weapon);
params ["_unit", "_weapon"];
if (_weapon == "") exitWith {};

View File

@ -1,7 +1,19 @@
// by commy2
/*
* Author: commy2
*
* Select weapon for unit in vehicle.
*
* Argument:
* 0: Unit <OBJECT>
* 1: Vehicle <OBJECT>
* 2: Weapon index <NUMBER>
*
* Return value:
* None
*/
#include "script_component.hpp"
PARAMS_3(_unit,_vehicle,_index);
params ["_unit", "_vehicle", "_index"];
private "_turret";
_turret = [_unit] call EFUNC(common,getTurretIndex);

View File

@ -4,18 +4,18 @@
* Select the next grenade muzzle to throw.
*
* Argument:
* muzzle name
* 0: Unit <OBJECT>
* 1: Muzzlename <STRING>
*
* Return value:
* None
*
*/
#include "script_component.hpp"
PARAMS_2(_unit,_muzzle);
private ["_uniformMags", "_vestMags", "_backpackMags", "_i", "_uniformMagsToRemove", "_vestMagsToRemove", "_backpackMagsToRemove", "_firstMagazine", "_throwMuzzleNames"];
params ["_unit", "_muzzle"];
_uniformMags = getMagazineCargo uniformContainer _unit;
_vestMags = getMagazineCargo vestContainer _unit;
_backpackMags = getMagazineCargo backpackContainer _unit;

View File

@ -1,11 +1,19 @@
// by commy2
/*
* Author: commy2
*
* Display Grenade information on grenade throw.
*
* Argument:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
* 2: Magazine <STRING>
*
* Return value:
* None
*/
#include "script_component.hpp"
private ["_unit","_weapon","_magazine"];
_unit = _this select 0;
_weapon = _this select 1;
_magazine = _this select 5;
params ["_unit", "_weapon", "_magazine"];
if (_weapon != "Throw") exitWith {};