added SellCrate, Spawn items into vehicles
This commit is contained in:
parent
89111f4619
commit
e3c5e377e7
@ -0,0 +1,107 @@
|
||||
private["_dialog","_inventoryDropdown","_index","_nearVehicles","_crateTypes"];
|
||||
disableSerialization;
|
||||
_crateTypes = [
|
||||
"CargoNet_01_box_F",
|
||||
"Exile_Container_SupplyBox",
|
||||
"I_CargoNet_01_ammo_F",
|
||||
"O_CargoNet_01_ammo_F",
|
||||
"B_CargoNet_01_ammo_F",
|
||||
"I_supplyCrate_F",
|
||||
"O_supplyCrate_F",
|
||||
"B_supplyCrate_F",
|
||||
"C_supplyCrate_F",
|
||||
"IG_supplyCrate_F",
|
||||
"Box_NATO_AmmoVeh_F",
|
||||
"Box_East_AmmoVeh_F",
|
||||
"Box_IND_AmmoVeh_F",
|
||||
"I_CargoNET_01_F",
|
||||
"O_CargoNET_01_F",
|
||||
"B_CargoNET_01_F",
|
||||
"Land_CargoBox_V1_F",
|
||||
"ASC_B_box",
|
||||
"Box_NATO_Wps_F",
|
||||
"Box_East_Wps_F",
|
||||
"Box_IND_Wps_F",
|
||||
"Box_East_WpsLaunch_F",
|
||||
"Box_NATO_WpsLaunch_F",
|
||||
"Box_IND_WpsLaunch_F",
|
||||
"Box_IND_WpsSpecial_F",
|
||||
"Box_East_WpsSpecial_F",
|
||||
"Box_NATO_WpsSpecial_F",
|
||||
"Box_NATO_Wps_F",
|
||||
"Box_East_Wps_F",
|
||||
"Box_IND_Wps_F",
|
||||
"Box_East_WpsLaunch_F",
|
||||
"Box_NATO_WpsLaunch_F",
|
||||
"Box_IND_WpsLaunch_F",
|
||||
"Box_IND_WpsSpecial_F",
|
||||
"Box_East_WpsSpecial_F",
|
||||
"Box_NATO_WpsSpecial_F",
|
||||
"Box_NATO_AmmoOrd_F",
|
||||
"Box_East_AmmoOrd_F",
|
||||
"Box_IND_AmmoOrd_F",
|
||||
"Box_NATO_Grenades_F",
|
||||
"Box_East_Grenades_F",
|
||||
"Box_IND_Grenades_F",
|
||||
"Box_NATO_Ammo_F",
|
||||
"Box_East_Ammo_F",
|
||||
"Box_IND_Ammo_F",
|
||||
"Box_IND_Support_F",
|
||||
"Box_East_Support_F",
|
||||
"Box_NATO_Support_F"
|
||||
];
|
||||
_dialog = uiNameSpace getVariable ["RscExileTraderDialog", displayNull];
|
||||
_inventoryDropdown = _dialog displayCtrl 4004;
|
||||
lbClear _inventoryDropdown;
|
||||
_index = _inventoryDropdown lbAdd "Equipment";
|
||||
_inventoryDropdown lbSetValue [_index, 1];
|
||||
_inventoryDropdown lbSetPicture [_index, "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\face_ca.paa"];
|
||||
_inventoryDropdown lbSetCurSel 0;
|
||||
if !((uniform player) isEqualTo "") then
|
||||
{
|
||||
_index = _inventoryDropdown lbAdd "Uniform";
|
||||
_inventoryDropdown lbSetPicture [_index, "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\uniform_ca.paa"];
|
||||
_inventoryDropdown lbSetValue [_index, 2];
|
||||
};
|
||||
if !((vest player) isEqualTo "") then
|
||||
{
|
||||
_index = _inventoryDropdown lbAdd "Vest";
|
||||
_inventoryDropdown lbSetPicture [_index, "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\vest_ca.paa"];
|
||||
_inventoryDropdown lbSetValue [_index, 3];
|
||||
};
|
||||
if !((backpack player) isEqualTo "") then
|
||||
{
|
||||
_index = _inventoryDropdown lbAdd "Backpack";
|
||||
_inventoryDropdown lbSetPicture [_index, "a3\ui_f\data\gui\Rsc\RscDisplayArsenal\backpack_ca.paa"];
|
||||
_inventoryDropdown lbSetValue [_index, 4];
|
||||
};
|
||||
_nearVehicles = nearestObjects [player, ["LandVehicle","Air","Ship"] + _crateTypes, 80];
|
||||
{
|
||||
if (local _x) then
|
||||
{
|
||||
if (alive _x) then
|
||||
{
|
||||
if (isNull attachedTo _x) then
|
||||
{
|
||||
_index = _inventoryDropdown lbAdd getText(configFile >> "CfgVehicles" >> (typeOf _x) >> "displayName");
|
||||
_inventoryDropdown lbSetData [_index, netId _x];
|
||||
_inventoryDropdown lbSetValue [_index, 5];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if (typeOf _x in _crateTypes) then
|
||||
{
|
||||
if (alive _x) then
|
||||
{
|
||||
if (isNull attachedTo _x) then
|
||||
{
|
||||
_index = _inventoryDropdown lbAdd getText(configFile >> "CfgVehicles" >> (typeOf _x) >> "displayName");
|
||||
_inventoryDropdown lbSetData [_index, netId _x];
|
||||
_inventoryDropdown lbSetValue [_index, 5];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
forEach _nearVehicles;
|
||||
true
|
@ -0,0 +1,105 @@
|
||||
private["_nearVehicles","_localVehicles","_display","_revenue","_sellButton","_dropdown","_vehicleObject","_vehicleName","_index","_crateTypes"];
|
||||
disableSerialization;
|
||||
_crateTypes = [
|
||||
"CargoNet_01_box_F",
|
||||
"Exile_Container_SupplyBox",
|
||||
"I_CargoNet_01_ammo_F",
|
||||
"O_CargoNet_01_ammo_F",
|
||||
"B_CargoNet_01_ammo_F",
|
||||
"I_supplyCrate_F",
|
||||
"O_supplyCrate_F",
|
||||
"B_supplyCrate_F",
|
||||
"C_supplyCrate_F",
|
||||
"IG_supplyCrate_F",
|
||||
"Box_NATO_AmmoVeh_F",
|
||||
"Box_East_AmmoVeh_F",
|
||||
"Box_IND_AmmoVeh_F",
|
||||
"I_CargoNET_01_F",
|
||||
"O_CargoNET_01_F",
|
||||
"B_CargoNET_01_F",
|
||||
"Land_CargoBox_V1_F",
|
||||
"ASC_B_box",
|
||||
"Box_NATO_Wps_F",
|
||||
"Box_East_Wps_F",
|
||||
"Box_IND_Wps_F",
|
||||
"Box_East_WpsLaunch_F",
|
||||
"Box_NATO_WpsLaunch_F",
|
||||
"Box_IND_WpsLaunch_F",
|
||||
"Box_IND_WpsSpecial_F",
|
||||
"Box_East_WpsSpecial_F",
|
||||
"Box_NATO_WpsSpecial_F",
|
||||
"Box_NATO_Wps_F",
|
||||
"Box_East_Wps_F",
|
||||
"Box_IND_Wps_F",
|
||||
"Box_East_WpsLaunch_F",
|
||||
"Box_NATO_WpsLaunch_F",
|
||||
"Box_IND_WpsLaunch_F",
|
||||
"Box_IND_WpsSpecial_F",
|
||||
"Box_East_WpsSpecial_F",
|
||||
"Box_NATO_WpsSpecial_F",
|
||||
"Box_NATO_AmmoOrd_F",
|
||||
"Box_East_AmmoOrd_F",
|
||||
"Box_IND_AmmoOrd_F",
|
||||
"Box_NATO_Grenades_F",
|
||||
"Box_East_Grenades_F",
|
||||
"Box_IND_Grenades_F",
|
||||
"Box_NATO_Ammo_F",
|
||||
"Box_East_Ammo_F",
|
||||
"Box_IND_Ammo_F",
|
||||
"Box_IND_Support_F",
|
||||
"Box_East_Support_F",
|
||||
"Box_NATO_Support_F"
|
||||
];
|
||||
_nearVehicles = nearestObjects [player, ["LandVehicle", "Air", "Ship"] + _crateTypes, 150];
|
||||
_localVehicles = [];
|
||||
{
|
||||
if (local _x) then
|
||||
{
|
||||
if (alive _x) then
|
||||
{
|
||||
if (isNull attachedTo _x) then
|
||||
{
|
||||
_localVehicles pushBack _x;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
if (typeOf _x in _crateTypes) then
|
||||
{
|
||||
if (alive _x) then
|
||||
{
|
||||
if (isNull attachedTo _x) then
|
||||
{
|
||||
_localVehicles pushBack _x;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
forEach _nearVehicles;
|
||||
if (_localVehicles isEqualTo []) exitWith
|
||||
{
|
||||
["ErrorTitleAndText", ["Whoops!", "Park within 50m and get in as driver first."]] call ExileClient_gui_toaster_addTemplateToast;
|
||||
};
|
||||
ExileClientCurrentTrader = _this;
|
||||
createDialog "RscExileWasteDumpDialog";
|
||||
waitUntil { !isNull findDisplay 24011 };
|
||||
_display = uiNameSpace getVariable ["RscExileWasteDumpDialog", displayNull];
|
||||
_revenue = _display displayCtrl 4001;
|
||||
_revenue ctrlSetStructuredText (parseText "<t size='1.4'>0<img image='\exile_assets\texture\ui\poptab_notification_ca.paa' size='1' shadow='true' /></t>");
|
||||
_sellButton = _display displayCtrl 4000;
|
||||
_sellButton ctrlEnable false;
|
||||
_dropdown = _display displayCtrl 4002;
|
||||
lbClear _dropdown;
|
||||
{
|
||||
_vehicleObject = _x;
|
||||
_vehicleName = getText(configFile >> "CfgVehicles" >> (typeOf _vehicleObject) >> "displayName");
|
||||
_index = _dropdown lbAdd (format ["Cargo: %1", _vehicleName]);
|
||||
_dropdown lbSetData [_index, netId _vehicleObject];
|
||||
_dropdown lbSetValue [_index, 1];
|
||||
_index = _dropdown lbAdd (format ["Vehicle + Cargo: %1", _vehicleName]);
|
||||
_dropdown lbSetData [_index, netId _vehicleObject];
|
||||
_dropdown lbSetValue [_index, 2];
|
||||
}
|
||||
forEach _localVehicles;
|
||||
true call ExileClient_gui_postProcessing_toggleDialogBackgroundBlur;
|
||||
true
|
@ -0,0 +1,129 @@
|
||||
private["_sessionID","_parameters","_vehicleNetID","_mode","_vehicleObject","_vehicleDBID","_playerObject","_cargo","_revenue","_playerMoney","_respectGain","_playerRespect","_logging","_traderLog","_responseCode","_crateTypes"];
|
||||
_sessionID = _this select 0;
|
||||
_parameters = _this select 1;
|
||||
_vehicleNetID = _parameters select 0;
|
||||
_mode = _parameters select 1;
|
||||
_crateTypes = [
|
||||
"CargoNet_01_box_F",
|
||||
"Exile_Container_SupplyBox",
|
||||
"I_CargoNet_01_ammo_F",
|
||||
"O_CargoNet_01_ammo_F",
|
||||
"B_CargoNet_01_ammo_F",
|
||||
"I_supplyCrate_F",
|
||||
"O_supplyCrate_F",
|
||||
"B_supplyCrate_F",
|
||||
"C_supplyCrate_F",
|
||||
"IG_supplyCrate_F",
|
||||
"Box_NATO_AmmoVeh_F",
|
||||
"Box_East_AmmoVeh_F",
|
||||
"Box_IND_AmmoVeh_F",
|
||||
"I_CargoNET_01_F",
|
||||
"O_CargoNET_01_F",
|
||||
"B_CargoNET_01_F",
|
||||
"Land_CargoBox_V1_F",
|
||||
"ASC_B_box",
|
||||
"Box_NATO_Wps_F",
|
||||
"Box_East_Wps_F",
|
||||
"Box_IND_Wps_F",
|
||||
"Box_East_WpsLaunch_F",
|
||||
"Box_NATO_WpsLaunch_F",
|
||||
"Box_IND_WpsLaunch_F",
|
||||
"Box_IND_WpsSpecial_F",
|
||||
"Box_East_WpsSpecial_F",
|
||||
"Box_NATO_WpsSpecial_F",
|
||||
"Box_NATO_Wps_F",
|
||||
"Box_East_Wps_F",
|
||||
"Box_IND_Wps_F",
|
||||
"Box_East_WpsLaunch_F",
|
||||
"Box_NATO_WpsLaunch_F",
|
||||
"Box_IND_WpsLaunch_F",
|
||||
"Box_IND_WpsSpecial_F",
|
||||
"Box_East_WpsSpecial_F",
|
||||
"Box_NATO_WpsSpecial_F",
|
||||
"Box_NATO_AmmoOrd_F",
|
||||
"Box_East_AmmoOrd_F",
|
||||
"Box_IND_AmmoOrd_F",
|
||||
"Box_NATO_Grenades_F",
|
||||
"Box_East_Grenades_F",
|
||||
"Box_IND_Grenades_F",
|
||||
"Box_NATO_Ammo_F",
|
||||
"Box_East_Ammo_F",
|
||||
"Box_IND_Ammo_F",
|
||||
"Box_IND_Support_F",
|
||||
"Box_East_Support_F",
|
||||
"Box_NATO_Support_F"
|
||||
];
|
||||
try
|
||||
{
|
||||
_vehicleObject = objectFromNetId _vehicleNetID;
|
||||
_vehicleDBID = _vehicleObject getVariable "ExileDatabaseID";
|
||||
if (isNull _vehicleObject) then
|
||||
{
|
||||
throw 6;
|
||||
};
|
||||
if (_vehicleObject getVariable ["ExileMutex", false]) then
|
||||
{
|
||||
throw 12;
|
||||
};
|
||||
_vehicleObject setVariable ["ExileMutex", true];
|
||||
_playerObject = _sessionID call ExileServer_system_session_getPlayerObject;
|
||||
if (isNull _playerObject) then
|
||||
{
|
||||
throw 1;
|
||||
};
|
||||
if !(alive _playerObject) then
|
||||
{
|
||||
throw 2;
|
||||
};
|
||||
if !((owner _vehicleObject) isEqualTo (owner _playerObject)) then
|
||||
{
|
||||
if (typeOf _vehicleObject in _crateTypes) then
|
||||
{
|
||||
_vehicleObject setOwner (owner _playerObject);
|
||||
} else {
|
||||
throw 6;
|
||||
};
|
||||
};
|
||||
_cargo = _vehicleObject call ExileClient_util_containerCargo_list;
|
||||
_revenue = _cargo call ExileClient_util_gear_calculateTotalSellPrice;
|
||||
clearBackpackCargoGlobal _vehicleObject;
|
||||
clearItemCargoGlobal _vehicleObject;
|
||||
clearMagazineCargoGlobal _vehicleObject;
|
||||
clearWeaponCargoGlobal _vehicleObject;
|
||||
if (_mode isEqualTo 2) then
|
||||
{
|
||||
_revenue = _revenue + ([(typeOf _vehicleObject)] call ExileClient_util_gear_calculateTotalSellPrice);
|
||||
_vehicleObject call ExileServer_object_vehicle_remove;
|
||||
deleteVehicle _vehicleObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
_vehicleObject call ExileServer_object_vehicle_database_update;
|
||||
};
|
||||
_playerMoney = _playerObject getVariable ["ExileMoney", 0];
|
||||
_playerMoney = _playerMoney + _revenue;
|
||||
_playerObject setVariable ["ExileMoney", _playerMoney, true];
|
||||
format["setPlayerMoney:%1:%2", _playerMoney, _playerObject getVariable ["ExileDatabaseID", 0]] call ExileServer_system_database_query_fireAndForget;
|
||||
_respectGain = _revenue * getNumber (configFile >> "CfgSettings" >> "Respect" >> "tradingRespectFactor");
|
||||
_playerRespect = _playerObject getVariable ["ExileScore", 0];
|
||||
_playerRespect = floor (_playerRespect + _respectGain);
|
||||
_playerObject setVariable ["ExileScore", _playerRespect];
|
||||
format["setAccountScore:%1:%2", _playerRespect, (getPlayerUID _playerObject)] call ExileServer_system_database_query_fireAndForget;
|
||||
[_sessionID, "wasteDumpResponse", [0, _revenue, str _playerRespect]] call ExileServer_system_network_send_to;
|
||||
_logging = getNumber(configFile >> "CfgSettings" >> "Logging" >> "traderLogging");
|
||||
if (_logging isEqualTo 1) then
|
||||
{
|
||||
_traderLog = format ["PLAYER: ( %1 ) %2 SOLD ITEM: %3 (ID# %4) with Cargo %5 FOR %6 POPTABS AND %7 RESPECT | PLAYER TOTAL MONEY: %8",getPlayerUID _playerObject,_playerObject,typeOf _vehicleObject,_vehicleDBID,_cargo,_revenue,_respectGain,_playerMoney];
|
||||
"extDB3" callExtension format["1:TRADING:%1",_traderLog];
|
||||
};
|
||||
}
|
||||
catch
|
||||
{
|
||||
_responseCode = _exception;
|
||||
[_sessionID, "wasteDumpResponse", [_responseCode, 0, ""]] call ExileServer_system_network_send_to;
|
||||
};
|
||||
if (!isNull _vehicleObject) then
|
||||
{
|
||||
_vehicleObject setVariable ["ExileMutex", false];
|
||||
};
|
||||
true
|
@ -0,0 +1,105 @@
|
||||
/**
|
||||
* ExileServer_world_spawnVehicles
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* © 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*/
|
||||
|
||||
private["_mapsizeX", "_mapsizeY", "_gridSize", "_gridVehicles", "_gridSizeOffset", "_vehicleCount", "_debugMarkers", "_vehicleClassNames", "_maximumDamage", "_damageChance", "_randomizeFuel", "_fuel", "_randomizeAmmo", "_ammo", "_xSize", "_workingXSize", "_ySize", "_workingYSize", "_position", "_spawned", "_spawnedPositions", "_positionReal", "_spawnControl", "_vehicleClassName", "_vehicle", "_hitpointsData", "_hitpoints", "_debugMarker"];
|
||||
_mapsizeX = worldSize;
|
||||
_mapsizeY = worldSize;
|
||||
_gridSize = getNumber(configFile >> "CfgSettings" >> "VehicleSpawn" >> "vehiclesGridSize");
|
||||
_gridVehicles = getNumber(configFile >> "CfgSettings" >> "VehicleSpawn" >> "vehiclesGridAmount");
|
||||
format ["Spawning Dynamic Vehicles. GridSize: %1 Vehs/Grid: %2",_gridSize,_gridVehicles] call ExileServer_util_log;
|
||||
_gridSizeOffset = _gridSize % 2;
|
||||
_vehicleCount = 0;
|
||||
_debugMarkers = ((getNumber(configFile >> "CfgSettings" >> "VehicleSpawn" >> "vehiclesDebugMarkers")) isEqualTo 1);
|
||||
_vehicleClassNames = getArray (configFile >> "CfgSettings" >> "VehicleSpawn" >> "ground");
|
||||
_maximumDamage = getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "maximumDamage");
|
||||
_damageChance = getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "damageChance");
|
||||
_randomizeFuel = ((getNumber(configFile >> "CfgSettings" >> "VehicleSpawn" >> "randomizeFuel")) isEqualTo 1);
|
||||
_fuel = (getNumber(configFile >> "CfgSettings" >> "VehicleSpawn" >> "fuel"));
|
||||
_randomizeAmmo = ((getNumber(configFile >> "CfgSettings" >> "VehicleSpawn" >> "randomizeAmmo")) isEqualTo 1);
|
||||
_ammo = (getNumber(configFile >> "CfgSettings" >> "VehicleSpawn" >> "ammo"));
|
||||
_vehicleItemsAllowed = getNumber (missionConfigFile >> "SpawnVehicleItems" >> "WorldVehicles" >> "vehicleItemsAllowed");
|
||||
_allowedItems = getArray (missionConfigFile >> "SpawnVehicleItems" >> "WorldVehicles" >> "allowedItems");
|
||||
_maximumItemsPerVehicle = getNumber (missionConfigFile >> "SpawnVehicleItems" >> "WorldVehicles" >> "maximumItemsPerVehicle");
|
||||
_maximumItemsPerVehicle = _maximumItemsPerVehicle +1;
|
||||
for "_xSize" from 0 to _mapsizeX step _gridSize do
|
||||
{
|
||||
_workingXSize = _xSize + _gridSizeOffset;
|
||||
for "_ySize" from 0 to _mapsizeY step _gridSize do
|
||||
{
|
||||
_workingYSize = _ySize + _gridSizeOffset;
|
||||
_position = [_workingXSize,_workingYSize];
|
||||
_spawned = 0;
|
||||
_spawnedPositions = [];
|
||||
while {_spawned < _gridVehicles} do
|
||||
{
|
||||
_positionReal = [_position, 25, _gridSize, 5, 0 , 1 , 0 , _spawnedPositions] call BIS_fnc_findSafePos;
|
||||
if(count _positionReal isEqualTo 3)exitWith{};
|
||||
_spawnControl = [[(_positionReal select 0) - 50, (_positionReal select 1) + 50],[(_positionReal select 0) + 50,(_positionReal select 1) - 50]];
|
||||
_spawnedPositions pushBack _spawnControl;
|
||||
_positionReal pushBack 0;
|
||||
_vehicleClassName = selectRandom _vehicleClassNames;
|
||||
_vehicle = [_vehicleClassName, _positionReal, random 360, true] call ExileServer_object_vehicle_createNonPersistentVehicle;
|
||||
_hitpointsData = getAllHitPointsDamage _vehicle;
|
||||
if !(_hitpointsData isEqualTo []) then
|
||||
{
|
||||
_hitpoints = _hitpointsData select 0;
|
||||
{
|
||||
if ((random 100) < _damageChance) then
|
||||
{
|
||||
_vehicle setHitPointDamage [_x, random _maximumDamage];
|
||||
};
|
||||
}
|
||||
forEach _hitpoints;
|
||||
};
|
||||
if (_randomizeFuel) then
|
||||
{
|
||||
_vehicle setFuel (random _fuel);
|
||||
}
|
||||
else
|
||||
{
|
||||
_vehicle setFuel _fuel;
|
||||
};
|
||||
if (_randomizeAmmo) then
|
||||
{
|
||||
_vehicle setVehicleAmmo (random _ammo);
|
||||
}
|
||||
else
|
||||
{
|
||||
_vehicle setVehicleAmmo _ammo;
|
||||
};
|
||||
if (_debugMarkers) then
|
||||
{
|
||||
_debugMarker = createMarker ["vehicleMarker#"+str _vehicleCount, _positionReal];
|
||||
_debugMarker setMarkerColor "ColorOrange";
|
||||
_debugMarker setMarkerType "mil_dot_noShadow";
|
||||
};
|
||||
if (_vehicleItemsAllowed isEqualTo 1) then {
|
||||
_itemsAdded = 0;
|
||||
_itemsPerVehicle = floor (random _maximumItemsPerVehicle);
|
||||
while{_itemsAdded < _itemsPerVehicle} do {
|
||||
_itemAdd = _allowedItems select (floor (random (count _allowedItems)));
|
||||
_cargoType = _itemAdd call ExileClient_util_cargo_getType;
|
||||
switch (_cargoType) do {
|
||||
case 1: { _vehicle addMagazineAmmoCargo [_itemAdd, 1, 1]; };
|
||||
case 2: { _vehicle addWeaponCargoGlobal [_itemAdd, 1]; };
|
||||
case 3: { _vehicle addBackpackCargoGlobal [_itemAdd, 1]; };
|
||||
default { _vehicle addItemCargoGlobal [_itemAdd, 1, 1]; };
|
||||
};
|
||||
_itemsAdded = _itemsAdded + 1;
|
||||
};
|
||||
};
|
||||
_spawned = _spawned + 1;
|
||||
_vehicleCount = _vehicleCount + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
format ["Dynamic vehicles spawned. Count : %1",_vehicleCount] call ExileServer_util_log;
|
||||
true
|
@ -0,0 +1,114 @@
|
||||
/**
|
||||
* ExileClient_util_inventory_canExchangeItems
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* © 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*/
|
||||
|
||||
private["_itemsToRemoveFirst", "_itemsToAddAfterwards", "_result", "_uniformLoad", "_uniformMaximumLoad", "_uniformContent", "_vestLoad", "_vestMaximumLoad", "_vestContent", "_backpackLoad", "_backpackMaximumLoad", "_backpackContent", "_quantity", "_itemClassName", "_itemMass", "_i", "_index"];
|
||||
_itemsToRemoveFirst = _this select 0;
|
||||
_itemsToAddAfterwards = _this select 1;
|
||||
_result = true;
|
||||
//_uniformLoad = loadUniform player;
|
||||
//from: http://epochmod.site.nfoservers.com/donkeypunch/index.php?topic=749.0
|
||||
_uniformLoad = 0;
|
||||
_uniformMaximumLoad = (uniform player) call ExileClient_util_gear_getMaximumLoad;
|
||||
_uniformContent = uniformItems player;
|
||||
{
|
||||
_itemMass = _x call ExileClient_util_gear_getMass;
|
||||
_uniformLoad = _uniformLoad + _itemMass;
|
||||
}forEach _uniformContent;
|
||||
//_vestLoad = loadVest player;
|
||||
_vestLoad = 0;
|
||||
_vestMaximumLoad = (vest player) call ExileClient_util_gear_getMaximumLoad;
|
||||
_vestContent = vestItems player;
|
||||
{
|
||||
_itemMass = _x call ExileClient_util_gear_getMass;
|
||||
_vestLoad = _vestLoad + _itemMass;
|
||||
}forEach _vestContent;
|
||||
//_backpackLoad = loadBackpack player;
|
||||
_backpackLoad = 0;
|
||||
_backpackMaximumLoad = (backpack player) call ExileClient_util_gear_getMaximumLoad;
|
||||
_backpackContent = backpackItems player;
|
||||
{
|
||||
_itemMass = _x call ExileClient_util_gear_getMass;
|
||||
_backpackLoad = _backpackLoad + _itemMass;
|
||||
}forEach _backpackContent;
|
||||
|
||||
_uniformMaximumLoad = (uniform player) call ExileClient_util_gear_getMaximumLoad;
|
||||
_uniformContent = uniformItems player;
|
||||
_vestLoad = loadVest player;
|
||||
_vestMaximumLoad = (vest player) call ExileClient_util_gear_getMaximumLoad;
|
||||
_vestContent = vestItems player;
|
||||
_backpackLoad = loadBackpack player;
|
||||
_backpackMaximumLoad = (backpack player) call ExileClient_util_gear_getMaximumLoad;
|
||||
_backpackContent = backpackItems player;
|
||||
{
|
||||
_quantity = _x select 0;
|
||||
_itemClassName = _x select 1;
|
||||
_itemMass = _itemClassName call ExileClient_util_gear_getMass;
|
||||
for "_i" from 1 to _quantity do
|
||||
{
|
||||
_index = _backpackContent find _itemClassName;
|
||||
if (_index != -1) then
|
||||
{
|
||||
_backpackContent deleteAt _index;
|
||||
_backpackLoad = _backpackLoad - _itemMass;
|
||||
}
|
||||
else
|
||||
{
|
||||
_index = _vestContent find _itemClassName;
|
||||
if (_index != -1) then
|
||||
{
|
||||
_vestContent deleteAt _index;
|
||||
_vestLoad = _vestLoad - _itemMass;
|
||||
}
|
||||
else
|
||||
{
|
||||
_index = _uniformContent find _itemClassName;
|
||||
if (_index != -1) then
|
||||
{
|
||||
_uniformContent deleteAt _index;
|
||||
_uniformLoad = _uniformLoad - _itemMass;
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
forEach _itemsToRemoveFirst;
|
||||
{
|
||||
_quantity = _x select 0;
|
||||
_itemClassName = _x select 1;
|
||||
_itemMass = _itemClassName call ExileClient_util_gear_getMass;
|
||||
for "_i" from 1 to _quantity do
|
||||
{
|
||||
if (_backpackLoad + _itemMass <= _backpackMaximumLoad) then
|
||||
{
|
||||
_backpackLoad = _backpackLoad + _itemMass;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_vestLoad + _itemMass <= _vestMaximumLoad) then
|
||||
{
|
||||
_vestLoad = _vestLoad + _itemMass;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_uniformLoad + _itemMass <= _uniformMaximumLoad) then
|
||||
{
|
||||
_uniformLoad = _uniformLoad + _itemMass;
|
||||
}
|
||||
else
|
||||
{
|
||||
_result = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
forEach _itemsToAddAfterwards;
|
||||
_result
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
* ExileServer_system_event_ambientFlyOver_start
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* © 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*/
|
||||
|
||||
private["_targetPlayer", "_flyHeight", "_speed", "_direction", "_targetPosition", "_distance", "_endPosition", "_planeClass", "_i", "_startPosition", "_pilot", "_plane", "_waypoint"];
|
||||
_group = createGroup independent;
|
||||
_targetPlayer = selectRandom allPlayers;
|
||||
format ["Ambient Fly Over - Heading to %1...", _targetPlayer] call ExileServer_util_log;
|
||||
_flyHeight = 125;
|
||||
_speed = 250;
|
||||
_direction = random 360;
|
||||
_targetPosition =
|
||||
[
|
||||
(getPos _targetPlayer) select 0,
|
||||
(getPos _targetPlayer) select 1,
|
||||
_flyHeight
|
||||
];
|
||||
_distance = worldSize * 0.75;
|
||||
_endPosition =
|
||||
[
|
||||
(_targetPosition select 0) - (sin _direction) * _distance,
|
||||
(_targetPosition select 1) - (cos _direction) * _distance,
|
||||
_flyHeight
|
||||
];
|
||||
_planeClass = selectRandom
|
||||
[
|
||||
"B_Plane_CAS_01_F",
|
||||
"O_Plane_CAS_02_F",
|
||||
"I_Plane_Fighter_03_CAS_F"
|
||||
];
|
||||
for "_i" from 1 to (1 + (floor (random 3))) do
|
||||
{
|
||||
_distance = 4000 + (_i * 400);
|
||||
_startPosition =
|
||||
[
|
||||
(_targetPosition select 0) + (sin _direction) * _distance,
|
||||
(_targetPosition select 1) + (cos _direction) * _distance,
|
||||
800
|
||||
];
|
||||
_pilot = _group createUnit ["I_helicrew_F", _startPosition, [], 100, "FORM"];
|
||||
_pilot setSkill 1;
|
||||
[_pilot] joinSilent _group;
|
||||
_plane = createVehicle [_planeClass, _startPosition, [], 100, "FLY"];
|
||||
clearBackpackCargoGlobal _plane;
|
||||
clearWeaponCargoGlobal _plane;
|
||||
clearMagazineCargoGlobal _plane;
|
||||
clearItemCargoGlobal _plane;
|
||||
_plane setVehicleAmmo 0;
|
||||
_plane setFuel 0.1;
|
||||
_pilot assignAsDriver _plane;
|
||||
_pilot moveInDriver _plane;
|
||||
_pilot allowDamage false;
|
||||
_plane allowDamage false;
|
||||
_plane flyInHeight _flyHeight;
|
||||
_plane disableAI "TARGET";
|
||||
_plane disableAI "AUTOTARGET";
|
||||
_plane setDir _direction;
|
||||
_plane setVelocity [(sin _direction) * _speed, (cos _direction) * _speed, 0];
|
||||
};
|
||||
_group allowFleeing 0;
|
||||
_group setBehaviour "CARELESS";
|
||||
_group setSpeedMode "FULL";
|
||||
_group setFormation "WEDGE";
|
||||
_group setCombatMode "BLUE";
|
||||
_waypoint = _group addWaypoint [getPos _targetPlayer, 0];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointCompletionRadius 800;
|
||||
_waypoint setWaypointStatements ["true", "'Ambient Fly Over - Reached player...' call ExileServer_util_log;"];
|
||||
_waypoint = _group addWaypoint [_endPosition, 0];
|
||||
_waypoint setWaypointType "MOVE";
|
||||
_waypoint setWaypointCompletionRadius 800;
|
||||
_waypoint setWaypointStatements ["true", "'Ambient Fly Over - Reached end...' call ExileServer_util_log; { deleteVehicle (vehicle _x); deleteVehicle _x; } forEach thisList;"];
|
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* ExileServer_system_garbageCollector_deleteObject
|
||||
*
|
||||
* Exile Mod
|
||||
* www.exilemod.com
|
||||
* © 2015 Exile Mod Team
|
||||
*
|
||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
||||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
|
||||
*/
|
||||
|
||||
private["_object", "_fliesSound", "_fliesParticles"];
|
||||
_object = _this;
|
||||
if (_object getVariable ["ExileIsSimulationMonitored", false]) then
|
||||
{
|
||||
_object call ExileServer_system_simulationMonitor_removeVehicle;
|
||||
};
|
||||
_object removeAllMPEventHandlers "MPKilled";
|
||||
_object removeAllEventHandlers "Dammaged";
|
||||
_object removeAllEventHandlers "GetIn";
|
||||
_object removeAllEventHandlers "GetOut";
|
||||
removeAllActions _object;
|
||||
clearBackpackCargoGlobal _object;
|
||||
clearWeaponCargoGlobal _object;
|
||||
clearItemCargoGlobal _object;
|
||||
clearMagazineCargoGlobal _object;
|
||||
removeAllContainers _object;
|
||||
if !(isNull (attachedTo _object)) then
|
||||
{
|
||||
detach _object;
|
||||
};
|
||||
_fliesSound = _object getVariable ["ExileFliesSound", objNull];
|
||||
if !(isNull _fliesSound) then
|
||||
{
|
||||
deleteVehicle _fliesSound;
|
||||
};
|
||||
_fliesParticles = _object getVariable ["ExileFliesParticles", objNull];
|
||||
if !(isNull _fliesParticles) then
|
||||
{
|
||||
_fliesParticles setDamage 999;
|
||||
};
|
||||
{
|
||||
_x call ExileServer_system_garbageCollector_deleteObject;
|
||||
}
|
||||
forEach (attachedObjects _object);
|
||||
deleteVehicle _object;
|
Loading…
Reference in New Issue
Block a user