Update vanilla zeus functions (#5888)

* Cleanup zeus module

* Update zeus BI functions

* Restore accidentally removed setting check
This commit is contained in:
SilentSpike 2017-12-10 18:29:38 +00:00 committed by PabstMirror
parent be67cf0737
commit c1045e4266
24 changed files with 74 additions and 93 deletions

View File

@ -22,7 +22,7 @@
params ["_logic", "_units", "_activated"];
if (_activated) then {
_explosive = gettext (configFile >> "CfgVehicles" >> typeOf _logic >> "explosive");
_explosive = gettext (configfile >> "cfgvehicles" >> typeof _logic >> "explosive");
if (_explosive != "") then {
_explosive = createvehicle [_explosive,position _logic,[],0,"none"];
_explosive attachto [_logic];
@ -44,7 +44,7 @@ if (_activated) then {
//--- Show hint to curator who placed the object
[[["Curator","PlaceMines"],nil,nil,nil,nil,nil,nil,true],"bis_fnc_advHint",_logic] call bis_fnc_mp;
waitUntil {sleep 0.1; isnull _explosive || isnull _logic || !alive _logic};
waituntil {sleep 0.1; isnull _explosive || isnull _logic || !alive _logic};
if (isnull _logic) then {deletevehicle _explosive;} else {_explosive setdamage 1;};
deletevehicle _logic;
};

View File

@ -20,33 +20,30 @@
#include "script_component.hpp"
_fnc_scriptNameParentTemp = if !(isNil '_fnc_scriptName') then {_fnc_scriptName} else {'BIS_fnc_moduleProjectile'};
private _fnc_scriptNameParent = _fnc_scriptNameParentTemp;
_fnc_scriptNameParentTemp = nil;
private _fnc_scriptName = 'BIS_fnc_moduleProjectile';
scriptname _fnc_scriptName;
params ["_logic", "_units", "_activated"];
_logic = _this select 0;
_units = _this select 1;
_activated = _this select 2;
if ({local _x} count (objectcurators _logic) > 0) then {
//--- Reveal the circle to curators
_logic hideobject false;
_logic setpos position _logic;
};
if !(isserver) exitWith {};
if !(isserver) exitwith {};
if (_activated) then {
_ammo = _logic getVariable ["type",gettext (configFile >> "CfgVehicles" >> typeOf _logic >> "ammo")];
_ammo = _logic getvariable ["type",gettext (configfile >> "cfgvehicles" >> typeof _logic >> "ammo")];
if (_ammo != "") then {
_CfgAmmo = configFile >> "CfgAmmo" >> _ammo;
_dirVar = _fnc_scriptname + typeOf _logic;
_logic setdir (missionnamespace getVariable [_dirVar,direction _logic]); //--- Restore custom direction
_cfgAmmo = configfile >> "cfgammo" >> _ammo;
//if !(isclass _cfgAmmo) exitwith {["CfgAmmo class '%1' not found.",_ammo] call bis_fnc_error;};
// It seems BI broke this part...
// _dirVar = _fnc_scriptname + typeof _logic;
// _logic setdir (missionnamespace getvariable [_dirVar,direction _logic]); //--- Restore custom direction
_pos = getposatl _logic;
_posAmmo = +_pos;
_posAmmo set [2,0];
_dir = direction _logic;
_simulation = tolower gettext (configFile >> "CfgAmmo" >> _ammo >> "simulation");
_simulation = tolower gettext (configfile >> "cfgammo" >> _ammo >> "simulation");
_altitude = 0;
_velocity = [];
_attach = false;
@ -107,15 +104,15 @@ if (_activated) then {
};
};
};
} forEach _entities;
} foreach _entities;
};
};
if (count _hint > 0 && {count objectCurators _logic > 0}) then {
if (count _hint > 0 && {count objectcurators _logic > 0}) then {
[[_hint,nil,nil,nil,nil,nil,nil,true],"bis_fnc_advHint",objectcurators _logic] call bis_fnc_mp;
};
if (count _velocity == 3) then {
_altitude = (_logic getVariable ["altitude",_altitude]) call bis_fnc_parsenumber;
_radio = _logic getVariable ["radio",_radio];
_altitude = (_logic getvariable ["altitude",_altitude]) call bis_fnc_parsenumber;
_radio = _logic getvariable ["radio",_radio];
//--- Create projectile
_posAmmo set [2,_altitude];
@ -143,13 +140,13 @@ if (_activated) then {
//--- Update
if (_attach) then {
waitUntil {
waituntil {
_soundSource setposatl getposatl _projectile;
sleep 1;
isnull _projectile || isnull _logic
};
} else {
waitUntil {
waituntil {
_soundSource setposatl getposatl _projectile;
if (getposatl _logic distance _pos > 0 || direction _logic != _dir) then {
@ -161,7 +158,7 @@ if (_activated) then {
_projectile setposasl _posNew;
_pos = getposatl _logic;
_dir = direction _logic;
missionnamespace setVariable [_dirVar,_dir];
missionnamespace setvariable [_dirVar,_dir];
};
sleep 0.1;
isnull _projectile || isnull _logic
@ -180,7 +177,7 @@ if (_activated) then {
} else {
//--- Repeat to achieve permanent effect
_repeat = _logic getVariable ["repeat",0] > 0;
_repeat = _logic getvariable ["repeat",0] > 0;
if (_repeat) then {
[_logic,_units,_activated] call bis_fnc_moduleprojectile;
} else {
@ -191,6 +188,6 @@ if (_activated) then {
deletevehicle _logic;
};
} else {
["Cannot create projectile, 'ammo' config attribute is missing in %1",typeOf _logic] call bis_fnc_error;
["Cannot create projectile, 'ammo' config attribute is missing in %1",typeof _logic] call bis_fnc_error;
};
};

View File

@ -34,13 +34,16 @@ if (_activated && local _logic && !isnull curatorcamera) then {
if ((_mouseOver select 0) == typename objnull) then {_unit = _mouseOver select 1;};
_unit = effectivecommander _unit;
//--- Temp owner
private _tempOwner = _unit getvariable ["bis_fnc_moduleRemoteControl_owner", objnull];
//--- Check if the unit is suitable
_error = "";
if !(side group _unit in [east,west,resistance,civilian]) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorEmpty";};
if (isplayer _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorPlayer";};
if !(alive _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorDestroyed";};
if (isnull _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorNull";};
if !(isnull (_unit getvariable ["bis_fnc_moduleRemoteControl_owner",objnull])) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";};
if (!isnull _tempOwner && {_tempOwner in allPlayers}) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";};
if (isuavconnected vehicle _unit) then {_error = localize "str_a3_cfgvehicles_moduleremotecontrol_f_errorControl";};
if (_error == "") then {

View File

@ -40,8 +40,8 @@ GVAR(moduleDestination_displayEHMouse) = [findDisplay 312, "mouseButtonDown", {
params ["", "_mouseButton", "", "", "_shift", "_ctrl", "_alt"];
if (_mouseButton != 0) exitWith {}; // Only watch for LMB
TRACE_2("placed",_object,_mousePosASL);
//IGNORE_PRIVATE_WARNING ["_thisArgs"]
_thisArgs params ["_object", "_code"];
// Get mouse position on 2D map or 3D world
@ -52,6 +52,7 @@ GVAR(moduleDestination_displayEHMouse) = [findDisplay 312, "mouseButtonDown", {
} else {
AGLToASL (screenToWorld getMousePosition);
};
TRACE_2("placed",_object,_mousePosASL);
[true, _object, _mousePosASL, _shift, _ctrl, _alt] call _code;
GVAR(moduleDestination_running) = false;
@ -62,8 +63,8 @@ GVAR(moduleDestination_displayEHKeyboard) = [findDisplay 312, "KeyDown", {
params ["", "_keyCode", "_shift", "_ctrl", "_alt"];
if (_keyCode != 1) exitWith {}; // Only watch for ESC
TRACE_2("aborted",_object,_mousePosASL);
//IGNORE_PRIVATE_WARNING ["_thisArgs"]
_thisArgs params ["_object", "_code"];
// Get mouse position on 2D map or 3D world
@ -74,6 +75,7 @@ GVAR(moduleDestination_displayEHKeyboard) = [findDisplay 312, "KeyDown", {
} else {
AGLToASL (screenToWorld getMousePosition);
};
TRACE_2("aborted",_object,_mousePosASL);
[false, _object, _mousePosASL, _shift, _ctrl, _alt] call _code;
GVAR(moduleDestination_running) = false;
@ -83,6 +85,7 @@ GVAR(moduleDestination_displayEHKeyboard) = [findDisplay 312, "KeyDown", {
// Add draw EH for the zeus map - draws the 2D icon and line
GVAR(moduleDestination_mapDrawEH) = [((findDisplay 312) displayCtrl 50), "draw", {
params ["_mapCtrl"];
//IGNORE_PRIVATE_WARNING ["_thisArgs"]
_thisArgs params ["_object", "_text", "_icon", "_color"];
private _pos2d = (((findDisplay 312) displayCtrl 50) ctrlMapScreenToWorld getMousePosition);

View File

@ -25,27 +25,23 @@
if !(isClass (configFile >> "ACE_Curator")) exitWith { ERROR("The ACE_Curator class does not exist") };
params ["_logic"];
private _removeAddons = [];
private _numCfgs = count (configFile >> "ACE_Curator");
for "_n" from 0 to (_numCfgs - 1) do {
private _cfg = (configFile >> "ACE_Curator") select _n;
if (isArray _cfg) then {
_requiredAddon = getArray _cfg;
{
private _addon = _x;
if (isArray _addon) then {
{
if !(isClass (configFile >> "CfgPatches" >> _x)) exitWith {
_removeAddons pushBack (configName _cfg);
_removeAddons pushBack (configName _addon);
};
} forEach _requiredAddon;
} forEach (getArray _addon);
};
if (isText _cfg) then {
_requiredAddon = getText _cfg;
if !(isClass (configFile >> "CfgPatches" >> _requiredAddon)) then {
_removeAddons pushBack (configName _cfg);
};
if (isText _addon) then {
if !(isClass (configFile >> "CfgPatches" >> getText _addon)) then {
_removeAddons pushBack (configName _addon);
};
};
} forEach configProperties [configFile >> "ACE_Curator"];
_logic removeCuratorAddons _removeAddons;

View File

@ -17,9 +17,9 @@
*/
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && {local _logic}) exitWith {};
if !(local _logic) exitWith {};
if !(["ace_fastroping"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -17,9 +17,9 @@
*/
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -17,9 +17,9 @@
*/
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if !(["ace_cargo"] call EFUNC(common,isModLoaded) && ["ace_repair"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if (isNil QEFUNC(captives,setHandcuffed)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -19,9 +19,9 @@
if (canSuspend) exitWith {[FUNC(moduleConfigurePylons), _this] call CBA_fnc_directCall;};
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && {local _logic}) exitWith {};
if !(local _logic) exitWith {};
private _aircraft = attachedTo _logic;

View File

@ -17,7 +17,7 @@
#include "script_component.hpp"
_this params ["_varName","_varValue"];
params ["_varName", "_varValue"];
_varValue params ["_general", "_accuracy", "_handling", "_spotting", "_cover", "_combat"];
TRACE_1("Params",_this);

View File

@ -19,9 +19,9 @@
if (canSuspend) exitWith {[FUNC(moduleLoadIntoCargo), _this] call CBA_fnc_directCall;};
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && {local _logic}) exitWith {};
if !(local _logic) exitWith {};
private _cargo = attachedTo _logic;

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params ["_logic","_units","_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
//Validate the module target:
private _unit = effectiveCommander (attachedTo _logic);

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if !(["ACE_Medical"] call EFUNC(common,isModLoaded)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if (isNil QEFUNC(captives,setSurrendered)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -18,9 +18,9 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
params ["_logic"];
if !(_activated && local _logic) exitWith {};
if !(local _logic) exitWith {};
if (isNil QEFUNC(medical,setUnconscious)) then {
[LSTRING(RequiresAddon)] call FUNC(showMessage);

View File

@ -18,9 +18,7 @@
#include "script_component.hpp"
params ["_logic", "_units", "_activated"];
if !(_activated) exitWith {};
params ["_logic"];
[_logic, QGVAR(zeusAscension), "zeusAscension"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(zeusBird), "zeusBird"] call EFUNC(common,readSettingFromModule);

View File

@ -48,7 +48,7 @@ private _fnc_onDraw = {
};
private _fnc_onMapClick = {
params ["_map","_button","_x","_y","_shift","_ctrl","_alt"];
params ["_map","_button"];
if (_button == 0) then {
private _display = ctrlParent _map;

View File

@ -115,7 +115,7 @@ private _fnc_onUnload = {
};
private _fnc_onConfirm = {
params [["_ctrlButtonOK", controlNull, [controlNull]]];
params ["_ctrlButtonOK"];
private _display = ctrlparent _ctrlButtonOK;
if (isNull _display) exitWith {};

View File

@ -126,18 +126,7 @@ private _fnc_onConfirm = {
private _target = _combo2 lbValue (lbCurSel _combo2);
private _gear = _combo3 lbValue (lbCurSel _combo3);
_toggle = [
false,
true
] select (_toggle == 1);
_gear = [
false,
true
] select (_gear == 1);
[_logic, _toggle, _gear, _target] call FUNC(moduleToggleFlashlight);
[_logic, _toggle == 1, _gear == 1, _target] call FUNC(moduleToggleFlashlight);
};
_display displayAddEventHandler ["unload", _fnc_onUnload];

View File

@ -115,12 +115,7 @@ private _fnc_onConfirm = {
private _toggle = _combo1 lbValue (lbCurSel _combo1);
private _target = _combo2 lbValue (lbCurSel _combo2);
private _toggle = [
false,
true
] select (_toggle == 1);
[_logic, _toggle, _target] call FUNC(moduleToggleNvg);
[_logic, _toggle == 1, _target] call FUNC(moduleToggleNvg);
};
_display displayAddEventHandler ["unload", _fnc_onUnload];