diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_AnimateScheduled.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_AnimateScheduled.sqf new file mode 100644 index 00000000..d6f31a36 --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_AnimateScheduled.sqf @@ -0,0 +1,47 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + Run scheduled animations on objects + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_fnc_AnimateScheduled.sqf + + Example: + [ + _object, // object + [ // animationarray + ['door1',1], + ['door2',1], + ['handle1',1], + ['handle2',1] + ], + [0,1,0] // delays + ] remoteexec ['EPOCH_fnc_AnimateScheduled',_player]; + + Parameter(s): + _this select 0: OBJ - Object for the animations + _this select 1: ARRAY - Array of animations and their final state + _this select 2: ARRAY - Array of delays between each animation + + Returns: + NOTHING +*/ + +private ["_ins","_target"]; +params [["_object",objnull], ["_animarray",[]], ["_delays",[]]]; +if (isnull _object) exitwith {}; +if !(_animarray isEqualType []) exitwith {}; +if !(_delays isEqualType []) exitwith {}; +{ + if (_x isEqualType []) then { + _x params [["_animation",""],["_state",0]]; + _object animate [_animation,_state]; + uisleep (_delays param [_foreachindex,0]); + }; +} foreach _animarray; diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp index cbceb8c0..e5368e79 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp @@ -131,14 +131,14 @@ class lock_lockbox }; class unlock_safe { - condition = "(dyna_cursorTargetType in ['Safe_EPOCH','SafeProxy_EPOCH']) && (dyna_cursorTarget getVariable ['EPOCH_Locked',false])"; + condition = "(dyna_cursorTargetType in ['Safe_EPOCH','SafeProxy_EPOCH','GunSafe_EPOCH']) && (dyna_cursorTarget getVariable ['EPOCH_Locked',false])"; action = "dyna_cursorTarget call Epoch_secureStorageHandler"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\pad_can_unlock.paa"; tooltip = "Unlock Safe"; }; class lock_safe { - condition = "(dyna_cursorTargetType in ['Safe_EPOCH','SafeProxy_EPOCH']) && !(dyna_cursorTarget getVariable ['EPOCH_Locked',false])"; + condition = "(dyna_cursorTargetType in ['Safe_EPOCH','SafeProxy_EPOCH','GunSafe_EPOCH']) && !(dyna_cursorTarget getVariable ['EPOCH_Locked',false])"; action = "dyna_cursorTarget call Epoch_secureStorageHandler"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\pad_cannot_lock.paa"; tooltip = "Lock Safe"; @@ -154,7 +154,7 @@ class pack_lockbox }; class pack_safe { - condition = "(dyna_cursorTargetType in ['Safe_EPOCH','SafeProxy_EPOCH']) && (dyna_cursorTarget getVariable ['EPOCH_Locked',false])"; + condition = "(dyna_cursorTargetType in ['Safe_EPOCH','SafeProxy_EPOCH','GunSafe_EPOCH']) && (dyna_cursorTarget getVariable ['EPOCH_Locked',false])"; action = "[dyna_cursorTarget,player,Epoch_personalToken] remoteExec ['EPOCH_server_packStorage',2];"; icon = "x\addons\a3_epoch_code\Data\UI\buttons\build_pack.paa"; tooltip = "Pack Safe"; diff --git a/Sources/epoch_config/Configs/CfgBaseBuilding.hpp b/Sources/epoch_config/Configs/CfgBaseBuilding.hpp index 2bb03112..28342299 100644 --- a/Sources/epoch_config/Configs/CfgBaseBuilding.hpp +++ b/Sources/epoch_config/Configs/CfgBaseBuilding.hpp @@ -1375,6 +1375,21 @@ class CfgBaseBuilding { returnOnPack[] = {}; }; + class GunSafe_EPOCH : Default + { + returnOnPack[] = {{"ItemGunSafe",1}}; + simulClass = "GunSafe_SIM_EPOCH"; + staticClass = "GunSafe_EPOCH"; + weaponHolderProxy = "SafeProxy_EPOCH"; + GhostPreview = "GunSafe_EPOCH"; + bypassJammer = 1; + limitNearby = 2; + isSecureStorage = 1; + }; + class GunSafe_SIM_EPOCH : GunSafe_EPOCH + { + returnOnPack[] = {}; + }; class Jack_EPOCH : Default { simulClass = "Jack_SIM_EPOCH"; diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index 8e2f9c36..ce4228cf 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -171,6 +171,7 @@ class CfgClientFunctions class fnc_setVariableLimited {}; class fnc_createLocalMarkerSet {}; class fnc_deleteLocalMarkerSet {}; + class fnc_AnimateScheduled {}; }; class environment { diff --git a/Sources/epoch_config/Configs/CfgItemInteractions.hpp b/Sources/epoch_config/Configs/CfgItemInteractions.hpp index c13f55fd..7c8f0a7d 100644 --- a/Sources/epoch_config/Configs/CfgItemInteractions.hpp +++ b/Sources/epoch_config/Configs/CfgItemInteractions.hpp @@ -249,6 +249,10 @@ class CfgItemInteractions { buildClass = "Safe_SIM_EPOCH"; }; + class ItemGunSafe : Item_Build_base + { + buildClass = "GunSafe_SIM_EPOCH"; + }; class JackKit : Item_Build_base { buildClass = "Jack_SIM_EPOCH"; diff --git a/Sources/epoch_config/Configs/CfgItemSort.hpp b/Sources/epoch_config/Configs/CfgItemSort.hpp index b3d95bd8..5e08883f 100644 --- a/Sources/epoch_config/Configs/CfgItemSort.hpp +++ b/Sources/epoch_config/Configs/CfgItemSort.hpp @@ -1151,6 +1151,7 @@ class CfgItemSort "ItemLockbox", "Pelt_EPOCH", "ItemSafe", + "ItemGunSafe", "ItemSolar", "ItemCables", "ItemBattery", diff --git a/Sources/epoch_config/Configs/CfgPricing.hpp b/Sources/epoch_config/Configs/CfgPricing.hpp index 96720fd8..12b4b59f 100644 --- a/Sources/epoch_config/Configs/CfgPricing.hpp +++ b/Sources/epoch_config/Configs/CfgPricing.hpp @@ -330,6 +330,11 @@ class CfgPricing price = 1250; tax = 0.5; }; + class ItemGunSafe + { + price = 1250; + tax = 0.5; + }; class ItemCompass { price = 3; diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf index 1e1f7595..bd47c6d4 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf @@ -53,6 +53,11 @@ if (isText _staticClassConfig) then { if (getNumber(_cfgBaseBuilding >> _staticClass >> "isSecureStorage") == 1) then{ _storageObj setVariable["EPOCH_Locked", false, true]; + if (_storageObj isKindOf "GunSafe_EPOCH") then { + { + _storageObj animate [_x,1]; + } foreach ["door1","door2","handle1","handle2"]; + }; }; _storageObj setVariable["STORAGE_OWNERS", [_playerUID]]; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockStorage.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockStorage.sqf index 98deb299..3d4403e7 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockStorage.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_lockStorage.sqf @@ -27,6 +27,10 @@ _playerGroup = _player getVariable["GROUP", ""]; _fnc_Lock_Unlock = { _locked = !_locked; _unit setVariable ["EPOCH_Locked", _locked, true]; + if (_unit iskindof "GunSafe_EPOCH") then { + _animations = if (_locked) then {[['door1',0],['door2',0],['handle1',0],['handle2',0]]} else {[['handle1',1],['handle2',1],['door1',1],['door2',1]]}; + [_unit,_animations,[0,1,0]] remoteexec ['EPOCH_fnc_AnimateScheduled',_player]; + }; _LockStateChanged = true; }; diff --git a/Sources/epoch_server_settings/configs/CfgLootTable.h b/Sources/epoch_server_settings/configs/CfgLootTable.h index fb45f140..abda3a7b 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable.h @@ -80,6 +80,13 @@ class CfgLootTable { { "FAK", "magazine" }, 20 } }; }; + class Safes + { + items[] = { + { { "ItemSafe", "magazine" }, 1 }, + { { "ItemGunSafe", "magazine" }, 1 } + }; + }; class Repairs { items[] = { @@ -331,7 +338,7 @@ class CfgLootTable { { "ItemBattery", "magazine" }, 5 }, { { "ItemCables", "magazine" }, 5 }, { { "ItemPipe", "magazine" }, 5 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemBarrelE", "magazine" }, 1 } @@ -342,7 +349,7 @@ class CfgLootTable { items[] = { { { "VehicleDocs", "CfgLootTable" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemLockbox", "magazine" }, 4 }, { { "jerrycan_epoch", "magazine" }, 5 }, { { "CircuitParts", "magazine" }, 6 }, @@ -1001,7 +1008,7 @@ class CfgLootTable { { "KitCinderWall", "magazine" }, 5 }, { { "KitFoundation", "magazine" }, 5 }, { { "KitWoodFoundation", "magazine" }, 14 }, - { { "ItemSafe", "magazine" }, 1 } + { { "Safes", "CfgLootTable" }, 1 } }; }; @@ -1014,7 +1021,7 @@ class CfgLootTable { { "BaseBuilding", "CfgLootTable" }, 20 }, { { "GenericLarge", "CfgLootTable" }, 24 }, { { "ItemLockbox", "magazine" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "Generic", "CfgLootTable" }, 10 }, { { "Tools", "CfgLootTable" }, 19 } }; diff --git a/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h b/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h index a8e2c52f..28966c76 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable_CUP.h @@ -80,6 +80,13 @@ class CfgLootTable_CUP { { "FAK", "magazine" }, 20 } }; }; + class Safes + { + items[] = { + { { "ItemSafe", "magazine" }, 1 }, + { { "ItemGunSafe", "magazine" }, 1 } + }; + }; class Repairs { items[] = { @@ -424,7 +431,7 @@ class CfgLootTable_CUP { { "ItemBattery", "magazine" }, 5 }, { { "ItemCables", "magazine" }, 5 }, { { "ItemPipe", "magazine" }, 5 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemBarrelE", "magazine" }, 1 } }; }; @@ -433,7 +440,7 @@ class CfgLootTable_CUP { items[] = { { { "VehicleDocs", "CfgLootTable" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemLockbox", "magazine" }, 4 }, { { "jerrycan_epoch", "magazine" }, 5 }, { { "CircuitParts", "magazine" }, 6 }, @@ -1550,7 +1557,7 @@ class CfgLootTable_CUP { { "KitCinderWall", "magazine" }, 5 }, { { "KitFoundation", "magazine" }, 5 }, { { "KitWoodFoundation", "magazine" }, 14 }, - { { "ItemSafe", "magazine" }, 1 } + { { "Safes", "CfgLootTable" }, 1 } }; }; @@ -1563,7 +1570,7 @@ class CfgLootTable_CUP { { "BaseBuilding", "CfgLootTable" }, 20 }, { { "GenericLarge", "CfgLootTable" }, 24 }, { { "ItemLockbox", "magazine" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "Generic", "CfgLootTable" }, 10 }, { { "Tools", "CfgLootTable" }, 19 } }; diff --git a/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h b/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h index eb068af7..28c12401 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable_MAD.h @@ -80,6 +80,13 @@ class CfgLootTable_MAD { { "FAK", "magazine" }, 20 } }; }; + class Safes + { + items[] = { + { { "ItemSafe", "magazine" }, 1 }, + { { "ItemGunSafe", "magazine" }, 1 } + }; + }; class Repairs { items[] = { @@ -329,7 +336,7 @@ class CfgLootTable_MAD { { "ItemBattery", "magazine" }, 5 }, { { "ItemCables", "magazine" }, 5 }, { { "ItemPipe", "magazine" }, 5 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemBarrelE", "magazine" }, 1 } @@ -340,7 +347,7 @@ class CfgLootTable_MAD { items[] = { { { "VehicleDocs", "CfgLootTable" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemLockbox", "magazine" }, 4 }, { { "jerrycan_epoch", "magazine" }, 5 }, { { "CircuitParts", "magazine" }, 6 }, @@ -990,7 +997,7 @@ class CfgLootTable_MAD { { "KitCinderWall", "magazine" }, 5 }, { { "KitFoundation", "magazine" }, 5 }, { { "KitWoodFoundation", "magazine" }, 14 }, - { { "ItemSafe", "magazine" }, 1 } + { { "Safes", "CfgLootTable" }, 1 } }; }; @@ -1003,7 +1010,7 @@ class CfgLootTable_MAD { { "BaseBuilding", "CfgLootTable" }, 20 }, { { "GenericLarge", "CfgLootTable" }, 24 }, { { "ItemLockbox", "magazine" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "Generic", "CfgLootTable" }, 10 }, { { "Tools", "CfgLootTable" }, 19 } }; diff --git a/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h b/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h index 31f421e8..e3240db4 100644 --- a/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h +++ b/Sources/epoch_server_settings/configs/CfgLootTable_MADCUP.h @@ -80,6 +80,13 @@ class CfgLootTable_MADCUP { { "FAK", "magazine" }, 20 } }; }; + class Safes + { + items[] = { + { { "ItemSafe", "magazine" }, 1 }, + { { "ItemGunSafe", "magazine" }, 1 } + }; + }; class Repairs { items[] = { @@ -424,7 +431,7 @@ class CfgLootTable_MADCUP { { "ItemBattery", "magazine" }, 5 }, { { "ItemCables", "magazine" }, 5 }, { { "ItemPipe", "magazine" }, 5 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemBarrelE", "magazine" }, 1 } }; }; @@ -433,7 +440,7 @@ class CfgLootTable_MADCUP { items[] = { { { "VehicleDocs", "CfgLootTable" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "ItemLockbox", "magazine" }, 4 }, { { "jerrycan_epoch", "magazine" }, 5 }, { { "CircuitParts", "magazine" }, 6 }, @@ -1557,7 +1564,7 @@ class CfgLootTable_MADCUP { { "KitCinderWall", "magazine" }, 5 }, { { "KitFoundation", "magazine" }, 5 }, { { "KitWoodFoundation", "magazine" }, 14 }, - { { "ItemSafe", "magazine" }, 1 } + { { "Safes", "CfgLootTable" }, 1 } }; }; @@ -1570,7 +1577,7 @@ class CfgLootTable_MADCUP { { "BaseBuilding", "CfgLootTable" }, 20 }, { { "GenericLarge", "CfgLootTable" }, 24 }, { { "ItemLockbox", "magazine" }, 4 }, - { { "ItemSafe", "magazine" }, 1 }, + { { "Safes", "CfgLootTable" }, 1 }, { { "Generic", "CfgLootTable" }, 10 }, { { "Tools", "CfgLootTable" }, 19 } };