diff --git a/Sources/epoch_code/compile/EPOCH_mineRocks.sqf b/Sources/epoch_code/compile/EPOCH_mineRocks.sqf index 4c3db31e..0839fe38 100644 --- a/Sources/epoch_code/compile/EPOCH_mineRocks.sqf +++ b/Sources/epoch_code/compile/EPOCH_mineRocks.sqf @@ -17,7 +17,7 @@ private ["_currentPos","_found","_foundIndex","_getWorldTypes","_object","_objec //[[[end]]] if ((diag_tickTime - EPOCH_lastMineRocks) >= 2) then { EPOCH_lastMineRocks = diag_tickTime; - if (random 1 < 0.16) then { + if (random 1 < 0.33) then { _currentPos = player modelToWorld[0, 5, 0]; if !(surfaceIsWater _currentPos) then { @@ -30,21 +30,19 @@ if ((diag_tickTime - EPOCH_lastMineRocks) >= 2) then { _found = false; _foundIndex = -1; { - _worldTypes = ["rock","cinder","wreck"]; + _worldTypes = ["rock","cinder","wreck","ore"]; _getWorldTypes = [_x, _worldTypes] call EPOCH_worldObjectType; { if (_getWorldTypes param [_worldTypes find _x, false]) exitWith { _found = true; - _foundIndex = _forEachIndex - 1; + _foundIndex = _forEachIndex; }; } forEach _worldTypes; if (_found)exitWith{_object = _x}; }foreach _objects; - if (!isNull _object) then { - if (alive _object) then { - [_object, _foundIndex, player, Epoch_personalToken] remoteExec ["EPOCH_server_mineRocks",2]; - }; + if (!isNull _object && {alive _object}) then { + [_object, _foundIndex, player, Epoch_personalToken] remoteExec ["EPOCH_server_mineRocks",2]; }; }; }; diff --git a/Sources/epoch_config/Configs/CfgEpochClient/WorldInteractions.hpp b/Sources/epoch_config/Configs/CfgEpochClient/WorldInteractions.hpp index b01c55b9..8f05df7a 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient/WorldInteractions.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient/WorldInteractions.hpp @@ -1,4 +1,7 @@ class CfgWorldInteractions { + class Ore { + ore = 1; + }; class Water { water = 1; }; @@ -743,53 +746,58 @@ class CfgWorldInteractions { class hiluxWreck : Wrecks {}; class BMP2Wreck : Wrecks {}; class BRDMWreck : Wrecks {}; - class M113Wreck : Wrecks {}; - class Land_chz_avtobus : Wrecks {}; - class Land_chz_avtobus2 : Wrecks {}; - class Land_chz_avtobus2a : Wrecks {}; - class Land_chz_benozovoz_gaz : Wrecks {}; - class Land_chz_benozovoz_zil : Wrecks {}; - class Land_chz_bochka_pricep : Wrecks {}; - class Land_chz_buldozer : Wrecks {}; - class Land_chz_ekskavator : Wrecks {}; - class Land_chz_gaz : Wrecks {}; - class Land_chz_gaz66_02 : Wrecks {}; - class Land_chz_gazon : Wrecks {}; - class Land_chz_kamaz_fura : Wrecks {}; - class Land_chz_kamaz_korpus : Wrecks {}; - class Land_chz_kamaz_korpus_02 : Wrecks {}; - class Land_chz_kamaz_korpus_03 : Wrecks {}; - class Land_chz_kamaz_korpus_04 : Wrecks {}; - class Land_chz_kamaz_pricep : Wrecks {}; - class Land_chz_katok_1 : Wrecks {}; - class Land_chz_katok_1_br : Wrecks {}; - class Land_chz_molokovoz_01 : Wrecks {}; - class Land_chz_moskvich : Wrecks {}; - class Land_chz_moskvich_2 : Wrecks {}; - class Land_chz_niva_01 : Wrecks {}; - class Land_chz_niva_02 : Wrecks {}; - class Land_chz_niva_03 : Wrecks {}; - class Land_chz_rls_chp75b : Wrecks {}; - class Land_chz_train_vagon_01_open_br1 : Wrecks {}; - class Land_chz_train_vagon_02_open_br1 : Wrecks {}; - class Land_chz_train_vagon_04 : Wrecks {}; - class Land_chz_train_vagon_platforma : Wrecks {}; - class Land_chz_train_vagon_suburban_01 : Wrecks {}; - class Land_chz_train_vagon_suburban_02 : Wrecks {}; - class Land_chz_traktor_1 : Wrecks {}; - class Land_chz_traktor_2 : Wrecks {}; - class Land_chz_traktor_3 : Wrecks {}; - class Land_chz_traktor_4 : Wrecks {}; - class Land_chz_uaz_1 : Wrecks {}; - class Land_chz_uazik_01 : Wrecks {}; - class Land_chz_uazik_02 : Wrecks {}; - class Land_chz_veh_diesel_br : Wrecks {}; - class Land_chz_zaz968_1 : Wrecks {}; - class Land_chz_zaz968_2 : Wrecks {}; - class Land_chz_zil_130_4 : Wrecks {}; - class Land_chz_zil_fire_1 : Wrecks {}; - class Land_chz_zibk_2 : Wrecks {}; - class Land_chz_zibk_3 : Wrecks {}; - class Land_chz_zibk_4 : Wrecks {}; - class Land_fishing_boat : Wrecks {}; + class M113Wreck : Wrecks {}; + class Land_chz_avtobus : Wrecks {}; + class Land_chz_avtobus2 : Wrecks {}; + class Land_chz_avtobus2a : Wrecks {}; + class Land_chz_benozovoz_gaz : Wrecks {}; + class Land_chz_benozovoz_zil : Wrecks {}; + class Land_chz_bochka_pricep : Wrecks {}; + class Land_chz_buldozer : Wrecks {}; + class Land_chz_ekskavator : Wrecks {}; + class Land_chz_gaz : Wrecks {}; + class Land_chz_gaz66_02 : Wrecks {}; + class Land_chz_gazon : Wrecks {}; + class Land_chz_kamaz_fura : Wrecks {}; + class Land_chz_kamaz_korpus : Wrecks {}; + class Land_chz_kamaz_korpus_02 : Wrecks {}; + class Land_chz_kamaz_korpus_03 : Wrecks {}; + class Land_chz_kamaz_korpus_04 : Wrecks {}; + class Land_chz_kamaz_pricep : Wrecks {}; + class Land_chz_katok_1 : Wrecks {}; + class Land_chz_katok_1_br : Wrecks {}; + class Land_chz_molokovoz_01 : Wrecks {}; + class Land_chz_moskvich : Wrecks {}; + class Land_chz_moskvich_2 : Wrecks {}; + class Land_chz_niva_01 : Wrecks {}; + class Land_chz_niva_02 : Wrecks {}; + class Land_chz_niva_03 : Wrecks {}; + class Land_chz_rls_chp75b : Wrecks {}; + class Land_chz_train_vagon_01_open_br1 : Wrecks {}; + class Land_chz_train_vagon_02_open_br1 : Wrecks {}; + class Land_chz_train_vagon_04 : Wrecks {}; + class Land_chz_train_vagon_platforma : Wrecks {}; + class Land_chz_train_vagon_suburban_01 : Wrecks {}; + class Land_chz_train_vagon_suburban_02 : Wrecks {}; + class Land_chz_traktor_1 : Wrecks {}; + class Land_chz_traktor_2 : Wrecks {}; + class Land_chz_traktor_3 : Wrecks {}; + class Land_chz_traktor_4 : Wrecks {}; + class Land_chz_uaz_1 : Wrecks {}; + class Land_chz_uazik_01 : Wrecks {}; + class Land_chz_uazik_02 : Wrecks {}; + class Land_chz_veh_diesel_br : Wrecks {}; + class Land_chz_zaz968_1 : Wrecks {}; + class Land_chz_zaz968_2 : Wrecks {}; + class Land_chz_zil_130_4 : Wrecks {}; + class Land_chz_zil_fire_1 : Wrecks {}; + class Land_chz_zibk_2 : Wrecks {}; + class Land_chz_zibk_3 : Wrecks {}; + class Land_chz_zibk_4 : Wrecks {}; + class Land_fishing_boat : Wrecks {}; + // ore classes + class MineralDepositCopper_EPOCH : Ore {}; + class MineralDepositGold_EPOCH : Ore {}; + class MineralDepositSilver_EPOCH : Ore {}; + class mineral_p3d : Ore {}; }; diff --git a/Sources/epoch_server/compile/epoch_looting/EPOCH_server_mineRocks.sqf b/Sources/epoch_server/compile/epoch_looting/EPOCH_server_mineRocks.sqf index 65a4da43..103abcb9 100644 --- a/Sources/epoch_server/compile/epoch_looting/EPOCH_server_mineRocks.sqf +++ b/Sources/epoch_server/compile/epoch_looting/EPOCH_server_mineRocks.sqf @@ -13,48 +13,47 @@ https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_looting/EPOCH_server_mineRocks.sqf */ //[[[cog import generate_private_arrays ]]] -private ["_item","_lootables","_nearbyWH","_payout","_payoutQty","_posWH","_selectedPayout"]; +private ["_config","_posWH","_selectedConfig"]; //[[[end]]] params ["_object","_index","_player",["_token","",[""]] ]; if !([_player, _token] call EPOCH_server_getPToken) exitWith{}; -if (alive _object) then { +// make sure object still exists and is proper object type and alive. +if (_object isEqualType objNull && {!(isNull _object)} && {alive _object}) then { _posWH = getPosATL _player; _posWH set[2, 0]; - // defaults - _selectedPayout = ["ItemRock", 4]; - // Not Rock - if (_index >= 0) then { - _selectedPayout = ["ItemScraps", 2]; - if (_index == 0) then { - _selectedPayout = ["CinderBlocks", 1]; + // define loot table class + _selectedConfig = typeOf _object; + if (_selectedConfig isEqualTo "") then { + // handle simple/terrain objects + (getModelInfo _object) params [["_modelName",""]]; + if (!isnil "_modelName") then { + // replace spaces and periods with underscores + _selectedConfig = (_modelName splitString " .") joinString "_"; }; - } else { - _lootables = [["PartOre", 2], ["ItemRock", 4]]; - _selectedPayout = selectRandom _lootables; }; - _payout = _selectedPayout select 0; - _payoutQty = _selectedPayout select 1; - - if (isSimpleObject _object) then { - // just remove for now, object will respawn on restart. - deleteVehicle _object; - } else { - _object setdamage ((damage _object) + (1/_payoutQty)) min 1; - }; - - _nearbyWH = nearestObjects[_posWH, ["groundWeaponHolder"], 2]; - if !(_nearbyWH isEqualTo[]) then { - _posWH = getPosATL(_nearbyWH select 0); - (_nearbyWH select 0) addMagazineCargoGlobal[_payout, _payoutQty]; - } else { - _item = createVehicle["groundWeaponHolder", _posWH, [], 0, "CAN_COLLIDE"]; - _item setPosATL _posWH; - _item addMagazineCargoGlobal[_payout, _payoutQty]; + _config = configFile >> "CfgMainTable" >> _selectedConfig; + if !(isClass(_config)) then { + // allow override with generic loot classes if object class is not in CfgMainTable + switch (_index) do { + case 0: { _selectedConfig = "Rock" }; + case 1: { _selectedConfig = "Cinder" }; + case 2: { _selectedConfig = "Wreck" }; + case 3: { _selectedConfig = "Ore" }; + }; }; + + if (isSimpleObject _object) then { + // just remove for now, object will respawn on restart. + deleteVehicle _object; + } else { + _object setdamage 1; + }; + + // output loot + [objNull, _selectedConfig, false, _posWH] call EPOCH_serverLootObject; }; - true diff --git a/Sources/epoch_server/compile/epoch_server/EPOCH_serverLootObject.sqf b/Sources/epoch_server/compile/epoch_server/EPOCH_serverLootObject.sqf index 021df6bc..e1f9cd4d 100644 --- a/Sources/epoch_server/compile/epoch_server/EPOCH_serverLootObject.sqf +++ b/Sources/epoch_server/compile/epoch_server/EPOCH_serverLootObject.sqf @@ -27,6 +27,7 @@ if !(EPOCH_forcedLootSpawnTable isEqualTo "") then { _randomizeMagazineAmmoCount = ["CfgEpochClient", "randomizeMagazineAmmoCount", true] call EPOCH_fnc_returnConfigEntryV2; if (isnull _object && !(_pos isequalto [])) then { _object = createVehicle ["groundWeaponHolder",_pos,[],0,"CAN_COLLIDE"]; + _object setPosATL _pos; }; if !(isNull _object) then{ _lootTable = ["CfgMainTable", _type, "tables"] call EPOCH_fnc_weightedArray; diff --git a/Sources/epoch_server_settings/configs/CfgLootTable.h b/Sources/epoch_server_settings/configs/CfgLootTable.h index 05d36f9f..696a0045 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable.h @@ -20,6 +20,25 @@ class CfgLootTable { { "WoodLog_EPOCH", "magazine" }, 1 } }; }; + class Rock + { + items[] = { + { { "PartOre", "magazine" }, 1 }, + { { "ItemRock", "magazine" }, 2 } + }; + }; + class Cinder + { + items[] = { + { { "CinderBlocks", "magazine" }, 1 } + }; + }; + class Wreck + { + items[] = { + { { "ItemScraps", "magazine" }, 1 } + }; + }; class Bush { items[] = { @@ -777,6 +796,33 @@ class CfgLootTable { { "PartOre", "magazine" }, 35 } }; }; + class CopperMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 30 }, + { { "PartOre", "magazine" }, 35 } + }; + }; + class SilverMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 35 }, + { { "PartOre", "magazine" }, 30 } + }; + }; + class GoldMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 20 }, + { { "PartOreGold", "magazine" }, 35 }, + { { "PartOreSilver", "magazine" }, 20 }, + { { "PartOre", "magazine" }, 25 } + }; + }; class Food { items[] = { diff --git a/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h b/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h index 20ea335b..61c12bbf 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h @@ -20,6 +20,25 @@ class CfgLootTable_CUP { { "WoodLog_EPOCH", "magazine" }, 1 } }; }; + class Rock + { + items[] = { + { { "PartOre", "magazine" }, 1 }, + { { "ItemRock", "magazine" }, 2 } + }; + }; + class Cinder + { + items[] = { + { { "CinderBlocks", "magazine" }, 1 } + }; + }; + class Wreck + { + items[] = { + { { "ItemScraps", "magazine" }, 1 } + }; + }; class Bush { items[] = { @@ -1340,6 +1359,33 @@ class CfgLootTable_CUP { { "PartOre", "magazine" }, 35 } }; }; + class CopperMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 30 }, + { { "PartOre", "magazine" }, 35 } + }; + }; + class SilverMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 35 }, + { { "PartOre", "magazine" }, 30 } + }; + }; + class GoldMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 20 }, + { { "PartOreGold", "magazine" }, 35 }, + { { "PartOreSilver", "magazine" }, 20 }, + { { "PartOre", "magazine" }, 25 } + }; + }; class Food { items[] = { diff --git a/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h b/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h index d84a1749..a590b660 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h @@ -20,6 +20,25 @@ class CfgLootTable_MAD { { "WoodLog_EPOCH", "magazine" }, 1 } }; }; + class Rock + { + items[] = { + { { "PartOre", "magazine" }, 1 }, + { { "ItemRock", "magazine" }, 2 } + }; + }; + class Cinder + { + items[] = { + { { "CinderBlocks", "magazine" }, 1 } + }; + }; + class Wreck + { + items[] = { + { { "ItemScraps", "magazine" }, 1 } + }; + }; class Bush { items[] = { @@ -782,6 +801,33 @@ class CfgLootTable_MAD { { "PartOre", "magazine" }, 35 } }; }; + class CopperMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 30 }, + { { "PartOre", "magazine" }, 35 } + }; + }; + class SilverMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 35 }, + { { "PartOre", "magazine" }, 30 } + }; + }; + class GoldMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 20 }, + { { "PartOreGold", "magazine" }, 35 }, + { { "PartOreSilver", "magazine" }, 20 }, + { { "PartOre", "magazine" }, 25 } + }; + }; class Food { items[] = { diff --git a/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h b/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h index d4e7ae54..21e93ed0 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h @@ -20,6 +20,25 @@ class CfgLootTable_MADCUP { { "WoodLog_EPOCH", "magazine" }, 1 } }; }; + class Rock + { + items[] = { + { { "PartOre", "magazine" }, 1 }, + { { "ItemRock", "magazine" }, 2 } + }; + }; + class Cinder + { + items[] = { + { { "CinderBlocks", "magazine" }, 1 } + }; + }; + class Wreck + { + items[] = { + { { "ItemScraps", "magazine" }, 1 } + }; + }; class Bush { items[] = { @@ -1345,6 +1364,33 @@ class CfgLootTable_MADCUP { { "PartOre", "magazine" }, 35 } }; }; + class CopperMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 30 }, + { { "PartOre", "magazine" }, 35 } + }; + }; + class SilverMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 15 }, + { { "PartOreGold", "magazine" }, 20 }, + { { "PartOreSilver", "magazine" }, 35 }, + { { "PartOre", "magazine" }, 30 } + }; + }; + class GoldMine + { + items[] = { + { { "Gems", "CfgLootTable" }, 20 }, + { { "PartOreGold", "magazine" }, 35 }, + { { "PartOreSilver", "magazine" }, 20 }, + { { "PartOre", "magazine" }, 25 } + }; + }; class Food { items[] = { diff --git a/Sources/epoch_server_settings/configs/CfgMainTable.h b/Sources/epoch_server_settings/configs/CfgMainTable.h index 5e707c2e..baa955dd 100644 --- a/Sources/epoch_server_settings/configs/CfgMainTable.h +++ b/Sources/epoch_server_settings/configs/CfgMainTable.h @@ -28,6 +28,34 @@ class CfgMainTable LootMax = 6; tables[] = { "Tree" }; }; + class Rock : Default + { + chance = 1; + lootMin = 3; + LootMax = 6; + tables[] = { "Rock" }; + }; + class Ore : Default + { + chance = 1; + lootMin = 3; + LootMax = 6; + tables[] = { "Mine" }; + }; + class Cinder : Default + { + chance = 1; + lootMin = 3; + LootMax = 6; + tables[] = { "Cinder" }; + }; + class Wreck : Default + { + chance = 1; + lootMin = 3; + LootMax = 6; + tables[] = { "Wreck" }; + }; class Bush : Default { chance = 1; @@ -230,27 +258,24 @@ class CfgMainTable lootMin = 3; LootMax = 6; tables[] = { "Shipwreck" }; - antagonists[] = { - { "GreatWhite", 1 } - }; }; class MineralDepositCopper_EPOCH : Default { lootMin = 5; LootMax = 10; - tables[] = { "Mine" }; + tables[] = { "CopperMine" }; }; class MineralDepositGold_EPOCH : Default { lootMin = 5; LootMax = 10; - tables[] = { "Mine" }; + tables[] = { "GoldMine" }; }; class MineralDepositSilver_EPOCH : Default { lootMin = 5; LootMax = 10; - tables[] = { "Mine" }; + tables[] = { "SilverMine" }; }; class Shelf_EPOCH : Default {