mirror of
https://github.com/EpochModTeam/Epoch.git
synced 2024-08-30 18:22:13 +00:00
fixes and less debug
This commit is contained in:
parent
953e26cf42
commit
396f58e941
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
5 "" !="I_UAV_01_F" !="(I|B|O)_UAV_AI" !"_EPOCH" !="B_65x39_Minigun_Caseless_Red_splash" !="B_762x51_Minigun_Tracer_Yellow_splash" !="B_(Swing|Stick)" !"^SmokeShell" !"^G_40mm_" !"^F_40mm_" !"Sub_F_" !"^F_Signal_" !="mini_Grenade" !="GrenadeHand" !="LaserTarget(C|W|E)" !"^Chemlight_" !="(ClaymoreDirectionalMine|DemoCharge|SatchelCharge)_Remote_Ammo" !="SLAMDirectionalMine_Wire_Ammo" !="(CMflare_Chaff|Sapper_Charge|SapperB_Charge|ATMine_Range)_Ammo" !="APERS(TripMine_Wire|BoundingMine_Range|Mine_Range)_Ammo" !="Epoch_(Sapper|SapperB|Cloak)_F" !="GreatWhite_F" !="groundWeaponHolder" !="WeaponHolderSimulated" !="Epoch_(Male|Female)_F" !"Supply[0-9]" !"Steerable_Parachute_F" !="Epoch_Female_CamoRed_F" !="Land_Cages_F" !="(O|I|B)_UAV_01_backpack_F" !="I_(helipilot|helicrew)_F"
|
||||
5 "" !="I_UAV_01_F" !="(I|B|O)_UAV_AI" !"_EPOCH" !="B_65x39_Minigun_Caseless_Red_splash" !="B_762x51_Minigun_Tracer_Yellow_splash" !="B_(Swing|Stick)" !"^SmokeShell" !"^G_40mm_" !"^F_40mm_" !"Sub_F_" !"^F_Signal_" !="mini_Grenade" !="GrenadeHand" !="LaserTarget(C|W|E)" !"^Chemlight_" !="(ClaymoreDirectionalMine|DemoCharge|SatchelCharge)_Remote_Ammo" !="SLAMDirectionalMine_Wire_Ammo" !="(CMflare_Chaff|Sapper_Charge|SapperB_Charge|ATMine_Range)_Ammo" !="APERS(TripMine_Wire|BoundingMine_Range|Mine_Range)_Ammo" !="Epoch_(Sapper|SapperB|Cloak)_F" !="GreatWhite_F" !="groundWeaponHolder" !="WeaponHolderSimulated" !="Epoch_(Male|Female)_F" !"Supply[0-9]" !"Steerable_Parachute_F" !="Epoch_Female_CamoRed_F" !="Land_Cages_F" !="(O|I|B)_UAV_01_backpack_F" !="I_(helipilot|helicrew)_F" !="#smokesource"
|
||||
5 "_EPOCH" !="(SapperHead|Jack|SolarGen)_SIM_EPOCH" !="Wood(Floor|LargeWall|Stairs|Ramp|Foundation|Ladder|Tower)_EPOCH" !="(Tipi|Workbench|StorageShelf|CinderWallHalf|Foundation|Wood(Floor|LargeWall|Stairs|Ramp|Foundation|Ladder|Tower))_Ghost_EPOCH" !="(Tipi|StorageShelf|Safe|LockBox|FirePlace|FirePlaceOn|PlotPole|SolarGen|Jack|Freezer|Tarp|CinderWallHalf|Bobber)_EPOCH" !="I_(Soldier[1-3]|Soldier)_EPOCH" !="(Bed|locker|Filing|Chair|ChairRed|wardrobe|cooker|Couch|Table|Pelican|Fridge|Shelf|ToolRack|Shoebox|Bunk|Rabbit|Cabinet)_EPOCH" !="(Sheep|Goat|Snake|Snake2|Hen|Cock|Fin|Alsatian)_random_EPOCH" !="(Safe|Workbench|LockBox|CinderWall|CinderWallGarage|CinderWallHalf|PlotPole|Tipi|StorageShelf|Fireplace)_SIM_EPOCH" !="Wood(Floor|LargeWall|LargeWallCor|LargeWallDoor|LargeWallDoorL|LargeWallDoorway|Stairs|Stairs2|Ramp|Ladder|Tower)_SIM_EPOCH" !="(WoodFoundation|Foundation)_EPOCH" !="WoodWall[1-4](_SIM|_Ghost|)_EPOCH"
|
||||
5 SeaGull
|
||||
|
@ -91,7 +91,7 @@ if (isText _config) then {
|
||||
|
||||
if (!isNull _newVehicle) then {
|
||||
|
||||
diag_log format["building lockbox !isnull %1", _newVehicle];
|
||||
//diag_log format["building lockbox !isnull %1", _newVehicle];
|
||||
|
||||
if !(EPOCH_StorageSlots isEqualTo []) then {
|
||||
|
||||
|
@ -8,14 +8,16 @@ if (typename _this != "ARRAY") then {
|
||||
if (_this select 1) then {
|
||||
private "_unit";
|
||||
_unit = _this select 0;
|
||||
{
|
||||
_unit removeAllMPEventHandlers _x;
|
||||
}forEach ["mpkilled","mphit","mprespawn"];
|
||||
{
|
||||
_unit removeAllEventHandlers _x;
|
||||
}forEach ["FiredNear","HandleDamage","Killed","Fired","GetOut","GetIn","Local"];
|
||||
deleteVehicle _unit;
|
||||
deleteGroup (group _unit);
|
||||
if (!isNull _unit) then{
|
||||
{
|
||||
_unit removeAllMPEventHandlers _x;
|
||||
}forEach["mpkilled", "mphit", "mprespawn"];
|
||||
{
|
||||
_unit removeAllEventHandlers _x;
|
||||
}forEach["FiredNear", "HandleDamage", "Killed", "Fired", "GetOut", "GetIn", "Local"];
|
||||
deleteVehicle _unit;
|
||||
deleteGroup(group _unit);
|
||||
};
|
||||
};
|
||||
}];
|
||||
};
|
||||
|
@ -61,12 +61,13 @@ for "_i" from 0 to _this do {
|
||||
// count vehicles
|
||||
{
|
||||
_limit = ["CfgTraderLimits", _x, 100] call EPOCH_fnc_returnConfigEntryV2;
|
||||
_currentStock = (_arr select 1) param[_forEachIndex, 0];
|
||||
if (_limit == 0) then {
|
||||
// mark for removal since limit is 0
|
||||
_toBeRemoved pushBack _forEachIndex;
|
||||
_currentStock = 0;
|
||||
} else {
|
||||
// lower to limit current qty is over limit
|
||||
_currentStock = (_arr select 1) select _forEachIndex;
|
||||
if (_currentStock > _limit) then {
|
||||
(_arr select 1) set [_forEachIndex,_limit];
|
||||
_currentStock = _limit;
|
||||
|
@ -15,6 +15,7 @@ _vehicleBought = false;
|
||||
|
||||
_returnIn = [];
|
||||
_returnOut = [];
|
||||
_final_location = [];
|
||||
|
||||
if (isNull _trader) exitWith{};
|
||||
if !([_plyr,_this select 4] call EPOCH_server_getPToken) exitWith {};
|
||||
@ -34,7 +35,7 @@ if (_slot != -1) then {
|
||||
_current_crypto = _vars select _cIndex;
|
||||
_current_cryptoRaw = _current_crypto;
|
||||
|
||||
// diag_log format["_current_crypto: %1 _cIndex:%2", _current_crypto, _cIndex];
|
||||
//diag_log format["_current_crypto: %1 _cIndex:%2 %3", _current_crypto, _cIndex, _this];
|
||||
|
||||
// SELL ITEMS TO TRADER
|
||||
_aiItems = _trader getVariable["AI_ITEMS", [[], []]];
|
||||
@ -113,14 +114,14 @@ if (_slot != -1) then {
|
||||
_item = _x;
|
||||
_itemQty = 1;
|
||||
|
||||
// diag_log format["_item: %1", _item];
|
||||
//diag_log format["_item: %1", _item];
|
||||
if (isClass (_config >> _item)) then{
|
||||
_itemWorth = getNumber(_config >> _item >> "price");
|
||||
_itemTax = getNumber(_config >> _item >> "tax");
|
||||
_tax = _itemWorth * (EPOCH_taxRate + _itemTax);
|
||||
_itemWorth = ceil(_itemWorth + _tax);
|
||||
|
||||
// diag_log format["_itemWorth: %1", _itemWorth];
|
||||
//diag_log format["_itemWorth: %1", _itemWorth];
|
||||
|
||||
_qtyIndex = _itemClasses find _item;
|
||||
// add items to array
|
||||
@ -128,7 +129,7 @@ if (_slot != -1) then {
|
||||
|
||||
_currQty = _itemQtys select _qtyIndex;
|
||||
|
||||
// diag_log format["_currQty: %1 >= %2", _currQty, _itemQty];
|
||||
//diag_log format["_currQty: %1 >= %2", _currQty, _itemQty];
|
||||
|
||||
if (_currQty >= _itemQty) then {
|
||||
|
||||
@ -142,14 +143,30 @@ if (_slot != -1) then {
|
||||
_position = getPosATL _plyr;
|
||||
|
||||
_helipad = nearestObjects[_position, ["Land_HelipadEmpty_F", "Land_HelipadCircle_F"], 100];
|
||||
_helipads = [];
|
||||
_smoke = nearestObject[_position, "SmokeShell"];
|
||||
if (!isNull _smoke) then {
|
||||
_helipad pushBack _smoke;
|
||||
};
|
||||
|
||||
// water check
|
||||
if (_item isKindOf "Ship") then {
|
||||
{
|
||||
if (surfaceIsWater (getposATL _x)) then {
|
||||
_helipads pushBack _x;
|
||||
}
|
||||
} forEach _helipad;
|
||||
} else {
|
||||
{
|
||||
if !(surfaceIsWater (getposATL _x)) then {
|
||||
_helipads pushBack _x;
|
||||
}
|
||||
} forEach _helipad;
|
||||
};
|
||||
|
||||
// diag_log format["DEBUG: helipad: %1", _helipad];
|
||||
|
||||
if !(_helipad isEqualTo[]) then {
|
||||
if !(_helipads isEqualTo[]) then {
|
||||
|
||||
_foundSmoke = false;
|
||||
{
|
||||
@ -168,9 +185,9 @@ if (_slot != -1) then {
|
||||
};
|
||||
};
|
||||
if (_foundSmoke) exitWith {};
|
||||
} forEach _helipad;
|
||||
} forEach _helipads;
|
||||
if !(_foundSmoke) then {
|
||||
_position = getPosATL (_helipad select 0);
|
||||
_position = getPosATL (_helipads select 0);
|
||||
};
|
||||
} else {
|
||||
_tmpposition = [];
|
||||
@ -181,6 +198,10 @@ if (_slot != -1) then {
|
||||
_tmpposition = [_position, 20, 120, 20, 0, 2000, 0] call BIS_fnc_findSafePos;
|
||||
};
|
||||
if ((count _tmpposition) == 2) then {
|
||||
_tmpposition set [2, 0];
|
||||
if (surfaceIsWater _tmpposition) then {
|
||||
_tmpposition = ATLtoASL _tmpposition;
|
||||
};
|
||||
_position = _tmpposition;
|
||||
};
|
||||
};
|
||||
@ -204,7 +225,11 @@ if (_slot != -1) then {
|
||||
};
|
||||
|
||||
_vehObj = [_item,_position,random 360,true,_vehslot,_lockOwner,"NONE",false] call EPOCH_fnc_spawn_vehicle;
|
||||
|
||||
_final_location = getPosATL _vehObj;
|
||||
|
||||
_group = group _plyr;
|
||||
_wp = _group addWaypoint [_final_location, 0];
|
||||
deleteWaypoint [_group, 0];
|
||||
|
||||
_returnOut pushBack _item;
|
||||
|
||||
@ -212,6 +237,8 @@ if (_slot != -1) then {
|
||||
_tradeTotal = _tradeTotal - _itemWorth;
|
||||
_current_crypto = _current_crypto - _itemWorth;
|
||||
_tradeQtyTotal = _tradeQtyTotal + _itemQty;
|
||||
} else {
|
||||
diag_log "DEBUG: no slots found to spawn vehicle";
|
||||
};
|
||||
};
|
||||
} else {
|
||||
|
@ -31,7 +31,7 @@ for "_i" from 1 to _this do {
|
||||
|
||||
_worldspace = _arr select 1;
|
||||
_wsCount = count _worldspace;
|
||||
diag_log format ["DEBUG: _wsCount %1 _worldspace %2", _wsCount, _worldspace];
|
||||
//diag_log format ["DEBUG: _wsCount %1 _worldspace %2", _wsCount, _worldspace];
|
||||
|
||||
// new worldspace format
|
||||
if (_wsCount == 3) then {
|
||||
@ -94,7 +94,7 @@ for "_i" from 1 to _this do {
|
||||
|
||||
// missionNamespace setVariable [format ["EPOCH_STORAGE_%1", _i], _vehicle];
|
||||
|
||||
diag_log format ["STORAGE: created storage %1 at %2", _class, _location];
|
||||
// diag_log format ["STORAGE: created storage %1 at %2", _class, _location];
|
||||
|
||||
_vehicle call EPOCH_server_storageInit;
|
||||
|
||||
|
@ -248,7 +248,6 @@ if (_immuneVehicleSpawn) then{
|
||||
|
||||
addToRemainsCollector _allVehicles;
|
||||
|
||||
diag_log format ["VEH SPAWN TIMER %1", diag_tickTime - _diag];
|
||||
// diag_log (EPOCH_VehicleSlots);
|
||||
diag_log format ["VEH SPAWN TIMER %1, LOADED 2% VEHICLES", diag_tickTime - _diag, count _allVehicles];
|
||||
|
||||
true
|
||||
|
@ -67,7 +67,7 @@ if (!isNull _this) then {
|
||||
["Storage", _vehHiveKey, EPOCH_expiresBuilding, _VAL] call EPOCH_fnc_server_hiveSETEX;
|
||||
//["Storage", _vehHiveKey, _VAL] call EPOCH_fnc_server_hiveSET;
|
||||
|
||||
diag_log format["STORAGE: saved to hive %1 Pos %2 Owners %3 Parent %4 Locked %5", _class, _worldspace, _storageOwners, _storageParent, _locked];
|
||||
diag_log format["STORAGE: saved to hive %1 Pos %2 Owners %3 Locked %4", _class, _worldspace, _storageOwners, _locked];
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ if (getNumber(configFile >> "CfgVehicles" >> _type >> "isSecureStorage") == 1) t
|
||||
if (_type isKindOf "Secure_Storage_Proxy") then {
|
||||
|
||||
_owners = _unit getVariable["STORAGE_OWNERS", []];
|
||||
diag_log format["_owners2 %1", _owners];
|
||||
//diag_log format["_owners2 %1", _owners];
|
||||
|
||||
// allow group members and owner access
|
||||
if (_plyrGroup != "") then {
|
||||
@ -68,11 +68,11 @@ if (getNumber(configFile >> "CfgVehicles" >> _type >> "isSecureStorage") == 1) t
|
||||
} else {
|
||||
|
||||
_weaponHolder = _unit getVariable["EPOCH_secStorParent", objNull];
|
||||
diag_log format["DEBUG: SecStor _weaponHolder %1", _weaponHolder];
|
||||
//diag_log format["DEBUG: SecStor _weaponHolder %1", _weaponHolder];
|
||||
|
||||
if (!isNull _weaponHolder) then {
|
||||
_owners = _weaponHolder getVariable["STORAGE_OWNERS", []];
|
||||
diag_log format["_owners %1", _owners];
|
||||
//diag_log format["_owners %1", _owners];
|
||||
|
||||
// allow group members and owner access
|
||||
if (_plyrGroup != "") then {
|
||||
|
@ -9,7 +9,7 @@ _class = typeOf _unit;
|
||||
if (_class isKindOf 'Constructions_lockedstatic_F') then{
|
||||
|
||||
_weaponHolder = _unit getVariable["EPOCH_secStorParent", objNull];
|
||||
diag_log format["DEBUG: Pack _weaponHolder %1", _weaponHolder];
|
||||
//diag_log format["DEBUG: Pack _weaponHolder %1", _weaponHolder];
|
||||
|
||||
if (!isNull _weaponHolder) then {
|
||||
_owners = _weaponHolder getVariable["STORAGE_OWNERS", []];
|
||||
|
@ -12,92 +12,99 @@ _lockOwner = param [5, ""];
|
||||
_can_collide = param [6, "CAN_COLLIDE"];
|
||||
_spawnLoot = param [7, false];
|
||||
|
||||
|
||||
//diag_log format["DEBUG: spawn_vehicle %1", _this];
|
||||
|
||||
//place vehicle
|
||||
_vehObj = createVehicle[_vehClass, _position, [], 0, _can_collide];
|
||||
_vehObj call EPOCH_server_setVToken;
|
||||
|
||||
// Set Direction
|
||||
if (typeName _direction == "ARRAY") then{
|
||||
_vehObj setVectorDirAndUp _direction;
|
||||
if !(isNull _vehObj) then{
|
||||
|
||||
_vehObj call EPOCH_server_setVToken;
|
||||
|
||||
// Set Direction
|
||||
if (typeName _direction == "ARRAY") then{
|
||||
_vehObj setVectorDirAndUp _direction;
|
||||
} else {
|
||||
_vehObj setdir _direction;
|
||||
};
|
||||
// Set Position
|
||||
_vehObj setposATL _position;
|
||||
|
||||
// Normalize vehicle inventory
|
||||
clearWeaponCargoGlobal _vehObj;
|
||||
clearMagazineCargoGlobal _vehObj;
|
||||
clearBackpackCargoGlobal _vehObj;
|
||||
clearItemCargoGlobal _vehObj;
|
||||
|
||||
// Disable Termal Equipment
|
||||
_vehObj disableTIEquipment true;
|
||||
|
||||
// Vehicle Lock
|
||||
_vehObj lock _locked;
|
||||
|
||||
// randomize fuel TODO push min max to config
|
||||
_vehObj setFuel ((random 1 max 0.1) min 0.9);
|
||||
|
||||
// get colors from config
|
||||
_config = (configFile >> "CfgVehicles" >> _vehClass >> "availableColors");
|
||||
|
||||
if (isArray(_config)) then{
|
||||
|
||||
_textureSelectionIndex = configFile >> "CfgVehicles" >> _vehClass >> "textureSelectionIndex";
|
||||
_selections = if (isArray(_textureSelectionIndex)) then{ getArray(_textureSelectionIndex) } else { [0] };
|
||||
_colors = getArray(_config);
|
||||
_textures = _colors select 0;
|
||||
_color = floor(random(count _textures));
|
||||
_count = (count _colors) - 1;
|
||||
{
|
||||
if (_count >= _forEachIndex) then{
|
||||
_textures = _colors select _forEachIndex;
|
||||
};
|
||||
_vehObj setObjectTextureGlobal[_x, (_textures select _color)];
|
||||
} forEach _selections;
|
||||
_vehObj setVariable["VEHICLE_TEXTURE", _color];
|
||||
};
|
||||
|
||||
// add random loots
|
||||
if (_spawnLoot) then {
|
||||
if (_vehClass isKindOf "Ship") then{
|
||||
[_vehObj, "VehicleBoat"] call EPOCH_serverLootObject;
|
||||
} else {
|
||||
[_vehObj, "Vehicle"] call EPOCH_serverLootObject;
|
||||
};
|
||||
};
|
||||
|
||||
// Set slot used by vehicle
|
||||
_vehObj setVariable["VEHICLE_SLOT", _slot, true];
|
||||
|
||||
// Lock vehicle for owner
|
||||
if (_locked && _lockOwner != "") then {
|
||||
_vehLockHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _slot];
|
||||
["VehicleLock", _vehLockHiveKey, EPOCH_vehicleLockTime, [_lockOwner]] call EPOCH_fnc_server_hiveSETEX;
|
||||
} else {
|
||||
_vehLockHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _slot];
|
||||
["VehicleLock", _vehLockHiveKey] call EPOCH_fnc_server_hiveDEL;
|
||||
};
|
||||
|
||||
// SAVE VEHICLE
|
||||
_vehObj call EPOCH_server_save_vehicle;
|
||||
|
||||
// Event Handlers
|
||||
_vehObj call EPOCH_server_vehicleInit;
|
||||
|
||||
// Markers
|
||||
if (EPOCH_DEBUG_VEH) then{
|
||||
_marker = createMarker[str(_position), _position];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _vehClass;
|
||||
};
|
||||
|
||||
// Add to A3 remains collector
|
||||
addToRemainsCollector[_vehObj];
|
||||
|
||||
} else {
|
||||
_vehObj setdir _direction;
|
||||
diag_log format["DEBUG: Failed to create vehicle: %1", _this];
|
||||
};
|
||||
// Set Position
|
||||
_vehObj setposATL _position;
|
||||
|
||||
// Normalize vehicle inventory
|
||||
clearWeaponCargoGlobal _vehObj;
|
||||
clearMagazineCargoGlobal _vehObj;
|
||||
clearBackpackCargoGlobal _vehObj;
|
||||
clearItemCargoGlobal _vehObj;
|
||||
|
||||
// Disable Termal Equipment
|
||||
_vehObj disableTIEquipment true;
|
||||
|
||||
// Vehicle Lock
|
||||
_vehObj lock _locked;
|
||||
|
||||
// randomize fuel TODO push min max to config
|
||||
_vehObj setFuel ((random 1 max 0.1) min 0.9);
|
||||
|
||||
// get colors from config
|
||||
_config = (configFile >> "CfgVehicles" >> _vehClass >> "availableColors");
|
||||
|
||||
if (isArray(_config)) then{
|
||||
|
||||
_textureSelectionIndex = configFile >> "CfgVehicles" >> _vehClass >> "textureSelectionIndex";
|
||||
_selections = if (isArray(_textureSelectionIndex)) then{ getArray(_textureSelectionIndex) } else { [0] };
|
||||
_colors = getArray(_config);
|
||||
_textures = _colors select 0;
|
||||
_color = floor(random(count _textures));
|
||||
_count = (count _colors) - 1;
|
||||
{
|
||||
if (_count >= _forEachIndex) then{
|
||||
_textures = _colors select _forEachIndex;
|
||||
};
|
||||
_vehObj setObjectTextureGlobal[_x, (_textures select _color)];
|
||||
} forEach _selections;
|
||||
_vehObj setVariable["VEHICLE_TEXTURE", _color];
|
||||
};
|
||||
|
||||
// add random loots
|
||||
if (_spawnLoot) then {
|
||||
if (_vehClass isKindOf "Ship") then{
|
||||
[_vehObj, "VehicleBoat"] call EPOCH_serverLootObject;
|
||||
} else {
|
||||
[_vehObj, "Vehicle"] call EPOCH_serverLootObject;
|
||||
};
|
||||
};
|
||||
|
||||
// Set slot used by vehicle
|
||||
_vehObj setVariable["VEHICLE_SLOT", _slot, true];
|
||||
|
||||
// Lock vehicle for owner
|
||||
if (_locked && _lockOwner != "") then {
|
||||
_vehLockHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _slot];
|
||||
["VehicleLock", _vehLockHiveKey, EPOCH_vehicleLockTime, [_lockOwner]] call EPOCH_fnc_server_hiveSETEX;
|
||||
} else {
|
||||
_vehLockHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _slot];
|
||||
["VehicleLock", _vehLockHiveKey] call EPOCH_fnc_server_hiveDEL;
|
||||
};
|
||||
|
||||
// SAVE VEHICLE
|
||||
_vehObj call EPOCH_server_save_vehicle;
|
||||
|
||||
// Event Handlers
|
||||
_vehObj call EPOCH_server_vehicleInit;
|
||||
|
||||
// Markers
|
||||
if (EPOCH_DEBUG_VEH) then{
|
||||
_marker = createMarker[str(_position), _position];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _vehClass;
|
||||
};
|
||||
|
||||
// Add to A3 remains collector
|
||||
addToRemainsCollector[_vehObj];
|
||||
|
||||
_vehObj
|
||||
|
@ -24,17 +24,17 @@ if (_allowedVehiclesList isEqualTo []) exitWith {
|
||||
};
|
||||
|
||||
_spawnPositionSizeDefaults = [
|
||||
["FlatAreaCity",1],
|
||||
["FlatAreaCitySmall",1],
|
||||
["NameCity",2],
|
||||
["NameVillage",1],
|
||||
["NameCityCapital",4],
|
||||
["Airport",5],
|
||||
["NameLocal",2],
|
||||
["StrongpointArea",1],
|
||||
["VegetationBroadleaf",1],
|
||||
["VegetationFir",1],
|
||||
["ViewPoint",1]
|
||||
["FlatAreaCity",1],
|
||||
["FlatAreaCitySmall",1],
|
||||
["NameCity",2],
|
||||
["NameVillage",1],
|
||||
["NameCityCapital",4],
|
||||
["Airport",5],
|
||||
["NameLocal",2],
|
||||
["StrongpointArea",1],
|
||||
["VegetationBroadleaf",1],
|
||||
["VegetationFir",1],
|
||||
["ViewPoint",1]
|
||||
];
|
||||
_serverMapConfig = configFile >> "CfgEpoch" >> worldName;
|
||||
_spawnPositionSize = [_serverMapConfig, "vehicleSpawnTypes", _spawnPositionSizeDefaults] call EPOCH_fnc_returnConfigEntry;
|
||||
@ -61,93 +61,87 @@ _allCitysDync = [];
|
||||
};
|
||||
} forEach _allCitys;
|
||||
|
||||
|
||||
_position = [0,0,0];
|
||||
|
||||
_spawnCount = (count EPOCH_VehicleSlots - EPOCH_storedVehicleCount) - 1;
|
||||
|
||||
{
|
||||
if (count EPOCH_VehicleSlots <= EPOCH_storedVehicleCount) exitWith{};
|
||||
diag_log format["DEBUG: count EPOCH_VehicleSlots: %1 EPOCH_storedVehicleCount: %2 _spawnCount %3", (count EPOCH_VehicleSlots), EPOCH_storedVehicleCount, _spawnCount];
|
||||
|
||||
_vehCount = count _allowedVehiclesList;
|
||||
if (_vehCount <= 0) exitWith{};
|
||||
for "_i" from 1 to _spawnCount do {
|
||||
|
||||
_vehClass = _allowedVehiclesList deleteAt(floor(random(_vehCount)));
|
||||
if (isNil "_vehClass") exitWith{};
|
||||
_slot = EPOCH_VehicleSlots deleteAt 0;
|
||||
|
||||
_direction = random 360;
|
||||
_position = [0,0,0];
|
||||
_getRandomPos = true;
|
||||
_vehCount = count _allowedVehiclesList;
|
||||
_vehClass = _allowedVehiclesList deleteAt(floor(random(_vehCount)));
|
||||
if (isNil "_vehClass") exitWith{diag_log "DEBUG: Failed to find vehicle class"};
|
||||
|
||||
_direction = random 360;
|
||||
_position = [0,0,0];
|
||||
_getRandomPos = true;
|
||||
|
||||
_preferedPos = getArray(configFile >> "CfgEpoch" >> worldname >> "whitelistedVehiclePos" >> _vehClass);
|
||||
if !(_preferedPos isEqualTo []) then{
|
||||
_newPosition = _preferedPos select(floor(random(count _preferedPos)));
|
||||
if ((nearestObjects[(_newPosition select 0), ["LandVehicle", "Ship", "Air", "Tank"], 50]) isEqualTo []) then{
|
||||
_position = _newPosition select 0;
|
||||
_direction = _newPosition select 1;
|
||||
_getRandomPos = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
if (_getRandomPos) then{
|
||||
_isShip = _vehClass isKindOf "Ship";
|
||||
if (_isShip || (_vehClass isKindOf "Air")) then{
|
||||
if (_isShip) then{
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 1] call BIS_fnc_findSafePos;
|
||||
_position = [_position, 0, 100, 10, 2, 4000, 0] call BIS_fnc_findSafePos;
|
||||
} else {
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
|
||||
};
|
||||
} else {
|
||||
|
||||
if (_allCitysDync isEqualTo []) then {
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
|
||||
} else {
|
||||
_selectedCity = _allCitysDync deleteAt (floor random(count _allCitysDync));
|
||||
_cityPos = getArray(_selectedCity >> "position");
|
||||
_range = getNumber(_selectedCity >> "radiusA") * 1.3;
|
||||
|
||||
_roads = _cityPos nearRoads _range;
|
||||
if !(_roads isEqualTo []) then {
|
||||
_road = _roads select(floor random(count _roads));
|
||||
_position = getPosATL _road;
|
||||
_position deleteAt 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if ((count _position == 2 && _getRandomPos) || !_getRandomPos) then{
|
||||
|
||||
|
||||
_collide = "CAN_COLLIDE";
|
||||
if (_getRandomPos) then{
|
||||
_collide = "NONE";
|
||||
_position set[2, 0];
|
||||
if (surfaceIsWater _position) then{
|
||||
_position = ASLToATL _position;
|
||||
};
|
||||
};
|
||||
|
||||
_vehObj = [_vehClass,_position,_direction,true,_x,"",_collide,true] call EPOCH_fnc_spawn_vehicle;
|
||||
|
||||
|
||||
if (EPOCH_DEBUG_VEH) then {
|
||||
_marker = createMarker [str(_position) , _position];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _vehClass;
|
||||
_marker setMarkerColor "ColorBlue";
|
||||
};
|
||||
|
||||
|
||||
EPOCH_VehicleSlots set[_forEachIndex, "REM"];
|
||||
_preferedPos = getArray(configFile >> "CfgEpoch" >> worldname >> "whitelistedVehiclePos" >> _vehClass);
|
||||
if !(_preferedPos isEqualTo []) then{
|
||||
_newPosition = _preferedPos select(floor(random(count _preferedPos)));
|
||||
if ((nearestObjects[(_newPosition select 0), ["LandVehicle", "Ship", "Air", "Tank"], 50]) isEqualTo []) then{
|
||||
_position = _newPosition select 0;
|
||||
_direction = _newPosition select 1;
|
||||
_getRandomPos = false;
|
||||
};
|
||||
};
|
||||
|
||||
} forEach EPOCH_VehicleSlots;
|
||||
|
||||
EPOCH_VehicleSlots = EPOCH_VehicleSlots - ["REM"];
|
||||
if (_getRandomPos) then{
|
||||
_isShip = _vehClass isKindOf "Ship";
|
||||
if (_isShip || (_vehClass isKindOf "Air")) then{
|
||||
if (_isShip) then{
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 4000, 1] call BIS_fnc_findSafePos;
|
||||
_position = [_position, 0, 100, 10, 2, 4000, 0] call BIS_fnc_findSafePos;
|
||||
} else {
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
|
||||
};
|
||||
} else {
|
||||
|
||||
if (_allCitysDync isEqualTo []) then {
|
||||
_position = [epoch_centerMarkerPosition, 0, EPOCH_dynamicVehicleArea, 10, 0, 1000, 0] call BIS_fnc_findSafePos;
|
||||
} else {
|
||||
_selectedCity = _allCitysDync deleteAt (floor random(count _allCitysDync));
|
||||
_cityPos = getArray(_selectedCity >> "position");
|
||||
_range = getNumber(_selectedCity >> "radiusA") * 1.3;
|
||||
|
||||
_roads = _cityPos nearRoads _range;
|
||||
if !(_roads isEqualTo []) then {
|
||||
_road = _roads select(floor random(count _roads));
|
||||
_position = getPosATL _road;
|
||||
_position deleteAt 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if ((count _position == 2 && _getRandomPos) || !_getRandomPos) then{
|
||||
|
||||
_collide = "CAN_COLLIDE";
|
||||
if (_getRandomPos) then{
|
||||
_collide = "NONE";
|
||||
_position set[2, 0];
|
||||
if (surfaceIsWater _position) then{
|
||||
_position = ASLToATL _position;
|
||||
};
|
||||
};
|
||||
|
||||
_vehObj = [_vehClass,_position,_direction,true,_slot,"",_collide,true] call EPOCH_fnc_spawn_vehicle;
|
||||
|
||||
if (EPOCH_DEBUG_VEH) then {
|
||||
_marker = createMarker [str(_position) , _position];
|
||||
_marker setMarkerShape "ICON";
|
||||
_marker setMarkerType "mil_dot";
|
||||
_marker setMarkerText _vehClass;
|
||||
_marker setMarkerColor "ColorBlue";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
EPOCH_VehicleSlotCount = count EPOCH_VehicleSlots;
|
||||
publicVariable "EPOCH_VehicleSlotCount";
|
||||
|
@ -126,7 +126,7 @@ class FSM
|
||||
" _list = _this nearEntities[[""Epoch_Male_F"", ""Epoch_Female_F"", ""LandVehicle"", ""Ship"", ""Air"", ""Tank""], 45];" \n
|
||||
" if ({ isPlayer _x }count _list == 0) then {" \n
|
||||
" _this setVariable [""LAST_CHECK"",nil];" \n
|
||||
" diag_log format[""DEBUG: _cleanIT del %1"", _this];" \n
|
||||
" //diag_log format[""DEBUG: _cleanIT del %1"", _this];" \n
|
||||
" deleteVehicle _this;" \n
|
||||
"" \n
|
||||
" };" \n
|
||||
@ -149,7 +149,7 @@ class FSM
|
||||
" deleteVehicle _x;" \n
|
||||
" }forEach nearestObjects[_this, [""WeaponHolder""], 2];" \n
|
||||
" _this setVariable [""LAST_CHECK"",nil];" \n
|
||||
" diag_log format[""DEBUG: _cleanIT2 del %1"", _this];" \n
|
||||
" //diag_log format[""DEBUG: _cleanIT2 del %1"", _this];" \n
|
||||
" deleteVehicle _this;" \n
|
||||
" _removed = true;" \n
|
||||
" };" \n
|
||||
@ -328,7 +328,7 @@ class FSM
|
||||
" _activeVehicles pushBack _x;" \n
|
||||
" };" \n
|
||||
" } else {" \n
|
||||
" diag_log format[""DEBUG: vtoken del %1"",_x];" \n
|
||||
" //diag_log format[""DEBUG: vtoken del %1"",_x];" \n
|
||||
" deleteVehicle _x;" \n
|
||||
" };" \n
|
||||
" };" \n
|
||||
|
Loading…
Reference in New Issue
Block a user