Merge pull request #605 from Ignatz-HeMan/patch-4

Remove Weapons / Magazines from Spawned / Loaded Vehicles (by Serversetting config)
This commit is contained in:
vbawol 2016-08-31 17:14:26 -05:00 committed by GitHub
commit f1990b2a84
5 changed files with 68 additions and 3 deletions

View File

@ -30,6 +30,15 @@ cloneCost = 100; // debt incurred on player death
// vehicles - Max vehicle slots is calculated from per vehicle limits below. Warning! Higher the number lower the performance.
simulationHandlerOld = false; // When enabled this feature disables simulation on vehicles that are not nea players. Can help improve client fps at the cost of server fps.
vehicleLockTime = 1800; // Controls how many seconds it takes to allow another person/group to unlock vehicle.
removevehweapons[] = { // remove these Weapons from spawned Vehicles
"missiles_DAR","gatling_30mm","gatling_20mm","missiles_DAGR","cannon_30mm_Plane_CAS_02_F","Missile_AA_03_Plane_CAS_02_F","Missile_AGM_01_Plane_CAS_02_F","Rocket_03_HE_Plane_CAS_02_F",
"Rocket_03_AP_Plane_CAS_02_F","Bomb_03_Plane_CAS_02_F","Bomb_04_Plane_CAS_01_F","Rocket_04_AP_Plane_CAS_01_F","Rocket_04_HE_Plane_CAS_01_F","Missile_AGM_02_Plane_CAS_01_F","Missile_AA_04_Plane_CAS_01_F",
"Gatling_30mm_Plane_CAS_01_F","GBU12BombLauncher_Plane_Fighter_03_F","missiles_ASRAAM","missiles_SCALPEL","Twin_Cannon_20mm","missiles_Zephyr","rockets_skyfire","gatling_30mm_vtol_02"
};
removevehmagazinesturret[] = { // Remove these Magazines from the given Turret from spawned Vehicles
{"24Rnd_missiles",{-1}},
{"200Rnd_40mm_G_belt",{0}}
};
// Traders
taxRate = 0.1; // controls the price increase for purchases

View File

