Compiles.sqf cleanup

- Moved player_countMagazines to \compile\ folder
- Removed several unused and obsolete files
- Moved some epoch functions out of compiles.sqf into individual files
- Synced order and formatting with 1.8.7. Much easier to compare now.

Any changes I make to official DayZ Mod code and files I also submit as
a pull request to them.
This commit is contained in:
ebaydayz
2016-03-17 16:34:15 -04:00
parent 3113889a98
commit 6a6db58291
38 changed files with 494 additions and 1547 deletions

View File

@@ -1,33 +1,41 @@
private ["_vehicle","_class","_maxMagazines","_maxWeapons","_maxBackpacks","_magazineCount","_weaponsCount","_backpackCount","_magazineCount_raw","_weaponsCount_raw","_backpackCount_raw"];
private ["_vehicle","_class","_maxMagazines","_maxWeapons","_maxBackpacks","_magazineCount","_weaponsCount","_backpackCount","_magazineCount_raw","_weaponsCount_raw","_backpackCount_raw","_vehicle_gear_count"];
_vehicle = _this select 3;
_class = typeOf _vehicle;
_vehicle_gear_count = {
private "_counter";
_counter = 0;
{
_counter = _counter + _x;
} count _this;
_counter
};
// Get max magazines count
_maxMagazines = getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxMagazines");
// Get max weapon count
_maxWeapons = getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxWeapons");
_maxWeapons = getNumber (configFile >> "CfgVehicles" >> _class >> "transportMaxWeapons");
// Get max backpack count
_maxBackpacks = getNumber (configFile >> "CfgVehicles" >> _class >> "transportmaxbackpacks");
// Count && show magazines available space
// Count and show magazines available space
_magazineCount_raw = getMagazineCargo _vehicle;
// Count && show weapons available space
// Count and show weapons available space
_weaponsCount_raw = getWeaponCargo _vehicle;
// Count && show backpacks available space
// Count and show backpacks available space
_backpackCount_raw = getBackpackCargo _vehicle;
// Count && show magazines available space
_magazineCount = (_magazineCount_raw select 1) call vehicle_gear_count;
// Count and show magazines available space
_magazineCount = (_magazineCount_raw select 1) call _vehicle_gear_count;
// Count && show weapons available space
_weaponsCount = (_weaponsCount_raw select 1) call vehicle_gear_count;
// Count and show weapons available space
_weaponsCount = (_weaponsCount_raw select 1) call _vehicle_gear_count;
// Count && show weapons available space
_backpackCount = (_backpackCount_raw select 1) call vehicle_gear_count;
// Count and show weapons available space
_backpackCount = (_backpackCount_raw select 1) call _vehicle_gear_count;
cutText [format[(localize "str_epoch_player_1"),_magazineCount,_maxMagazines,_weaponsCount,_maxWeapons,_backpackCount,_maxBackpacks], "PLAIN DOWN"];

View File

@@ -1,70 +0,0 @@
/*
count player magazines with ammo count
value = call player_countMagazines; //must be called from a spawned thread (|| use spawn)
return all player magazines with ammo count
Modified to save backpack magazine count by icomrade - Base for fix by Ziellos2k
*/
private ["_control","_item","_val","_max","_count","_magazineArray","_dialog"];
disableSerialization;
_magazineArray = [[],[]];
_dialog = ["0"] call gearDialog_create;
if ((isNull _dialog) || (isNil "_dialog")) exitWith {disableUserInput false; (findDisplay 106) closeDisplay 0; closeDialog 0; _magazineArray};
//Main inventory
for "_i" from 109 to 120 do {
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
(_magazineArray select 0) set [count (_magazineArray select 0),[_item,_val]];
} else {
(_magazineArray select 0) set [count (_magazineArray select 0),_item];
};
};
};
//Pistol/secondary ammo
for "_i" from 122 to 129 do {
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
(_magazineArray select 0) set [count (_magazineArray select 0),[_item,_val]];
} else {
(_magazineArray select 0) set [count (_magazineArray select 0),_item];
};
};
};
//backpack items
if ((typeOf (unitBackPack player)) != "") then {
_count = getNumber (configFile >> "CfgVehicles" >> (typeOf (unitBackpack Player)) >> "transportMaxMagazines");
ctrlActivate (_dialog displayCtrl 157);
if (gear_done) then {
waitUntil {ctrlShown (_dialog displayCtrl 159)};
uiSleep 0.001;
};
for "_i" from 5000 to (5000 + _count) do {
_control = _dialog displayCtrl _i;
_item = gearSlotData _control;
_val = gearSlotAmmoCount _control;
_max = getNumber (configFile >> "CfgMagazines" >> _item >> "count");
if (_item != "") then {
if (_val != _max) then {
(_magazineArray select 1) set [count (_magazineArray select 1),[_item,_val]];
} else {
(_magazineArray select 1) set [count (_magazineArray select 1),_item];
};
};
};
};
(findDisplay 106) closeDisplay 0;
if (gear_done) then {uiSleep 0.001;};
_magazineArray

View File

