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
This commit is contained in:
oiad
2017-01-15 13:40:54 +13:00
committed by ebayShopper
parent 798a994b02
commit fd0b81118b
4 changed files with 62 additions and 12 deletions

View File

@@ -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"
};
};
};

View File

@@ -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}
};

View File

@@ -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
};

View File

@@ -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
_obj