mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
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:
@@ -7,6 +7,7 @@
|
||||
- Optional news/rules feed on player login, set dayz_enableRules in init.sqf
|
||||
- Weapon switch hotkeys added (1 = primary, 2 = pistol, 3 = melee)
|
||||
- Journal is now functional for displaying stats
|
||||
- vehicle_handleDamage and vehicle_handleKilled have been renamed to fnc_veh_handleDam and fnc_veh_handleKilled respectively
|
||||
|
||||
[NEW] RedRyder BB Gun by @arma2WillRobinson
|
||||
[NEW] Added "RedRyder" and "350Rnd_BB_Magazine" to loot pile. #1456 #1457 @Namindu
|
||||
|
||||
@@ -10,12 +10,12 @@ class ItemToolbox : ItemCore
|
||||
class RemoveNet
|
||||
{
|
||||
text="Remove Camo Net";
|
||||
script="spawn player_removeNet;";
|
||||
script="[['DesertCamoNet_DZ','ForestCamoNet_DZ','DesertLargeCamoNet_DZ','ForestLargeCamoNet_DZ'],5,'str_epoch_player_8'] call player_removeNearby;";
|
||||
};
|
||||
class RemoveTankTrap
|
||||
{
|
||||
text="Remove Tank Trap";
|
||||
script="spawn player_removeTankTrap;";
|
||||
script="[['Hedgehog_DZ'],1,'STR_EPOCH_ACTIONS_14'] call player_removeNearby;";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -21,14 +21,6 @@ REMOVE TOOL BREAKING, IT'S STUPID
|
||||
|
||||
player_craftItem_DZV = compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_craftItem.sqf";
|
||||
|
||||
vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
|
||||
vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
|
||||
|
||||
ARE NO MORE, USE BELOW!! ACTUALLY IT MAY BE EASIER TO JUST RENAME THE BELOW TO ABOVE?
|
||||
|
||||
fnc_veh_handleDam = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleDam.sqf";
|
||||
fnc_veh_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\veh_handleKilled.sqf";
|
||||
|
||||
dayz_serverObjectMonitor = []; IS REPLACED WITH PVDZE_serverObjectMonitor = [];
|
||||
PVDZ_obj_Publish IS PVDZE_obj_Publish
|
||||
******REPLACE ALL PVCDZ_ AND PVDZ_ with PVCDZE/PVDZE_
|
||||
|
||||
@@ -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"];
|
||||
|
||||
@@ -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
|
||||
@@ -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"];
|
||||
@@ -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"];
|
||||
@@ -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;
|
||||
|
||||
// Alert Zombies
|
||||
[player,20,true,(getPosATL player)] call player_alertZombies;
|
||||
|
||||
// Added Nutrition-Factor for work
|
||||
["Working",0,[20,40,15,0]] call dayz_NutritionSystem;
|
||||
uiSleep 3;
|
||||
|
||||
|
||||
//Other possibilities
|
||||
//[_object,0, 0] call bis_fnc_setpitchbank;
|
||||
//_object setpos [getpos _object select 0, getpos _object select 1, 0];
|
||||
@@ -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"];
|
||||
};
|
||||
|
||||
12
SQF/dayz_code/compile/dze_ejectPlayer.sqf
Normal file
12
SQF/dayz_code/compile/dze_ejectPlayer.sqf
Normal file
@@ -0,0 +1,12 @@
|
||||
// check if player in vehicle
|
||||
private ["_noDriver","_vehicle","_inVehicle"];
|
||||
|
||||
_vehicle = vehicle player;
|
||||
_inVehicle = (_vehicle != player);
|
||||
|
||||
if(_inVehicle) then {
|
||||
_noDriver = ((_vehicle emptyPositions "driver") > 0);
|
||||
if (_noDriver && (speed _vehicle) != 0) then {
|
||||
player action [ "eject", _vehicle];
|
||||
};
|
||||
};
|
||||
15
SQF/dayz_code/compile/dze_getModelName.sqf
Normal file
15
SQF/dayz_code/compile/dze_getModelName.sqf
Normal file
@@ -0,0 +1,15 @@
|
||||
_objInfo = toArray(str(_this));
|
||||
_lenInfo = count _objInfo - 1;
|
||||
_objName = [];
|
||||
_i = 0;
|
||||
// determine where the object name starts
|
||||
{
|
||||
if (58 == _objInfo select _i) exitWith {};
|
||||
_i = _i + 1;
|
||||
} count _objInfo;
|
||||
_i = _i + 2; // skip the ": " part
|
||||
for "_k" from _i to _lenInfo do {
|
||||
_objName set [(count _objName), (_objInfo select _k)];
|
||||
};
|
||||
_objName = toLower(toString(_objName));
|
||||
_objName
|
||||
18
SQF/dayz_code/compile/dze_isNearestPlayer.sqf
Normal file
18
SQF/dayz_code/compile/dze_isNearestPlayer.sqf
Normal file
@@ -0,0 +1,18 @@
|
||||
private ["_notClosest","_playerDistance","_nearPlayers","_obj","_playerNear"];
|
||||
|
||||
if (!isNull _this) then {
|
||||
_nearPlayers = _this nearEntities ["CAManBase", 12];
|
||||
_playerNear = ({isPlayer _x} count _nearPlayers) > 1;
|
||||
_notClosest = false;
|
||||
if (_playerNear) then {
|
||||
// check if another player is closer
|
||||
_playerDistance = player distance _this;
|
||||
{
|
||||
if (_playerDistance > (_x distance _this)) exitWith { _notClosest = true; };
|
||||
} count _nearPlayers;
|
||||
};
|
||||
} else {
|
||||
_notClosest = false;
|
||||
};
|
||||
|
||||
_notClosest
|
||||
13
SQF/dayz_code/compile/epoch_itemCost.sqf
Normal file
13
SQF/dayz_code/compile/epoch_itemCost.sqf
Normal file
@@ -0,0 +1,13 @@
|
||||
_trade_total = 0;
|
||||
{
|
||||
_part_in_configClass = configFile >> "CfgMagazines" >> (_x select 0);
|
||||
if (isClass (_part_in_configClass)) then {
|
||||
_part_inWorth = (_part_in_configClass >> "worth");
|
||||
if isNumber (_part_inWorth) then {
|
||||
_trade_total = _trade_total + (getNumber(_part_inWorth) * (_x select 1));
|
||||
};
|
||||
};
|
||||
} count _this;
|
||||
|
||||
//diag_log format["DEBUG TRADER ITEMCOST: %1", _this];
|
||||
_trade_total
|
||||
@@ -1,4 +1,5 @@
|
||||
// Made for DayZ Epoch by vbawol
|
||||
// usage [["partinclassname",4]] call epoch_returnChange;
|
||||
|
||||
private ["_trade_total","_part_inWorth","_part_in_configClass","_total_currency","_part","_worth","_return_change","_total","_briefcase_100oz","_gold_10oz_a","_gold_10oz_b","_gold_10oz","_gold_1oz_a","_gold_1oz_b","_gold_1oz","_silver_10oz_a","_silver_10oz_b","_silver_10oz","_silver_1oz_a","_silver_1oz_b","_silver_1oz","_successful","_buyOrSell","_total_items"];
|
||||
_successful = false;
|
||||
|
||||
14
SQF/dayz_code/compile/epoch_tempKeys.sqf
Normal file
14
SQF/dayz_code/compile/epoch_tempKeys.sqf
Normal file
@@ -0,0 +1,14 @@
|
||||
private ["_temp_keys","_temp_keys_names","_key_colors","_ownerKeyId","_ownerKeyName"];
|
||||
_temp_keys = [];
|
||||
_temp_keys_names = [];
|
||||
// find available keys
|
||||
_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
|
||||
{
|
||||
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then {
|
||||
_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
|
||||
_ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
|
||||
_temp_keys_names set [_ownerKeyId,_ownerKeyName];
|
||||
_temp_keys set [count _temp_keys,str(_ownerKeyId)];
|
||||
};
|
||||
} count (items player);
|
||||
[_temp_keys,_temp_keys_names]
|
||||
10
SQF/dayz_code/compile/epoch_totalCurrency.sqf
Normal file
10
SQF/dayz_code/compile/epoch_totalCurrency.sqf
Normal file
@@ -0,0 +1,10 @@
|
||||
// total currency
|
||||
_total_currency = 0;
|
||||
{
|
||||
_part = (configFile >> "CfgMagazines" >> _x);
|
||||
_worth = (_part >> "worth");
|
||||
if isNumber (_worth) then {
|
||||
_total_currency = _total_currency + getNumber(_worth);
|
||||
};
|
||||
} count (magazines player);
|
||||
_total_currency
|
||||
7
SQF/dayz_code/compile/fn_checkAndRemoveItems.sqf
Normal file
7
SQF/dayz_code/compile/fn_checkAndRemoveItems.sqf
Normal file
@@ -0,0 +1,7 @@
|
||||
private ["_items","_b"];
|
||||
_items = _this;
|
||||
_b = _items call player_checkItems;
|
||||
if (_b) then {
|
||||
_b = _items call player_removeItems;
|
||||
};
|
||||
_b
|
||||
@@ -1,21 +0,0 @@
|
||||
scriptName "Functions\misc\fn_damageHandler.sqf";
|
||||
/***********************************************************
|
||||
PROCESS DAMAGE TO A UNIT
|
||||
- Function
|
||||
- [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
|
||||
************************************************************/
|
||||
private ["_unit","_hit","_damage","_total"];
|
||||
_unit = _this select 0;
|
||||
_hit = _this select 1;
|
||||
_damage = _this select 2;
|
||||
//_source = _this select 3;
|
||||
//_ammo = _this select 4;
|
||||
|
||||
_total = _damage;
|
||||
|
||||
//diag_log ("DAMAGE VEH: " + typeof(_unit) + " / " + str(_hit) + " / " + str(_damage) + " / " + str(getDammage _unit));
|
||||
|
||||
if (local _unit) then {
|
||||
_total = [_unit,_hit,_damage] call object_setHitServer;
|
||||
};
|
||||
_total
|
||||
@@ -1,35 +0,0 @@
|
||||
private ["_unit1","_building","_relPos","_boundingBox","_min","_max","_myX","_myY","_myZ","_inside"];
|
||||
_unit1 = _this select 0;
|
||||
_building = _this select 1;
|
||||
|
||||
//_type = typeOf _building;
|
||||
_relPos = _building worldToModel _unit1;
|
||||
_boundingBox = boundingBox _building;
|
||||
//diag_log ("DEBUG: Building: " + str(_building) );
|
||||
//diag_log ("DEBUG: Building Type: " + str(_type) );
|
||||
//diag_log ("DEBUG: BoundingBox: " + str(_boundingBox) );
|
||||
|
||||
_min = _boundingBox select 0;
|
||||
_max = _boundingBox select 1;
|
||||
|
||||
//diag_log ("Min: " + str(_min) );
|
||||
//diag_log ("Max: " + str(_max) );
|
||||
|
||||
_myX = _relPos select 0;
|
||||
_myY = _relPos select 1;
|
||||
_myZ = _relPos select 2;
|
||||
|
||||
//diag_log ("X: " + str(_myX) );
|
||||
//diag_log ("Y: " + str(_myY) );
|
||||
//diag_log ("Z: " + str(_myZ) );
|
||||
|
||||
if ((_myX > (_min select 0)) && (_myX < (_max select 0))) then {
|
||||
if ((_myY > (_min select 1)) && (_myY < (_max select 1))) then {
|
||||
if ((_myZ > (_min select 2)) && (_myZ < (_max select 2))) then {
|
||||
_inside = true;
|
||||
} else { _inside = false; };
|
||||
} else { _inside = false; };
|
||||
} else { _inside = false; };
|
||||
|
||||
//diag_log ("isinBuilding Check: " + str(_inside) );
|
||||
_inside
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
Description:
|
||||
Removes the items (magazines) from the player's inventory
|
||||
&& performs a double check for the required items.
|
||||
and performs a double check for the required items.
|
||||
|
||||
Parameter(s):
|
||||
_this: <array> list of item names to be removed (can also be an sub-array with item name && quantity)
|
||||
_this: <array> list of item names to be removed (can also be an sub-array with item name and quantity)
|
||||
|
||||
Returns:
|
||||
Boolean (true if all items have been removed from the player's inventory)
|
||||
|
||||
16
SQF/dayz_code/compile/fnc_getPlayerUID.sqf
Normal file
16
SQF/dayz_code/compile/fnc_getPlayerUID.sqf
Normal file
@@ -0,0 +1,16 @@
|
||||
private ["_object","_version","_PID"];
|
||||
|
||||
_object = _this select 0;
|
||||
_version = productVersion select 3;
|
||||
if (DayZ_UseSteamID) then {
|
||||
_PID = GetPlayerUID _object;
|
||||
} else {
|
||||
if (_version >= 125548) then {
|
||||
_PID = call (compile "GetPlayerUIDOld _object");
|
||||
} else {
|
||||
_PID = GetPlayerUID _object;
|
||||
diag_log format["Your game version, %1, is less than the required for the old UID system; using Steam ID system instead. Update to 1.63.125548 (or latest steam beta)", _version];
|
||||
};
|
||||
};
|
||||
|
||||
_PID
|
||||
11
SQF/dayz_code/compile/fnc_getPos.sqf
Normal file
11
SQF/dayz_code/compile/fnc_getPos.sqf
Normal file
@@ -0,0 +1,11 @@
|
||||
private "_pos";
|
||||
|
||||
if (isNil {_this select 0}) exitWith {[0,0,0]};
|
||||
_thingy = _this select 0;
|
||||
_pos = getPosASL _thingy;
|
||||
|
||||
if !(surfaceIsWater _pos) then {
|
||||
_pos = ASLToATL _pos;
|
||||
};
|
||||
|
||||
_pos
|
||||
11
SQF/dayz_code/compile/fnc_getSetPos.sqf
Normal file
11
SQF/dayz_code/compile/fnc_getSetPos.sqf
Normal file
@@ -0,0 +1,11 @@
|
||||
//DO NOT USE IF YOU NEED ANGLE COMPENSATION!!!!
|
||||
private "_pos";
|
||||
|
||||
_thingy = _this select 0;
|
||||
_pos = getPosASL _thingy;
|
||||
|
||||
if (surfaceIsWater _pos) then {
|
||||
_thingy setPosASL _pos;
|
||||
} else {
|
||||
_thingy setPosATL (ASLToATL _pos);
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
private ["_spawnveh","_position","_direction","_veh"];
|
||||
{
|
||||
_spawnveh = _x select 0;
|
||||
_position = _x select 1;
|
||||
_direction = _x select 2;
|
||||
|
||||
//diag_log("DEBUG: Spawning a crashed " + _spawnveh + " with " + _spawnloot + " at " + str(_position));
|
||||
|
||||
_veh = _spawnveh createVehicleLocal _position;
|
||||
_veh enableSimulation false;
|
||||
|
||||
// Randomize placement a bit
|
||||
_veh setDir _direction;
|
||||
_veh setpos _position;
|
||||
|
||||
} count _this;
|
||||
@@ -1,9 +0,0 @@
|
||||
private["_type","_tent","_pos"];
|
||||
_type = _this select 0;
|
||||
_pos = _this select 1;
|
||||
|
||||
_tent = nearestObject [_type,_pos];
|
||||
|
||||
if (!isNull _tent) then {
|
||||
if (local _tent) then {deleteVehicle _tent};
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
private ["_nearByObjects","_targetObject","_error","_range","_objects"];
|
||||
|
||||
//Object Array, Range, Error Message (@Skaronator)
|
||||
_objects = _this select 0;
|
||||
_range = _this select 1;
|
||||
_error = _this select 2;
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
private ["_unit"];
|
||||
_unit = _this select 0;
|
||||
if (local _unit) then {
|
||||
deleteVehicle _unit;
|
||||
};
|
||||
@@ -1,58 +1,70 @@
|
||||
/*
|
||||
count player magazines with ammo count
|
||||
value = call player_countMagazines;
|
||||
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 ["_dialog","_created","_magazineArray"];
|
||||
private ["_control","_item","_val","_max","_count","_magazineArray","_dialog"];
|
||||
disableSerialization;
|
||||
disableUserInput true;
|
||||
|
||||
_dialog = findDisplay 106;
|
||||
_created = false;
|
||||
_magazineArray = [[],[]];
|
||||
_dialog = ["0"] call gearDialog_create;
|
||||
if ((isNull _dialog) || (isNil "_dialog")) exitWith {disableUserInput false; (findDisplay 106) closeDisplay 0; closeDialog 0; _magazineArray};
|
||||
|
||||
if ( isNull _dialog ) then {
|
||||
//startLoadingScreen [""];
|
||||
createGearDialog [player, "RscDisplayGear"];
|
||||
_dialog = findDisplay 106;
|
||||
_created = true;
|
||||
};
|
||||
|
||||
_magazineArray = [];
|
||||
|
||||
for "_i" from 109 to 120 do
|
||||
{
|
||||
//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 set [count _magazineArray,[_item,_val]];
|
||||
(_magazineArray select 0) set [count (_magazineArray select 0),[_item,_val]];
|
||||
} else {
|
||||
_magazineArray set [count _magazineArray,_item];
|
||||
(_magazineArray select 0) set [count (_magazineArray select 0),_item];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
for "_i" from 122 to 129 do
|
||||
{
|
||||
//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 set [count _magazineArray,[_item,_val]];
|
||||
(_magazineArray select 0) set [count (_magazineArray select 0),[_item,_val]];
|
||||
} else {
|
||||
_magazineArray set [count _magazineArray,_item];
|
||||
(_magazineArray select 0) set [count (_magazineArray select 0),_item];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if ( _created ) then {
|
||||
closeDialog 0;
|
||||
//endLoadingScreen;
|
||||
//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];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
disableUserInput false;
|
||||
(findDisplay 106) closeDisplay 0;
|
||||
if (gear_done) then {uiSleep 0.001;};
|
||||
_magazineArray
|
||||
@@ -1,49 +0,0 @@
|
||||
private ["_objects"];
|
||||
_objects = nearestObjects [player, dayz_updateObjects, 10];
|
||||
{
|
||||
//["PVDZE_veh_Update",[_x,"gear"]] call callRpcProcedure;
|
||||
PVDZE_veh_Update = [_x,"gear"];
|
||||
publicVariableServer "PVDZE_veh_Update";
|
||||
|
||||
} count _objects;
|
||||
|
||||
private["_dialog","_magazineArray","_control","_item","_val","_max"];
|
||||
|
||||
disableSerialization;
|
||||
_dialog = _this select 0;
|
||||
_magazineArray = [];
|
||||
|
||||
//Primary Mags
|
||||
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 (_item == "BoltSteel") then { _item = "WoodenArrow" };
|
||||
if (_val != _max) then {
|
||||
_magazineArray set [count _magazineArray,[_item,_val]];
|
||||
} else {
|
||||
_magazineArray set [count _magazineArray,_item];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Secondary Mags
|
||||
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 set [count _magazineArray,[_item,_val]];
|
||||
} else {
|
||||
_magazineArray set [count _magazineArray,_item];
|
||||
};
|
||||
};
|
||||
};
|
||||
dayz_unsaved = true;
|
||||
dayz_Magazines = _magazineArray;
|
||||
@@ -1,3 +1,4 @@
|
||||
//Trader ["Trader City Name",false,"enter"] - Trader City Name | Show Message | "enter" || "leave"
|
||||
private ["_traderName","_showText","_enterORleave"];
|
||||
_traderName = _this select 0;
|
||||
_showText = _this select 1;
|
||||
|
||||
@@ -1,222 +0,0 @@
|
||||
private ["_iPos","_tQty","_qty","_index","_weights","_cntWeights","_canType","_item","_magQty","_mags","_item2","_itemTypes","_max","_iItem","_iClass","_radius","_uniq","_iPosZ"];
|
||||
_iItem = _this select 0;
|
||||
_iClass = _this select 1;
|
||||
_iPos = _this select 2;
|
||||
_radius = _this select 3;
|
||||
_uniq = [];
|
||||
|
||||
_item = objNull;
|
||||
|
||||
_iPosZ = _iPos select 2;
|
||||
if((isNil "_iPosZ") || {( _iPosZ < 0)}) then { _iPos = [_iPos select 0,_iPos select 1,0]; };
|
||||
if (isNil "_iClass") exitWith {diag_log "_iClass isNil, exiting loot spawn!";};
|
||||
|
||||
switch (_iClass) do {
|
||||
default {
|
||||
_itemTypes = [];
|
||||
if (DZE_MissionLootTable) then {
|
||||
{
|
||||
_itemTypes set [count _itemTypes, _x select 0]
|
||||
} count getArray (missionConfigFile >> "cfgLoot" >> _iClass);
|
||||
} else {
|
||||
{
|
||||
_itemTypes set [count _itemTypes, _x select 0]
|
||||
} count getArray (configFile >> "cfgLoot" >> _iClass);
|
||||
};
|
||||
_qty = 0;
|
||||
_max = ceil(random 2) + 1;
|
||||
if (_iClass in ["trash","civilian","office","office2","food","generic","medical","hospital","military","militarypilot","policeman","hunter","worker"]) then {
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
while {_qty < _max} do {
|
||||
_index = dayz_CLBase find _iClass;
|
||||
_weights = dayz_CLChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
|
||||
// diag_log ("dayz_CLChances: "+str(dayz_CLChances));
|
||||
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
|
||||
//diag_log ("dayz_CLChances: "+str(_itemTypes));
|
||||
|
||||
_canType = _itemTypes select _index;
|
||||
_tQty = round(random 1) + 1;
|
||||
if (_canType in _uniq) then {
|
||||
if (({_x in _uniq} count magazines _item) == 0) then { _tQty = 1; } else { _tQty = 0;};
|
||||
if (_tQty == 0) then {diag_log(format["%1 Prevent any duplicate member %2 from family %3",__FILE__, _canType, _uniq]);};
|
||||
};
|
||||
if (_tQty > 0) then {
|
||||
if (!(_canType in _uniq)) then {
|
||||
_item addMagazineCargoGlobal [_canType,1];
|
||||
_uniq set [count _uniq, _canType];
|
||||
_qty = _qty + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
if ((_iItem != "") && (isClass(configFile >> "CfgWeapons" >> _iItem))) then {
|
||||
_item addWeaponCargoGlobal [_iItem,1];
|
||||
};
|
||||
}
|
||||
else {
|
||||
// diag_log format["DEBUG dayz_CLBase: %1", dayz_CLBase];
|
||||
_index = dayz_CLBase find _iClass;
|
||||
if (_index > 0) then {
|
||||
_weights = dayz_CLChances select _index;
|
||||
//diag_log format["DEBUG dayz_CLChances: %1", dayz_CLChances];
|
||||
_cntWeights = count _weights;
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_item2 = _itemTypes select _index;
|
||||
if ((_item2 != "") && (isClass(configFile >> "CfgWeapons" >> _item2))) then{
|
||||
_item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addWeaponCargoGlobal[_item2, 1];
|
||||
if ((count _mags) > 0) then{
|
||||
if (_mags select 0 == "20Rnd_556x45_Stanag") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
|
||||
if (_mags select 0 == "30Rnd_556x45_G36") then{ _mags set[0, "30Rnd_556x45_Stanag"] };
|
||||
if (_mags select 0 == "30Rnd_556x45_G36SD") then{ _mags set[0, "30Rnd_556x45_StanagSD"] };
|
||||
if (!(_item2 in MeleeWeapons)) then{
|
||||
_magQty = round(random 10);
|
||||
if (_magQty > 3) then{
|
||||
_item addMagazineCargoGlobal[(_mags select 0), (round(random 1) + 1)];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
if ((_item2 != "") && (isClass(configFile >> "CfgMagazines" >> _item2))) then{
|
||||
_item = createVehicle["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addMagazineCargoGlobal[_item2, 1];
|
||||
};
|
||||
if ((_item2 != "") && (isClass(configFile >> "CfgVehicles" >> _item2))) then{
|
||||
_item = createVehicle[_item2, _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
case "single":
|
||||
{
|
||||
//Item is sigle, add 1 item from cfgloot
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_itemTypes = [];
|
||||
if (DZE_MissionLootTable) then{
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(missionConfigFile >> "cfgLoot" >> _iItem);
|
||||
}
|
||||
else {
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(configFile >> "cfgLoot" >> _iItem);
|
||||
};
|
||||
_index = dayz_CLBase find _iItem;
|
||||
_weights = dayz_CLChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_canType = _itemTypes select _index;
|
||||
_item addMagazineCargoGlobal [_canType,1];
|
||||
};
|
||||
case "backpack":
|
||||
{
|
||||
//Item is single backpack
|
||||
_itemTypes = [];
|
||||
if (DZE_MissionLootTable) then {
|
||||
_itemTypes = ((getArray (missionConfigFile >> "cfgLoot" >> _iItem)) select 0);
|
||||
} else {
|
||||
_itemTypes = ((getArray (configFile >> "cfgLoot" >> _iItem)) select 0);
|
||||
};
|
||||
_index = dayz_CLBase find _iItem;
|
||||
_weights = dayz_CLChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_iItem = _itemTypes select _index;
|
||||
|
||||
_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
};
|
||||
case "cfglootweapon":
|
||||
{
|
||||
_itemTypes = [];
|
||||
if (DZE_MissionLootTable) then{
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(missionConfigFile >> "cfgLoot" >> _iItem);
|
||||
}
|
||||
else {
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(configFile >> "cfgLoot" >> _iItem);
|
||||
};
|
||||
_index = dayz_CLBase find _iItem;
|
||||
_weights = dayz_CLChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_iItem = _itemTypes select _index;
|
||||
|
||||
if (_iItem == "Chainsaw") then {
|
||||
_iItem = ["ChainSaw","ChainSawB","ChainSawG","ChainSawP","ChainSawR"] call BIS_fnc_selectRandom;
|
||||
};
|
||||
|
||||
//Item is a weapon, add it && a random quantity of magazines
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addWeaponCargoGlobal [_iItem,1];
|
||||
_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
|
||||
if ((count _mags) > 0) then
|
||||
{
|
||||
if (_mags select 0 == "Quiver") then { _mags set [0, "WoodenArrow"] }; // Prevent spawning a Quiver
|
||||
if (_mags select 0 == "20Rnd_556x45_Stanag") then { _mags set [0, "30Rnd_556x45_Stanag"] };
|
||||
if (_mags select 0 == "30Rnd_556x45_G36") then { _mags set [0, "30Rnd_556x45_Stanag"] };
|
||||
if (_mags select 0 == "30Rnd_556x45_G36SD") then { _mags set [0, "30Rnd_556x45_StanagSD"] };
|
||||
_item addMagazineCargoGlobal [(_mags select 0), (round(random 2))];
|
||||
};
|
||||
|
||||
};
|
||||
case "weapon":
|
||||
{
|
||||
//Item is a weapon, add it && a random quantity of magazines
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addWeaponCargoGlobal [_iItem,1];
|
||||
_mags = [] + getArray (configFile >> "cfgWeapons" >> _iItem >> "magazines");
|
||||
if ((count _mags) > 0) then
|
||||
{
|
||||
if (_mags select 0 == "Quiver") then { _mags set [0, "WoodenArrow"] }; // Prevent spawning a Quiver
|
||||
if (_mags select 0 == "20Rnd_556x45_Stanag") then { _mags set [0, "30Rnd_556x45_Stanag"] };
|
||||
if (_mags select 0 == "30Rnd_556x45_G36") then { _mags set [0, "30Rnd_556x45_Stanag"] };
|
||||
if (_mags select 0 == "30Rnd_556x45_G36SD") then { _mags set [0, "30Rnd_556x45_StanagSD"] };
|
||||
if (!(_iItem in MeleeWeapons)) then {
|
||||
_magQty = round(random 10);
|
||||
if (_magQty > 3) then {
|
||||
_item addMagazineCargoGlobal [(_mags select 0), (round(random 1) + 1)];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
case "weaponnomags":
|
||||
{
|
||||
//Item is a weapon, && spawns no mags
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addWeaponCargoGlobal [_iItem,1];
|
||||
};
|
||||
case "magazine":
|
||||
{
|
||||
//Item is one magazine
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addMagazineCargoGlobal [_iItem,1];
|
||||
};
|
||||
case "object": {
|
||||
_item = createVehicle [_iItem, _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
if ((count _iPos) > 2) then {
|
||||
_item setPosATL _iPos;
|
||||
};
|
||||
};
|
||||
};
|
||||
if (!isNull(_item)) then{
|
||||
if ((count _iPos) > 2) then{
|
||||
_item setPosATL _iPos;
|
||||
};
|
||||
};
|
||||
|
||||
_item
|
||||
@@ -1,124 +0,0 @@
|
||||
|
||||
private ["_iItem","_iClass","_iPos","_radius","_item","_itemTypes","_index","_weights","_cntWeights","_canType","_dateNow"];
|
||||
|
||||
_iItem = _this select 0;
|
||||
_iClass = _this select 1;
|
||||
//diag_log format["DEBUG spawn loot class: %1", _iClass];
|
||||
_iPos = _this select 2;
|
||||
_radius = _this select 3;
|
||||
|
||||
_item = objNull;
|
||||
|
||||
switch (_iClass) do
|
||||
{
|
||||
default
|
||||
{
|
||||
//Item is sigle, add 1 item from CfgLootSmall
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_itemTypes = [];
|
||||
if (DZE_MissionLootTable) then{
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(missionConfigFile >> "CfgLootSmall" >> _iClass);
|
||||
}
|
||||
else {
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(configFile >> "CfgLootSmall" >> _iClass);
|
||||
};
|
||||
_index = dayzE_CLSBase find _iClass;
|
||||
|
||||
_weights = dayzE_CLSChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_canType = _itemTypes select _index;
|
||||
_item addMagazineCargoGlobal [_canType,1];
|
||||
};
|
||||
case "single":
|
||||
{
|
||||
//Item is sigle, add 1 item from CfgLootSmall
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
|
||||
_itemTypes = [];
|
||||
if (DZE_MissionLootTable) then{
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(missionConfigFile >> "CfgLootSmall" >> _iItem);
|
||||
}
|
||||
else {
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(configFile >> "CfgLootSmall" >> _iItem);
|
||||
};
|
||||
_index = dayzE_CLSBase find _iItem;
|
||||
_weights = dayzE_CLSChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_canType = _itemTypes select _index;
|
||||
_item addMagazineCargoGlobal [_canType,1];
|
||||
};
|
||||
case "cfglootweapon":
|
||||
{
|
||||
//Item is sigle, add 1 item from cfgloot
|
||||
|
||||
_itemTypes = [];
|
||||
if (DZE_MissionLootTable) then{
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(missionConfigFile >> "CfgLootSmall" >> _iItem);
|
||||
}
|
||||
else {
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} count getArray(configFile >> "CfgLootSmall" >> _iItem);
|
||||
};
|
||||
_index = dayzE_CLSBase find _iItem;
|
||||
_weights = dayzE_CLSChances select _index;
|
||||
_cntWeights = count _weights;
|
||||
|
||||
//diag_log("_itemTypes small:" + str(_itemTypes));
|
||||
|
||||
_index = floor(random _cntWeights);
|
||||
_index = _weights select _index;
|
||||
_iItem = _itemTypes select _index;
|
||||
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addWeaponCargoGlobal [_iItem,1];
|
||||
|
||||
};
|
||||
case "weapon":
|
||||
{
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addWeaponCargoGlobal [_iItem,1];
|
||||
};
|
||||
case "magazine":
|
||||
{
|
||||
//Item is one magazine
|
||||
_item = createVehicle ["WeaponHolder", _iPos, [], _radius, "CAN_COLLIDE"];
|
||||
_item addMagazineCargoGlobal [_iItem,1];
|
||||
};
|
||||
|
||||
case "weaponnomags":
|
||||
{
|
||||
//do nothing for now
|
||||
};
|
||||
case "backpack":
|
||||
{
|
||||
//do nothing for now
|
||||
};
|
||||
case "object":
|
||||
{
|
||||
//do nothing for now
|
||||
};
|
||||
};
|
||||
if (!isNull(_item)) then{
|
||||
if ((count _iPos) > 2) then{
|
||||
_item setPosATL _iPos;
|
||||
};
|
||||
};
|
||||
|
||||
_item
|
||||
@@ -37,8 +37,8 @@ if (local _unit) then {
|
||||
_unit setHit [_selection, _total];
|
||||
|
||||
if (!isServer) then {
|
||||
PVDZ_veh_Save = [_unit,"damage"];
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
PVDZE_veh_Update = [_unit,"damage"];
|
||||
publicVariableServer "PVDZE_veh_Update";
|
||||
} else {
|
||||
[_unit, "damage"] call server_updateObject;
|
||||
};
|
||||
@@ -47,8 +47,8 @@ if (local _unit) then {
|
||||
//if ( (count _this > 5) AND {(_this select 5)}) then {
|
||||
// vehicle is not local to this client, ask the client which vehicle is local to set damage
|
||||
//_this resize 5; // delete "broadcast" boolean
|
||||
PVDZ_send = [_unit,"VehHandleDam",_this];
|
||||
publicVariableServer "PVDZ_send";
|
||||
PVDZE_send = [_unit,"VehHandleDam",_this];
|
||||
publicVariableServer "PVDZE_send";
|
||||
//};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
private["_unit","_hitPoints","_selection","_killer"];
|
||||
|
||||
_unit = _this select 0;
|
||||
//_killer = _this select 1;
|
||||
_killer = _this select 1;
|
||||
|
||||
_hitPoints = _unit call vehicle_getHitpoints;
|
||||
{
|
||||
_selection = getText (configFile >> "CfgVehicles" >> (typeof _unit) >> "HitPoints" >> _x >> "name");
|
||||
_unit setVariable [_selection, 1, true];
|
||||
} count _hitPoints;
|
||||
|
||||
// ask server to set global damage to 1, save to the hive
|
||||
if (local _unit) then {
|
||||
if (isServer) then {
|
||||
[_unit, "killed"] call server_updateObject;
|
||||
if (isServer) then {
|
||||
[_unit, "killed"] call server_updateObject;
|
||||
} else {
|
||||
if (DZE_Debug_Damage && ((!isPlayer _unit) || ((isPlayer _unit) && (vehicle _unit != _unit) && (_unit != _killer)))) then {
|
||||
PVDZE_veh_Update = [_unit, "killed",_killer];
|
||||
} else {
|
||||
PVDZ_veh_Save = [_unit, "killed"];
|
||||
publicVariableServer "PVDZ_veh_Save";
|
||||
PVDZE_veh_Update = [_unit, "killed"];
|
||||
};
|
||||
publicVariableServer "PVDZE_veh_Update";
|
||||
};
|
||||
|
||||
// everyone removes their EH for this vehicle
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/***********************************************************
|
||||
ASSIGN DAMAGE TO A UNIT
|
||||
- Function Vehicle_HandleDamage
|
||||
- [unit, selectionName, damage, source, projectile] call Vehicle_HandleDamage;
|
||||
************************************************************/
|
||||
private["_unit","_selection","_strH","_total","_damage","_needUpdate"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_selection = _this select 1;
|
||||
_total = _this select 2;
|
||||
|
||||
if (_selection != "") then {
|
||||
_strH = "hit_" + _selection;
|
||||
} else {
|
||||
_strH = "totalDmg";
|
||||
};
|
||||
|
||||
if (_total >= 0.98) then {
|
||||
_total = 1.0;
|
||||
};
|
||||
|
||||
if (local _unit) then {
|
||||
if (_total > 0) then {
|
||||
|
||||
_unit setVariable [_strH, _total, true];
|
||||
_unit setHit [_selection, _total];
|
||||
|
||||
if (isServer) then {
|
||||
[_unit, "damage"] call server_updateObject;
|
||||
} else {
|
||||
PVDZE_veh_Update = [_unit,"damage"];
|
||||
publicVariableServer "PVDZE_veh_Update";
|
||||
};
|
||||
};
|
||||
} else {
|
||||
// vehicle is not local to this client, ask the client which vehicle is local to set damage
|
||||
/* PVS/PVC - Skaronator */
|
||||
PVDZE_send = [_unit,"VehHandleDam",_this];
|
||||
publicVariableServer "PVDZE_send";
|
||||
};
|
||||
|
||||
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part
|
||||
_total
|
||||
@@ -1,29 +0,0 @@
|
||||
private["_unit","_hitPoints","_selection","_killer"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_killer = _this select 1;
|
||||
|
||||
_hitPoints = _unit call vehicle_getHitpoints;
|
||||
{
|
||||
_selection = getText (configFile >> "CfgVehicles" >> (typeof _unit) >> "HitPoints" >> _x >> "name");
|
||||
_unit setVariable [_selection, 1, true];
|
||||
} count _hitPoints;
|
||||
|
||||
//["PVDZE_veh_Update",[_unit, "damage"]] call callRpcProcedure;
|
||||
if (isServer) then {
|
||||
[_unit, "killed"] call server_updateObject;
|
||||
} else {
|
||||
if (DZE_Debug_Damage && ((!isPlayer _unit) || ((isPlayer _unit) && (vehicle _unit != _unit) && (_unit != _killer)))) then {
|
||||
PVDZE_veh_Update = [_unit, "killed",_killer];
|
||||
_killerVeh = if (vehicle _killer != _killer) then { format["[KILLER IN VEHICLE %1 OF TYPE %2]", (vehicle _killer), (typeOf (vehicle _killer))]; } else {""};
|
||||
_name = if (alive _killer) then { name _killer; } else { format["OBJECT %1", _killer]; };
|
||||
} else {
|
||||
PVDZE_veh_Update = [_unit, "killed"];
|
||||
};
|
||||
publicVariableServer "PVDZE_veh_Update";
|
||||
};
|
||||
|
||||
_unit removeAllEventHandlers "HandleDamage";
|
||||
_unit removeAllEventHandlers "Killed";
|
||||
_unit removeAllEventHandlers "GetIn";
|
||||
_unit removeAllEventHandlers "GetOut";
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,6 @@
|
||||
//"usecMorphine" addPublicVariableEventHandler {(_this select 1) call player_medMorphine};
|
||||
//"usecPainK" addPublicVariableEventHandler {(_this select 1) call player_medPainkiller};
|
||||
"PVDZE_plr_Hit" addPublicVariableEventHandler {(_this select 1) call fnc_usec_damageHandler};
|
||||
"PVDZE_plr_HitV" addPublicVariableEventHandler {(_this select 1) call fnc_usec_damageVehicle};
|
||||
//"usecBreakLegs" addPublicVariableEventHandler {(_this select 1) call player_breaklegs};
|
||||
"PVDZ_hlt_Bleed" addPublicVariableEventHandler {(_this select 1) spawn fnc_usec_damageBleed};
|
||||
"PVDZ_veh_SF" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleRepair}; // repair a part from a vehicle
|
||||
@@ -23,13 +22,11 @@
|
||||
"PVDZE_veh_Lock" addPublicVariableEventHandler {(_this select 1) spawn local_lockUnlock};
|
||||
"PVCDZE_obj_GutBody" addPublicVariableEventHandler {(_this select 1) spawn local_gutObject};
|
||||
"PVDZE_plr_GutBodyZ" addPublicVariableEventHandler {(_this select 1) spawn local_gutObjectZ};
|
||||
"PVDZE_plr_DelLocal" addPublicVariableEventHandler {(_this select 1) call object_delLocal};
|
||||
"PVDZE_veh_Init" addPublicVariableEventHandler {(_this select 1) call fnc_veh_ResetEH};
|
||||
//"PVDZE_plr_HumanityChange" addPublicVariableEventHandler {(_this select 1) spawn player_humanityChange};
|
||||
"PVDZE_serverObjectMonitor" addPublicVariableEventHandler {PVDZE_serverObjectMonitor = dayz_safety};
|
||||
/* PVS/PVC - Skaronator */
|
||||
"PVCDZE_veh_SH" addPublicVariableEventHandler {(_this select 1) call vehicle_handleDamage}; // set damage to vehicle part
|
||||
"PVCDZE_veh_SF" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleDam}; // set damage to vehicle part
|
||||
"PVCDZE_veh_SH" addPublicVariableEventHandler {(_this select 1) call fnc_veh_handleDam}; // set damage to vehicle part
|
||||
|
||||
//reset OpenTarget timer
|
||||
"PVCDZE_OpenTarget_Reset" addPublicVariableEventHandler { OpenTarget_Time = diag_tickTime; };
|
||||
@@ -335,10 +332,9 @@ if (!isDedicated) then {
|
||||
};
|
||||
"PVDZE_plr_SetSaveTime" addPublicVariableEventHandler {DZE_SaveTime = (_this select 1)};
|
||||
"PVDZE_obj_RoadFlare" addPublicVariableEventHandler {(_this select 1) spawn object_roadFlare};
|
||||
"PVDZE_plr_Morph2" addPublicVariableEventHandler {(_this select 1) call player_serverModelChange};
|
||||
"PVDZE_plr_Morph" addPublicVariableEventHandler {(_this select 1) call server_switchPlayer};
|
||||
"PVDZE_obj_Fire" addPublicVariableEventHandler {nulexp=(_this select 1) spawn BIS_Effects_Burn};
|
||||
"PVDZE_plr_FriendRQ" addPublicVariableEventHandler {(_this select 1) call player_tagFriendlyMsg};
|
||||
"PVDZE_plr_FriendRQ" addPublicVariableEventHandler {if (player == ((_this select 1) select 0)) then {cutText[localize "str_epoch_player_2","PLAIN DOWN"];};};
|
||||
"PVDZ_drg_RaDrag" addPublicVariableEventHandler {(_this select 1) execVM "\z\addons\dayz_code\medical\publicEH\animDrag.sqf"};
|
||||
"PVDZ_dayzFlies" addPublicVariableEventHandler {(_this select 1) call spawn_flies};
|
||||
//Medical
|
||||
@@ -350,8 +346,6 @@ if (!isDedicated) then {
|
||||
"PVCDZ_hlt_PainK" addPublicVariableEventHandler {(_this select 1) call player_medPainkiller};
|
||||
"PVCDZ_hlt_AntiB" addPublicVariableEventHandler {(_this select 1) call player_medAntiBiotics};
|
||||
|
||||
// "PVDZE_obj_Debris" addPublicVariableEventHandler {(_this select 1) call local_roadDebris};
|
||||
|
||||
"norrnRaDrag" addPublicVariableEventHandler {(_this select 1) execVM "\z\addons\dayz_code\medical\publicEH\animDrag.sqf"};
|
||||
"norrnRnoAnim" addPublicVariableEventHandler {(_this select 1) execVM "\z\addons\dayz_code\medical\publicEH\noAnim.sqf"};
|
||||
"PVCDZ_plr_Humanity" addPublicVariableEventHandler {(_this select 1) spawn player_humanityChange};
|
||||
|
||||
Reference in New Issue
Block a user