mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
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:
parent
9aeb1024c7
commit
49442da4d4
@ -19,7 +19,7 @@ private ["_ServicePointClasses","_config","_inSP","_nearClasses","_servicepointD
|
|||||||
|
|
||||||
_vehicle = vehicle player;
|
_vehicle = vehicle player;
|
||||||
if (_vehicle == player) exitwith {false};
|
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 (speed _vehicle > 2 || speed _vehicle < -2) exitwith {false};
|
||||||
if (((getpos _vehicle) select 2) > 1) exitwith {false};
|
if (((getpos _vehicle) select 2) > 1) exitwith {false};
|
||||||
if (!(_vehicle iskindof 'ship') && (((getposasl _vehicle) select 2) < 1)) exitwith {false};
|
if (!(_vehicle iskindof 'ship') && (((getposasl _vehicle) select 2) < 1)) exitwith {false};
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
//[[[cog import generate_private_arrays ]]]
|
//[[[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"];
|
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]]]
|
//[[[end]]]
|
||||||
|
|
||||||
Ignatz_Refuel = nil;
|
Ignatz_Refuel = nil;
|
||||||
Ignatz_Repair = nil;
|
Ignatz_Repair = nil;
|
||||||
Ignatz_Rearm0 = nil;
|
Ignatz_Rearm0 = nil;
|
||||||
@ -24,6 +23,8 @@ Ignatz_Rearm1 = nil;
|
|||||||
Ignatz_Rearm2 = nil;
|
Ignatz_Rearm2 = nil;
|
||||||
Ignatz_Rearm3 = nil;
|
Ignatz_Rearm3 = nil;
|
||||||
|
|
||||||
|
params ["_myturret"];
|
||||||
|
|
||||||
_vehicle = vehicle player;
|
_vehicle = vehicle player;
|
||||||
_repair_costs = ["CfgServicePoint", "repair_costs", []] call EPOCH_fnc_returnConfigEntryV2;
|
_repair_costs = ["CfgServicePoint", "repair_costs", []] call EPOCH_fnc_returnConfigEntryV2;
|
||||||
_refuel_costs = ["CfgServicePoint", "refuel_costs", []] call EPOCH_fnc_returnConfigEntryV2;
|
_refuel_costs = ["CfgServicePoint", "refuel_costs", []] call EPOCH_fnc_returnConfigEntryV2;
|
||||||
@ -65,40 +66,44 @@ _fnc_actionTitle = {
|
|||||||
if ((typeof _vehicle) == _x select 0) exitwith {
|
if ((typeof _vehicle) == _x select 0) exitwith {
|
||||||
{
|
{
|
||||||
_x params ["_ammotype","_turret","_maxmags","_costs",["_ammocount",getNumber (configfile >> "CfgMagazines" >> (_x select 0) >> "count")]];
|
_x params ["_ammotype","_turret","_maxmags","_costs",["_ammocount",getNumber (configfile >> "CfgMagazines" >> (_x select 0) >> "count")]];
|
||||||
_maxammototal = _maxmags*_ammocount;
|
if (_myturret isequalto _turret) then {
|
||||||
_totalammocount = 0;
|
_maxammototal = _maxmags*_ammocount;
|
||||||
{
|
_totalammocount = 0;
|
||||||
if (_ammotype isequalto (_x select 0) && _turret isequalto (_x select 1)) then {
|
{
|
||||||
_totalammocount = _totalammocount + (_x select 2);
|
if (_ammotype isequalto (_x select 0) && _turret isequalto (_x select 1)) then {
|
||||||
};
|
_totalammocount = _totalammocount + (_x select 2);
|
||||||
} foreach (magazinesAllTurrets _vehicle);
|
|
||||||
if (_totalammocount < _maxammototal) then {
|
|
||||||
for '_i' from 1 to 10 do {
|
|
||||||
if (_totalammocount < _i*_ammocount) exitwith {
|
|
||||||
_ownedcompletemags = _i-1;
|
|
||||||
_missingammo = _ammocount*_i - _totalammocount;
|
|
||||||
_costs = round (_costs/_ammocount*_missingammo);
|
|
||||||
};
|
};
|
||||||
|
} foreach (magazinesAllTurrets _vehicle);
|
||||||
|
if (_totalammocount < _maxammototal) then {
|
||||||
|
for '_i' from 1 to 10 do {
|
||||||
|
if (_totalammocount < _i*_ammocount) exitwith {
|
||||||
|
_ownedcompletemags = _i-1;
|
||||||
|
_missingammo = _ammocount*_i - _totalammocount;
|
||||||
|
_costs = round (_costs/_ammocount*_missingammo);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
_magname = getText (configFile >> 'CfgMagazines' >> _ammotype >> 'displayName');
|
||||||
|
if (_magname isequalto '') then {
|
||||||
|
_magname = _ammotype;
|
||||||
|
};
|
||||||
|
_reloagmags = _ownedcompletemags+1;
|
||||||
|
_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]];
|
||||||
};
|
};
|
||||||
_magname = getText (configFile >> 'CfgMagazines' >> _ammotype >> 'displayName');
|
|
||||||
if (_magname isequalto '') then {
|
|
||||||
_magname = _ammotype;
|
|
||||||
};
|
|
||||||
_reloagmags = _ownedcompletemags+1;
|
|
||||||
_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 (_x select 1);
|
||||||
};
|
};
|
||||||
} foreach _VehiclesAndAmmo;
|
} foreach _VehiclesAndAmmo;
|
||||||
|
|
||||||
_costs = [_vehicle, _refuel_costs] call _fnc_getCosts;
|
if (player == driver _vehicle) then {
|
||||||
_actionTitle = [format['Refuel %1',getText (configFile >> 'Cfgvehicles' >> typeOf _vehicle >> 'displayName')], _costs] call _fnc_actionTitle;
|
_costs = [_vehicle, _refuel_costs] call _fnc_getCosts;
|
||||||
Ignatz_Refuel = [_actionTitle,[_vehicle,[_costs, _refuel_updateInterval,_refuel_amount]]];
|
_actionTitle = [format['Refuel %1',getText (configFile >> 'Cfgvehicles' >> typeOf _vehicle >> 'displayName')], _costs] call _fnc_actionTitle;
|
||||||
|
Ignatz_Refuel = [_actionTitle,[_vehicle,[_costs, _refuel_updateInterval,_refuel_amount]]];
|
||||||
|
|
||||||
_costs = [_vehicle, _repair_costs] call _fnc_getCosts;
|
_costs = [_vehicle, _repair_costs] call _fnc_getCosts;
|
||||||
_actionTitle = [format['Repair %1',getText (configFile >> 'Cfgvehicles' >> typeOf _vehicle >> 'displayName')], _costs] call _fnc_actionTitle;
|
_actionTitle = [format['Repair %1',getText (configFile >> 'Cfgvehicles' >> typeOf _vehicle >> 'displayName')], _costs] call _fnc_actionTitle;
|
||||||
Ignatz_Repair = [_actionTitle,[_vehicle,[_costs, _repairTime]]];
|
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 > 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 > 1) then {Ignatz_Rearm1 = _Ignatz_SP_Array select 1;};
|
||||||
if (count _Ignatz_SP_Array > 2) then {Ignatz_Rearm2 = _Ignatz_SP_Array select 2;};
|
if (count _Ignatz_SP_Array > 2) then {Ignatz_Rearm2 = _Ignatz_SP_Array select 2;};
|
||||||
|
@ -123,20 +123,20 @@ class Drink
|
|||||||
class ServicePoint
|
class ServicePoint
|
||||||
{
|
{
|
||||||
condition = "call EPOCH_SP_Check";
|
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";
|
icon = "x\addons\a3_epoch_code\Data\UI\buttons\Repair_man.paa";
|
||||||
tooltip = "Service Point";
|
tooltip = "Service Point";
|
||||||
|
|
||||||
class Refuel
|
class Refuel
|
||||||
{
|
{
|
||||||
condition = "true";
|
condition = "!isnil 'Ignatz_Refuel'";
|
||||||
action = "(Ignatz_Refuel select 1) spawn EPOCH_SP_Refuel";
|
action = "(Ignatz_Refuel select 1) spawn EPOCH_SP_Refuel";
|
||||||
icon = "x\addons\a3_epoch_code\Data\UI\buttons\vehicle_refuel.paa";
|
icon = "x\addons\a3_epoch_code\Data\UI\buttons\vehicle_refuel.paa";
|
||||||
tooltipcode = "Ignatz_Refuel select 0";
|
tooltipcode = "Ignatz_Refuel select 0";
|
||||||
};
|
};
|
||||||
class Repair
|
class Repair
|
||||||
{
|
{
|
||||||
condition = "true";
|
condition = "!isnil 'Ignatz_Repair'";
|
||||||
action = "(Ignatz_Repair select 1) spawn EPOCH_SP_Repair";
|
action = "(Ignatz_Repair select 1) spawn EPOCH_SP_Repair";
|
||||||
icon = "x\addons\a3_epoch_code\Data\UI\buttons\repair.paa";
|
icon = "x\addons\a3_epoch_code\Data\UI\buttons\repair.paa";
|
||||||
tooltipcode = "Ignatz_Repair select 0";
|
tooltipcode = "Ignatz_Repair select 0";
|
||||||
|
Loading…
Reference in New Issue
Block a user