@@ -1,88 +0,0 @@
private ["_onLadder","_itemorignal","_hasdrinkitem","_hasoutput","_config","_text","_sfx","_dis","_itemtodrop","_nearByPile","_item","_display","_invehicle"];
disableserialization;
call gear_ui_init;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
//if (vehicle player != player) exitWith {cutText ["\n\nYou may not drink while in a vehicle", "PLAIN DOWN"]};
//Force players to wait 3 mins to drink again
//if (dayz_lastDrink < 180) exitWith {cutText ["You may not drink, your not thirsty", "PLAIN DOWN"]};
_itemorignal = _this;
_hasdrinkitem = _itemorignal in magazines player;
_hasoutput = _itemorignal in drink_with_output;
_invehicle = false;
_config = configFile >> "CfgMagazines" >> _itemorignal;
_text = getText (_config >> "displayName");
//getting type of sfx (now just drink od soda open && drink)
_sfx = getText (_config >> "sfx");
if (!_hasdrinkitem) exitWith {cutText [format[(localize "str_player_31"),_text,"drink"] , "PLAIN DOWN"]};
player playActionNow "PutDown";
player removeMagazine _itemorignal;
if (vehicle player != player) then {
_display = findDisplay 106;
_display closeDisplay 0;
_invehicle = true;
};
uiSleep 1;
if (["ItemWaterbottle",_itemorignal] call fnc_inString) then {
//low alert && sound radius
_dis=5;
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
player addMagazine "ItemWaterbottleUnfilled";
};
if (["ItemSoda",_itemorignal] call fnc_inString) then {
//higher alert && sound radius
_dis=10;
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
};
if (_hasoutput) then {
// Selecting output
_itemtodrop = drink_output select (drink_with_output find _itemorignal);
if (!_invehicle) then {
uiSleep 3;
_nearByPile = nearestObjects [(getPosATL player), ["WeaponHolder","WeaponHolderBase"],2];
if (count _nearByPile == 0) then {
_iPos = getPosATL player;
_radius = 0.0;
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item setPosATL _iPos;
} else {
_item = _nearByPile select 0;
};
_item addMagazineCargoGlobal [_itemtodrop,1];
} else {
uiSleep 2;
(vehicle player) addMagazineCargoGlobal [_itemtodrop,1];
};
};
//add infection chance for "ItemWaterbottle",
if ((random 15 < 1) && (_itemorignal == "ItemWaterbottle")) then {
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
dayz_lastDrink = time;
dayz_thirst = 0;
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
(_display displayCtrl 1302) ctrlShow true;
cutText [format[(localize "str_player_consumed"),_text], "PLAIN DOWN"];

View File

@@ -1,106 +0,0 @@
private ["_onLadder","_itemorignal","_hasfooditem","_rawfood","_hasoutput","_config","_text","_regen","_dis","_sfx","_itemtodrop","_nearByPile","_item","_display","_rawexceptions","_badfood","_invehicle"];
disableserialization;
call gear_ui_init;
_onLadder = (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {cutText [(localize "str_player_21") , "PLAIN DOWN"]};
//if (vehicle player != player) exitWith {cutText ["\n\nYou may not eat while in a vehicle", "PLAIN DOWN"]};
//Force players to wait 3 mins to eat again
//if (dayz_lastMeal < 180) exitWith {cutText ["You may not eat, you're already full", "PLAIN DOWN"]};
_itemorignal = _this;
_hasfooditem = _itemorignal in magazines player;
_rawfood = _itemorignal in meatraw;
_rawexceptions = _itemorignal in exceptionsraw;
//_cookedfood = _itemorignal in meatcooked;
_hasoutput = _itemorignal in food_with_output;
_badfood = _itemorignal in badfood;
_config = configFile >> "CfgMagazines" >> _itemorignal;
_text = getText (_config >> "displayName");
_regen = getNumber (_config >> "bloodRegen");
if (!_hasfooditem) exitWith {cutText [format[(localize "str_player_31"),_text,"consume"] , "PLAIN DOWN"]};
player playActionNow "PutDown";
player removeMagazine _itemorignal;
_invehicle = false;
if (vehicle player != player) then {
_display = findDisplay 106;
_display closeDisplay 0;
_invehicle = true;
};
uiSleep 1;
_dis=6;
_sfx = "eat";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
if (dayz_lastMeal < 3600) then {
if (_itemorignal == "FoodSteakCooked") then {
//_regen = _regen * (10 - (10 max ((time - _Cookedtime) / 3600)));
};
};
if (_hasoutput) then {
// Selecting output
_itemtodrop = food_output select (food_with_output find _itemorignal);
if (!_invehicle) then {
uiSleep 3;
_nearByPile = nearestObjects [(getPosATL player), ["WeaponHolder","WeaponHolderBase"],2];
if (count _nearByPile == 0) then {
_iPos = getPosATL player;
_radius = 0.0;
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
_item setPosATL _iPos;
} else {
_item = _nearByPile select 0;
};
_item addMagazineCargoGlobal [_itemtodrop,1];
} else {
uiSleep 2;
(vehicle player) addMagazineCargoGlobal [_itemtodrop,1];
};
};
if (_rawfood && !_rawexceptions && (random 15 < 1)) then {
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};
if (_badfood && (random 2 < 1)) then {
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};
r_player_blood = r_player_blood + _regen;
if (r_player_blood > r_player_bloodTotal) then {
r_player_blood = r_player_bloodTotal;
};
player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
player setVariable["USEC_BloodQty",r_player_blood,true];
player setVariable["medForceUpdate",true];
//["PVDZE_plr_Save",[player,[],true]] call callRpcProcedure;
PVDZE_plr_Save = [player,[],true,true];
publicVariableServer "PVDZE_plr_Save";
dayz_lastMeal = time;
dayz_hunger = 0;
//Ensure Control is visible
_display = uiNamespace getVariable 'DAYZ_GUI_display';
(_display displayCtrl 1301) ctrlShow true;
if (r_player_blood / r_player_bloodTotal >= 0.2) then {
(_display displayCtrl 1300) ctrlShow true;
};
cutText [format[(localize "str_player_consumed"),_text], "PLAIN DOWN"];

View File

@@ -1,25 +1,15 @@
private ["_object"];
private ["_object","_position"];
_object = _this select 3;
// _position = [position _object,0,0,0,0,0,0,position player] call BIS_fnc_findSafePos;
//Standup
//player playMove "amovpercmstpsraswrfldnon_amovpknlmstpslowwrfldnon";
//uiSleep 1;
//waitUntil { animationState player != "amovpercmstpsraswrfldnon_amovpknlmstpslowwrfldnon"};
//Kneel Down
player playMove "amovpknlmstpslowwrfldnon_amovpercmstpsraswrfldnon";
waitUntil { animationState player != "amovpknlmstpslowwrfldnon_amovpercmstpsraswrfldnon"};
uiSleep 2;
//_object setpos _position;
_object setvectorup [0,0,1];
//[player,"scream",0,true] call dayz_zombieSpeak;
[player,20,true,(getPosATL player)] spawn player_alertZombies;
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
uiSleep 3;
// Alert Zombies
[player,20,true,(getPosATL player)] call player_alertZombies;
//Other possibilities
//[_object,0, 0] call bis_fnc_setpitchbank;
//_object setpos [getpos _object select 0, getpos _object select 1, 0];
// Added Nutrition-Factor for work
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;

View File

@@ -1,71 +0,0 @@
private ["_location","_isOk","_pondPos","_isPond","_dir","_dis","_sfx","_classname","_object","_playerPos","_item","_hastentitem","_building","_config","_text","_objectsPond"];
//check if can pitch here
call gear_ui_init;
_playerPos = getPosATL player;
_item = _this;
_hastentitem = _this in magazines player;
_location = player modeltoworld [0,2.5,0];
_location set [2,0];
_building = nearestObject [(vehicle player), "HouseBase"];
_isOk = [(vehicle player),_building] call fnc_isInsideBuilding;
//_isOk = true;
//diag_log ("Pitch Tent: " + str(_isok) );
_config = configFile >> "CfgMagazines" >> _item;
_text = getText (_config >> "displayName");
if (!_hastentitem) exitWith {cutText [format[(localize "str_player_31"),_text,"pitch"] , "PLAIN DOWN"]};
//blocked
if (["concrete",dayz_surfaceType] call fnc_inString) then { _isOk = true; diag_log ("surface concrete"); };
//Block Tents in pounds
_objectsPond = nearestObjects [_playerPos, [], 10];
{
_isPond = ["pond",str(_x),false] call fnc_inString;
if (_isPond) then {
_pondPos = (_x worldToModel _playerPos) select 2;
if (_pondPos < 0) then {
_isOk = true;
};
};
} count _objectsPond;
//diag_log ("Pitch Tent: " + str(_isok) );
if (!_isOk) then {
//remove tentbag
player removeMagazine _item;
_dir = round(direction player);
[1,1] call dayz_HungerThirst;
//wait a bit
player playActionNow "Medic";
uiSleep 1;
_dis=20;
_sfx = "tentunpack";
[player,_sfx,0,false,_dis] call dayz_zombieSpeak;
[player,_dis,true,(getPosATL player)] spawn player_alertZombies;
_classname = getText (configFile >> "CfgMagazines" >> _item >> "ItemActions" >> "Pitch" >> "create");
uiSleep 5;
//place tent (local)
_object = createVehicle [_classname, _location, [], 0, "CAN_COLLIDE"];
_object setdir _dir;
_object setpos _location;
player reveal _object;
_location = getPosATL _object;
_object setVariable ["CharacterID",dayz_characterID,true];
//["PVDZE_obj_Publish",[dayz_characterID,_tent,[_dir,_location],_classname]] call callRpcProcedure;
PVDZE_obj_Publish = [dayz_characterID,_object,[_dir,_location],_classname];
publicVariableServer "PVDZE_obj_Publish";
cutText [localize "str_success_tent_pitch", "PLAIN DOWN"];
} else {
cutText [localize "str_fail_tent_pitch", "PLAIN DOWN"];
};