mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
objectParent command replacing fnc_getBackpackAssignedUnit
This commit is contained in:
parent
2f54cfadbc
commit
32300a0a80
@ -3,7 +3,6 @@
|
|||||||
ADDON = false;
|
ADDON = false;
|
||||||
|
|
||||||
PREP(backpackOpened);
|
PREP(backpackOpened);
|
||||||
PREP(getBackpackAssignedUnit);
|
|
||||||
PREP(isBackpack);
|
PREP(isBackpack);
|
||||||
PREP(onOpenInventory);
|
PREP(onOpenInventory);
|
||||||
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: commy2
|
|
||||||
*
|
|
||||||
* Returns the unit that has the given backpack object equipped.
|
|
||||||
*
|
|
||||||
* Argument:
|
|
||||||
* 0: Executing Unit (Object)
|
|
||||||
* 1: A backpack object (Object)
|
|
||||||
*
|
|
||||||
* Return value:
|
|
||||||
* Unit that has the backpack equipped. (Object)
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
scopeName "main";
|
|
||||||
|
|
||||||
params ["_unit","_backpack"];
|
|
||||||
_target = objNull;
|
|
||||||
{
|
|
||||||
if (backpackContainer _x == _backpack) then {_target = _x; breakTo "main"};
|
|
||||||
} count nearestObjects [_unit, ["Man"], 5];
|
|
||||||
if (isNull _target) exitWith {ACE_Player};
|
|
||||||
_target
|
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Author: commy2
|
* Author: commy2
|
||||||
*
|
*
|
||||||
* Handle the open inventory event. Display message on traget client.
|
* Handle the open inventory event. Display message on target client.
|
||||||
*
|
*
|
||||||
* Argument:
|
* Argument:
|
||||||
* Input from "InventoryOpened" eventhandler
|
* Input from "InventoryOpened" eventhandler
|
||||||
@ -11,16 +11,17 @@
|
|||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private "_target";
|
params ["_unit","_backpack"];
|
||||||
params ["","_backpack"];
|
|
||||||
|
|
||||||
// exit if the target is not a backpack
|
// exit if the target is not a real backpack, i.e. parachute, static weapon bag etc.
|
||||||
if !([_backpack] call FUNC(isBackpack)) exitWith {};
|
if !([_backpack] call FUNC(isBackpack)) exitWith {false};
|
||||||
|
|
||||||
// get the unit that wears the backpack object
|
// get the unit that wears the backpack object
|
||||||
_target = _this call FUNC(getBackpackAssignedUnit);
|
private "_target";
|
||||||
|
_target = objectParent _backpack;
|
||||||
|
|
||||||
if (isNull _target) exitWith {false};
|
if (isNull _target) exitWith {false};
|
||||||
|
|
||||||
// raise event on target unit
|
// raise event on target unit
|
||||||
["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent);
|
["backpackOpened", _target, [_target, _backpack]] call EFUNC(common,targetEvent);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user