From ac86ccf254477b216439cc81597480d41d3b72ce Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 1 Apr 2017 16:01:09 +0200 Subject: [PATCH 1/6] Added optional Classnames for Service Point Pos. - Added optional Classnames for Service Point Pos - Some Cleanups and Script optimization --- .../compile/servicepoint/EPOCH_SP_Check.sqf | 52 +++++++++++++++---- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Check.sqf b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Check.sqf index 8f010c6f..982a4982 100644 --- a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Check.sqf +++ b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Check.sqf @@ -1,14 +1,48 @@ -if (vehicle player == player) exitwith {false}; -if !(local vehicle player) exitwith {false}; -if (speed vehicle player > 2 || speed vehicle player < -2) exitwith {false}; -if (((getpos vehicle player) select 2) > 1) exitwith {false}; +/* + Author: [Ignatz] He-Man + + Contributors: Aaron Clark - EpochMod.com + + Description: + Check if in Service Point for A3 Epoch + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/servicepoint/EPOCH_SP_Check.sqf +*/ + +private ['_inSP','_vehicle','_vehName','_allRepaired']; + +_vehicle = vehicle player; +if (_vehicle == player) 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}; _config = 'CfgServicePoint' call EPOCH_returnConfig; _servicepoints = getArray (_config >> worldname >> 'ServicePoints'); _servicepointDist = ["CfgServicePoint", "ServicePointDist", 40] call EPOCH_fnc_returnConfigEntryV2; +_ServicePointClasses = ["CfgServicePoint", "ServicePointClasses", []] call EPOCH_fnc_returnConfigEntryV2; -if (_servicepoints isequalto []) exitwith {false}; -if !(({player distance _x < _servicepointDist} count _servicepoints > 0)) exitwith {false}; -_Vehicle = vehicle player; -if (!(_Vehicle iskindof 'ship') && (((getposasl _Vehicle) select 2) < 1)) exitwith {false}; -true +if (_servicepoints isequalto [] && _ServicePointClasses isequalto []) exitwith {false}; +if (_vehicle == player) 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}; +_inSP = false; +if (({player distance _x < _servicepointDist} count _servicepoints > 0)) then { + _inSP = true; +}; +if (!_inSP) then { + if !(_ServicePointClasses isequalto []) then { + _nearClasses = nearestobjects [_vehicle,_ServicePointClasses,_servicepointDist]; + if !(_nearClasses isequalto []) then { + _inSP = true; + }; + }; +}; +_inSP From cf270019669384a475e68f9a476ddbd33f9dba9b Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 1 Apr 2017 16:02:25 +0200 Subject: [PATCH 2/6] Added optional Classnames for Service Point Pos. - Added optional Classnames for Service Point Pos - Some Cleanups and Script optimization --- .../compile/servicepoint/EPOCH_SP_Rearm.sqf | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Rearm.sqf b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Rearm.sqf index e3bd5e2c..91ccff47 100644 --- a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Rearm.sqf +++ b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Rearm.sqf @@ -1,20 +1,31 @@ -params ['_vehicle','_ammotype','_turret','_reloagmags','_ammocount','_costs']; -private ['_magname']; -_vehtype = typeof _vehicle; -_VehName = getText(configFile >> 'cfgVehicles' >> _vehtype >> 'displayName'); -if (!local _vehicle) exitWith { - _line = 'Rearm denied - Vehicle is not local to you!'; - [_line,5] call Epoch_message; -}; -if(count (crew _vehicle) > 1) exitWith { - _line = 'Rearm denied - All Passengers must exit the Vehicle!'; - [_line,5] call Epoch_message; -}; -if (EPOCH_playerCrypto < _costs) exitWith { - _line = format ['You need %1 Crypto to re-arm %2', _costs,_VehName]; - [_line,5] call Epoch_message; -}; +/* + Author: [Ignatz] He-Man + Contributors: Aaron Clark - EpochMod.com + + Description: + Rearm Vehicles for A3 Epoch + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/servicepoint/EPOCH_SP_Rearm.sqf +*/ + +private ['_magname','_vehtype','_vehName']; +params ['_vehicle','_ammotype','_turret','_reloagmags','_ammocount','_costs']; + +if (!local _vehicle) exitWith { + _line = 'Rearm denied - Go in as driver first!'; + [_line,5] call Epoch_message; +}; +_vehtype = typeof _vehicle; +_vehName = getText(configFile >> 'cfgVehicles' >> _vehtype >> 'displayName'); +if (EPOCH_playerCrypto < _costs) exitWith { + _line = format ['You need %1 Crypto to Rearm %2', _costs,_vehName]; + [_line,5] call Epoch_message; +}; if(_costs > 0)then{ [player,(_costs*-1),Epoch_personalToken] remoteexec ['epoch_server_paycrypto',2]; }; @@ -26,5 +37,5 @@ _magname = getText (configFile >> 'CfgMagazines' >> _ammotype >> 'displayName'); if (_magname isequalto '') then { _magname = _ammotype; }; -_line = format ['%1 rearmed with %2', _VehName, _magname]; +_line = format ['%1 rearmed with %2', _vehName, _magname]; [_line,5] call Epoch_message; From a5a51a9ac652552f61fd2795eba4acb586ef8d1d Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 1 Apr 2017 16:02:48 +0200 Subject: [PATCH 3/6] Added optional Classnames for Service Point Pos. - Added optional Classnames for Service Point Pos - Some Cleanups and Script optimization --- .../compile/servicepoint/EPOCH_SP_Refuel.sqf | 46 ++++++++++++------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Refuel.sqf b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Refuel.sqf index 1b620577..5c0a1e54 100644 --- a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Refuel.sqf +++ b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Refuel.sqf @@ -1,32 +1,44 @@ -private ['_vehicle','_args','_servicePoint','_costs','_updateInterval','_amount','_type','_name','_textMissing']; -_vehicle = _this select 0; -if (!local _vehicle) exitWith {}; -_args = _this select 1; -_costs = _args select 0; -_updateInterval = _args select 1; -_amount = _args select 2; -_type = typeOf _vehicle; -_name = getText(configFile >> 'cfgVehicles' >> _type >> 'displayName'); +/* + Author: [Ignatz] He-Man + + Contributors: Aaron Clark - EpochMod.com + + Description: + Refuel Vehicles for A3 Epoch + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/servicepoint/EPOCH_SP_Refuel.sqf +*/ + +private ['_vehtype','_vehName']; +params [['_vehicle',objnull],['_args',[]]]; +_args params [['_costs',0],['_updateInterval',1],['_amount',0.1]]; + +if (!local _vehicle) exitWith { + _line = 'Refuel denied - Go in as driver first!'; + [_line,5] call Epoch_message; +}; +_vehtype = typeof _vehicle; +_vehName = getText(configFile >> 'cfgVehicles' >> _vehtype >> 'displayName'); if (EPOCH_playerCrypto < _costs) exitWith { - _line = format ['You need %1 Crypto to refuel %2', _costs,_name]; + _line = format ['You need %1 Crypto to Refuel %2', _costs,_vehName]; [_line,5] call Epoch_message; }; if(_costs > 0)then{ [player,(_costs*-1),Epoch_personalToken] remoteexec ['epoch_server_paycrypto',2]; }; _vehicle engineOn false; -if ((vehicle player != _vehicle) || (!local _vehicle) || speed _vehicle < -2 || speed _vehicle > 2) exitWith { - _line = format ['Fueling of %1 stopped', _name]; - [_line,5] call Epoch_message; -}; -while {(vehicle player == _vehicle) && (local _vehicle)} do { +while {(vehicle player == _vehicle) && (local _vehicle) && (alive player)} do { if (speed _vehicle > 2 || speed _vehicle < -2 ) exitWith { - _line = format ['Refueling of %1 stopped', _name]; + _line = format ['Refueling of %1 stopped', _vehName]; [_line,5] call Epoch_message; }; _vehicle setFuel ((Fuel _vehicle)+_amount); if (Fuel _vehicle > 0.99) exitWith { - _line = format ['%1 Refueled', _name]; + _line = format ['%1 Refueled', _vehName]; [_line,5] call Epoch_message; }; uisleep _updateInterval; From b90fbafb051299f4de03b830ae8de2a8521ef217 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 1 Apr 2017 16:03:12 +0200 Subject: [PATCH 4/6] Added optional Classnames for Service Point Pos. - Added optional Classnames for Service Point Pos - Some Cleanups and Script optimization --- .../compile/servicepoint/EPOCH_SP_Repair.sqf | 57 ++++++++++++------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Repair.sqf b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Repair.sqf index eabaed79..eac299d0 100644 --- a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Repair.sqf +++ b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Repair.sqf @@ -1,28 +1,43 @@ -private ['_Ignatz_vehicle','_args','_servicePoint','_costs','_repairTime','_type','_name','_hitpoints','_allRepaired']; -_Ignatz_vehicle = _this select 0; -if (!local _Ignatz_vehicle) exitWith { - diag_log format['Error: called service_point_repair.sqf with non-local vehicle: %1', _Ignatz_vehicle] +/* + Author: [Ignatz] He-Man + + Contributors: Aaron Clark - EpochMod.com + + Description: + Repair Vehicles for A3 Epoch + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/servicepoint/EPOCH_SP_Repair.sqf +*/ + +private ['_vehtype','_vehName','_allRepaired']; +params [['_vehicle',objnull],['_args',[]]]; +_args params [['_costs',0],['_updateInterval',1.2]]; + +if (!local _vehicle) exitWith { + _line = 'Repair denied - Go in as driver first!'; + [_line,5] call Epoch_message; }; -_args = _this select 1; -_costs = _args select 0; -_repairTime = _args select 1; -_type = typeOf _Ignatz_vehicle; -_name = getText(configFile >> 'cfgVehicles' >> _type >> 'displayName'); +_vehtype = typeOf _vehicle; +_vehName = getText(configFile >> 'cfgVehicles' >> _vehtype >> 'displayName'); if (EPOCH_playerCrypto < _costs) exitWith { - _line = format ['You need %1 Crypto to Repair %2', _costs,_name]; + _line = format ['You need %1 Crypto to Repair %2', _costs,_vehName]; [_line,5] call Epoch_message; }; if(_costs > 0)then{ [player,(_costs*-1),Epoch_personalToken] remoteexec ['epoch_server_paycrypto',2]; }; -_Ignatz_vehicle engineOn false; +_vehicle engineOn false; _repaired = []; _allRepaired = true; -_allHitPointsDamage = getAllHitPointsDamage _Ignatz_vehicle; +_allHitPointsDamage = getAllHitPointsDamage _vehicle; { - if ((vehicle player != _Ignatz_vehicle) || (!local _Ignatz_vehicle) || speed _Ignatz_vehicle < -2 || speed _Ignatz_vehicle > 2) exitWith { + if ((vehicle player != _vehicle) || (!local _vehicle) || speed _vehicle < -2 || speed _vehicle > 2) exitWith { _allRepaired = false; - _line = format ['Repairing of %1 stopped', _name]; + _line = format ['Repairing of %1 stopped', _vehName]; [_line,5] call Epoch_message; }; if (!(_x in _repaired) && !(_x isequalto "") && (_allHitPointsDamage select 2 select _foreachindex) > 0) then { @@ -31,20 +46,20 @@ _allHitPointsDamage = getAllHitPointsDamage _Ignatz_vehicle; _partName set [1,45]; _partName set [2,20]; _partName = toString _partName; - _Ignatz_vehicle setHitPointDamage [_x,0]; + _vehicle setHitPointDamage [_x,0]; _line = format ['Repairing%1 ...', _partName]; [_line,5] call Epoch_message; _repaired pushback _x; - uisleep _repairTime; + uisleep _updateInterval; }; } foreach (_allHitPointsDamage select 0); if (_allRepaired) then { - if ((damage _Ignatz_vehicle) > 0) then { - [_Ignatz_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; + if ((damage _vehicle) > 0) then { + [_vehicle,["ALL",0],player,Epoch_personalToken] remoteExec ["EPOCH_server_repairVehicle",2]; }; - _pos = getposatl _Ignatz_vehicle; + _pos = getposatl _vehicle; _pos set [2,(_pos select 2)+0.25]; - _Ignatz_vehicle setposatl _pos; - _line = format ['%1 full Repaired', _name]; + _vehicle setposatl _pos; + _line = format ['%1 full Repaired', _vehName]; [_line,5] call Epoch_message; }; From a84326d446c0ffd89d20b91f2969d194b6d2a7c0 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 1 Apr 2017 16:03:32 +0200 Subject: [PATCH 5/6] Added optional Classnames for Service Point Pos. - Added optional Classnames for Service Point Pos - Some Cleanups and Script optimization --- .../compile/servicepoint/EPOCH_SP_Start.sqf | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Start.sqf b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Start.sqf index d16359e8..c4f26728 100644 --- a/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Start.sqf +++ b/Sources/epoch_code/compile/servicepoint/EPOCH_SP_Start.sqf @@ -1,3 +1,20 @@ +/* + Author: [Ignatz] He-Man + + Contributors: Aaron Clark - EpochMod.com + + Description: + Service Point StartScript for A3 Epoch + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/servicepoint/EPOCH_SP_Start.sqf +*/ + +private ['_missingammo','_ownedcompletemags','_magname','_actionTitle','_costs','_vehicle','_refuel_costs','_refuel_updateInterval','_refuel_amount','_costsFree','_repair_costs','_fnc_getCosts','_fnc_actionTitle']; + Ignatz_Refuel = nil; Ignatz_Repair = nil; Ignatz_Rearm0 = nil; @@ -5,21 +22,7 @@ Ignatz_Rearm1 = nil; Ignatz_Rearm2 = nil; Ignatz_Rearm3 = nil; -if (vehicle player == player) exitwith {false}; -if !(local vehicle player) exitwith {false}; -if (speed vehicle player > 2 || speed vehicle player < -2) exitwith {false}; -if (((getpos vehicle player) select 2) > 1) exitwith {false}; - -private ['_missingammo','_ownedcompletemags','_magname','_actionTitle','_costs','_vehicle','_refuel_costs','_refuel_updateInterval','_refuel_amount','_costsFree','_repair_costs','_repair_repairTime','_fnc_getCosts','_fnc_actionTitle']; - -_config = 'CfgServicePoint' call EPOCH_returnConfig; -_servicepoints = getArray (_config >> worldname >> 'ServicePoints'); -_servicepointDist = ["CfgServicePoint", "ServicePointDist", 40] call EPOCH_fnc_returnConfigEntryV2; - -if !(({player distance _x < _servicepointDist} count _servicepoints > 0)) exitwith {false}; -_Vehicle = vehicle player; -if (!(_Vehicle iskindof 'ship') && (((getposasl _Vehicle) select 2) < 1)) exitwith {false}; - +_vehicle = vehicle player; _repair_costs = ["CfgServicePoint", "repair_costs", []] call EPOCH_fnc_returnConfigEntryV2; _refuel_costs = ["CfgServicePoint", "refuel_costs", []] call EPOCH_fnc_returnConfigEntryV2; _refuel_updateInterval = ["CfgServicePoint", "refuel_updateInterval", 1] call EPOCH_fnc_returnConfigEntryV2; @@ -43,6 +46,7 @@ _fnc_getCosts = { } forEach _costs; _cost }; + _fnc_actionTitle = { private ['_itemName','_displayName','_actionName','_costs','_costsText','_actionTitle']; _actionName = _this select 0; From 9d558083c2d5b2d760acaa1f6d08168174800bfd Mon Sep 17 00:00:00 2001 From: He-Man Date: Sat, 1 Apr 2017 16:06:03 +0200 Subject: [PATCH 6/6] Added optional Classnames for Service Point Pos. - Added optional Classnames for Service Point Pos - Some Cleanups and Script optimization --- Sources/epoch_config/Configs/CfgServicePoint.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Sources/epoch_config/Configs/CfgServicePoint.hpp b/Sources/epoch_config/Configs/CfgServicePoint.hpp index 304ccb71..9c1af975 100644 --- a/Sources/epoch_config/Configs/CfgServicePoint.hpp +++ b/Sources/epoch_config/Configs/CfgServicePoint.hpp @@ -1,11 +1,11 @@ class CfgServicePoint { class Altis { - ServicePoints[] = { + ServicePoints[] = { // Array of coords for ServicePoints {13325,14477,0} }; }; class Tanoa { - ServicePoints[] = { + ServicePoints[] = { // Array of coords for ServicePoints /* {2157.79,3477.65,0}, {11731.5,3125.95,0}, @@ -19,11 +19,17 @@ class CfgServicePoint { */ }; }; - class Chernarus { + class Chernarus { // Array of coords for ServicePoints ServicePoints[] = { }; }; + ServicePointClasses[] = { // Array of Classnames, where also are ServicePoints +// "Land_Pillar_Pier_F", +// "Land_CarService_F", +// "Land_fs_feed_F", +// "Land_fs_roof_F" + }; ServicePointDist = 40; refuel_updateInterval = 1; refuel_amount = 0.1; @@ -245,4 +251,4 @@ class CfgServicePoint { } } }; -}; \ No newline at end of file +};