fn_getForceRatio to fn_getBluforRatio
This commit is contained in:
parent
2d0a300177
commit
21a3a4deb7
|
@ -20,9 +20,9 @@ class KPLIB
|
|||
class fillStorage {};
|
||||
class forceBluforCrew {};
|
||||
class getAdaptiveVehicle {};
|
||||
class getBluforRatio {};
|
||||
class getCommander {};
|
||||
class getFobName {};
|
||||
class getForceRatio {};
|
||||
class getGroupType {};
|
||||
class getLessLoadedHC {};
|
||||
class getLoadout {};
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
File: fn_getBluforRatio.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-11-25
|
||||
Last Update: 2019-12-05
|
||||
License: MIT License - http://www.opensource.org/licenses/MIT
|
||||
|
||||
Description:
|
||||
Gets the ratio of blufor units in the given sector to the total number of units.
|
||||
|
||||
Parameter(s):
|
||||
_sector - Sector to get the blufor / opfor ratio from [STRING, defaults to ""]
|
||||
|
||||
Returns:
|
||||
Blufor ratio [NUMBER]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_sector", "", [""]]
|
||||
];
|
||||
|
||||
if (_sector isEqualTo "") exitWith {["Empty string given"] call BIS_fnc_error; -1};
|
||||
|
||||
private _range = [GRLIB_capture_size, GRLIB_capture_size * 1.4] select (_sector in sectors_bigtown);
|
||||
private _red = [(markerPos _sector), _range, GRLIB_side_enemy] call KPLIB_fnc_getUnitsCount;
|
||||
private _blue = [(markerPos _sector), _range, GRLIB_side_friendly] call KPLIB_fnc_getUnitsCount;
|
||||
|
||||
if (_blue > 0 || _red > 0) then {
|
||||
_blue / (_blue + _red)
|
||||
} else {
|
||||
[0, 1] select (_sector in blufor_sectors)
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
File: fn_getForceRatio.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-11-25
|
||||
Last Update: 2019-12-03
|
||||
License: MIT License - http://www.opensource.org/licenses/MIT
|
||||
|
||||
Description:
|
||||
No description added yet.
|
||||
|
||||
Parameter(s):
|
||||
_localVariable - Description [DATATYPE, defaults to DEFAULTVALUE]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
// TODO
|
||||
params [ "_sector" ];
|
||||
private [ "_actual_capture_size", "_red_forces", "_blue_forces", "_ratio" ];
|
||||
|
||||
_actual_capture_size = GRLIB_capture_size;
|
||||
if ( _sector in sectors_bigtown ) then {
|
||||
_actual_capture_size = GRLIB_capture_size * 1.4;
|
||||
};
|
||||
|
||||
_red_forces = [ (markerpos _sector), _actual_capture_size, GRLIB_side_enemy ] call KPLIB_fnc_getUnitsCount;
|
||||
_blue_forces = [ (markerpos _sector), _actual_capture_size, GRLIB_side_friendly ] call KPLIB_fnc_getUnitsCount;
|
||||
_ratio = -1;
|
||||
|
||||
if (_red_forces > 0) then {
|
||||
_ratio = _blue_forces / ( _red_forces + _blue_forces );
|
||||
} else {
|
||||
if ( _sector in blufor_sectors || _blue_forces != 0 ) then {
|
||||
_ratio = 1;
|
||||
} else {
|
||||
_ratio = 0;
|
||||
};
|
||||
};
|
||||
|
||||
_ratio
|
|
@ -216,7 +216,7 @@ while { true } do {
|
|||
if ( [ markerpos _nearest_active_sector, _zone_size ] call KPLIB_fnc_getSectorOwnership == GRLIB_side_resistance ) then { _colorzone = "ColorCivilian" };
|
||||
"zone_capture" setmarkercolorlocal _colorzone;
|
||||
|
||||
_ratio = [_nearest_active_sector] call KPLIB_fnc_getForceRatio;
|
||||
_ratio = [_nearest_active_sector] call KPLIB_fnc_getBluforRatio;
|
||||
_barwidth = 0.084 * safezoneW * _ratio;
|
||||
_bar = (uiNamespace getVariable 'GUI_OVERLAY') displayCtrl (244);
|
||||
_bar ctrlSetPosition [(ctrlPosition _bar) select 0,(ctrlPosition _bar) select 1,_barwidth,(ctrlPosition _bar) select 3];
|
||||
|
|
|
@ -10,7 +10,7 @@ private _range = 40;
|
|||
while {_move_is_disabled && local _unit && alive _unit && !(captive _unit)} do {
|
||||
|
||||
if !(_sector isEqualTo "") then {
|
||||
_ratio = [_sector] call KPLIB_fnc_getForceRatio;
|
||||
_ratio = [_sector] call KPLIB_fnc_getBluforRatio;
|
||||
};
|
||||
|
||||
_range = floor (linearConversion [0, 1, _ratio, 0, GRLIB_capture_size / 3 * 2, true]);
|
||||
|
|
Loading…
Reference in New Issue