Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mharis001
Copy link
Member

@mharis001 mharis001 commented Jun 10, 2018

When merged this pull request will:

  • Optimize interactEH function
  • Misc improvements to isFence and cutDownFence functions (cleanup, readability, time macros)
  • Remove redundant parentheses and spaces
  • Added missing fences
  • RVMAT cleanup, config guidelines
  • Remove unused sound files

Performance results for ace_logistics_wirecutter_interactEH_counter:

Test Old New
1 0.320984s / 433 = 0.741302ms 0.169006s / 415 = 0.407244ms
2 0.307983s / 290 = 1.06201ms 0.128906s / 334 = 0.385947ms
3 0.611984s / 419 = 1.46058ms 0.183029s / 425 = 0.430657ms

@mharis001 mharis001 closed this Jun 10, 2018
@mharis001 mharis001 reopened this Jun 10, 2018
@mharis001
Copy link
Member Author

Wrong button 😞

@commy2
Copy link
Contributor

commy2 commented Jun 10, 2018

Why don't we get the sound files to work instead of deleting them? More sfx!

@mharis001
Copy link
Member Author

They sound like a machine cutting metal (a saw or something similar), instead of clipping with a wire cutter.

class Land_IndFnc_3_Hole_F: Wall_F { GVAR(isFence) = 1; };
class Land_IndFnc_3_F: Wall_F { GVAR(isFence) = 1; };
class Land_Razorwire_F: NonStrategic { GVAR(isFence) = 1; };
class Land_Net_Fence_4m_F: Wall_F {
Copy link
Contributor

Choose a reason for hiding this comment

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

it didn't break Coding Guidelines before and was quite compact

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer the spread out variant more as it looks cleaner. I would however prefer a Macro much more.

Copy link
Member Author

Choose a reason for hiding this comment

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

What about MACRO_FENCE(Land_Net_Fence_4m_F,Wall_F);?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried it out and it is less readable than having them spread out.

*
* Example:
* [player, berlinWall] call ace_logistics_wirecutter_fnc_cutDownFence
* [_player, _fence] call ace_logistics_wirecutter_fnc_cutDownFence
Copy link
Contributor

Choose a reason for hiding this comment

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

example is mostly useful for copy-pasting to debug console so [player, cursorObject] call ace_logistics_wirecutter_fnc_cutDownFence would be better

params ["_unit", "_fence"];
TRACE_2("Fence cutting started",_unit,_fence);

// Exit if unit is not player
Copy link
Contributor

Choose a reason for hiding this comment

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

really :trollface:

Copy link
Member Author

Choose a reason for hiding this comment

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

brain-lag :trollface:

// Ignore self-interaction menu or mounted vehicle interaction
// For performance reasons only add PFH if player has wirecutter item
// If player somehow gets a wirecutter during keyDown, they will just have to reopen menu
if (_interactionType != 0 || {vehicle ACE_player != ACE_player} || {!("ACE_wirecutter" in ([ACE_player, false, true, true, true, false] call CBA_fnc_uniqueUnitItems))}) exitWith {};
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be better to split this line to multi-line condition

if (!(_x in _fencesHelped) && {_x call FUNC(isFence)}) then {
_fencesHelped pushBack _x;
private _helper = "ACE_LogicDummy" createVehicleLocal [0, 0, 0];
private _action = [QGVAR(helperCutFence), localize LSTRING(CutFence), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0, 0, 0]}, 5.5, [false, false, false, false, true]] call EFUNC(interact_menu,createAction);
Copy link
Member Author

@mharis001 mharis001 Jun 26, 2018

Choose a reason for hiding this comment

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

What about creating a helper object with this action in config? The attached fence would then be a variable on the helper.

@jonpas jonpas added this to the 3.13.0 milestone Jun 26, 2018
@jonpas jonpas added kind/optimization Release Notes: **IMPROVED:** kind/enhancement Release Notes: **IMPROVED:** kind/cleanup Release Notes: **CHANGED:** labels Jun 26, 2018
@PabstMirror PabstMirror modified the milestones: 3.13.0, 3.12.3 Jul 13, 2018
@PabstMirror PabstMirror merged commit def05b9 into acemod:master Jul 13, 2018
@mharis001 mharis001 deleted the wirecutter-improvements branch August 29, 2018 23:28
BaerMitUmlaut pushed a commit that referenced this pull request Aug 5, 2019
* Optimize and cleanup interactEH function

* Add missing fences and improve formatting

* Improve cutDownFence function

* Remove unused sound files and cleanup

* Multi-line condition and fix examples

* Increase PFH delay and use distanceSqr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Release Notes: **CHANGED:** kind/enhancement Release Notes: **IMPROVED:** kind/optimization Release Notes: **IMPROVED:**

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants