Restrict SP to local resources

Rearming not local turrets do not work, so make it similar to new
Dyna-Options to add / remove Magazines
- Driver can Refuel / Repair and Reload only Driver-Weapons
- All other Seats can only rearm they current available weapons
This commit is contained in:
He-Man 2017-10-09 22:51:22 +02:00
parent 9aeb1024c7
commit 49442da4d4
3 changed files with 36 additions and 31 deletions

View File

@ -19,7 +19,7 @@ private ["_ServicePointClasses","_config","_inSP","_nearClasses","_servicepointD
_vehicle = vehicle player;
if (_vehicle == player) exitwith {false};
if !(local _vehicle) exitwith {false};
// if !(local _vehicle) exitwith {false};
if (speed _vehicle > 2 || speed _vehicle < -2) exitwith {false};
if (((getpos _vehicle) select 2) > 1) exitwith {false};
if (!(_vehicle iskindof 'ship') && (((getposasl _vehicle) select 2) < 1)) exitwith {false};

View File

@ -16,7 +16,6 @@
//[[[cog import generate_private_arrays ]]]
private ["_Ignatz_SP_Array","_VehiclesAndAmmo","_actionName","_actionTitle","_ammocount","_ammotype","_cost","_costs","_costsFree","_costsText","_fnc_actionTitle","_fnc_getCosts","_magname","_maxammototal","_maxmags","_missingammo","_ownedcompletemags","_refuel_amount","_refuel_costs","_refuel_updateInterval","_reloagmags","_repairTime","_repair_costs","_totalammocount","_turret","_typeName","_vehicle"];
//[[[end]]]
Ignatz_Refuel = nil;
Ignatz_Repair = nil;
Ignatz_Rearm0 = nil;
@ -24,6 +23,8 @@ Ignatz_Rearm1 = nil;
Ignatz_Rearm2 = nil;
Ignatz_Rearm3 = nil;
params ["_myturret"];
_vehicle = vehicle player;
_repair_costs = ["CfgServicePoint", "repair_costs", []] call EPOCH_fnc_returnConfigEntryV2;
_refuel_costs = ["CfgServicePoint", "refuel_costs", []] call EPOCH_fnc_returnConfigEntryV2;
@ -65,6 +66,7 @@ _fnc_actionTitle = {
if ((typeof _vehicle) == _x select 0) exitwith {
{
_x params ["_ammotype","_turret","_maxmags","_costs",["_ammocount",getNumber (configfile >> "CfgMagazines" >> (_x select 0) >> "count")]];
if (_myturret isequalto _turret) then {
_maxammototal = _maxmags*_ammocount;
_totalammocount = 0;
{
@ -88,10 +90,12 @@ _fnc_actionTitle = {
_actionTitle = format['Rearm %1 with %2 round %3 (%4 Crypto)',getText (configFile >> 'Cfgvehicles' >> typeOf _vehicle >> 'displayName'),_missingammo,_magname, _costs];
_Ignatz_SP_Array pushback [_actionTitle,[_vehicle,_ammotype,_turret,_reloagmags,_ammocount,_costs]];
};
};
} foreach (_x select 1);
};
} foreach _VehiclesAndAmmo;
if (player == driver _vehicle) then {
_costs = [_vehicle, _refuel_costs] call _fnc_getCosts;
_actionTitle = [format['Refuel %1',getText (configFile >> 'Cfgvehicles' >> typeOf _vehicle >> 'displayName')], _costs] call _fnc_actionTitle;
Ignatz_Refuel = [_actionTitle,[_vehicle,[_costs, _refuel_updateInterval,_refuel_amount]]];
@ -99,6 +103,7 @@ Ignatz_Refuel = [_actionTitle,[_vehicle,[_costs, _refuel_updateInterval,_refuel_
_costs = [_vehicle, _repair_costs] call _fnc_getCosts;
_actionTitle = [format['Repair %1',getText (configFile >> 'Cfgvehicles' >> typeOf _vehicle >> 'displayName')], _costs] call _fnc_actionTitle;
Ignatz_Repair = [_actionTitle,[_vehicle,[_costs, _repairTime]]];
};
if (count _Ignatz_SP_Array > 0) then {Ignatz_Rearm0 = _Ignatz_SP_Array select 0;};
if (count _Ignatz_SP_Array > 1) then {Ignatz_Rearm1 = _Ignatz_SP_Array select 1;};
if (count _Ignatz_SP_Array > 2) then {Ignatz_Rearm2 = _Ignatz_SP_Array select 2;};

View File

@ -123,20 +123,20 @@ class Drink
class ServicePoint
{
condition = "call EPOCH_SP_Check";
action = "call EPOCH_SP_Start;";
action = "[dyna_Turret] call EPOCH_SP_Start;";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Repair_man.paa";
tooltip = "Service Point";
class Refuel
{
condition = "true";
condition = "!isnil 'Ignatz_Refuel'";
action = "(Ignatz_Refuel select 1) spawn EPOCH_SP_Refuel";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\vehicle_refuel.paa";
tooltipcode = "Ignatz_Refuel select 0";
};
class Repair
{
condition = "true";
condition = "!isnil 'Ignatz_Repair'";
action = "(Ignatz_Repair select 1) spawn EPOCH_SP_Repair";
icon = "x\addons\a3_epoch_code\Data\UI\buttons\repair.paa";
tooltipcode = "Ignatz_Repair select 0";