Updated parameterization in Vehiclelock module.

This commit is contained in:
Michael Braun 2015-08-04 05:11:45 +02:00
parent 275b0c4300
commit 2423798753
10 changed files with 32 additions and 30 deletions

View File

@ -20,7 +20,7 @@
private ["_previousMags","_newMags","_keyMagazine","_keyName"];
PARAMS_3(_unit,_veh,_useCustom);
params ["_unit", "_veh", "_useCustom"];
if (isNull _unit) exitWith {ERROR("null unit");};
if (isNull _veh) exitWith {ERROR("null vehicle");};

View File

@ -17,7 +17,7 @@
private ["_vehConfigSide","_vehSide","_returnValue"];
PARAMS_1(_veh);
params ["_veh"];
if (isNull _veh) exitWith {ERROR("null vehicle"); "error"};

View File

@ -16,23 +16,26 @@
*/
#include "script_component.hpp"
PARAMS_1(_vehicle);
if (!isServer) exitWith {};
params ["_vehicle"];
[{
//If the module wasn't placed, just exit (needs to be in wait because objectInitEH is before moduleInit)
if (GVAR(VehicleStartingLockState) == -1) exitWith {};
private ["_lock"];
PARAMS_1(_vehicle);
params ["_vehicle"];
if ((_vehicle isKindOf "Car") || {_vehicle isKindOf "Tank"} || {_vehicle isKindOf "Helicopter"}) then {
//set lock state (eliminates the ambigious 1-"Default" and 3-"Locked for Player" states)
_lock = switch (GVAR(VehicleStartingLockState)) do {
case (0): {(locked _vehicle) in [2, 3]};
case (1):{true};
case (2):{false};
case (0): { (locked _vehicle) in [2, 3] };
case (1): { true };
case (2): { false };
};
if (((_lock) && {(locked _vehicle) != 2}) || {(!_lock) && {(locked _vehicle) != 0}}) then {
if ((_lock && {(locked _vehicle) != 2}) || {!_lock && {(locked _vehicle) != 0}}) then {
TRACE_3("Setting Lock State",_lock,(typeOf _vehicle),_vehicle);
["VehicleLock_SetVehicleLock", [_vehicle], [_vehicle, _lock]] call EFUNC(common,targetEvent);
};

View File

@ -18,7 +18,7 @@
private ["_returnValue","_sideKeyName","_customKeys"];
PARAMS_2(_unit,_veh);
params ["_unit", "_veh"];
if (isNull _unit) exitWith {ERROR("null unit"); false};
if (isNull _veh) exitWith {ERROR("null vehicle"); false};

View File

@ -22,7 +22,7 @@
private ["_vehLockpickStrenth","_condition","_returnValue"];
PARAMS_3(_unit,_veh,_funcType);
params ["_unit", "_veh", "_funcType"];
if (isNull _unit) exitWith {ERROR("null unit"); false};
if (isNull _veh) exitWith {ERROR("null vehicle"); false};
@ -41,25 +41,20 @@ if (_vehLockpickStrenth < 0) exitWith {false};
//Condition check for progressBar
_condition = {
PARAMS_1(_args);
EXPLODE_2_PVT(_args,_unit,_veh);
params ["_args"];
_args params ["_args", "_unit", "_veh"];
((_unit distance _veh) < 5) && {(speed _veh) < 0.1}
};
if (!([[_unit, _veh]] call _condition)) exitWith {false};
_returnValue = false;
switch (true) do {
case (_funcType == "canLockpick"): {
_returnValue = true;
};
case (_funcType == "startLockpick"): {
_returnValue = _funcType in ["canLockpick", "startLockpick", "finishLockpick"];
switch (_funcType) do {
case "startLockpick": {
[_vehLockpickStrenth, [_unit, _veh, "finishLockpick"], {(_this select 0) call FUNC(lockpick)}, {}, (localize LSTRING(Action_LockpickInUse)), _condition] call EFUNC(common,progressBar);
_returnValue = true;
};
case (_funcType == "finishLockpick"): {
case "finishLockpick": {
["VehicleLock_SetVehicleLock", [_veh], [_veh, false]] call EFUNC(common,targetEvent);
_returnValue = true;
};
default {
ERROR("bad function type");

View File

@ -17,10 +17,11 @@
*/
#include "script_component.hpp"
PARAMS_3(_logic,_syncedUnits,_activated);
if (!isServer) exitWith {};
params ["_logic", "_syncedUnits", "_activated"];
if (!_activated) exitWith {WARNING("Vehicle Lock Init Module - placed but not active");};
if (!isServer) exitWith {};
//Set the GVAR for default lockpick strength
[_logic, QGVAR(DefaultLockpickStrength), "DefaultLockpickStrength"] call EFUNC(common,readSettingFromModule);

View File

@ -17,14 +17,17 @@
*/
#include "script_component.hpp"
PARAMS_3(_logic,_syncedObjects,_activated);
if (!isServer) exitWith {};
params ["_logic", "_syncedObjects", "_activated"];
if !(_activated) exitWith {WARNING("Vehicle Lock Sync Module - placed but not active");};
if (!isServer) exitWith {};
[{
private ["_listOfVehicles"];
PARAMS_1(_syncedObjects);
params ["_syncedObjects"];
_listOfVehicles = [];
{
if ((_x isKindOf "Car") || (_x isKindOf "Tank") || (_x isKindOf "Helicopter")) then {

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
PARAMS_2(_unit,_container);
params ["_unit", "_container"];
//Only check for player:
if (_unit != ace_player) exitWith {false};

View File

@ -18,7 +18,7 @@
private ["_currentKeys"];
PARAMS_2(_veh,_key);
params ["_veh", "_key"];
if (!isServer) exitWith {ERROR("only run on server");};
if (isNull _veh) exitWith {ERROR("null vehicle");};

View File

@ -18,7 +18,7 @@
private ["_lockNumber"];
PARAMS_2(_veh,_isLocked);
params ["_veh", "_isLocked"];
_lockNumber = if (_isLocked) then {2} else {0};
TRACE_2("Setting Lock State", _veh, _lockNumber);