mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
Added optional Classnames for Service Point Pos.
- Added optional Classnames for Service Point Pos - Some Cleanups and Script optimization
This commit is contained in:
parent
a5a51a9ac6
commit
b90fbafb05
@ -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;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user