From fd0b81118b399dd6e85a83c50d6a8d56058f0993 Mon Sep 17 00:00:00 2001 From: oiad Date: Sun, 15 Jan 2017 13:40:54 +1300 Subject: [PATCH] Move dze_supplyCrate and vein wrecks to CfgLoot (#1863) * Move dze_supplyCrate and vein wrecks to CfgLoot Moves both the supply crates and vein wrecks to the CfgLoot tables so admins can customize. Also modifies the main add item statement to allow support for weapons, magazines and backpack refunding/spawning instead of hard coded magazines. Should be backwards compatible with the old style (I did test). * Remove unused _activatingPlayer variable * Rework --- SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp | 3 +- .../Configs/CfgLoot/Groups/Wrecks.hpp | 29 ++++++++++++++++ .../Configs/CfgVehicles/DZE/Doors.hpp | 8 ++--- SQF/dayz_code/actions/remove.sqf | 34 +++++++++++++++---- 4 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 SQF/dayz_code/Configs/CfgLoot/Groups/Wrecks.hpp diff --git a/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp b/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp index c66208dd8..bd84adf09 100644 --- a/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp +++ b/SQF/dayz_code/Configs/CfgLoot/CfgLoot.hpp @@ -41,6 +41,7 @@ class CfgLoot #include "Groups\Weapons.hpp" #include "Groups\Clothes.hpp" #include "Groups\Backpacks.hpp" + #include "Groups\Wrecks.hpp" // Points of interest #include "Groups\CrashSite.hpp" @@ -113,4 +114,4 @@ class CfgLoot // Buildings #include "CfgBuildingPos.hpp" }; -}; \ No newline at end of file +}; diff --git a/SQF/dayz_code/Configs/CfgLoot/Groups/Wrecks.hpp b/SQF/dayz_code/Configs/CfgLoot/Groups/Wrecks.hpp new file mode 100644 index 000000000..3b523f6e5 --- /dev/null +++ b/SQF/dayz_code/Configs/CfgLoot/Groups/Wrecks.hpp @@ -0,0 +1,29 @@ +Land_iron_vein_wreck[] = +{ + {Loot_MAGAZINE,85,PartOre,10,10}, + {Loot_MAGAZINE,10,PartOreSilver,0,10}, + {Loot_MAGAZINE,5,PartOreGold,0,5} +}; + +Land_silver_vein_wreck[] = +{ + {Loot_MAGAZINE,80,PartOreSilver,10,10}, + {Loot_MAGAZINE,15,PartOreGold,2,6}, + {Loot_MAGAZINE,5,PartOre,0,1} +}; + +Land_gold_vein_wreck[] = +{ + {Loot_MAGAZINE,80,PartOreGold,10,10}, + {Loot_MAGAZINE,15,PartOreSilver,2,6}, + {Loot_MAGAZINE,5,PartOre,0,1} +}; + +Land_ammo_supply_wreck[] = +{ + {Loot_MAGAZINE, 20, 2000Rnd_762x51_M134}, + {Loot_MAGAZINE, 20, 29Rnd_30mm_AGS30}, + {Loot_MAGAZINE, 20, 50Rnd_127x107_DSHKM}, + {Loot_MAGAZINE, 20, 48Rnd_40mm_MK19}, + {Loot_MAGAZINE, 20, 100Rnd_127x99_M2} +}; \ No newline at end of file diff --git a/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp b/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp index 19669ee8d..a13a4c571 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp @@ -252,26 +252,26 @@ class Land_iron_vein_wreck: ruins { scope = protected; model = "\z\addons\dayz_epoch\models\iron_vein_wreck.p3d"; displayName = $STR_ORE_VEIN_WRECK_IRON; - removeoutput[] = {{"PartOre",{10,10}},{"PartOreSilver",{0,10}},{"PartOreGold",{0,5}}}; + //removeoutput[] = {{"PartOre",{10,10}},{"PartOreSilver",{0,10}},{"PartOreGold",{0,5}}}; // Moved to CfgLoot group }; class Land_silver_vein_wreck: ruins { scope = protected; model = "\z\addons\dayz_epoch\models\silver_vein_wreck.p3d"; displayName = $STR_ORE_VEIN_WRECK_SILVER; - removeoutput[] = {{"PartOreSilver",{10,10}},{"PartOre",{0,1}},{"PartOreGold",{6,4}}}; + //removeoutput[] = {{"PartOreSilver",{10,10}},{"PartOre",{0,1}},{"PartOreGold",{6,4}}}; // Moved to CfgLoot group }; class Land_gold_vein_wreck: ruins { scope = protected; model = "\z\addons\dayz_epoch\models\gold_vein_wreck.p3d"; displayName = $STR_ORE_VEIN_WRECK_GOLD; - removeoutput[] = {{"PartOreGold",{10,10}},{"PartOre",{0,1}},{"PartOreSilver",{6,4}}}; + //removeoutput[] = {{"PartOreGold",{10,10}},{"PartOre",{0,1}},{"PartOreSilver",{6,4}}}; // Moved to CfgLoot group }; class Land_ammo_supply_wreck: ruins { scope = protected; model = "\z\addons\dayz_epoch\models\ammo_supply_wreck.p3d"; displayName = $STR_EPOCH_BULK_NAME; - removeoutput[] = {{"100Rnd_762x54_PK",{0,1}},{"29Rnd_30mm_AGS30",{0,1}},{"50Rnd_127x107_DSHKM",{0,1}},{"100Rnd_127x99_M2",{0,1}},{"2000Rnd_762x51_M134",{0,1}},{"48Rnd_40mm_MK19",{0,1}},{"100Rnd_762x51_M240",{0,1}}}; + //removeoutput[] = {{"100Rnd_762x54_PK",{0,1}},{"29Rnd_30mm_AGS30",{0,1}},{"50Rnd_127x107_DSHKM",{0,1}},{"100Rnd_127x99_M2",{0,1}},{"2000Rnd_762x51_M134",{0,1}},{"48Rnd_40mm_MK19",{0,1}},{"100Rnd_762x51_M240",{0,1}}}; // Moved to CfgLoot group }; diff --git a/SQF/dayz_code/actions/remove.sqf b/SQF/dayz_code/actions/remove.sqf index 83c9749da..e7a5c7718 100644 --- a/SQF/dayz_code/actions/remove.sqf +++ b/SQF/dayz_code/actions/remove.sqf @@ -4,13 +4,12 @@ dayz_actionInProgress = true; delete object from db with extra waiting by [VB]AWOL parameters: _obj */ -private ["_activatingPlayer","_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_ownerID","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular","_success"]; +private ["_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_isOk","_proceed","_counter","_limit","_objType","_sfx","_dis","_itemOut","_countOut","_selectedRemoveOutput","_nearestPole","_ownerID","_refundpart","_isWreck","_IsNearPlot","_brokenTool","_removeTool","_isDestructable","_isRemovable","_objOwnerID","_isOwnerOfObj","_preventRefund","_ipos","_item","_radius","_isWreckBuilding","_nameVehicle","_isModular","_success","_lootGroupIndex","_output"]; player removeAction s_player_deleteBuild; s_player_deleteBuild = 1; _obj = _this select 3; -_activatingPlayer = player; _objOwnerID = "0"; _isOwnerOfObj = false; @@ -182,8 +181,7 @@ if (_proceed && _success) then { deleteVehicle _obj; if(!_isWreck && !_isWreckBuilding) then { - _activatingPlayer = player; - PVDZ_obj_Destroy = [_objectID,_objectUID, _activatingPlayer]; + PVDZ_obj_Destroy = [_objectID,_objectUID,player]; publicVariableServer "PVDZ_obj_Destroy"; }; @@ -203,7 +201,21 @@ if (_proceed && _success) then { _selectedRemoveOutput set [count _selectedRemoveOutput,[_refundpart,1]]; } else { if(_isWreckBuilding) then { - _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); + switch true do { + case (_isMine): { + _lootGroupIndex = dz_loot_groups find _objType; + _output = [_lootGroupIndex,3] call dz_fn_loot_select; + + {_selectedRemoveOutput set [count _selectedRemoveOutput, [_x select 1,[_x select 2,_x select 3]]]} forEach _output; + }; + case (_objType == "Land_ammo_supply_wreck"): { + _lootGroupIndex = dz_loot_groups find _objType; + _output = [_lootGroupIndex,5] call dz_fn_loot_select; + + {_selectedRemoveOutput set [count _selectedRemoveOutput, [_x select 1,1,_x select 0]]} forEach _output; + }; + default {_selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput")}; + }; } else { _selectedRemoveOutput = getArray (configFile >> "CfgVehicles" >> _objType >> "removeoutput"); _preventRefund = (_objectID == "0" && _objectUID == "0"); @@ -245,7 +257,15 @@ if (_proceed && _success) then { if (typeName _countOut == "ARRAY") then { _countOut = round((random (_countOut select 1)) + (_countOut select 0)); }; - _item addMagazineCargoGlobal [_itemOut,_countOut]; + if (count _x > 2) then { + switch (_x select 2) do { + case 2: {_item addWeaponCargoGlobal [_itemOut,_countOut]}; + case 3: {_item addMagazineCargoGlobal [_itemOut,_countOut]}; + case 5: {_item addBackpackCargoGlobal [_itemOut,_countOut]}; // Needs to make sure object can handle Backpacks or will dump on the ground. + }; + } else { + _item addMagazineCargoGlobal [_itemOut,_countOut]; + }; } count _selectedRemoveOutput; _item setposATL _iPos; @@ -268,4 +288,4 @@ if (_proceed && _success) then { dayz_actionInProgress = false; s_player_deleteBuild = -1; -_obj \ No newline at end of file +_obj