mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Laser - Fix seeker owner return value (#8862)
* Fix laser seeker return value Back to consistent with the documentation * Pick the owner with most hits instead of the last one in the hashmap
This commit is contained in:
parent
020cf2ddd8
commit
72774c909a
@ -164,8 +164,9 @@ if ((count _spots) > 0) then {
|
|||||||
{
|
{
|
||||||
_x params ["_xPos", "_owner"];
|
_x params ["_xPos", "_owner"];
|
||||||
_finalPos = _finalPos vectorAdd _xPos;
|
_finalPos = _finalPos vectorAdd _xPos;
|
||||||
private _count = _ownersHash getOrDefault [hashValue _owner, 0];
|
private _value = _ownersHash getOrDefault [hashValue _owner, [0, _owner]];
|
||||||
_ownersHash set [hashValue _owner, _count + 1];
|
_value set [0, 1 + _value#0];
|
||||||
|
_ownersHash set [hashValue _owner, _value];
|
||||||
} forEach _finalBucket;
|
} forEach _finalBucket;
|
||||||
|
|
||||||
_finalPos = _finalPos vectorMultiply (1 / (count _finalBucket));
|
_finalPos = _finalPos vectorMultiply (1 / (count _finalBucket));
|
||||||
@ -174,8 +175,10 @@ if ((count _spots) > 0) then {
|
|||||||
|
|
||||||
{
|
{
|
||||||
//IGNORE_PRIVATE_WARNING ["_x", "_y"];
|
//IGNORE_PRIVATE_WARNING ["_x", "_y"];
|
||||||
if (_y > _maxOwnerCount) then {
|
_y params ["_count", "_owner"];
|
||||||
_finalOwner = _x;
|
if (_count > _maxOwnerCount) then {
|
||||||
|
_maxOwnerCount = _count;
|
||||||
|
_finalOwner = _owner;
|
||||||
};
|
};
|
||||||
} forEach _ownersHash;
|
} forEach _ownersHash;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user