diff --git a/SQF/dayz_code/compile/building_spawnZombies.sqf b/SQF/dayz_code/compile/building_spawnZombies.sqf index 3e8fa128a..651ba3abf 100644 --- a/SQF/dayz_code/compile/building_spawnZombies.sqf +++ b/SQF/dayz_code/compile/building_spawnZombies.sqf @@ -64,7 +64,6 @@ if (_canLoot ) then { }; } forEach _positions; }; - //dayz_buildingMonitor set [count dayz_buildingMonitor,_obj]; }; }; diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index cad35bdb8..c60c5c75c 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -137,7 +137,6 @@ deleteGroup _myGroup; _body setVariable["combattimeout", 0, true]; //due to a cleanup issue with effects this has been disabled remember to look at the cleanup before adding it back. -//[_body] call spawn_flies; //dayzFlies = player; //publicVariable "dayzFlies"; uiSleep 2; diff --git a/SQF/dayz_code/compile/spawn_flies.sqf b/SQF/dayz_code/compile/spawn_flies.sqf deleted file mode 100644 index f727c3bf2..000000000 --- a/SQF/dayz_code/compile/spawn_flies.sqf +++ /dev/null @@ -1,6 +0,0 @@ -private["_body","_id","_position"]; -_body = _this select 0; -_position = getPosATL _body; -[_position,0.1,1.5] call bis_fnc_flies; -//_id setVariable ["body",_body]; -//dayz_flyMonitor set[count dayz_flyMonitor, _id]; \ No newline at end of file diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index 3303be1c9..48082a274 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -15,7 +15,6 @@ if (!isDedicated) then { fn_dropItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dropItem.sqf"; //fnc to drop items. _item call fn_dropItem; BIS_Effects_Burn = compile preprocessFile "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf"; - spawn_flies = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\spawn_flies.sqf"; player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them player_attackdelay = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_attackfsmdelay.sqf"; diff --git a/SQF/dayz_code/init/publicEH.sqf b/SQF/dayz_code/init/publicEH.sqf index 0aa6a1cb7..41923ba94 100644 --- a/SQF/dayz_code/init/publicEH.sqf +++ b/SQF/dayz_code/init/publicEH.sqf @@ -267,7 +267,6 @@ if (!isDedicated) then { "PVDZ_obj_RoadFlare" addPublicVariableEventHandler {(_this select 1) spawn object_roadFlare}; "PVDZ_drg_RaDrag" addPublicVariableEventHandler {(_this select 1) execVM "\z\addons\dayz_code\medical\publicEH\animDrag.sqf"}; "PVDZ_obj_Fire" addPublicVariableEventHandler {(_this select 1) spawn BIS_Effects_Burn}; - "PVDZ_dayzFlies" addPublicVariableEventHandler {(_this select 1) call spawn_flies}; "PVCDZ_plr_Humanity" addPublicVariableEventHandler {(_this select 1) spawn player_humanityChange}; "PVDZE_plr_FriendRQ" addPublicVariableEventHandler {if (player == ((_this select 1) select 0)) then {localize "str_epoch_player_2" call dayz_rollingMessages;};}; diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index ac4349d46..9bf2cdb5b 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -582,10 +582,6 @@ if (isServer) then { }; if (!isDedicated) then { - dayz_buildingMonitor = []; //Buildings to check - dayz_bodyMonitor = []; - dayz_flyMonitor = []; - dayz_zedMonitor = []; dayz_buildingBubbleMonitor = []; dayz_baseTypes = if (DZE_MissionLootTable) then {getArray (missionConfigFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass")} else {getArray (configFile >> "CfgBuildingLoot" >> "Default" >> "zombieClass")}; diff --git a/SQF/dayz_code/system/animal_agent.fsm b/SQF/dayz_code/system/animal_agent.fsm index a2ee5037a..30e20f9ca 100644 --- a/SQF/dayz_code/system/animal_agent.fsm +++ b/SQF/dayz_code/system/animal_agent.fsm @@ -112,8 +112,6 @@ class FSM init = /*%FSM*/"if (!_isTamed) then {" \n " if (!_isSomeone) then {" \n " deleteVehicle _agent;" \n - " } else {" \n - " dayz_bodyMonitor set [count dayz_bodyMonitor,_agent];" \n " };" \n "};"/*%FSM*/; precondition = /*%FSM*/""/*%FSM*/; diff --git a/SQF/dayz_server/compile/fa_antiwallhack.sqf b/SQF/dayz_server/compile/fa_antiwallhack.sqf deleted file mode 100644 index a04de5a96..000000000 --- a/SQF/dayz_server/compile/fa_antiwallhack.sqf +++ /dev/null @@ -1,96 +0,0 @@ -/* - Created exclusively for ArmA2:OA - DayZMod. - Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com) -*/ - -private ["_antiwallhack","_houseType","_houseList","_tmp","_patchList","_house","_o","_nbhouses","_nbpatchs","_pos"]; - -_antiwallhack=[ - [ - "Land_A_Hospital", // building type - [ - [6414.05,2760.21,0], [6817.3,2702.03,0], [10517.9,2287.55,0], [11956.7,9120.21,0] // optional precomputed building positions - ], - [ - [17.6182,-1.8418,3.23178,"Land_CncBlock_D",0],[15.7192,-1.84277,3.22177,"Land_CncBlock_D",0],[-17.4,-0.38,-4.25,"Land_CncBlock_D",90],[-17.4,2.25,-4.25,"Land_CncBlock_D",90],[-17.4,4.22,-4.25,"Land_CncBlock_D",90],[-17.42,-3.55,-7.63,"Land_CncBlock_D",90],[-13.27,2.83,-4.25,"Fort_RazorWire",180],[-13.23,4.28,-4.25,"Fort_RazorWire",180],[-16.81,1.38,-4.25,"Hedgehog",85],[-16.82,-0.6,-4.25,"Hedgehog",90],[-7.45,4.26,-4.25,"Fort_RazorWire",180] // what to add on building (coordinates/type/angle) - ] - ], - [ - "Land_HouseB_Tenement", - [ - [6855.66,2496.78,0] - ], - [ - [-9.66602,7.66602,18.3236,"Fort_RazorWire",0], [-1.30273,7.66602,18.3236,"Fort_RazorWire",0], [-9.66602,0.814453,18.3236,"Fort_RazorWire",0], [-1.30273,0.814453,18.3236,"Fort_RazorWire",0], [-15.0029,4.18359,18.3236,"Fort_RazorWire",90], [3.62109,3.95117,18.3236,"Fort_RazorWire",270], [-7.42,8.15,-20.57,"Fort_RazorWire",180], [-4.67,9.92,-21.55,"Fort_RazorWire",180] - ] - ], - [ - "Land_A_Office02", - [[6552.96,2807.47,0], [7036.05,2526.13,0], [10028.6,1832.52,0]], - [ - [2.17627, 1.98828, 5.31387, "Land_CncBlock_D" , 0], [2.85547, 3.02246, 5.38394, "Land_CncBlock_D" , 0], [-15.7412, 3.98145, 5.38394, "Land_CncBlock_D" , 270], [-20.2915, 4.01563, 5.35391, "Land_CncBlock_D" , 90], [-20.291, 1.22559, 5.36392, "Land_CncBlock_D" , 90], [-19.0527, -0.318359, 5.38394, "Land_CncBlock_D" , 0], [-16.6426, -0.321289, 5.38394, "Land_CncBlock_D" , 0], [-15.4575, 1.01563, 5.35391, "Land_CncBlock_D" , 270], [-16.7344, 5.30762, 5.38394, "Land_CncBlock_D" , 180], [-19.0361, 5.30859, 5.38394, "Land_CncBlock_D" , 180] - ] - ], - [ - "Land_A_Office01", - [[3804.1,8924.83,-0.15], [10481.5,2358.45,0], [12742.4,9593.23,0]], - [ - [0.837891, -1.13086, 5.93463, "Land_CncBlock_D", 90], [2.30957, -2.65918, 6.02472, "Land_CncBlock_D", 0], [3.68457, -1.2168, 6.06476, "Land_CncBlock_D", 270], [2.36914, -1.09863, 6.01471, "Land_CncBlock_D", 225], [2.4043, 0.155273, 6.14484, "Land_CncBlock_D", 180], [2.18359, -1.36035, 6.01471, "Land_CncBlock_D", 135] - ] - ], - [ - "Land_A_statue01", - [[3796.36,8838.01,0], [6531.07,2804.09,0], [6811.04,2455.16,0]], - [ - [1.50049,2.14844,-3.6926,"Land_CncBlock_D",180], [2.86523,0.0966797,-3.69263,"Land_CncBlock_D",270], [1.38232,-2.17578,-3.69305,"Land_CncBlock_D",0] - ] - ], - [ - "Land_Barn_Metal", - [[2860.45,9746.05,0.682495],[4565.07,4528.81,0.199997], [6339.55,7693.31,0.0499878],[11329.8,6646.15,0.331261]], - [ - [7.02,17.13,-5.74,"Misc_TyreHeap",36], [-5.4,7.85,-5.44,"SKODAWreck",181], [-7.5,8.87,-5.44,"SKODAWreck",181], [-0.99,-9.31,-5.44,"UralWreck",320], - [8.33,8.43,-5.44,"datsun01Wreck",176], [4.13,10.16,-5.44,"SKODAWreck",176], [-7.21,-15.37,-5.44,"SKODAWreck",8], [3.3,15.19,-5.44,"UralWreck",210], - [-5.76,12.87,-5.44,"SKODAWreck",150], [6.76,-6.86,-5.54,"LADAWreck",85], [-0.42,-21.9,-5.75,"Misc_TyreHeap",95] - ] - ] -]; - -_nbhouses = 0; -_nbpatchs = 0; -{ - _houseType = _x select 0; - _houseList = _x select 1; - if (count _houseList == 0) then { - _houseList = dayz_centerMarker nearObjects [_houseType, 20000]; - } - else { - _tmp = []; - { - _tmp set [count _tmp, _x nearestObject _houseType]; - } forEach _houseList; - _houseList = _tmp; - }; - _patchList = _x select 2; - { - _nbhouses = _nbhouses +1; - _house = _x; - { - _pos = +(_x); - _pos resize 3; - _pos = _house modelToWorld _pos; - _o = (_x select 3) createVehicle [0,0,0]; - _o setDir ((getDir _house)+(_x select 4)); - _o setPosATL _pos; - diag_log [ typeOf _o, getPosATL _o, getDir _o, 0, nil]; - _nbpatchs = _nbpatchs +1; - } forEach _patchList; - //diag_log format["Found building %1 at %2", _houseType, getPosATL _house ]; - } forEach _houseList; -} forEach _antiwallhack; - -diag_log(format["%1: %2 buildings patched with %3 objects", __FILE__, _nbhouses, _nbpatchs]); - - - - diff --git a/SQF/dayz_server/compile/fa_fuelConsumption.sqf b/SQF/dayz_server/compile/fa_fuelConsumption.sqf deleted file mode 100644 index 036d071ca..000000000 --- a/SQF/dayz_server/compile/fa_fuelConsumption.sqf +++ /dev/null @@ -1,18 +0,0 @@ -/* - Not Used Test System -*/ - - -//_vehicle = _this select 0; -//_engineState = _this select 1; - -_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf (_this select 0)) >> "fuelconsumptionrate"); - -if (_this select 1) then { - //[_vehicle, _rate] spawn { - while {isEngineOn (_this select 0)} do { - (_this select 0) setFuel ( Fuel (_this select 0) - (_this select 1)); - sleep 1; - }; - //}; -}; \ No newline at end of file diff --git a/SQF/dayz_server/compile/fa_hiveMaintenance.hpp b/SQF/dayz_server/compile/fa_hiveMaintenance.hpp deleted file mode 100644 index 3f631f6e4..000000000 --- a/SQF/dayz_server/compile/fa_hiveMaintenance.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - Created exclusively for ArmA2:OA - DayZMod. - Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com) -*/ - -//// TENTS CHECK //// - -// Proceed to empty tents check: extra empty tents will be ignored (tents won't be created on map) -// comment this out if you don't want any check -//#define EMPTY_TENTS_CHECK - -// Max number of empty tents -#define EMPTY_TENTS_GLOBAL_LIMIT 100 - -// Keep a least this number of empty tents per user -#define EMPTY_TENTS_USER_LIMIT 3 - - - -//// OUT-OF-MAP CHECK //// - -// Move out-of-map tents and other crafted/installed objects next to map boundary. -//#define OBJECTS_FIX_OUTOFMAP - -// Move out-of-map vehicle next to map boundary. -//#define VEH_MAINTENANCE_FIX_OUTOFMAP - -// Move out-of-map player next to map boundary during playerSetup -//#define PLAYERS_FIX_OUTOFMAP - - - -//// VEHICLE MAINTENANCE ///// - -// Ignore (don't create on map) vehicles not decribed in Cfg file, or outnumbered ones -//#define VEH_MAINTENANCE_IGNORE_UNKNOWN - -// Add missing vehicles, as described in Cfg file. Respawn damaged vehicles. -//#define VEH_MAINTENANCE_ADD_MISSING - -// Don't look for a suitable place anywhere on map if current place is not safe -#define VEH_MAINTENANCE_DONT_BE_SMART - -// Damage the vehicle for 1 startup over 5 -// don't define if you don't want any damage -//#define VEH_MAINTENANCE_ROTTEN_AT_STARTUP 5 - -// How the damage is computed. Here, a 0% damaged vehicle would be respawned after 100 restarts -#define VEH_MAINTENANCE_ROTTEN_LOGIC (_damage * 1.04 + 0.03) - -// How initial fuel level is set when a vehicle is created/spawned -#define VEH_MAINTENANCE_SPAWN_FUEL_LOGIC (0.1 + floor(random 3) / 10) - - - - -// where the config is described -#define CONFIGBASE_VEHMAINTENANCE configFile >> "CfgPatches" >> "vehMaint" diff --git a/SQF/dayz_server/compile/fa_hiveMaintenance.sqf b/SQF/dayz_server/compile/fa_hiveMaintenance.sqf deleted file mode 100644 index 9c4335dc7..000000000 --- a/SQF/dayz_server/compile/fa_hiveMaintenance.sqf +++ /dev/null @@ -1,382 +0,0 @@ -/* - Created exclusively for ArmA2:OA - DayZMod. - Please request permission to use/alter/distribute from project leader (R4Z0R49) AND the author (facoptere@gmail.com) -*/ - -#include "fa_hiveMaintenance.hpp" - -// coor2str: convert position to a GPS coordinates -fa_coor2str = { - private["_pos","_res","_nearestCity","_town"]; - - _pos = +(_this); - if (count _pos < 1) then { _pos = [0,0]; } - else { if (count _pos < 2) then { _pos = [_pos select 0,0]; }; - }; - _nearestCity = nearestLocations [_pos, ["NameCityCapital","NameCity","NameVillage","NameLocal"],1000]; - _town = "Wilderness"; - if (count _nearestCity > 0) then {_town = text (_nearestCity select 0)}; - _res = format["%1 [%2:%3]", _town, round((_pos select 0)/100), round((15360-(_pos select 1))/100)]; - - _res -}; - -// print vehicle OID and name. if OID is unknown, it should be an hacked vehicle so print hacker PID. -fa_veh2str = { - private["_res","_oid", "_type"]; - - _res = "anything"; - if (!isNil "_this") then { - _oid = _this getVariable ["ObjectID", nil]; - if (isNil "_oid" OR {(_oid == "")}) then { - _oid = "Hacked vehicle owned by PID#" + str(owner _this); - } - else { - _oid = "OID#" + _oid; - }; - _type = getText(configFile >> "CfgVehicles" >> (typeOf _this) >> "displayName"); - if (_type == "") then { _type = typeOf _this; }; - _res = format["%1(%2)", _oid, _type ]; - }; - - _res -}; - -// print player player PID and name. If name unknown then print UID. -fa_plr2str = { - private["_x","_res","_name"]; - _x = _this; - _res = "nobody"; - if (!isNil "_x") then { - _name = _x getVariable ["bodyName", nil]; - if ((isNil "_name" OR {(_name == "")}) AND ({alive _x})) then { _name = name _x; }; - if (isNil "_name" OR {(_name == "")}) then { _name = "UID#"+(getPlayerUID _x); }; - _res = format["PID#%1(%2)", owner _x, _name ]; - }; - _res -}; - - -// isoutofmap: return true if position is out of map -fa_isoutofmap = { - private ["_SWcorner","_NEcorner"]; - _SWcorner = getArray(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "SWcorner"); - _NEcorner = getArray(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "NEcorner"); - (!((((_this select 0 >= _SWcorner select 0) AND {(_this select 0 <= _NEcorner select 0)}) - AND {(_this select 1 >= _SWcorner select 1)}) AND {(_this select 1 <= _NEcorner select 1)})) -}; - -// spawninventory: draw preexisting loot in the vehicle. helicrash loot type is taken here + parts taken as arg -fa_spawninventory = { - private["_partType","_partChance","_lootWeight","_config","_itemType","_itemChance","_weights", - "_index","_y","_partWeight","_spawnType","_spawnChance","_inventory","_weaponType","_weaponQty" ]; - - _partType = _this select 0; - _partChance = _this select 1; - _config = configFile >> "CfgLoot" >> "Buildings" >> "HeliCrash"; - // append parts to loot item - _itemType = (getArray (_config >> "itemType")); - { _itemType set [count _itemType, [_x,"object"]] } forEach _partType; - _itemChance = getArray (_config >> "itemChance"); - //diag_log (format["FACO _itemType:%1 _itemChance:%2", _itemType, _itemChance]); - // _partWeight : sum of weights of parts list - _partWeight = 0; { _partWeight = _partWeight + _x; } forEach _partChance; - // _lootWeight : sum of weights of loot list - _lootWeight = 0; { _lootWeight = _lootWeight + _x; } forEach _itemChance; - // multiply parts weight so that parts have same chance to be chosen as regular loot - // and append parts chance to loot item weight array - { _itemChance set [count _itemChance, _x * _lootWeight / _partWeight]; } forEach _partChance; - // _partWeight : now, number of item to be chosen - _partWeight = ceil(random(_partWeight)); - // lets choose the inventory - _spawnType = []; - _spawnQty = []; - _weaponType = []; - _weaponQty = []; - _weights = [_itemType,_itemChance] call fnc_buildWeightedArray; - for "_x" from 0 to _partWeight do { - _index = _weights call BIS_fnc_selectRandom; - if (_index < count _itemType) then { - _y=(_itemType select _index) select 0; - if (_y != "") then { - if (_y isKindOf "Pistol" OR _y isKindOf "RifleCore" OR _y isKindOf "Binocular") then { - _weaponType set [count _weaponType, _y ]; - _weaponType set [count _weaponType, 1]; - } - else { - _spawnType set [count _spawnType, _y ]; - _spawnQty set [count _spawnQty, 1]; - }; - }; - }; - }; - _inventory = [[_weaponType,_weaponQty],[_spawnType,_spawnQty],[[],[]]]; - _inventory -}; - -// populateCargo: add item and quantity to the 3 cargos (magazines,weapons,backpack) of an unit -fa_populateCargo = { - private["_entity","_config","_magItemTypes","_magItemQtys","_i","_inventory"]; - _entity = _this select 0; - _inventory = _this select 1; - - clearWeaponCargoGlobal _entity; - clearMagazineCargoGlobal _entity; - clearBackpackCargoGlobal _entity; - _config = ["CfgWeapons", "CfgMagazines", "CfgVehicles" ]; - { - _magItemTypes = _x select 0; - _magItemQtys = _x select 1; - _i = _forEachIndex; - { - if (_x == "Crossbow") then { _x = "Crossbow_DZ" }; // Convert Crossbow to Crossbow_DZ - if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow - if (_x == "ItemBloodbag") then { _x = "bloodBagONEG" }; // Convert ItemBloodbag into universal blood type/rh bag - // Convert to DayZ Weapons - if (_x == "DMR") then { _x = "DMR_DZ" }; - //if (_x == "M14_EP1") then { _x = "M14_DZ" }; - if (_x == "SVD") then { _x = "SVD_DZ" }; - if (_x == "SVD_CAMO") then { _x = "SVD_CAMO_DZ" }; - if (isClass(configFile >> (_config select _i) >> _x) && - getNumber(configFile >> (_config select _i) >> _x >> "stopThis") != 1) then { - if (_forEachIndex < count _magItemQtys) then { - switch (_i) do { - case 0: { _entity addWeaponCargoGlobal [_x,(_magItemQtys select _forEachIndex)]; }; - case 1: { _entity addMagazineCargoGlobal [_x,(_magItemQtys select _forEachIndex)]; }; - case 2: { _entity addBackpackCargoGlobal [_x,(_magItemQtys select _forEachIndex)]; }; - }; - }; - }; - } forEach _magItemTypes; - } forEach _inventory; -}; - - -// all damageable parts names defined in Legacy/dayz_vehicles/config.cpp, some of them commented. -// other damageables parts, defined in other CfgVehicles, are ignored. -dayZ_damageableParts = [ "motor", "sklo predni P", "sklo predni L", "karoserie", "palivo", "wheel_1_1_steering", "wheel_2_1_steering", "wheel_1_2_steering", "wheel_2_2_steering", "glass1", "glass2", "glass3", "glass4" -//, "glass5", "glass6", "door_fl", "door_rl", "door_fr", "door_rr" -]; - -// setDamagedParts: declare some damageable parts of a vehicle. Randomly set damage to 80% (very damaged) to some parts -// compute global damage of the vehicle -// return: global damage, "_this" is modified and should be _hitpoints array from server_monitor -fa_setDamagedParts = { - private ["_part_damage", "_part_name", "_damage", "_hitpoints"]; - _damage = 0; - _hitpoints = _this; - { - _part_damage = 0.05; // don't put 0, otherwise server_updateObject will think it's repaired - if (random(3)<1) then { _part_damage = 0.80; }; - _part_name = getText (configFile >> "CfgVehicles" >> (typeOf _entity) >> "HitPoints" >> _x >> "name"); - if (_part_name IN dayZ_damageableParts) then { - _damage = _damage + _part_damage; - _hitpoints set [count _hitpoints, [ _part_name, _part_damage ]]; - }; - } forEach (_entity call vehicle_getHitpoints); - _damage = _damage / (1 + (count _hitpoints)); // avoid DIV0 - - _damage -}; - -fa_tentEmpty = { - ( (count _this == 0) || { - (count ((_this select 0) select 0) == 0) && - (count ((_this select 1) select 0) == 0) && - (count ((_this select 2) select 0) == 0) - }) -}; - -// ignore empty tents from array of objects fetched from hive -fa_removeExtraTents = { - private ["_emptytenttotal", "_idx", "_intentory", "_k", "_maxEmptyTents", "_allowedEmptyTents", "_ownerID", "_stall", "_tentcur", "_tentidx", "_tentowner", "_y", "_z", "_myArray"]; - - _myArray = _this select 0; - _maxEmptyTents = _this select 1; - _allowedEmptyTents = _this select 2; - - _tentowner=[]; - _tentidx=[]; - _tentcur=[]; - _emptytenttotal=0; - - { - if ((_x select 2) == "TentStorage") then { - _idx=_forEachIndex; - _ownerID = _x select 3; - if (!(_ownerID IN _tentowner)) then { - _tentidx set [count _tentidx, []]; - _tentcur set [count _tentcur, 0]; - _tentowner set [count _tentowner, _ownerID]; - }; - _intentory = (_x select 5); - if (_intentory call fa_tentEmpty) then { - { - if (_x == _ownerID) then { - (_tentidx select _forEachIndex) set [count (_tentidx select _forEachIndex), _idx]; - _emptytenttotal = _emptytenttotal + 1; - }; - } forEach _tentowner; - }; - }; - } forEach _myArray; - diag_log (format [ "fa_removeExtraTents: Empty tents: %1, would like less than %2.", - _emptytenttotal, - _maxEmptyTents - ]); - if (_emptytenttotal > _maxEmptyTents) then { - for [{_k = _emptytenttotal / 2}, {_k >= 2}, {_k = _k / 2}] do { - _stall = 0; - while {_emptytenttotal > _maxEmptyTents && _stall == 0} do { - _stall = 1; - for [{_x = (count _tentidx) - 1}, {_x >= 0 && _emptytenttotal >= _maxEmptyTents}, {_x = _x - 1}] do { - _y = _tentidx select _x; - _z = _tentcur select _x; - if (_z < (count _y) -_allowedEmptyTents + 2 - _k) then { - _idx = _myArray select (_y select _z); - /*diag_log (format ["fa_removeExtraTents: will remove Tent ID=%1, owner=%2", - _idx select 1, - _idx select 3 - ]);*/ - _idx set [ 8, 1 ]; // Set damage to 100% - _emptytenttotal = _emptytenttotal - 1; - _tentcur set [_x, _z + 1]; - _stall=0; - }; - }; - _z =_z + 1; - }; - }; - }; -}; - -// check that vehicles list from the Hive has the right count of each vehicle -// if some vehicles are missing, add them to the array -// if a vehicle is illegal or outnumbered, delete it -fa_checkVehicles = { - private ["_vehcat", "_myArray", "_y", "_j","_type", "_count", "_idKey" ]; - _myArray = _this select 0; - - // populate catalogue by browsing configFile - _vehcat = []; - _list = configFile >> "CfgPatches" >> "vehMaint"; - for "_x" from 0 to (count _list - 1) do { - _class = configname (_list select _x); - _qty = getNumber(CONFIGBASE_VEHMAINTENANCE >> _class >> "quantity"); - if (_qty > 0) then { - _vehcat set [count _vehcat, [_class, _qty]]; -// diag_log(format["class:%1 val:%2", _class, _qty]); - }; - }; - - // check the amount of vehicles of each kind - { - _type = _x select 2; - for "_j" from 0 to (count _vehcat-1) do { - if (_type == ((_vehcat select _j) select 0)) then { - _count = ((_vehcat select _j) select 1); - if (_count > 0) then { - (_vehcat select _j) set [1, (_count-1)]; - if ((_x select 8) >= 1) then { -#ifdef VEH_MAINTENANCE_ADD_MISSING - (_myArray select _forEachIndex) set [8, 0.9] ; // damage = 0.9 so this veh will me respawned - diag_log (format["fa_checkVehicles: recycling vehicle class=%1, oid=%2", _x select 2, _x select 1]); -#endif - }; - } -#ifdef VEH_MAINTENANCE_IGNORE_UNKNOWN - else { - (_myArray select _forEachIndex) set [8,2]; // damage=2, so this veh will be deleted - diag_log (format["fa_checkVehicles: skipping vehicle class=%1, oid=%2", - _x select 2, _x select 1]); - } -#endif - ;_j = 999999; // break; - }; - }; - } foreach _myArray; - -#ifdef VEH_MAINTENANCE_ADD_MISSING - // create missing vehicles of each kind. - { - for "_y" from 1 to (_x select 1) do { - // create a new one at the end of _myArray list - _type = (_x select 0); - _idKey = format["%1%2",48,60000+floor(random 10000)]; - // "1" as Character ID since if I put "0" the vehicle is not stored in hive (since january 2013) - _myArray set [count _myArray, ["CREATED",_idKey,_type,"1",[0,[0,0,0]],[[[],[]],[[],[]],[[],[]]],[],0,0.9]]; - diag_log (format["fa_checkVehicles: inserting in HIVE: vehicle class=%1, chosen oid=%2", _type, _idKey]); - }; - } foreach _vehcat; -#endif -}; - -// move object to map boundary if it's out of map -fa_staywithus = { - - private["_a","_dir","_px","_py","_cx","_cy","_k", "_SWcorner", "_NEcorner"]; - - _dir = +(_this select 0); // current position of player / vehicle - _a = +(_this select 1); // current position of player / vehicle - - _SWcorner = getArray(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "SWcorner"); - _NEcorner = getArray(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "NEcorner"); - - _a = ASLtoATL [_a select 0, _a select 1, 0]; - if ((((_a select 2) > 9) AND {(surfaceisWater _a)}) // entity in water and sea depth above 9 meters? - OR {(_a call fa_isoutofmap)}) then { // or entity is out of map? - // first : put object close to the map boundary, following an axis to the center of the map. - _px = _a select 0; - _py = _a select 1; - - _cx = (dayz_centerMarker select 0) - _px; if (_cx == 0) then { _cx = 0.00001; }; - _cy = (dayz_centerMarker select 1) - _py; if (_cy == 0) then { _cy = 0.00001; }; - if (_px <= (_SWcorner select 0)) then { _py = _py + (1 + (_SWcorner select 0) - _px) / _cx * _cy; _px = 1 + (_SWcorner select 0); }; - if (_py <= (_SWcorner select 1)) then { _px = _px + (1 + (_SWcorner select 1) - _py) / _cy * _cx; _py = 1 + (_SWcorner select 1); }; - if (_px >= (_NEcorner select 0)) then { _py = _py + ((_NEcorner select 0) - 1 - _px) / _cx * _cy; _px = (_NEcorner select 0) - 1; }; - if (_py >= (_NEcorner select 1)) then { _px = _px + ((_NEcorner select 1) - 1 - _py) / _cy * _cx; _py = (_NEcorner select 1) - 1; }; - // 2nd: compute the object direction, so that it heads toward the center of the map. - _dir = atan(_cx / _cy); - if (_cy < 0) then { _dir = _dir + 180; }; - - // 3rd: if the object is on shalow sea, make it virtually swim so that sea depth is below 9 meters. - _a = [_px,_py,0]; - for "_k" from 0 to 1 step 0.005 do { - _a = [_px + _cx * _k, _py + _cy * _k, 0]; -// if ((_k*200) mod 5 == 4) then { diag_log (format["fa_staywithus: a:%1 water:%2 zx:%3", _a, surfaceisWater _a, (getPosATL _o) select 2]); }; - if (surfaceisWater _a) then { - _a = ASLtoATL [_a select 0, _a select 1, 0]; - if (((_a select 2) < 9) AND{(!(_a call fa_isoutofmap))}) then { _k = 2; } - else { if ((_a select 2) < 30) then { _k = _k - 0.0045; };}; // slow down on the axis - } - else { - if (!(_a call fa_isoutofmap)) then { _k = 2; }; - }; - }; - /*diag_log (format["FACO out-of-map new pos:%1 direction:%2 in water:%3 out-of-map:%4 ", - (getPosATL _o) call fa_coor2str, - round(_dir), - surfaceisWater _a, - (if ([_a] call fa_isoutofmap == 1) then { true } else { false }) - ]);*/ - }; - - // cancel the change if it is too near original pos - if (([(_this select 1),_a] call BIS_fnc_distance2Dsqr) <= 30) then { - [_this select 0, +(_this select 1)] - } - else { - [ _dir, [_a select 0, _a select 1, 0]] - } -}; - -FNC_kindOf = { - _inherit = inheritsFrom _this; - _list = [configName _this]; - while { (configName _inherit) != "" } do { - _list set[count _list,configName _inherit]; - _inherit = inheritsFrom( _inherit ); - }; - _list -}; - diff --git a/SQF/dayz_server/compile/server_plantSpawner.sqf b/SQF/dayz_server/compile/server_plantSpawner.sqf index db77cbd9d..3e3505992 100644 --- a/SQF/dayz_server/compile/server_plantSpawner.sqf +++ b/SQF/dayz_server/compile/server_plantSpawner.sqf @@ -1,15 +1,7 @@ private ["_SWcorner","_NEcorner","_amount","_a","_b","_c"]; -#define CONFIGBASE_VEHMAINTENANCE configFile >> "CfgPatches" >> "vehMaint" - -if (toLower worldName == "chernarus") then { - _SWcorner = getArray(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "SWcorner"); - _NEcorner = getArray(CONFIGBASE_VEHMAINTENANCE >> (worldName) >> "NEcorner"); -} else { - // Not used, plant spawner is disabled on other maps for now, may add town generator and other coordinates later - _SWcorner = [0,1360]; - _NEcorner = [14400,13560]; -}; +_SWcorner = [0,1360]; +_NEcorner = [14400,13560]; _a = [(_SWcorner select 0), (_SWcorner select 1), (_NEcorner select 0) - (_SWcorner select 0), (_NEcorner select 1) - (_SWcorner select 1) ] call psrnd_init; _b = [ -15, -15, 30, 30 ] call psrnd_init; diff --git a/SQF/dayz_server/config.cpp b/SQF/dayz_server/config.cpp index b620ee90c..a8110fd52 100644 --- a/SQF/dayz_server/config.cpp +++ b/SQF/dayz_server/config.cpp @@ -5,78 +5,4 @@ class CfgPatches { requiredVersion = 0.1; requiredAddons[] = {"dayz_code"}; }; - - class vehMaint { - class CAWorld {}; - class Chernarus:CAWorld { - center[] = {7839,8414}; // x y - SWcorner[] = {0,1360}; - NEcorner[] = {14400,13560}; - spawnRadius = 6000; - }; - - class AllVehicles { - // location types where vehicles will be spawned - localityTypes[] = { "Airport", "CityCenter", "FlatArea", "FlatAreaCity", "FlatAreaCitySmall", "Hill", "NameCity", "NameCityCapital", "NameLocal", "NameMarine", "NameVillage" }; - // disk radius around location - localityRadius = 1500; - // enabled altitudes (or sea depth) - minAltitude = 3; - maxAltitude = 400; - // look for objects class/type in location. Leave it empty for a random spot inside the disk - nearObjects[] = { "Land_Wall_Gate_Ind1_L", "Land_Wall_Gate_Ind2A_L", "Land_Wall_Gate_Ind2B_L", "Land_Wall_Gate_Ind2Rail_L", "Land_Wall_Gate_Kolchoz", "Land_CncBlock_Stripes", "Land_repair_center", "Land_A_FuelStation_Build" }; - }; - class Air:AllVehicles { - nearObjects[] = { "Body","Body1","Body2","NT72Wreck","Fort_Razor_Wire", "HeliHRescue", "Land_A_Castle_Bastion", "Land_CamoNetB_NATO_EP1", "Land_SS_hangar", "HeliH","HeliHCivil", "HeliHRescue", "Land_Tent_East" }; // "UralWreck","HMMWVWreck", - }; - class Ship:AllVehicles { - localityTypes[] = { "NameMarine" }; - localityRadius = 900; - minAltitude = -9; // sea depth - maxAltitude = -1.2; // sea depth - nearObjects[] = {}; - }; - class PBX : Ship { quantity = 1; }; - class Smallboat_1 : Ship { quantity = 2; }; - class Smallboat_2 : Ship { quantity = 1; }; - class MH6J_DZ : Air { quantity = 3; }; - class UH1H_DZ : Air { quantity = 1; }; - class AH6X_DZ : Air { quantity = 1; }; - class Mi17_DZ : Air { quantity = 2; }; - class AN2_DZ : Air { quantity = 1; }; - class Motorcycle : AllVehicles {}; - - class TT650_Civ : Motorcycle { quantity = 1; }; - class TT650_Ins : Motorcycle { quantity = 1; }; - class M1030 : Motorcycle { quantity = 2; }; - - class Bicycle : Motorcycle { - nearObjects[] = { "Land_Misc_Cargo1B", "Land_loco_742_blue", "Land_Misc_Cargo1Bo", "Land_Misc_Cargo1D", "Land_Rail_Zavora","Land_HouseV_3I1","Land_rail_station_big", "Land_Rail_House_01", "Land_HouseV_1L2","Land_NAV_Lighthouse", "Land_NAV_Lighthouse2", "Land_A_FuelStation_Build", "Land_Hlidac_budka", "Land_Shed_W01" }; - maxAltitude = 60; - }; - class Old_bike_TK_INS_EP1 : Bicycle { quantity = 4; }; - class Old_bike_TK_CIV_EP1 : Bicycle { quantity = 6; }; - class Car:AllVehicles {}; - class Truck:Car {}; - class Ural_TK_CIV_EP1:Truck { quantity = 1; }; - class Ikarus : Car { quantity = 2; }; // Bus? - - class V3S_Civ:Truck { quantity = 1; }; - class tractor:Car { - localityTypes[] = { "Hill", "NameLocal", "NameVillage" }; - nearObjects[] = { "Land_seno_balik" }; // haystack - quantity = 4; - }; - class ATV_US_EP1 : Car { quantity = 5; }; - class ATV_CZ_EP1 : Car { quantity = 4; }; - class car_hatchback : Car { quantity = 1; }; - class Volha_2_TK_CIV_EP1 : Car { quantity = 1; }; - class Lada2 : Car { quantity = 1; }; - class hilux1_civil_3_open : Car { quantity = 2; }; - class UAZ_CDF : Car { quantity = 1; }; - class BAF_Offroad_W : Car { quantity = 1; }; - class S1203_TK_CIV_EP1 : Car { quantity = 1; }; - class HMMWV_DZ : Car { quantity = 2; }; - class SUV_DZ : Car { quantity = 1; }; - }; }; diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index f4d41de5a..1721c1527 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -243,20 +243,6 @@ dayz_recordLogin = { diag_log format["INFO - Player: %1(UID:%3/CID:%4) Status: %2",_name,_status,(_this select 0),(_this select 1)]; }; -dayz_reseed = { - private ["_loc","_i","_radius","_ref"]; - _loc = _this select 0; - _ref = _this select 1; - - diag_log str(_loc); - //_lootspawner = [[10416.695, 4198.4634],[7982.2563, 1419.8256],[10795.93, 1419.8263],[7966.083, 4088.7463],[9259.7266, 2746.1985],[5200.5234, 3915.3274],[6494.1665, 2572.7798],[5216.6968, 1246.407],[2564.7244, 3915.3296],[3858.3674, 2572.782],[2580.8977, 1246.4092],[13398.995, 4400.5874],[12242.025, 2948.3196],[13551.842, 1832.2257],[14870.512, 3009.5117],[-178.19415, 1062.4478],[1099.2754, 2388.8206],[-194.36755, 3731.3679],[10394.215, 8322.1719],[7959.7759, 5543.5342],[10773.449, 5543.5342],[7943.6025, 8212.4551],[9237.2461, 6869.9063],[5178.043, 8039.0361],[6471.686, 6696.4883],[5194.2163, 5370.1152],[2542.2439, 8039.0381],[3835.887, 6696.4902],[2558.4172, 5370.1172],[13376.514, 8524.2969],[12219.544, 7072.0273],[13529.361, 5955.9336],[14848.032, 7133.2197],[-200.67474, 5186.1563],[1076.7949, 6512.5283],[-216.84814, 7855.0771],[10293.751, 12197.736],[7859.312, 9419.0996],[10672.988, 9419.0996],[7843.1387, 12088.021],[9136.7822, 10745.474],[5077.5791, 11914.601],[6371.2222, 10572.052],[5093.7524, 9245.6816],[2441.78, 11914.604],[3735.4231, 10572.055],[2457.9534, 9245.6816],[13276.053, 12399.861],[12119.08, 10947.596],[13428.897, 9831.501],[14747.566, 11008.786],[-301.13867, 9061.7207],[976.33112, 10388.096],[-317.31201, 11730.642],[10271.271, 16321.429],[7836.8315, 13542.813],[10650.506, 13542.813],[7820.6582, 16211.718],[9114.3018, 14869.175],[5055.0986, 16038.3],[6348.7417, 14695.758],[5071.272, 13369.392],[2419.2996, 16038.305],[3712.9426, 14695.76],[2435.4729, 13369.392],[13253.568, 16523.553],[12096.6, 15071.295],[13406.416, 13955.209],[14725.089, 15132.486],[-323.61914, 13185.43],[953.85059, 14511.8],[-339.79248, 15854.346]]; - //{ - _radius = 1500; - dayz_lootspawner = [_loc,_radius,_ref] spawn server_lootSpawner; - waitUntil {scriptDone dayz_lootspawner}; - //} forEach dayz_grid; -}; - generate_new_damage = { private "_damage"; _damage = ((random(DynamicVehicleDamageHigh-DynamicVehicleDamageLow))+DynamicVehicleDamageLow) / 100; @@ -271,6 +257,35 @@ server_hiveReadWriteLarge = { _resultArray }; -call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fa_hiveMaintenance.sqf"; +// coor2str: convert position to a GPS coordinates +fa_coor2str = { + private["_pos","_res","_nearestCity","_town"]; + + _pos = +(_this); + if (count _pos < 1) then { _pos = [0,0]; } + else { if (count _pos < 2) then { _pos = [_pos select 0,0]; }; + }; + _nearestCity = nearestLocations [_pos, ["NameCityCapital","NameCity","NameVillage","NameLocal"],1000]; + _town = "Wilderness"; + if (count _nearestCity > 0) then {_town = text (_nearestCity select 0)}; + _res = format["%1 [%2:%3]", _town, round((_pos select 0)/100), round((15360-(_pos select 1))/100)]; + + _res +}; + +// print player player PID and name. If name unknown then print UID. +fa_plr2str = { + private["_x","_res","_name"]; + _x = _this; + _res = "nobody"; + if (!isNil "_x") then { + _name = _x getVariable ["bodyName", nil]; + if ((isNil "_name" OR {(_name == "")}) AND ({alive _x})) then { _name = name _x; }; + if (isNil "_name" OR {(_name == "")}) then { _name = "UID#"+(getPlayerUID _x); }; + _res = format["PID#%1(%2)", owner _x, _name ]; + }; + _res +}; + // Precise base building 1.0.5 call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\kk_functions.sqf"; \ No newline at end of file