Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attach - Added attached/detaching events #8193

Merged
merged 3 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/attach/functions/fnc_attach.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
[_onAttachText, 2] call EFUNC(common,displayTextStructured);
};
_unit setVariable [QGVAR(attached), [[_attachedItem, _itemClassname]], true];
[QGVAR(attached), [_attachedItem, _itemClassname]] call CBA_fnc_localEvent;
} else {
GVAR(placeAction) = PLACE_WAITING;

Expand Down
2 changes: 2 additions & 0 deletions addons/attach/functions/fnc_detach.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ if (!([_unit, _itemName] call CBA_fnc_canAddItem) && {!_isChemlight}) exitWith {
[LELSTRING(common,Inventory_Full)] call EFUNC(common,displayTextStructured);
};

[QGVAR(detach), [_attachedObject, _itemName]] call CBA_fnc_localEvent;
dedmen marked this conversation as resolved.
Show resolved Hide resolved

// Add item to inventory (unless it's a chemlight)
if (!_isChemlight) then {
_unit addItem _itemName;
Expand Down
3 changes: 2 additions & 1 deletion addons/attach/functions/fnc_placeApprove.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Approves placement of the lightObject, scans for an appropriate location and attaches
* A player can release the attachObject with it floating in mid-air.
* This will use lineIntersectsSurfaces to scan towards the center of the vehicle to find a collision
* ArmA's collision detection is of couse terrible and often misses collisions (difference between what we see and collision LOD)
* Arma's collision detection is of couse terrible and often misses collisions (difference between what we see and collision LOD)
* So it does multiple scans at slighly different angles
* This is VERY computationaly intensive, but doesn't happen that often.
*
Expand Down Expand Up @@ -100,5 +100,6 @@ _unit removeItem _itemClassname;
private _attachList = _attachToVehicle getVariable [QGVAR(attached), []];
_attachList pushBack [_attachedObject, _itemClassname];
_attachToVehicle setVariable [QGVAR(attached), _attachList, true];
[QGVAR(attached), [_attachedObject, _itemClassname]] call CBA_fnc_localEvent;

[_onAttachText, 2] call EFUNC(common,displayTextStructured);
8 changes: 8 additions & 0 deletions docs/wiki/framework/events-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ MenuType: 0 = Interaction, 1 = Self Interaction
|`ace_cookoff_cookOffBox` | _box | Global | Listen | Ammo box cook off has started
|`ace_cookoff_engineFire` | _vehicle | Global | Listen | Engine fire has started


### 2.11 Attach (`ace_attach`)

| Event Key | Parameters | Locality | Type | Description |
|----------|---------|---------|---------|---------|---------|
|`ace_attach_attached` | [_attachedObject, _itemClassname] | Local | Listen | After a item was attached to Unit/Vehicle
dedmen marked this conversation as resolved.
Show resolved Hide resolved
|`ace_attach_detach` | [_attachedObject, _itemName] | Local | Listen | Just before a item gets detached/removed from Unit/Vehicle
dedmen marked this conversation as resolved.
Show resolved Hide resolved

## 3. Usage
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.

Expand Down