mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Fix refuel trucks, add upgraded trucks to array
Issue was: A. with locality, we were checking the wrong vehicle in one instance and B. with variable names, since we called local_setFuel and _vehicle was private already from the calling script we ran into an issue with duplicate variables causing the command to fail. local_setFuel doesnt really need any local variable so I removed them and this fixed the issue (script filters may need to be adjusted accordingly)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
private ["_vehicle","_curFuel","_newFuel","_started","_finished","_animState","_isMedic","_abort","_canSize","_configVeh","_capacity","_nameText","_isOk","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_isVehicle","_configSrcVeh","_capacitySrc","_nameTextSrc","_isFillok","_curFuelSrc","_newFuelSrc","_vehicleSrc"];
|
||||
|
||||
private ["_isVehicle","_configSrcVeh","_capacitySrc","_nameTextSrc","_started","_finished","_animState","_isMedic","_newFuel","_abort","_newFuelSrc","_canSize","_vehicle","_configVeh","_capacity","_nameText","_isOk","_vehicleSrc","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle"];
|
||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_24" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
|
||||
@@ -23,7 +22,7 @@ _findNearestVehicles = nearestObjects [player, ["AllVehicles"], 30];
|
||||
_findNearestVehicle = [];
|
||||
{
|
||||
//diag_log ("FILL = " + str(_x) + " = " + str(_vehicleSrc));
|
||||
if (alive _x && !(_x == _vehicleSrc) && !(_x isKindOf "Man")) exitWith {
|
||||
if ((alive _x) && {_x != _vehicleSrc} && {!(_x isKindOf "Man")}) exitWith {
|
||||
_findNearestVehicle set [(count _findNearestVehicle),_x];
|
||||
};
|
||||
} count _findNearestVehicles;
|
||||
@@ -82,64 +81,36 @@ if(_IsNearVehicle >= 1) then {
|
||||
|
||||
if(!_finished) then {
|
||||
r_interrupt = false;
|
||||
|
||||
if (vehicle player == player) then {
|
||||
if ((vehicle player) == player) then {
|
||||
[objNull, player, rSwitchMove,""] call RE;
|
||||
player playActionNow "stop";
|
||||
};
|
||||
_abort = true;
|
||||
};
|
||||
|
||||
if (_finished) then {
|
||||
|
||||
_isFillok = true;
|
||||
|
||||
// add checks for fuel level
|
||||
} else {
|
||||
if(_isVehicle) then {
|
||||
_curFuelSrc = ((fuel _vehicleSrc) * _capacitySrc);
|
||||
_newFuelSrc = (_curFuelSrc - _canSize);
|
||||
|
||||
// calculate new fuel
|
||||
_newFuelSrc = (_newFuelSrc / _capacitySrc);
|
||||
_newFuelSrc = ((((fuel _vehicleSrc) * _capacitySrc) - _canSize) / _capacitySrc);
|
||||
_newFuel = (((fuel _vehicle) * _capacity) + _canSize);
|
||||
if (_newFuelSrc > 0) then {
|
||||
/* PVS/PVC - Skaronator */
|
||||
if (local _vehicle) then {
|
||||
if (local _vehicleSrc) then {
|
||||
[_vehicleSrc,_newFuelSrc] call local_setFuel;
|
||||
//_vehicleSrc setFuel _newFuelSrc;
|
||||
} else {
|
||||
/* PVS/PVC - Skaronator */
|
||||
PVDZ_send = [_vehicle,"SetFuel",[_vehicleSrc,_newFuelSrc]];
|
||||
PVDZ_send = [_vehicleSrc,"SetFuel",[_vehicleSrc,_newFuelSrc]];
|
||||
publicVariableServer "PVDZ_send";
|
||||
};
|
||||
if (_newFuel >= _capacity) then {_newFuel = 1; _abort = true;} else {_newFuel = (_newFuel / _capacity);};
|
||||
if (local _vehicle) then {
|
||||
[_vehicle,_newFuel] call local_setFuel;
|
||||
} else {
|
||||
PVDZ_send = [_vehicle,"SetFuel",[_vehicle,_newFuel]];
|
||||
publicVariableServer "PVDZ_send";
|
||||
};
|
||||
[player,"refuel",0,false] call dayz_zombieSpeak;
|
||||
format[localize "str_epoch_player_132",_nameText,round(_newFuel*100)] call dayz_rollingMessages;
|
||||
} else {
|
||||
_isFillok = false;
|
||||
_abort = true;
|
||||
};
|
||||
};
|
||||
|
||||
if (_isFillok) then {
|
||||
// Get vehicle fuel levels again
|
||||
_curFuel = ((fuel _vehicle) * _capacity);
|
||||
_newFuel = (_curFuel + _canSize);
|
||||
|
||||
if (_newFuel > _capacity) then {_newFuel = _capacity; _abort = true; };
|
||||
|
||||
// calculate minimum needed fuel
|
||||
_newFuel = (_newFuel / _capacity);
|
||||
|
||||
/* PVS/PVC - Skaronator */
|
||||
if (local _vehicle) then {
|
||||
[_vehicle,_newFuel] call local_setFuel;
|
||||
} else {
|
||||
/* PVS/PVC - Skaronator */
|
||||
PVDZ_send = [_vehicle,"SetFuel",[_vehicle,_newFuel]];
|
||||
publicVariableServer "PVDZ_send";
|
||||
};
|
||||
|
||||
// Play sound
|
||||
[player,"refuel",0,false] call dayz_zombieSpeak;
|
||||
|
||||
format[localize "str_epoch_player_132",_nameText,round(_newFuel*100)] call dayz_rollingMessages;
|
||||
};
|
||||
};
|
||||
|
||||
if(_abort) exitWith {};
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
_vehicle = _this select 0;
|
||||
_qty = _this select 1;
|
||||
_vehicle setFuel _qty;
|
||||
(_this select 0) setFuel (_this select 1);
|
||||
@@ -521,7 +521,7 @@ dayz_humanitytarget = "";
|
||||
dayz_selectedVault = objNull;
|
||||
dayz_selectedDoor = objNull;
|
||||
DAYZ_woundHit_dog = [["body","hands","legs"],[0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2]];
|
||||
DZE_fueltruckarray = ["KamazRefuel_DZ","UralRefuel_TK_EP1_DZ","MtvrRefuel_DES_EP1_DZ","V3S_Refuel_TK_GUE_EP1_DZ","MtvrRefuel_DZ","KamazRefuel_DZE","UralRefuel_TK_EP1_DZE","MtvrRefuel_DES_EP1_DZE","V3S_Refuel_TK_GUE_EP1_DZE","MtvrRefuel_DZE"];
|
||||
DZE_fueltruckarray = ["KamazRefuel_DZ","UralRefuel_TK_EP1_DZ","MtvrRefuel_DES_EP1_DZ","V3S_Refuel_TK_GUE_EP1_DZ","MtvrRefuel_DZ","KamazRefuel_DZE","KamazRefuel_DZE1","KamazRefuel_DZE2","KamazRefuel_DZE3","KamazRefuel_DZE4","UralRefuel_TK_EP1_DZE","MtvrRefuel_DES_EP1_DZE","V3S_Refuel_TK_GUE_EP1_DZE","MtvrRefuel_DZE"];
|
||||
DZE_Lock_Door = "";
|
||||
DZE_HeliAllowTowFrom = ["CH_47F_EP1_DZE","CH_47F_EP1_DZ","CH_47F_BAF","CH_47F_EP1","BAF_Merlin_DZE","CH53_DZE"];
|
||||
DZE_HeliAllowToTow = ["hilux1_civil_1_open","HMMWV_Base","Lada_base","Offroad_DSHKM_base","Pickup_PK_base","SkodaBase","tractor","VWGolf","Volha_TK_CIV_Base_EP1","S1203_TK_CIV_EP1","SUV_Base_EP1","ArmoredSUV_Base_PMC","UAZ_Base","LandRover_Base","Ship"];
|
||||
|
||||
Reference in New Issue
Block a user