Skip to content

Commit

Permalink
updated for Epoch 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Vos committed Jan 30, 2014
1 parent c363bc4 commit 40c0e4e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 198 deletions.
38 changes: 20 additions & 18 deletions elevator/ac_functions.sqf
@@ -1,7 +1,7 @@
// DayZ Epoch Helper Functions by Axe Cop

private ["_version","_skip"];
_version = 1.02;
_version = 1.03;

// redefine functions only if this file is a newer version
_skip = false;
Expand Down Expand Up @@ -77,21 +77,22 @@ AC_fnc_hasTools = {
// params: requirements:array
// return: bool
AC_fnc_checkRequirements = {
private ["_requirements","_inventory","_hasRequirements","_itemIn","_countIn","_qty","_missing","_missingQty","_textMissing"];
_requirements = _this;
private ["_items","_inventory","_hasItems","_itemIn","_countIn","_qty","_missing","_missingQty","_textMissing"];
_items = _this;
_inventory = magazines player;
_hasRequirements = true;
_hasItems = true;
{
_itemIn = "";
_countIn = 1;
if (_x call AC_fnc_isArray) then {
if (count _x >= 2) then {
if (typeName _x == "ARRAY") then {
if (count _x > 0) then {
_itemIn = _x select 0;
_countIn = _x select 1;
if (count _x > 1) then {
_countIn = _x select 1;
};
};
} else {
_itemIn = _x;
// _countIn = 1;
};
if (_itemIn != "") then {
_qty = { (_x == _itemIn) || (configName(inheritsFrom(configFile >> "cfgMagazines" >> _x)) == _itemIn) } count _inventory;
Expand All @@ -101,19 +102,19 @@ AC_fnc_checkRequirements = {
if (_qty < _countIn) exitWith {
_missing = _itemIn;
_missingQty = (_countIn - _qty);
_hasRequirements = false;
_hasItems = false;
_textMissing = getText(configFile >> "CfgMagazines" >> _missing >> "displayName");
cutText [format["Missing %1 more of %2", _missingQty, _textMissing], "PLAIN DOWN"];
};
} forEach _requirements;
_hasRequirements
} forEach _items;
_hasItems
};

// params: requirements:array
// return: bool
AC_fnc_removeRequirements = {
private ["_requirements","_inventory","_temp_removed_array","_removed_total","_tobe_removed_total","_removed","_itemIn","_countIn","_num_removed"];
_requirements = _this;
private ["_items","_inventory","_temp_removed_array","_removed_total","_tobe_removed_total","_removed","_itemIn","_countIn","_num_removed"];
_items = _this;
_inventory = magazines player;
_temp_removed_array = [];
_removed_total = 0;
Expand All @@ -122,14 +123,15 @@ AC_fnc_removeRequirements = {
_removed = 0;
_itemIn = "";
_countIn = 1;
if (_x call AC_fnc_isArray) then {
if (count _x >= 2) then {
if (typeName _x == "ARRAY") then {
if (count _x > 0) then {
_itemIn = _x select 0;
_countIn = _x select 1;
if (count _x > 1) then {
_countIn = _x select 1;
};
};
} else {
_itemIn = _x;
// _countIn = 1;
};
if (_itemIn != "") then {
_tobe_removed_total = _tobe_removed_total + _countIn;
Expand All @@ -144,7 +146,7 @@ AC_fnc_removeRequirements = {
};
} forEach _inventory;
};
} forEach _requirements;
} forEach _items;
// all parts removed
if (_tobe_removed_total == _removed_total) exitWith { true };
// missing parts
Expand Down
175 changes: 0 additions & 175 deletions service_point/ac_functions.sqf

This file was deleted.

2 changes: 0 additions & 2 deletions service_point/service_point.sqf
Expand Up @@ -38,8 +38,6 @@ _rearm_magazineCount = 3; // amount of magazines to be added to the vehicle weap

// ----------------- CONFIG END -----------------

call compile preprocessFileLineNumbers (_folder + "ac_functions.sqf");

_lastVehicle = objNull;
_lastRole = [];

Expand Down
2 changes: 1 addition & 1 deletion service_point/service_point_rearm.sqf
Expand Up @@ -11,7 +11,7 @@ _costs = _args select 1;
_magazineCount = _args select 2;
_weapon = _args select 3;

if !([_costs] call AC_fnc_checkAndRemoveRequirements) exitWith {};
if !([_costs] call player_checkAndRemoveItems) exitWith {};

_type = typeOf _vehicle;
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
Expand Down
2 changes: 1 addition & 1 deletion service_point/service_point_refuel.sqf
Expand Up @@ -11,7 +11,7 @@ _costs = _args select 1;
_updateInterval = _args select 2;
_amount = _args select 3;

if !([_costs] call AC_fnc_checkAndRemoveRequirements) exitWith {};
if !([_costs] call player_checkAndRemoveItems) exitWith {};

_type = typeOf _vehicle;
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
Expand Down
2 changes: 1 addition & 1 deletion service_point/service_point_repair.sqf
Expand Up @@ -10,7 +10,7 @@ _servicePoint = _args select 0;
_costs = _args select 1;
_repairTime = _args select 2;

if !([_costs] call AC_fnc_checkAndRemoveRequirements) exitWith {};
if !([_costs] call player_checkAndRemoveItems) exitWith {};

_type = typeOf _vehicle;
_name = getText(configFile >> "cfgVehicles" >> _type >> "displayName");
Expand Down

0 comments on commit 40c0e4e

Please sign in to comment.