mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Code cleanup Backpacks
This commit is contained in:
parent
f77242fce3
commit
9ae215704c
@ -1,3 +1,3 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler);
|
["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Someone opened your backpack. Play sound and camshake. Execute locally.
|
||||||
*
|
*
|
||||||
* Someone opened your backpack. Execute locally.
|
* Arguments:
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Who accessed your inventory? (Object)
|
* 0: Who accessed your inventory? (Object)
|
||||||
* 1: Unit that wields the backpack (Object)
|
* 1: Unit that wields the backpack (Object)
|
||||||
* 2: The backpack object (Object)
|
* 2: The backpack object (Object)
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return Value:
|
||||||
* None.
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
private ["_sounds", "_position"];
|
|
||||||
params ["_target", "_backpack"];
|
params ["_target", "_backpack"];
|
||||||
|
|
||||||
// do cam shake if the target is the player
|
// do cam shake if the target is the player
|
||||||
@ -20,7 +21,8 @@ if ([_target] call EFUNC(common,isPlayer)) then {
|
|||||||
addCamShake [4, 0.5, 5];
|
addCamShake [4, 0.5, 5];
|
||||||
};
|
};
|
||||||
|
|
||||||
// play a rustling sound
|
// play a zipper sound effect
|
||||||
|
private ["_sounds", "_position"];
|
||||||
|
|
||||||
_sounds = [
|
_sounds = [
|
||||||
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
|
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
|
||||||
@ -32,8 +34,7 @@ _sounds = [
|
|||||||
QUOTE(PATHTO_R(sounds\zip_out.wav))
|
QUOTE(PATHTO_R(sounds\zip_out.wav))
|
||||||
];
|
];
|
||||||
|
|
||||||
_position = _target modelToWorldVisual (_target selectionPosition "Spine3");
|
_position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
|
||||||
_position = _position call EFUNC(common,positionToASL);
|
|
||||||
|
|
||||||
playSound3D [
|
playSound3D [
|
||||||
_sounds select floor random count _sounds,
|
_sounds select floor random count _sounds,
|
||||||
|
@ -1,23 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Check if the given backpack is an actual backpack that can store items. Parachute, static weapon packs, etc. will return false.
|
||||||
*
|
*
|
||||||
* Check if the given backpack is an actual backpack that can store items. Parachute backpacks will return false for example.
|
* Arguments:
|
||||||
|
* 0: Backpack <OBJECT, STRING>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* 0: A backpack (Object or String)
|
* Boolean <BOOL>
|
||||||
*
|
*
|
||||||
* Return value:
|
* Public: Yes
|
||||||
* Boolean (Bool)
|
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_config"];
|
|
||||||
params ["_backpack"];
|
params ["_backpack"];
|
||||||
|
|
||||||
if (typeName _backpack == "OBJECT") then {
|
if (typeName _backpack == "OBJECT") then {
|
||||||
_backpack = typeOf _backpack;
|
_backpack = typeOf _backpack;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private "_config";
|
||||||
_config = configFile >> "CfgVehicles" >> _backpack;
|
_config = configFile >> "CfgVehicles" >> _backpack;
|
||||||
|
|
||||||
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0}
|
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
|
* Handle the open inventory event. Camshake and sound on target client.
|
||||||
*
|
*
|
||||||
* Handle the open inventory event. Display message on target client.
|
* Arguments:
|
||||||
|
* 0: Unit <OBJECT>
|
||||||
|
* 1: Backpack <OBJECT>
|
||||||
*
|
*
|
||||||
* Argument:
|
* Return Value:
|
||||||
* Input from "InventoryOpened" eventhandler
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* false. Always open the inventory dialog. (Bool)
|
* false. Always open the inventory dialog. (Bool)
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_unit","_backpack"];
|
params ["_unit", "_backpack"];
|
||||||
|
|
||||||
// exit if the target is not a real backpack, i.e. parachute, static weapon bag etc.
|
// exit if the target is not a real backpack, i.e. parachute, static weapon bag etc.
|
||||||
if !([_backpack] call FUNC(isBackpack)) exitWith {false};
|
if !([_backpack] call FUNC(isBackpack)) exitWith {false};
|
||||||
|
Loading…
Reference in New Issue
Block a user