Preset category based permissions instead of arma class based
This commit is contained in:
parent
60b223d837
commit
ab637f09d8
|
@ -97,13 +97,27 @@ GRLIB_ignore_colisions_when_building = [
|
|||
|
||||
|
||||
/* !!! DO NOT EDIT BELOW !!! */
|
||||
|
||||
// Preset arrays
|
||||
infantry_units = [infantry_units] call F_filterMods;
|
||||
light_vehicles = [light_vehicles] call F_filterMods;
|
||||
heavy_vehicles = [heavy_vehicles] call F_filterMods;
|
||||
air_vehicles = [air_vehicles] call F_filterMods;
|
||||
support_vehicles = [support_vehicles] call F_filterMods;
|
||||
static_vehicles = [static_vehicles] call F_filterMods;
|
||||
// Preset classes arrays
|
||||
light_vehicles_classes = light_vehicles apply {toLower (_x select 0)};
|
||||
heavy_vehicles_classes = heavy_vehicles apply {toLower (_x select 0)};
|
||||
air_vehicles_classes = air_vehicles apply {toLower (_x select 0)};
|
||||
// Detect type of Potato 01 and support vehicles
|
||||
{
|
||||
_x params ["_class"];
|
||||
switch (true) do {
|
||||
case (_class isKindOf "Tank"): {heavy_vehicles_classes pushBack toLower _class};
|
||||
case (_class isKindOf "Air"): {air_vehicles_classes pushBack toLower _class};
|
||||
default {light_vehicles_classes pushBack toLower _class};
|
||||
};
|
||||
} forEach support_vehicles + [huron_typename];
|
||||
|
||||
buildings = [buildings] call F_filterMods;
|
||||
build_lists = [[],infantry_units,light_vehicles,heavy_vehicles,air_vehicles,static_vehicles,buildings,support_vehicles,squads];
|
||||
KP_liberation_storage_buildings = [KP_liberation_small_storage_building,KP_liberation_large_storage_building];
|
||||
|
|
|
@ -63,8 +63,8 @@ execVM "scripts\client\markers\update_production_sites.sqf";
|
|||
player addMPEventHandler ["MPKilled", {_this spawn kill_manager;}];
|
||||
player addEventHandler ["GetInMan", {[_this select 2] spawn kp_fuel_consumption;}];
|
||||
player addEventHandler ["GetInMan", {[_this select 2] spawn kp_cr_checkVehicle;}];
|
||||
player addEventHandler ["GetInMan", {[_this select 0, _this select 2] call kp_vehicle_permissions;}];
|
||||
player addEventHandler ["SeatSwitchedMan", {[_this select 0, _this select 2] call kp_vehicle_permissions;}];
|
||||
player addEventHandler ["GetInMan", {[_this select 2] call kp_vehicle_permissions;}];
|
||||
player addEventHandler ["SeatSwitchedMan", {[_this select 2] call kp_vehicle_permissions;}];
|
||||
|
||||
{
|
||||
[_x] call BIS_fnc_drawCuratorLocations;
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
params ["_unit", "_vehicle"];
|
||||
params ["_vehicle"];
|
||||
private _vehicleClass = toLower typeOf _vehicle;
|
||||
|
||||
private _role = assignedVehicleRole player select 0;
|
||||
if (_role isEqualTo "cargo") exitWith {};
|
||||
// Cargo is always allowed
|
||||
private _isCargo = (_vehicle getCargoIndex player) != -1;
|
||||
if (_isCargo || _vehicle isKindOf "ParachuteBase") exitWith {};
|
||||
|
||||
private _permissibleVehicles = [
|
||||
["Car", 0, "STR_PERMISSION_NO_LIGHT"],
|
||||
["Tank", 1, "STR_PERMISSION_NO_ARMOR"],
|
||||
["Air", 2, "STR_PERMISSION_NO_AIR"]
|
||||
[light_vehicles_classes, "STR_PERMISSION_NO_LIGHT"],
|
||||
[heavy_vehicles_classes, "STR_PERMISSION_NO_ARMOR"],
|
||||
[air_vehicles_classes, "STR_PERMISSION_NO_AIR"]
|
||||
];
|
||||
|
||||
(_permissibleVehicles select {_vehicle isKindOf (_x select 0)} select 0) params ["_type", "_permission", "_hintString"];
|
||||
private _permissionIdx = _permissibleVehicles findIf {_vehicleClass in (_x select 0)};
|
||||
if (_permissionIdx isEqualTo -1) exitWith {};
|
||||
|
||||
if !([player, _permission] call F_fetchPermission) exitWith {
|
||||
if !([player, _permissionIdx] call F_fetchPermission) exitWith {
|
||||
moveOut player;
|
||||
hint localize _hintString;
|
||||
};
|
||||
hint localize (_permissibleVehicles select _permissionIdx select 1);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue