-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misc - Add interactions for better patient loading/unloading when car…
…ried (#378) **When merged this pull request will:** - Add ability to load carried patients directly into vehicle, without having to drop and then load. - Add ability to unload and carry patients directly from vehicles, without having to unload (drop) and then carry. - Add more ace macros ![image](https://github.com/KAT-Advanced-Medical/KAM/assets/15182031/a471bb32-09d7-406a-a7b0-f9444388d466) ![image](https://github.com/KAT-Advanced-Medical/KAM/assets/15182031/7237a27b-96c4-4399-8ac5-0813a99a6905) ### IMPORTANT - [Development Guidelines](https://ace3.acemod.org/wiki/development/) are read, understood and applied. - Title of this PR uses our standard template `Component - Add|Fix|Improve|Change|Make|Remove {changes}`.
- Loading branch information
1 parent
c350954
commit d51262e
Showing
8 changed files
with
353 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Blue | ||
* Add carry load ace actions to vehicle. | ||
* | ||
* Arguments: | ||
* 0: Vehicle <OBJECT> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [vehicle] call kat_misc_fnc_addVehicleCarryLoadActions; | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_vehicle"]; | ||
|
||
private _type = (typeOf _vehicle); | ||
|
||
private _fnc_getFreeSeats = { | ||
params ["_vehicle"]; | ||
|
||
// From ace_common_fnc_nearestVehiclesFreeSeat | ||
private _canSitInCargo = (getNumber (configOf _vehicle >> "ejectDeadCargo")) == 0; | ||
|
||
private _seatIndex = (fullCrew [_vehicle, "", true]) findIf { | ||
_x params ["_body", "_role", "_cargoIndex"]; | ||
|
||
(isNull _body) && {_role != "DRIVER"} && {_canSitInCargo || {_cargoIndex == -1}} | ||
}; | ||
|
||
_seatIndex; | ||
}; | ||
|
||
private _action = [format ["KAT_MainActions_%1", _type], | ||
ACELLSTRING(Interaction,MainAction), | ||
"", | ||
{}, | ||
{ | ||
params ["_vehicle", "_medic", "_args"]; | ||
|
||
!(_medic getVariable [QACEGVAR(dragging,carriedObject), objNull] isEqualTo objNull) && {_medic getVariable [QACEGVAR(dragging,carriedObject), objNull] isKindOf 'CAManBase'} | ||
}, | ||
{ | ||
params ["_vehicle", "_medic", "_args"]; | ||
_args params ["_type", "_fnc_getFreeSeats"]; | ||
|
||
private _loadAction = []; | ||
_loadAction pushBack [ | ||
[format ["KAT_LoadCarriedPatient_%1", _type], | ||
ACELLSTRING(medical_gui,LoadPatient), | ||
QACEPATHTOF(medical_gui,ui\cross.paa), | ||
{ | ||
params ["", "", "_args"]; | ||
_args params ["_vehicle", "_medic", "_fnc_getFreeSeats"]; | ||
|
||
[_medic, (_medic getVariable [QACEGVAR(dragging,carriedObject), objNull]), _vehicle] call ACEFUNC(medical_treatment,loadUnit); | ||
}, | ||
{ | ||
params ["", "", "_args"]; | ||
_args params ["_vehicle", "_medic", "_fnc_getFreeSeats"]; | ||
|
||
([_vehicle] call _fnc_getFreeSeats) != -1; | ||
}, | ||
{}, | ||
[_vehicle, _medic, _fnc_getFreeSeats] | ||
] call ACEFUNC(interact_menu,createAction), | ||
[], | ||
(_this select 1) | ||
]; | ||
|
||
_loadAction; | ||
}, | ||
[_type, _fnc_getFreeSeats], | ||
{call ACEFUNC(interaction,getVehiclePos)}, 4] call ACEFUNC(interact_menu,createAction); | ||
|
||
[_type, 0, [], _action] call ACEFUNC(interact_menu,addActionToClass); |
47 changes: 47 additions & 0 deletions
47
addons/misc/functions/fnc_addVehicleUnloadCarryPatientActions.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Blue | ||
* Add carry and unload ace actions to vehicle. | ||
* | ||
* Arguments: | ||
* 0: Vehicle <OBJECT> | ||
* | ||
* Return Value: | ||
* Ace actions <ARRAY> | ||
* | ||
* Example: | ||
* [vehicle] call kat_misc_fnc_addVehicleUnloadCarryPatientActions; | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_vehicle"]; | ||
|
||
private _type = (typeOf _vehicle); | ||
|
||
private _vehicleSeats = fullCrew [_vehicle, ""]; | ||
|
||
private _actions = []; | ||
|
||
{ | ||
private _unit = _x select 0; | ||
if (IS_UNCONSCIOUS(_unit)) then { | ||
_actions pushBack [[format ["KAT_UnloadAndCarryPatient_%1", _unit], | ||
[_unit, true] call ACEFUNC(common,getName), | ||
"", | ||
{ | ||
params ["_vehicle", "_medic", "_args"]; | ||
_args params ["_patient"]; | ||
|
||
[_medic, _patient] call FUNC(unloadAndCarryPatient); | ||
}, | ||
{ | ||
true; | ||
}, | ||
{}, | ||
[_unit] | ||
] call ACEFUNC(interact_menu,createAction),[], _medic]; | ||
}; | ||
} forEach (_vehicleSeats); | ||
|
||
_actions; |
Oops, something went wrong.