mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-04-04 19:52:49 +03:00
switchModel, jerry_fill, packTent changes/fixes (#1836)
* switchModel, jerry_fill, water_fill, drinkWater, packTent changes/fixes player_packTent: Add private array since there was none. Make it match player_packVault so a player can't pack the tent with others near (to stop duping) water_fill: Fixed the massive lag issue with the check for ponds etc, Originally was being done searching for all which is quite intensive, now only searching for waterholeproxy which matches all the water holes on chernarus I could try. Fixed a few localizations. Thanks @schwanzkopfhegel player_drinkWater: Same as above. Also removed a lot of unused private variables. jerry_fill: Made the minimum fill level of fuel tanks 10% of dayz_randomMaxFuelAmount so the tank will always have fuel Fixed issue with ItemFuelBarrel only using 40 litres from a tank. Thanks @schwanzkopfhegel Display how much fuel was needed if the tank is empty Fix issue if the tank was empty that dayz_actionInProgress was not reset player_switchModel: Fixed issue of coins dissapearing on gear change Fixed old commented out code that was broken so now you will go back into the camera view you were in before you changed clothes * Revert drinkWater/water_fill changes My previous commit can only be used on chernarus since it's the only map that has the waterholeproxy we rely on. * crafting localization fix * Update german translations * Rework * Missed private variable * Rework again * Update german string
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_34" call dayz_rollingMessages;};
|
||||
dayz_actionInProgress = true;
|
||||
private ["_qty","_dis","_sfx","_started","_finished","_animState","_isRefuel","_fuelcans","_qty20","_qty5","_qty40","_magazines","_cursorTarget","_fuelAmount"];
|
||||
private ["_qty","_dis","_sfx","_started","_finished","_animState","_isRefuel","_fuelCans","_qty20","_qty5","_qty210","_magazines","_cursorTarget","_fuelAmount","_fuelNeeded"];
|
||||
|
||||
player removeAction s_player_fillfuel;
|
||||
//s_player_fillfuel = -1;
|
||||
@@ -11,22 +11,22 @@ _magazines = magazines player;
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (isNil "_fuelAmount") then {
|
||||
_fuelAmount = floor(Random dayz_randomMaxFuelAmount);
|
||||
_fuelAmount = floor(Random dayz_randomMaxFuelAmount) max (dayz_randomMaxFuelAmount * 0.10);
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
};
|
||||
|
||||
if (_fuelAmount < 5) exitWith { format[localize "str_fill_notenough",typeOf _cursorTarget,_fuelAmount] call dayz_rollingMessages; };
|
||||
_qty5 = {_x == "ItemFuelcanEmpty"} count _magazines;
|
||||
_qty20 = {_x == "ItemJerrycanEmpty"} count _magazines;
|
||||
_qty210 = {_x == "ItemFuelBarrelEmpty"} count _magazines;
|
||||
|
||||
diag_log format["Fill Jerry, %1 - %2",_cursorTarget,_fuelAmount];
|
||||
_fuelNeeded = (_qty5 * 5) + (_qty20 * 20) + (_qty210 * 210);
|
||||
|
||||
_fuelcans = ["ItemFuelcanEmpty","ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
|
||||
if (_fuelAmount < _fuelNeeded) then {format[localize "str_fill_notenough",typeOf _cursorTarget,_fuelAmount,_fuelNeeded] call dayz_rollingMessages;};
|
||||
|
||||
_fuelCans = ["ItemFuelcanEmpty","ItemJerrycanEmpty","ItemFuelBarrelEmpty"];
|
||||
|
||||
_qty = 0;
|
||||
_qty = {_x in _fuelcans} count _magazines;
|
||||
|
||||
_qty20 = {_x == "ItemJerrycanEmpty"} count _magazines;
|
||||
_qty5 = {_x == "ItemFuelcanEmpty"} count _magazines;
|
||||
_qty40 = {_x == "ItemFuelBarrelEmpty"} count _magazines;
|
||||
_qty = {_x in _fuelCans} count _magazines;
|
||||
|
||||
if (("ItemJerrycanEmpty" in _magazines) or ("ItemFuelcanEmpty" in _magazines) or ("ItemFuelBarrelEmpty" in _magazines)) then {
|
||||
player playActionNow "Medic";
|
||||
@@ -58,18 +58,6 @@ if (("ItemJerrycanEmpty" in _magazines) or ("ItemFuelcanEmpty" in _magazines) or
|
||||
r_doLoop = false;
|
||||
|
||||
if (_finished) then {
|
||||
for "_x" from 1 to _qty20 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 20) then {
|
||||
_fuelAmount = _fuelAmount - 20;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemJerrycanEmpty";
|
||||
player addMagazine "ItemJerrycan";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
};
|
||||
for "_x" from 1 to _qty5 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
@@ -82,11 +70,23 @@ if (("ItemJerrycanEmpty" in _magazines) or ("ItemFuelcanEmpty" in _magazines) or
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
};
|
||||
for "_x" from 1 to _qty40 do {
|
||||
for "_x" from 1 to _qty20 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 40) then {
|
||||
_fuelAmount = _fuelAmount - 40;
|
||||
if (_fuelAmount >= 20) then {
|
||||
_fuelAmount = _fuelAmount - 20;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemJerrycanEmpty";
|
||||
player addMagazine "ItemJerrycan";
|
||||
} else {
|
||||
_qty = _qty - 1;
|
||||
};
|
||||
};
|
||||
for "_x" from 1 to _qty210 do {
|
||||
_fuelAmount = _cursorTarget getVariable "FuelAmount";
|
||||
|
||||
if (_fuelAmount >= 210) then {
|
||||
_fuelAmount = _fuelAmount - 210;
|
||||
_cursorTarget setVariable ["FuelAmount",_fuelAmount,true];
|
||||
player removeMagazine "ItemFuelBarrelEmpty";
|
||||
player addMagazine "ItemFuelBarrel";
|
||||
@@ -102,4 +102,4 @@ if (("ItemJerrycanEmpty" in _magazines) or ("ItemFuelcanEmpty" in _magazines) or
|
||||
} else {
|
||||
localize "str_player_10" call dayz_rollingMessages;
|
||||
};
|
||||
dayz_actionInProgress = false;
|
||||
dayz_actionInProgress = false;
|
||||
|
||||
Reference in New Issue
Block a user