diff --git a/@ExileServer/addons/exad_dv/$PREFIX$ b/@ExileServer/addons/exad_dv/$PREFIX$ new file mode 100644 index 0000000..31b4497 --- /dev/null +++ b/@ExileServer/addons/exad_dv/$PREFIX$ @@ -0,0 +1 @@ +exad_dv \ No newline at end of file diff --git a/@ExileServer/addons/exad_dv/Functions/fn_despawnDeployableVehicle.sqf b/@ExileServer/addons/exad_dv/Functions/fn_despawnDeployableVehicle.sqf new file mode 100644 index 0000000..089cf91 --- /dev/null +++ b/@ExileServer/addons/exad_dv/Functions/fn_despawnDeployableVehicle.sqf @@ -0,0 +1,73 @@ +/* + fn_createMarker.sqf + + Copyright 2016 Jan Babor + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +params ["_vehObjNetId"]; + +_vehObj = objectFromNetId _vehObjNetId; +_vehClass = typeOf _vehObj; +_vehPos = getPosATL _vehObj; + +moveOut (driver _vehObj); +_vehObj call ExileServer_system_vehicleSaveQueue_removeVehicle; +_vehObj call ExileServer_system_simulationMonitor_removeVehicle; +deleteVehicle _vehObj; + +_subClasses = (missionConfigfile >> "CfgXM8") call BIS_fnc_getCfgSubClasses; +{ + if(getText(missionConfigFile >> "CfgXM8" >> _x "vehicleClass") == _vehClass)exitWith{ + + _lootHolder = createVehicle ["LootWeaponHolder", _vehPos, [], 0, "CAN_COLLIDE"]; + _lootHolder setDir (random 360); + _lootHolder setPosATL _vehPos; + + { + _amount = if(count _x > 1)then{_x select 1}else{1}; + if(_amount > 0)then{ + _cargoType = (_x select 0) call ExileClient_util_cargo_getType; + switch (_cargoType) do + { + case 1: + { + if (_itemClassName isEqualTo "Exile_Item_MountainDupe") then + { + _lootHolder addMagazineCargoGlobal [_itemClassName, _amount]; + } + else + { + _lootHolder addMagazineCargoGlobal [_itemClassName, _amount]; + }; + }; + case 3: + { + _lootHolder addBackpackCargoGlobal [_itemClassName, _amount]; + }; + case 2: + { + _lootHolder addWeaponCargoGlobal [_itemClassName, _amount]; + }; + default + { + _lootHolder addItemCargoGlobal [_itemClassName, _amount; + }; + }; + }; + }forEach getArray(missionConfigFile >> CfgXM8 >> _x >> "recipe"); + }; +}forEach _subClasses; + +true \ No newline at end of file diff --git a/@ExileServer/addons/exad_dv/Functions/fn_spawnDeployableVehicle.sqf b/@ExileServer/addons/exad_dv/Functions/fn_spawnDeployableVehicle.sqf new file mode 100644 index 0000000..564685a --- /dev/null +++ b/@ExileServer/addons/exad_dv/Functions/fn_spawnDeployableVehicle.sqf @@ -0,0 +1,64 @@ +/* + fn_createMarker.sqf + + Copyright 2016 Jan Babor + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +params ["_playerNetId","_configClass","_player","_spawnPos","_spawnDir","_usePositionATL","_vehObj"]; + +_player = objectFromNetId _playerNetId; + +_spawnPos = _player modelToWorld [0,2,0]; +_spawnDir = direction _player; +_usePositionATL = true; + +_vehicleClass = getText(missionConfigFile >> "CfgXM8" >> _configClass >> "vehicleClass"); + +_vehObj = [_vehicleClass, _spawnPos, _spawnDir, _usePositionATL] call ExileServer_object_vehicle_createNonPersistentVehicle; + +if( getNumber(missionConfigFile >> "CfgXM8" >> _configClass >> "packable") > 0 ) then { + _vehObj setVariable ["ExAd_DV_Packable", true, true]; +}; + +if( getNumber(missionConfigFile >> "CfgXM8" >> _configClass >> "autoCleanUp") > 0 ) then { + [_vehObj] spawn { + private ["_wait","_tick", "_vehObj","_driver"]; + _wait = true; + _tick = 0; + _vehObj = [_this,0,objNull] call BIS_fnc_param; + + while {_wait} do { + UISleep 1; + if(isNull _vehObj)exitWith{_wait = false}; + + _driver = driver _vehObj; + if(isNull _driver)then{ + _tick = _tick + 1; + }else{ + _tick = 0; + }; + + if(_tick >= ExAd_DV_DESPAWN_IDLE_TIME)exitWith{_wait = false}; + }; + + moveOut (driver _vehObj); + _vehObj call ExileServer_system_vehicleSaveQueue_removeVehicle; + _vehObj call ExileServer_system_simulationMonitor_removeVehicle; + deleteVehicle _vehObj; + + }; +}; + +true \ No newline at end of file diff --git a/@ExileServer/addons/exad_dv/PboPrefix.txt b/@ExileServer/addons/exad_dv/PboPrefix.txt new file mode 100644 index 0000000..31b4497 --- /dev/null +++ b/@ExileServer/addons/exad_dv/PboPrefix.txt @@ -0,0 +1 @@ +exad_dv \ No newline at end of file diff --git a/@ExileServer/addons/exad_dv/config.cpp b/@ExileServer/addons/exad_dv/config.cpp new file mode 100644 index 0000000..e45f151 --- /dev/null +++ b/@ExileServer/addons/exad_dv/config.cpp @@ -0,0 +1,46 @@ +/* + config.cpp + + Copyright 2016 Jan Babor + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +class CfgPatches { + class ExAd_DV { + requiredVersion = 0.1; + requiredAddons[] = {"ExAd_Core"}; + }; +}; + +class CfgFunctions { + class ExAdServer { + class DV { + file = "exad_dv\Functions"; + class spawnDeployableVehicle {}; + class despawnDeployableVehicle {}; + }; + }; +}; + +class CfgNetworkMessages +{ + class spawnDeployableVehicle + { + parameters[] = {"STRING","STRING"}; + }; + class despawnDeployableVehicle + { + parameters[] = {"STRING"}; + }; +}; \ No newline at end of file