Merge pull request #859 from Ignatz-HeMan/experimental

Fixes and Cleanups for VehRepair + ServicePoint
This commit is contained in:
vbawol 2017-09-08 11:43:30 -05:00 committed by GitHub
commit a3a2de0841
9 changed files with 54 additions and 18 deletions

View File

@ -116,7 +116,7 @@ if (_object isKindOf "Constructions_static_F") then {
_canUpgradePartCount = _canUpgradePartCount + _req;
} forEach _upgradeParts;
_doors = ["WoodLargeWallDoorL_EPOCH","WoodWall4_EPOCH"];
_doors = ["WoodLargeWallDoorL_EPOCH","WoodWall4_EPOCH","CinderWallDoorwHatch_EPOCH"];
_gates = ["CinderWallGarage_EPOCH"];
if (_canUpgrade) then {
_upgradeto = _upgrade select 0;

View File

@ -14,7 +14,7 @@
*/
//[[[cog import generate_private_arrays ]]]
private ["_allHitPointsDamage","_allRepaired","_line","_partName","_pos","_repaired","_vehName","_vehtype"];
private ["_PreventRepairs","_allHitPointsDamage","_allRepaired","_line","_partName","_pos","_repaired","_vehName","_vehtype"];
//[[[end]]]
params [['_vehicle',objnull],['_args',[]] ];
_args params [['_costs',0],['_updateInterval',1.2]];
@ -36,22 +36,31 @@ _vehicle engineOn false;
_repaired = [];
_allRepaired = true;
_allHitPointsDamage = getAllHitPointsDamage _vehicle;
_PreventRepairs = ["CfgServicePoint", "PreventRepairs", []] call EPOCH_fnc_returnConfigEntryV2;
{
if ((vehicle player != _vehicle) || (!local _vehicle) || speed _vehicle < -2 || speed _vehicle > 2) exitWith {
_allRepaired = false;
_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 {
_HitPointName = _x;
if (!(_HitPointName in _repaired) && !(_HitPointName isequalto "") && (_allHitPointsDamage select 2 select _foreachindex) > 0) then {
_partName = toarray _x;
_partName set [0,20];
_partName set [1,45];
_partName set [2,20];
_partName = toString _partName;
_vehicle setHitPointDamage [_x,0];
_line = format ['Repairing%1 ...', _partName];
[_line,5] call Epoch_message;
_repaired pushback _x;
if (({_HitPointName == (_x select 0) && (_vehicle getHitPointDamage _HitPointName) >= (_x select 1)} count _PreventRepairs) > 0) then {
_line = format ['Can not Repair full damaged %1', _partName];
[_line,5] call Epoch_message;
_allRepaired = false;
}
else {
_vehicle setHitPointDamage [_HitPointName,0];
_line = format ['Repairing%1 ...', _partName];
[_line,5] call Epoch_message;
};
_repaired pushback _HitPointName;
uisleep _updateInterval;
};
} foreach (_allHitPointsDamage select 0);
@ -64,4 +73,8 @@ if (_allRepaired) then {
_vehicle setposatl _pos;
_line = format ['%1 full Repaired', _vehName];
[_line,5] call Epoch_message;
}
else {
_line = format ['%1 not full Repaired', _vehName];
[_line,5] call Epoch_message;
};

View File

@ -12,10 +12,10 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/vehicles/EPOCH_client_VehicleMaintananceCheck.sqf
*/
private ["_veh","_config","_VehicleRepairs","_repairs","_removes","_replaces","_wheels","_wheelcounter","_torepair","_HitPointName","_Hit","_wheel","_repairarrays"];
private ["_veh","_VehicleRepairs","_EnableRemoveParts","_repairs","_removes","_replaces","_wheels","_wheelcounter","_torepair","_HitPointName","_Hit","_wheel","_repairarrays"];
_veh = _this;
_config = 'CfgEpochClient' call EPOCH_returnConfig;
_VehicleRepairs = getArray (_config >> "VehicleRepairs");
_VehicleRepairs = ["CfgEpochClient", "VehicleRepairs", []] call EPOCH_fnc_returnConfigEntryV2;
_EnableRemoveParts = ["CfgEpochClient", "EnableRemoveParts", true] call EPOCH_fnc_returnConfigEntryV2;
_repairs = [];
_removes = [];
_replaces = [];
@ -42,7 +42,7 @@ _torepair = (getAllHitPointsDamage _veh) select 0;
if (_Hit >= _limit1) exitwith {
_repairs pushback _searchedhit;
};
if !((_veh getvariable ["vehicle_slot","-1"]) isequalto "-1") then {
if (!((_veh getvariable ["vehicle_slot","-1"]) isequalto "-1") && _EnableRemoveParts) then {
if (_searchedhit in ["HitLFWheel","HitLF2Wheel","HitLMWheel","HitLBWheel","HitRFWheel","HitRF2Wheel","HitRMWheel","HitRBWheel","HitEngine"]) then {
_removes pushback _searchedhit;
};

View File

@ -19,13 +19,9 @@ params ["_vehicle","_value"];
if (local _vehicle) then {
{
if ((_x select 0) isequaltype 0) then {
// _currentDMG = _vehicle getHitIndex (_x select 0);
// _vehicle setHitIndex [_x select 0, (_currentDMG - 0.5) max 0];
_vehicle setHitIndex [_x select 0, _x select 1];
}
else {
// _currentDMG = _vehicle getHitPointDamage (_x select 0);
// _vehicle setHitPointDamage [_x select 0, (_currentDMG - 0.5) max 0];
_vehicle setHitPointDamage [_x select 0, _x select 1];
};
} foreach _value;

View File

@ -289,7 +289,7 @@ class CfgBaseBuilding
class CinderWallHalf_Ghost_EPOCH : CinderWallHalf_SIM_EPOCH {};
class CinderWall_EPOCH : Default
{
upgradeBuilding[] = {{"CinderWallGarage_EPOCH",{{"ItemCorrugatedLg",1},{"CircuitParts",1}}}};
upgradeBuilding[] = {{"CinderWallGarage_EPOCH",{{"ItemCorrugatedLg",1},{"CircuitParts",1}}},{"CinderWallDoorwHatch_EPOCH",{{"ItemCorrugatedLg",1},{"CircuitParts",1}}}};
removeParts[] = {{"CinderBlocks",4},{"ItemRock",2}};
simulClass = "CinderWall_SIM_EPOCH";
staticClass = "CinderWall_EPOCH";
@ -305,6 +305,14 @@ class CfgBaseBuilding
upgradeBuilding[] = {};
removeParts[] = {};
};
class CinderWallDoorwHatch_EPOCH : Default
{
removeParts[] = {{"CinderBlocks",4},{"ItemCorrugatedLg",1},{"CircuitParts",1}};
staticClass = "CinderWallDoorwHatch_EPOCH";
snapType = "snapPointsPara";
snapPointsPara[] = {"N","E","W"};
allowedSnapPoints[] = {"N","S","E","W"};
};
class WoodLargeWall_EPOCH : Default
{
upgradeBuilding[] = {{"WoodWall1_EPOCH",{{"ItemPlywoodPack",1}}},{"WoodLargeWallCor_EPOCH",{{"ItemCorrugated",1}}}};

View File

@ -160,6 +160,7 @@ class CfgEpochClient
// Advanced Vehicle Repair
UseAdvancedVehicleRepair = "true"; // Switch On / Off Advanced Vehicle Repair (Does not effect SuppressedCraftingItems !)
EnableRemoveParts = "true"; // Enable removing Tires / Engines from Vehicles
DisallowSellOnDamage = "false"; // Prevent from selling Vehicles with one or more fully damaged wheel or engine
SuppressedCraftingItems[] = {"VehicleRepairLg"}; // These Items can not be crafted (but can be used in recipe) - for usage of "Advanced Vehicle Repair"
VehicleRepairs[] = { // {Hitpoint, dmg to repair, dmg to replace, mat to repair, mat to replace}

View File

@ -58,6 +58,17 @@ class CfgServicePoint {
// "Land_fs_feed_F",
// "Land_fs_roof_F"
};
PreventRepairs[] = { // These Hitpints will not be repaired, if damage >= value (Prevent from Duping Tires / Engines)
{"HitLFWheel",1}, // {"HitPoint",value}
{"HitLF2Wheel",1},
{"HitLMWheel",1},
{"HitLBWheel",1},
{"HitRFWheel",1},
{"HitRF2Wheel",1},
{"HitRMWheel",1},
{"HitRBWheel",1},
{"HitEngine",1}
};
ServicePointDist = 40;
refuel_updateInterval = 1;
refuel_amount = 0.1;

View File

@ -367,14 +367,13 @@ class CfgCrafting
};
class VehicleRepair : Part
{
usedIn[] = {"VehicleRepairLg","EngineParts","SpareTire"};
usedIn[] = {"VehicleRepairLg","EngineParts","SpareTire","KitVehicleUpgradeI_200_EPOCH"};
previewPosition[] = {0.787659,1,0.30098};
previewScale = 0.45;
previewVector = 1.5;
};
class VehicleRepairLg : Item
{
usedIn[] = {"KitVehicleUpgradeI_200_EPOCH"};
recipe[] = {"VehicleRepair","ItemCorrugated"};
previewPosition[] = {0.798742,1,0.317871};
previewScale = 0.25;

View File

@ -12,6 +12,7 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_repairVehicle.sqf
*/
private ["_god"];
params ["_vehicle","_value","_player",["_token","",[""]]];
if (isNull _vehicle) exitWith{};
if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
@ -22,6 +23,10 @@ if ((_value select 0) isEqualTo "ALL") then {
}
else {
if (local _vehicle) then {
_god = !(isDamageAllowed _vehicle);
if (_god) then {
_vehicle allowdamage true;
};
{
if ((_x select 0) isequaltype 0) then {
_vehicle setHitIndex _x;
@ -30,6 +35,9 @@ else {
_vehicle setHitPointDamage _x;
};
} foreach _value;
if (_god) then {
_vehicle allowdamage false;
};
} else {
[_vehicle, _value] remoteExec ['EPOCH_client_repairVehicle',_vehicle];
};