Skip to content

Commit

Permalink
locking framework
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenceIsFatto committed Aug 23, 2024
1 parent bd353e4 commit 443c7e8
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions A3A/addons/core/functions/CREATE/fn_createAIAirplane.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ for "_i" from 0 to (count _array - 1) do {

["locationSpawned", [_markerX, "Airport", true]] call EFUNC(Events,triggerEvent);

// {

// } forEach _vehiclesX;

waitUntil {sleep 1; (spawner getVariable _markerX == 2)};

Expand Down
6 changes: 6 additions & 0 deletions A3A/addons/ultimate/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ class CfgFunctions
class logisticsGrabSeats {};
class weightTest {};
};
class vehicles
{
file = QPATHTOFOLDER(functions\vehicles);
class setLock {};
class toggleLock {};
};
class zombie
{
file = QPATHTOFOLDER(functions\zombie);
Expand Down
30 changes: 30 additions & 0 deletions A3A/addons/ultimate/functions/vehicles/fn_setLock.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Author:
Silence
Description:
Locks or unlocks _vehicle with _state
Params:
_vehicle <OBJECT> <Default: ObjNull>
_state <BOOL> <Default: false>
Usage:
[cursorObject, true] call A3U_fnc_setLock;
Return:
true if successful <BOOL>
*/

params [
["_vehicle", ObjNull],
["_state", false]
];

if (_vehicle isEqualTo ObjNull || {isNil "_vehicle"}) exitWith {false};

_vehicle lock _state;

[format["%1 has been locked. State: %2", typeOf _vehicle, _state], _fnc_scriptName] call A3U_fnc_log;

true;
25 changes: 25 additions & 0 deletions A3A/addons/ultimate/functions/vehicles/fn_toggleLock.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
params [
["_vehicle", ObjNull]
];

if (_vehicle isEqualTo ObjNull || {isNil "_vehicle"}) exitWith {false};

switch (locked _vehicle) do
{
case 0:
{
[_vehicle, true] call A3U_fnc_setLock;
};
case 1;
case 2;
case 3:
{
[_vehicle, false] call A3U_fnc_setLock;
};
default
{
diag_log format["Vehicle %1 lock state was not recognized. Perhaps it is null?", typeOf _vehicle];
};
};

true;

0 comments on commit 443c7e8

Please sign in to comment.