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:
* 0: Emitter <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>
* 4: Laser code <number>
* 5: Beam divergence (in mils off beam center).

View File

@ -39,15 +39,19 @@ _finalOwner = nil;
_laser = [];
if(IS_CODE(_method)) then {
_laser = _x call _method;
} else {
if(IS_ARRAY(_method)) then {
if(count _method == 2) then {
_laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), _obj weaponDirection (_method select 1)];
} else {
if(count _method == 3) then {
_laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), (ATLtoASL (_obj modelToWorldVisual (_method select 1))) vectorFromTo (ATLtoASL (_obj modelToWorldVisual (_method select 2)))];
} else {
if(IS_STRING(_method)) then {
_laser = _x call (missionNamespace getVariable [_method, {}]);
} else {
if(IS_ARRAY(_method)) then {
if(count _method == 2) then {
_laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), _obj weaponDirection (_method select 1)];
} else {
if(count _method == 3) then {
_laser = [ATLtoASL (_obj modelToWorldVisual (_method select 0)), (ATLtoASL (_obj modelToWorldVisual (_method select 1))) vectorFromTo (ATLtoASL (_obj modelToWorldVisual (_method select 2)))];
};
};
};
};
};
};
_laserPos = _laser select 0;