Allow string function names.

This commit is contained in:
Nou 2015-04-12 10:52:50 -07:00
parent 40c5de8cfb
commit 4a23b8be00
2 changed files with 13 additions and 9 deletions

View File

@ -5,7 +5,7 @@
* Arguments: * Arguments:
* 0: Emitter <object> * 0: Emitter <object>
* 1: Owner <object> * 1: Owner <object>
* 2: Method, can be code, which emitter and owner are passed to, an array with a position memory point and weapon name, or an array with a position memory point, a vector begining memory point, and vector ending memory point. * 2: Method, can be code, which emitter and owner are passed to, a string function name, an array with a position memory point and weapon name, or an array with a position memory point, a vector begining memory point, and vector ending memory point.
* 3: Wavelength (1550nm is common eye safe) <number> * 3: Wavelength (1550nm is common eye safe) <number>
* 4: Laser code <number> * 4: Laser code <number>
* 5: Beam divergence (in mils off beam center). * 5: Beam divergence (in mils off beam center).

View File

@ -39,6 +39,9 @@ _finalOwner = nil;
_laser = []; _laser = [];
if(IS_CODE(_method)) then { if(IS_CODE(_method)) then {
_laser = _x call _method; _laser = _x call _method;
} else {
if(IS_STRING(_method)) then {
_laser = _x call (missionNamespace getVariable [_method, {}]);
} else { } else {
if(IS_ARRAY(_method)) then { if(IS_ARRAY(_method)) then {
if(count _method == 2) then { if(count _method == 2) then {
@ -50,6 +53,7 @@ _finalOwner = nil;
}; };
}; };
}; };
};
_laserPos = _laser select 0; _laserPos = _laser select 0;
_laserDir = _laser select 1; _laserDir = _laser select 1;
_res = [_laserPos, _laserDir, _divergence] call FUNC(shootCone); _res = [_laserPos, _laserDir, _divergence] call FUNC(shootCone);