mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Attach - Added attached/detaching events (#8193)
* Added ace_attach attached/detach events * Apply suggestions from code review Co-authored-by: Jo David <github@jonathandavid.de> * Apply suggestions from code review Co-authored-by: jonpas <jonpas33@gmail.com> Co-authored-by: Jo David <github@jonathandavid.de> Co-authored-by: jonpas <jonpas33@gmail.com>
This commit is contained in:
parent
cc0d8a5ada
commit
825596bffe
@ -44,6 +44,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
|
|||||||
[_onAttachText, 2] call EFUNC(common,displayTextStructured);
|
[_onAttachText, 2] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
_unit setVariable [QGVAR(attached), [[_attachedItem, _itemClassname]], true];
|
_unit setVariable [QGVAR(attached), [[_attachedItem, _itemClassname]], true];
|
||||||
|
[QGVAR(attached), [_attachedItem, _itemClassname]] call CBA_fnc_localEvent;
|
||||||
} else {
|
} else {
|
||||||
GVAR(placeAction) = PLACE_WAITING;
|
GVAR(placeAction) = PLACE_WAITING;
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ if (!([_unit, _itemName] call CBA_fnc_canAddItem) && {!_isChemlight}) exitWith {
|
|||||||
[LELSTRING(common,Inventory_Full)] call EFUNC(common,displayTextStructured);
|
[LELSTRING(common,Inventory_Full)] call EFUNC(common,displayTextStructured);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[QGVAR(detaching), [_attachedObject, _itemName]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
// Add item to inventory (unless it's a chemlight)
|
// Add item to inventory (unless it's a chemlight)
|
||||||
if (!_isChemlight) then {
|
if (!_isChemlight) then {
|
||||||
_unit addItem _itemName;
|
_unit addItem _itemName;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Approves placement of the lightObject, scans for an appropriate location and attaches
|
* Approves placement of the lightObject, scans for an appropriate location and attaches
|
||||||
* A player can release the attachObject with it floating in mid-air.
|
* 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
|
* 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
|
* So it does multiple scans at slighly different angles
|
||||||
* This is VERY computationaly intensive, but doesn't happen that often.
|
* This is VERY computationaly intensive, but doesn't happen that often.
|
||||||
*
|
*
|
||||||
@ -100,5 +100,6 @@ _unit removeItem _itemClassname;
|
|||||||
private _attachList = _attachToVehicle getVariable [QGVAR(attached), []];
|
private _attachList = _attachToVehicle getVariable [QGVAR(attached), []];
|
||||||
_attachList pushBack [_attachedObject, _itemClassname];
|
_attachList pushBack [_attachedObject, _itemClassname];
|
||||||
_attachToVehicle setVariable [QGVAR(attached), _attachList, true];
|
_attachToVehicle setVariable [QGVAR(attached), _attachList, true];
|
||||||
|
[QGVAR(attached), [_attachedObject, _itemClassname]] call CBA_fnc_localEvent;
|
||||||
|
|
||||||
[_onAttachText, 2] call EFUNC(common,displayTextStructured);
|
[_onAttachText, 2] call EFUNC(common,displayTextStructured);
|
||||||
|
@ -106,6 +106,14 @@ MenuType: 0 = Interaction, 1 = Self Interaction
|
|||||||
|`ace_cookoff_cookOffBox` | _box | Global | Listen | Ammo box cook off has started
|
|`ace_cookoff_cookOffBox` | _box | Global | Listen | Ammo box cook off has started
|
||||||
|`ace_cookoff_engineFire` | _vehicle | Global | Listen | Engine fire 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 an item was attached to a unit/vehicle
|
||||||
|
|`ace_attach_detaching` | [_attachedObject, _itemName] | Local | Listen | Just before an item gets detached/removed from a unit/vehicle
|
||||||
|
|
||||||
## 3. Usage
|
## 3. Usage
|
||||||
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.
|
Also Reference [CBA Events System](https://github.com/CBATeam/CBA_A3/wiki/Custom-Events-System){:target="_blank"} documentation.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user