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

Interaction - Add Flip and Push actions to Quad Bike, Kart and Static Weapons #6019

Merged
merged 7 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
39 changes: 39 additions & 0 deletions addons/interaction/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,40 @@ class CfgVehicles {
};
};

class Car_F: Car{};
class Quadbike_01_base_F: Car_F {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
class GVAR(flip) {
displayName = CSTRING(Flip);
condition = QUOTE(call DFUNC(canFlip));
statement = QUOTE([ARR_3(QQGVAR(flip),_target,_target)] call CBA_fnc_targetEvent);
};
class GVAR(push) {
displayName = CSTRING(Push);
condition = QUOTE(_target call FUNC(canPush));
statement = QUOTE(call FUNC(push));
};
};
};
};
class Kart_01_Base_F: Car_F {
class ACE_Actions: ACE_Actions {
class ACE_MainActions: ACE_MainActions {
class GVAR(flip) {
displayName = CSTRING(Flip);
condition = QUOTE(call DFUNC(canFlip));
statement = QUOTE([ARR_3(QQGVAR(flip),_target,_target)] call CBA_fnc_targetEvent);
};
class GVAR(push) {
displayName = CSTRING(Push);
condition = QUOTE(_target call FUNC(canPush));
statement = QUOTE(call FUNC(push));
};
};
};
};

class Tank: LandVehicle {
class ACE_Actions {
class ACE_MainActions {
Expand Down Expand Up @@ -545,6 +579,11 @@ class CfgVehicles {
exceptions[] = {"isNotSwimming"};
insertChildren = QUOTE(_this call DFUNC(addPassengersActions));
};
class GVAR(flip) {
displayName = CSTRING(Flip);
condition = QUOTE(call DFUNC(canFlip));
statement = QUOTE([ARR_3(QQGVAR(flip),_target,_target)] call CBA_fnc_targetEvent);
};
};
};

Expand Down
1 change: 1 addition & 0 deletions addons/interaction/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ PREP(openDoor);
PREP(canPush);
PREP(push);

PREP(canFlip);
PREP(switchLamp);
7 changes: 7 additions & 0 deletions addons/interaction/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ ACE_Modifier = 0;
{_lamp setHit [_x select 0, (_x select 1) max _disabledLampDMG];nil} count _hitPointsDamage;
}] call CBA_fnc_addEventHandler;

[QGVAR(flip), {
params ["_vehicle"];
private _position = getPosATL _vehicle;
_vehicle setVectorUp surfaceNormal _position;
_vehicle setPosATL _position;
}] call CBA_fnc_addEventHandler;

// Zeus action events
[QGVAR(zeusStance),{
{ _x setUnitPos (_this select 0); } forEach (_this select 1);
Expand Down
25 changes: 25 additions & 0 deletions addons/interaction/functions/fnc_canFlip.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Author: Dystopian
* Checks if vehicle can be flipped.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* Can Flip <BOOL>
*
* Example:
* [cursorObject] call ace_interaction_fnc_canFlip
*
* Public: No
*/
#include "script_component.hpp"

params ["_vehicle"];

// most suitable mass for all vanilla, CUP and RHS statics ATM (ZU-23 suits, D-30 and M119 don't suit)
#define FLIP_MAX_STATICWEAPON_MASS 2000

1 < (vectorUp _vehicle) vectorDistance (surfaceNormal getPosATL _vehicle)
&& {0 == {alive _x} count crew _vehicle || {isAutonomous _vehicle}}
&& {getMass _vehicle <= FLIP_MAX_STATICWEAPON_MASS}
6 changes: 5 additions & 1 deletion addons/interaction/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -831,14 +831,18 @@
<Polish>Pchnij</Polish>
<Czech>Tlačit</Czech>
<Hungarian>Tolás</Hungarian>
<Russian>Толкать</Russian>
<Russian>Толкнуть</Russian>
<Portuguese>Empurrar</Portuguese>
<Italian>Spingere</Italian>
<Japanese>押す</Japanese>
<Korean>밀기</Korean>
<Chinesesimp>推</Chinesesimp>
<Chinese>推</Chinese>
</Key>
<Key ID="STR_ACE_Interaction_Flip">
<English>Flip</English>
<Russian>Перевернуть</Russian>
</Key>
<Key ID="STR_ACE_Interaction_Interact">
<English>Interact</English>
<French>Interagir</French>
Expand Down