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 3 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(1 < (vectorUp _target) vectorDistance (surfaceNormal getPosATL _target) && {0 == {alive _x} count crew _target});
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(1 < (vectorUp _target) vectorDistance (surfaceNormal getPosATL _target) && {0 == {alive _x} count crew _target});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First condition should be made into a common function, as it repeats.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to move such a small piece of code to function.

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(1 < (vectorUp _target) vectorDistance (surfaceNormal getPosATL _target) && {0 == {alive _x} count crew _target || {isAutonomous _target}} && {getMass _target <= FLIP_MAX_STATICWEAPON_MASS});
statement = QUOTE([ARR_3(QQGVAR(flip),_target,_target)] call CBA_fnc_targetEvent);
};
};
};

Expand Down
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
3 changes: 3 additions & 0 deletions addons/interaction/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@
#include "\z\ace\addons\main\script_macros.hpp"

#define MACRO_DOOR_REACH_DISTANCE (AGLToASL positionCameraToWorld [0,0,0] vectorDistance AGLToASL (ACE_player modelToWorld (ACE_player selectionPosition "Head"))) + 2

// here is most suitable mass for all vanilla, CUP and RHS statics ATM (ZU-23 suits, D-30 and M119 don't suit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditch "here is", it's obviously here if the comment is here. ^^

#define FLIP_MAX_STATICWEAPON_MASS 2000
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