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

Vehicle Lock - Enable for planes #6646

Merged
merged 7 commits into from
Oct 21, 2018
Merged

Vehicle Lock - Enable for planes #6646

merged 7 commits into from
Oct 21, 2018

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented Oct 18, 2018

When merged this pull request will:

@commy2 commy2 added the kind/enhancement Release Notes: **IMPROVED:** label Oct 18, 2018
@commy2 commy2 added this to the 3.13.0 milestone Oct 18, 2018
@@ -33,4 +33,9 @@ class Extended_InitPost_EventHandlers {
serverInit = QUOTE(_this call FUNC(handleVehicleInitPost));
};
};
class Plane {
class ADDON {
serverInit = QUOTE(_this call FUNC(handleVehicleInitPost));
Copy link
Member

Choose a reason for hiding this comment

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

QFUNC(handleVehicleInitPost)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why? You can't call a string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would break it, because it removes the call.

Copy link
Member

Choose a reason for hiding this comment

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

oops... too much time with CBA state machine

@@ -27,7 +27,7 @@ TRACE_1("params",_vehicle);

params ["_vehicle"];

if ((_vehicle isKindOf "Car") || {_vehicle isKindOf "Tank"} || {_vehicle isKindOf "Helicopter"}) then {
if (_vehicle isKindOf "Car" || {_vehicle isKindOf "Tank" || {_vehicle isKindOf "Helicopter" || {_vehicle isKindOf "Plane"}}}) then {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we combine them into IsKindOf Air?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, although this is consistent with what we use everywhere else.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (_vehicle isKindOf "Car" || {_vehicle isKindOf "Tank" || {_vehicle isKindOf "Helicopter" || {_vehicle isKindOf "Plane"}}}) then {
if (-1 < ["Car", "Tank", "Helicopter", "Plane"] findIf {_vehicle isKindOf _x}) then {

github suggestion is cool :)

Copy link
Contributor Author

@commy2 commy2 Oct 19, 2018

Choose a reason for hiding this comment

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

Like, except the -1 should be at the end and the < be a >.

Copy link
Contributor

Choose a reason for hiding this comment

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

this whole line is pointless
func is only called from xeh added to specific vehicle types
https://github.com/acemod/ACE3/blob/master/addons/vehiclelock/CfgEventHandlers.hpp#L23

@@ -28,7 +28,7 @@ if !(_activated) exitWith {WARNING("Vehicle Lock Sync Module - placed but not ac
params ["_syncedObjects"];

private _listOfVehicles = _syncedObjects select {
(_x isKindOf "Car") || {(_x isKindOf "Tank") || {_x isKindOf "Helicopter"}}
_x isKindOf "Car" || {_x isKindOf "Tank" || {_x isKindOf "Helicopter" || {_x isKindOf "Plane"}}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
_x isKindOf "Car" || {_x isKindOf "Tank" || {_x isKindOf "Helicopter" || {_x isKindOf "Plane"}}}
private _vehicle = _x;
-1 < ["Car", "Tank", "Helicopter", "Plane"] findIf {_vehicle isKindOf _x}

Also I think this array of classes should become macro because it's used at least in 2 places.

@@ -28,7 +28,8 @@ if !(_activated) exitWith {WARNING("Vehicle Lock Sync Module - placed but not ac
params ["_syncedObjects"];

private _listOfVehicles = _syncedObjects select {
(_x isKindOf "Car") || {(_x isKindOf "Tank") || {_x isKindOf "Helicopter"}}
#define CLASSNAMES ["Car", "Tank", "Air"]
Copy link
Contributor

Choose a reason for hiding this comment

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

macro is useless here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commas break the args in a macro, because the preprocessor cannot handle the parentheses syntax. You'd have to use the ARR_3 macro which is ugly.

@@ -28,7 +28,8 @@ if !(_activated) exitWith {WARNING("Vehicle Lock Sync Module - placed but not ac
params ["_syncedObjects"];

private _listOfVehicles = _syncedObjects select {
(_x isKindOf "Car") || {(_x isKindOf "Tank") || {_x isKindOf "Helicopter"}}
#define CLASSNAMES ["Car", "Tank", "Air"]
IS_KIND_OF_ANY(_x,CLASSNAMES)
Copy link
Contributor

Choose a reason for hiding this comment

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

you now have findIf {(_x) isKindOf _x} after preprocessing

@PabstMirror PabstMirror changed the title enable vehicle lock module for planes Vehicle Lock - Enable for planes Oct 21, 2018
@PabstMirror PabstMirror merged commit 001942b into master Oct 21, 2018
@PabstMirror PabstMirror deleted the vehicle-lock-plane branch October 21, 2018 21:37
@PabstMirror PabstMirror modified the milestones: 3.13.0, 3.12.4 Nov 9, 2018
BaerMitUmlaut pushed a commit that referenced this pull request Aug 5, 2019
* enable vehicle lock module for planes

* Add actions to planes

* improved lazy eval

* remove superfluous parent class check

* IS_KIND_OF_ANY macro

* Update addons/vehiclelock/functions/fnc_moduleSync.sqf

* Improve handleVehicleInitPost XEH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vehicle Lock Assign Module Clarification
5 participants