@ -12,7 +12,7 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf
*/
private ["_availableColorsConfig","_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_cfgEpochVehicles","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig"];
private ["_removeweapons","_removemagazinesturret","_availableColorsConfig","_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_cfgEpochVehicles","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig"];
params [["_maxVehicleLimit",0]];
_diag = diag_tickTime;
@ -24,6 +24,8 @@ _vehicleDamages = [];
_serverSettingsConfig = configFile >> "CfgEpochServer";
_simulationHandler = [_serverSettingsConfig, "simulationHandlerOld", false] call EPOCH_fnc_returnConfigEntry;
_removeweapons = [_serverSettingsConfig, "removevehweapons", []] call EPOCH_fnc_returnConfigEntry;
_removemagazinesturret = [_serverSettingsConfig, "removevehmagazinesturret", []] call EPOCH_fnc_returnConfigEntry;
for "_i" from 1 to _maxVehicleLimit do {
_vehicleSlotIndex = EPOCH_VehicleSlots pushBack str(_i);
@ -109,6 +111,18 @@ for "_i" from 1 to _maxVehicleLimit do {
clearMagazineCargoGlobal _vehicle;
clearBackpackCargoGlobal _vehicle;
clearItemCargoGlobal _vehicle;
if !(_removeweapons isequalto []) then {
{
_vehicle removeWeaponGlobal _x;
} foreach _removeweapons;
};
if !(_removemagazinesturret isequalto []) then {
{
_vehicle removeMagazinesTurret _x;
} foreach _removemagazinesturret;
};
{
_objType = _forEachIndex;
_objTypes = _x;

View File

@ -12,7 +12,7 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/master/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf
*/
private ["_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_config","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_immuneVehicleSpawnTime","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig","_simulationHandler","_immuneVehicleSpawn"];
private ["_removeweapons","_removemagazinesturret","_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_config","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_immuneVehicleSpawnTime","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig","_simulationHandler","_immuneVehicleSpawn"];
params [["_maxVehicleLimit",0]];
_diag = diag_tickTime;
@ -24,6 +24,8 @@ _allVehicles = [];
_serverSettingsConfig = configFile >> "CfgEpochServer";
_simulationHandler = [_serverSettingsConfig, "simulationHandlerOld", false] call EPOCH_fnc_returnConfigEntry;
_immuneVehicleSpawn = [_serverSettingsConfig, "immuneVehicleSpawn", false] call EPOCH_fnc_returnConfigEntry;
_removeweapons = [_serverSettingsConfig, "removevehweapons", []] call EPOCH_fnc_returnConfigEntry;
_removemagazinesturret = [_serverSettingsConfig, "removevehmagazinesturret", []] call EPOCH_fnc_returnConfigEntry;
for "_i" from 1 to _maxVehicleLimit do {
_vehicleSlotIndex = EPOCH_VehicleSlots pushBack str(_i);
@ -116,6 +118,17 @@ for "_i" from 1 to _maxVehicleLimit do {
clearBackpackCargoGlobal _vehicle;
clearItemCargoGlobal _vehicle;
if !(_removeweapons isequalto []) then {
{
_vehicle removeWeaponGlobal _x;
} foreach _removeweapons;
};
if !(_removemagazinesturret isequalto []) then {
{
_vehicle removeMagazinesTurret _x;
} foreach _removemagazinesturret;
};
_vehicle disableTIEquipment true;
_vehicle lock true;

View File

@ -12,9 +12,12 @@
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf
*/
private ["_maxDamage","_textures","_textureSelectionIndex","_selections","_colors","_color","_count","_vehLockHiveKey","_marker","_cfgEpochVehicles","_vehObj"];
private ["_removeweapons","_removemagazinesturret","_maxDamage","_textures","_textureSelectionIndex","_selections","_colors","_color","_count","_vehLockHiveKey","_marker","_cfgEpochVehicles","_vehObj"];
params ["_vehClass","_position","_direction","_locked","_slot",["_lockOwner",""],["_can_collide","CAN_COLLIDE"],["_spawnLoot",false],["_spawnDamaged",true]];
if !(isClass (configFile >> "CfgVehicles" >> _vehClass)) exitWith {objNull};
_serverSettingsConfig = configFile >> "CfgEpochServer";
_removeweapons = [_serverSettingsConfig, "removevehweapons", []] call EPOCH_fnc_returnConfigEntry;
_removemagazinesturret = [_serverSettingsConfig, "removevehmagazinesturret", []] call EPOCH_fnc_returnConfigEntry;
_vehObj = createVehicle[_vehClass, _position, [], 0, _can_collide];
if !(isNull _vehObj) then{
_vehObj call EPOCH_server_setVToken;
@ -32,6 +35,17 @@ if !(isNull _vehObj) then{
clearBackpackCargoGlobal _vehObj;
clearItemCargoGlobal _vehObj;
if !(_removeweapons isequalto []) then {
{
_vehObj removeWeaponGlobal _x;
} foreach _removeweapons;
};
if !(_removemagazinesturret isequalto []) then {
{
_vehObj removeMagazinesTurret _x;
} foreach _removemagazinesturret;
};
// Disable Termal Equipment
_vehObj disableTIEquipment true;

View File

@ -1134,6 +1134,9 @@ call compile ("'"+_skn_doAdminRequest+"' addPublicVariableEventHandler {
_return = false;
if (_item isKindOf 'Air' || _item isKindOf 'Ship' || _item isKindOf 'LandVehicle') then {
if !(EPOCH_VehicleSlots isEqualTo[]) then {
_serverSettingsConfig = configFile >> 'CfgEpochServer';
_removeweapons = [_serverSettingsConfig, 'removevehweapons', []] call EPOCH_fnc_returnConfigEntry;
_removemagazinesturret = [_serverSettingsConfig, 'removevehmagazinesturret', []] call EPOCH_fnc_returnConfigEntry;
_position = getPosATL _target;
_slot = EPOCH_VehicleSlots select 0;
@ -1151,6 +1154,18 @@ call compile ("'"+_skn_doAdminRequest+"' addPublicVariableEventHandler {
clearMagazineCargoGlobal _vehObj;
clearBackpackCargoGlobal _vehObj;
clearItemCargoGlobal _vehObj;
if !(_removeweapons isequalto []) then {
{
_vehObj removeWeaponGlobal _x;
} foreach _removeweapons;
};
if !(_removemagazinesturret isequalto []) then {
{
_vehObj removeMagazinesTurret _x;
} foreach _removemagazinesturret;
};
_vehObj lock true;
_playerUID = getPlayerUID _target;