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

add CBA_fnc_binocularMagazine #325

Merged
merged 6 commits into from
May 15, 2016
Merged

add CBA_fnc_binocularMagazine #325

merged 6 commits into from
May 15, 2016

Conversation

commy2
Copy link
Contributor

@commy2 commy2 commented May 10, 2016

  • Adds CBA_fnc_binocularMagazine which reports the units "binocular magazine" (laserbatteries in laserdesignator)
  • Adds CBA_fnc_addBinocularMagazine which adds a magazine to the units binocular.
  • Adds CBA_fnc_removeBinocularMagazine which removes the units "binocular magazine" (if any)

Those are the current best SQF work arounds for these missing commands. (as far as I can tell)

This follows the same logic as primaryWeaponMagazine, handgunMagazine, removePrimaryWeaponItem, addSecondaryWeaponItem etc.

@commy2 commy2 added the Feature label May 10, 2016
@PabstMirror
Copy link
Contributor

I was wondering if this would be any faster:
(((getUnitLoadout player) select 8) select 4) param [0, ""]

but it's actually a little slower than the for loop; getUnitLoadout is an expensive command.

@commy2
Copy link
Contributor Author

commy2 commented May 10, 2016

Yeah. Was doing the same right now and had the same result.

getUnitLoadout/setUnitLoadout can be used to finally have a addBinocularMagazinevariant

@PabstMirror
Copy link
Contributor

Unfortunitly that will break unique magazine ids
player setUnitLoadout (getUnitLoadout player)
will have different magazinesDetail player

😢

@jonpas
Copy link
Member

jonpas commented May 10, 2016

Unfortunitly that will break unique magazine ids

As expected... it would be nice if we could get an optional parameter to keep magazine IDs.

@commy2
Copy link
Contributor Author

commy2 commented May 10, 2016

Unfortunitly that will break unique magazine ids

hmm, true. I don't see any other way though

@PabstMirror
Copy link
Contributor

We could do something like a magID lookup map.

  • Player adds a unique mag someUniqueMag:55
  • ["someUniqueMag:55"] call CBA_fnc_getUniqueMagIndex would return a index of 3
  • We do the gear swap, player now has mag with ID someUniqueMag:77.
  • Gear swap would handle this and add entires to the map.
  • Calling `["someUniqueMag:77"] call CBA_fnc_getUniqueMagIndex`` would have same return of 3

@commy2 - What about using this for CBA_fnc_addBinocularMagazine:

params [["_unit", objNull, [objNull]], ["_magazine", "", [""]], ["_ammo", nil, [0]]];

if (!local _unit) exitWith {};
private _binocularWeapon = binocular _unit;
if (_binocularWeapon == "") exitWith {};

_unit removeWeapon _binocularWeapon;


if (isNil "_ammo") then {
   _ammo = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count");
};
_unit addMagazine [_magazine, _ammo];


_unit addWeapon _binocularWeapon;

@commy2
Copy link
Contributor Author

commy2 commented May 10, 2016

addMagazine fails if you have no uniform/vest/backpack or they are full

@commy2
Copy link
Contributor Author

commy2 commented May 10, 2016

We could do something like a magID lookup map.

Yeah, but anyone else using setUnitLoadout would still break it.

@jokoho48
Copy link
Member

i just took a look at the model and found 2 thing that you should improve, the Polycount in this parts of the model is way to high
http://puu.sh/oNmPh/b985503f8b.jpg
http://puu.sh/oNmTj/ad8adb18ac.png

@commy2
Copy link
Contributor Author

commy2 commented May 10, 2016

joko, I think you took a wrong turn somewhere.

@jokoho48
Copy link
Member

what the Fuck how did this work... Fu you github... i just realise what you mean dafug

@jonpas
Copy link
Member

jonpas commented May 13, 2016

I'll just leave this here for @jokoho48
http://static.flickr.com/3248/3285678255_1905fbfbff.jpg


Description:
Adds a magazine to the units rangefinder.
Note that this breaks the unique magazine ids due to the usage of setUnitLoadout.
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an empty line after the first sentence. The first sentence can(*) then be used to generate a description field for CfgFunctions entries.

(*) The old Ruby script that does this needs updating, but with the Description: paragraph in this form, automation is possible.

@commy2 commy2 added this to the 2.3.2 milestone May 15, 2016
@Killswitch00 Killswitch00 merged commit 1d64287 into master May 15, 2016
@thojkooi thojkooi deleted the binocularMagazine branch June 16, 2016 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants