mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
remove lockbackpacks code, add sound and camshake, ref #178
This commit is contained in:
parent
eeb07f2bf6
commit
025c45dccc
@ -5,6 +5,12 @@ class Extended_PreInit_EventHandlers {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Extended_PostInit_EventHandlers {
|
||||||
|
class ADDON {
|
||||||
|
init = QUOTE(call COMPILE_FILE(XEH_postInit));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
class Extended_InventoryOpened_EventHandlers {
|
class Extended_InventoryOpened_EventHandlers {
|
||||||
class CAManBase {
|
class CAManBase {
|
||||||
class GVAR(onOpenInventory) {
|
class GVAR(onOpenInventory) {
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
|
|
||||||
class CfgVehicles {
|
|
||||||
class Man;
|
|
||||||
class CAManBase: Man {
|
|
||||||
class ACE_SelfActions {
|
|
||||||
class ACE_Equipment {
|
|
||||||
class ACE_LockBackpack {
|
|
||||||
displayName = "$STR_ACE_LockBackpacks_LockBackpack";
|
|
||||||
condition = QUOTE([backpackContainer _player] call FUNC(isBackpack) && {!((backpackContainer _player) getVariable [ARR_2('ACE_LockedInventory', false)])});
|
|
||||||
statement = QUOTE((backpackContainer _player) setVariable [ARR_3('ACE_LockedInventory', true, true)];);
|
|
||||||
showDisabled = 0;
|
|
||||||
priority = 2.5;
|
|
||||||
icon = ""; // @todo
|
|
||||||
hotkey = "L";
|
|
||||||
enableInside = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ACE_UnlockBackpack {
|
|
||||||
displayName = "$STR_ACE_LockBackpacks_UnlockBackpack";
|
|
||||||
condition = QUOTE([backpackContainer _player] call FUNC(isBackpack) && {(backpackContainer _player) getVariable [ARR_2('ACE_LockedInventory', false)]});
|
|
||||||
statement = QUOTE((backpackContainer _player) setVariable [ARR_3('ACE_LockedInventory', false, true)];);
|
|
||||||
showDisabled = 0;
|
|
||||||
priority = 2.5;
|
|
||||||
icon = ""; // @todo
|
|
||||||
hotkey = "L";
|
|
||||||
enableInside = 1;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
3
addons/backpacks/XEH_postInit.sqf
Normal file
3
addons/backpacks/XEH_postInit.sqf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
|
PREP(backpackOpened);
|
||||||
PREP(getBackpackAssignedUnit);
|
PREP(getBackpackAssignedUnit);
|
||||||
PREP(isBackpack);
|
PREP(isBackpack);
|
||||||
PREP(onOpenInventory);
|
PREP(onOpenInventory);
|
||||||
|
@ -5,7 +5,7 @@ class CfgPatches {
|
|||||||
units[] = {};
|
units[] = {};
|
||||||
weapons[] = {};
|
weapons[] = {};
|
||||||
requiredVersion = REQUIRED_VERSION;
|
requiredVersion = REQUIRED_VERSION;
|
||||||
requiredAddons[] = {"ace_common","ace_interaction"};
|
requiredAddons[] = {"ace_common"};
|
||||||
author[] = {"bux","commy2"};
|
author[] = {"bux","commy2"};
|
||||||
authorUrl = "https://github.com/commy2/";
|
authorUrl = "https://github.com/commy2/";
|
||||||
VERSION_CONFIG;
|
VERSION_CONFIG;
|
||||||
@ -13,4 +13,3 @@ class CfgPatches {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
#include "CfgVehicles.hpp"
|
|
||||||
|
48
addons/backpacks/functions/fnc_backpackOpened.sqf
Normal file
48
addons/backpacks/functions/fnc_backpackOpened.sqf
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* Author: commy2
|
||||||
|
*
|
||||||
|
* Someone opened your backpack. Execute locally.
|
||||||
|
*
|
||||||
|
* Argument:
|
||||||
|
* 0: Who accessed your inventory? (Object)
|
||||||
|
* 1: Unit that wields the backpack (Object)
|
||||||
|
* 2: The backpack object (Object)
|
||||||
|
*
|
||||||
|
* Return value:
|
||||||
|
* None.
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
private ["_unit", "_target"];
|
||||||
|
|
||||||
|
_unit = _this select 0;
|
||||||
|
_target = _this select 1;
|
||||||
|
_backpack = _this select 2;
|
||||||
|
|
||||||
|
// do cam shake if the target is the player
|
||||||
|
if ([_target] call EFUNC(common,isPlayer)) then {
|
||||||
|
addCamShake [4, 0.5, 5];
|
||||||
|
};
|
||||||
|
|
||||||
|
// play a rustling sound
|
||||||
|
private ["_sounds", "_position"];
|
||||||
|
|
||||||
|
_sounds = [
|
||||||
|
"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
|
||||||
|
"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWrflDnon_medic.wss",
|
||||||
|
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWpstDnon_medic.wss",
|
||||||
|
"a3\sounds_f\characters\ingame\AinvPpneMstpSlayWrflDnon_medic.wss"
|
||||||
|
];
|
||||||
|
|
||||||
|
_position = _target modelToWorld (_target selectionPosition "Spine3");
|
||||||
|
_position = _position call EFUNC(common,positionToASL);
|
||||||
|
|
||||||
|
playSound3D [
|
||||||
|
_sounds select floor random count _sounds,
|
||||||
|
objNull,
|
||||||
|
false,
|
||||||
|
_position,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
50
|
||||||
|
];
|
@ -1,47 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
* Author: bux, commy2
|
* Author: commy2
|
||||||
*
|
*
|
||||||
* Handle the open inventory event. Don't open the inventory if it's locked and display message.
|
* Handle the open inventory event. Display message on traget client.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* Input from "InventoryOpened" eventhandler
|
* Input from "InventoryOpened" eventhandler
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Don't open the inventory dialog? (Bool)
|
* false. Always open the inventory dialog. (Bool)
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_target", "_isBackpack", "_isLocked", "_return"];
|
private ["_unit", "_backpack"];
|
||||||
|
|
||||||
_target = _this select 1;
|
_unit = _this select 0;
|
||||||
|
_backpack = _this select 1;
|
||||||
|
|
||||||
_isBackpack = [_target] call FUNC(isBackpack);
|
// exit if the target is not a backpack
|
||||||
_isLocked = _target getVariable ["ACE_LockedInventory", false];
|
if !([_backpack] call FUNC(isBackpack)) exitWith {};
|
||||||
|
|
||||||
_return = false;
|
// get the unit that wears the backpack object
|
||||||
if (_isBackpack) then {
|
private "_target";
|
||||||
// target is a backpack
|
_target = [_backpack] call FUNC(getBackpackAssignedUnit);
|
||||||
private "_unit";
|
|
||||||
_unit = [_target] call FUNC(getBackpackAssignedUnit);
|
|
||||||
|
|
||||||
if (!alive _unit || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith {};
|
// raise event on target unit
|
||||||
|
["backpackOpened", _target, [_unit, _target, _backpack]] call EFUNC(common,targetEvent);
|
||||||
|
|
||||||
if (_isLocked) then {
|
// return false to open inventory as usual
|
||||||
// target is a locked backpack
|
false
|
||||||
[format [localize "STR_ACE_LockBackpacks_BackpackLocked", [_unit] call EFUNC(common,getName)]] call EFUNC(common,displayTextStructured);
|
|
||||||
_return = true;
|
|
||||||
} else {
|
|
||||||
// target is a not-locked backpack
|
|
||||||
if (_unit getVariable ["ACE_LockedInventory", false]) then {
|
|
||||||
[localize "STR_ACE_LockBackpacks_InventoryLocked"] call EFUNC(common,displayTextStructured);
|
|
||||||
_return = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// target is not a backpack
|
|
||||||
if (_isLocked) then {
|
|
||||||
[localize "STR_ACE_LockBackpacks_InventoryLocked"] call EFUNC(common,displayTextStructured);
|
|
||||||
_return = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
_return
|
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Edited with tabler - 2014-12-21 -->
|
|
||||||
<Project name="ACE">
|
|
||||||
<Package name="LockBackpacks">
|
|
||||||
<Key ID="STR_ACE_LockBackpacks_BackpackVentralTake">
|
|
||||||
<English>Take (Ventral)</English>
|
|
||||||
<German>Aufnehmen (Am Bauch)</German>
|
|
||||||
<Spanish>Coger (Mochila delantera)</Spanish>
|
|
||||||
<Polish>Załóż (brzuch)</Polish>
|
|
||||||
<Czech>Vzít (ventrální)</Czech>
|
|
||||||
<French>Prendre (Ventral)</French>
|
|
||||||
<Russian>Взять рюкзак (передний)</Russian>
|
|
||||||
<Hungarian>Felvétel (előre)</Hungarian>
|
|
||||||
<Portuguese>Pegar (Mochila Ventral)</Portuguese>
|
|
||||||
<Italian>Prendi</Italian>
|
|
||||||
</Key>
|
|
||||||
<Key ID="STR_ACE_LockBackpacks_BackpackVentralPut">
|
|
||||||
<English>Take Off Backpack</English>
|
|
||||||
<German>Rucksack ablegen</German>
|
|
||||||
<Spanish>Dejar mochila</Spanish>
|
|
||||||
<Polish>Zdejmij (brzuch)</Polish>
|
|
||||||
<Czech>Odložit batoh</Czech>
|
|
||||||
<French>Enlever (Ventral)</French>
|
|
||||||
<Russian>Снять рюкзак (передний)</Russian>
|
|
||||||
<Hungarian>Táska levétele</Hungarian>
|
|
||||||
<Portuguese>Retirar Mochila</Portuguese>
|
|
||||||
<Italian>Togliere zaino</Italian>
|
|
||||||
</Key>
|
|
||||||
<Key ID="STR_ACE_LockBackpacks_LockBackpack">
|
|
||||||
<English>Lock Backpack</English>
|
|
||||||
<German>Rucksack verschließen</German>
|
|
||||||
<French>Verrouiller le sac à dos</French>
|
|
||||||
<Spanish>Bloquear mochila</Spanish>
|
|
||||||
<Czech>Zamknout batoh</Czech>
|
|
||||||
<Polish>Zablokuj plecak</Polish>
|
|
||||||
<Hungarian>Táska zárolása</Hungarian>
|
|
||||||
<Russian>Запереть рюкзак</Russian>
|
|
||||||
</Key>
|
|
||||||
<Key ID="STR_ACE_LockBackpacks_UnlockBackpack">
|
|
||||||
<English>Unlock Backpack</English>
|
|
||||||
<German>Rucksack aufschließen</German>
|
|
||||||
<French>Déverouiller le sac à dos</French>
|
|
||||||
<Spanish>Desbloquear mochila</Spanish>
|
|
||||||
<Czech>Odemknout batoh</Czech>
|
|
||||||
<Polish>Odblokuj plecak</Polish>
|
|
||||||
<Hungarian>Táska nyitása</Hungarian>
|
|
||||||
<Russian>Отпереть рюкзак</Russian>
|
|
||||||
</Key>
|
|
||||||
<Key ID="STR_ACE_LockBackpacks_BackpackLocked">
|
|
||||||
<English>Backpack of %1 is locked</English>
|
|
||||||
<German>Der Rucksack von %1 ist verschlossen</German>
|
|
||||||
<French>Le sac à dos de %1 est verroullé</French>
|
|
||||||
<Spanish>La mochila de %1 está bloqueada</Spanish>
|
|
||||||
<Czech>%1 má zamčený batoh</Czech>
|
|
||||||
<Polish>Plecak %1 jest zablokowany</Polish>
|
|
||||||
<Hungarian>%1 táskája zárolva</Hungarian>
|
|
||||||
<Russian>Рюкзак %1 заперт</Russian>
|
|
||||||
</Key>
|
|
||||||
<Key ID="STR_ACE_LockBackpacks_InventoryLocked">
|
|
||||||
<English>Inventory is locked</English>
|
|
||||||
<German>Das Inventar ist verschlossen</German>
|
|
||||||
<French>L'inventaire est verrouillé</French>
|
|
||||||
<Spanish>Inventario bloqueado</Spanish>
|
|
||||||
<Czech>Inventář je zamčený</Czech>
|
|
||||||
<Polish>Ekwipunek jest zablokowany</Polish>
|
|
||||||
<Hungarian>Felszerelés zárolt</Hungarian>
|
|
||||||
<Russian>Инвентарь заперт</Russian>
|
|
||||||
</Key>
|
|
||||||
</Package>
|
|
||||||
</Project>
|
|
Loading…
Reference in New Issue
Block a user