Skip to content

Commit

Permalink
use opforcap_max
Browse files Browse the repository at this point in the history
  • Loading branch information
tbox1911 committed Feb 9, 2025
1 parent 369f780 commit 7eb85df
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 50 deletions.
70 changes: 33 additions & 37 deletions core.liberation/scripts/client/ui/ui_manager.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ while { true } do {
if (alive player && !dialog && !_overlayshown && !cinematic_camera_started && !halojumping && !_hide_HUD) then {
"LibUI" cutRsc ["statusoverlay", "PLAIN", 1];
_overlayshown = true;
_uiticks = 0;
};

if ((!alive player || dialog || cinematic_camera_started || _hide_HUD) && _overlayshown) then {
"LibUI" cutRsc ["blank", "PLAIN", 0];
_overlayshown = false;
};

if (_overlayshown) then {
if (_overlayshown && _uiticks % 5 == 0) then {
_overlay = uiNamespace getVariable ['GUI_OVERLAY', objNull];
(_overlay displayCtrl (266)) ctrlSetText format ["%1", GRLIB_ui_notif];
(_overlay displayCtrl (267)) ctrlSetText format ["%1", GRLIB_ui_notif];
Expand All @@ -52,42 +51,39 @@ while { true } do {
(_overlay displayCtrl (403)) ctrlSetText "";
};

if (_uiticks % 5 == 0) then {
(_overlay displayCtrl (107)) ctrlSetText format ["%1", (player getVariable ["GREUH_score_count",0])];
(_overlay displayCtrl (102)) ctrlSetText format ["%1", (player getVariable ["GREUH_ammo_count",0])];
(_overlay displayCtrl (103)) ctrlSetText format ["%1", (player getVariable ["GREUH_fuel_count",0])];
(_overlay displayCtrl (101)) ctrlSetText format ["%1/%2", resources_infantry, infantry_cap];
_reputation = [player] call F_getReput;
(_overlay displayCtrl (104)) ctrlSetText format ["%1", round(_reputation)];
(_overlay displayCtrl (105)) ctrlSetText format ["%1%2", round(combat_readiness),"%"];
(_overlay displayCtrl (106)) ctrlSetText format ["%1", round(resources_intel)];

_color_readiness = [0.8,0.8,0.8,1];
if (combat_readiness >= 25) then { _color_readiness = [0.8,0.8,0,1] };
if (combat_readiness >= 50) then { _color_readiness = [0.8,0.6,0,1] };
if (combat_readiness >= 75) then { _color_readiness = [0.8,0.3,0,1] };
if (combat_readiness >= 95) then { _color_readiness = [0.8,0,0,1] };

(_overlay displayCtrl (105)) ctrlSetTextColor _color_readiness;
(_overlay displayCtrl (135)) ctrlSetTextColor _color_readiness;

_color_reput = [0.8,0.8,0.8,1];
_reput_icon = "res\rep\rep3.paa";
if (_reputation >= 25) then { _color_reput = [0.8,0.8,0,1]; _reput_icon = "res\rep\rep4.paa" };
if (_reputation >= 50) then { _color_reput = [0.0,0.6,0,1]; _reput_icon = "res\rep\rep5.paa" };
if (_reputation >= 75) then { _color_reput = [0.0,0.8,0,1]; _reput_icon = "res\rep\rep6.paa" };
if (_reputation >= 100) then { _color_reput = [0,0.8,0.6,1]; _reput_icon = "res\rep\rep6.paa" };
if (_reputation <= -25) then { _color_reput = [0.8,0.8,0,1]; _reput_icon = "res\rep\rep2.paa" };
if (_reputation <= -50) then { _color_reput = [0.8,0.6,0,1]; _reput_icon = "res\rep\rep1.paa" };
if (_reputation <= -75) then { _color_reput = [0.8,0.3,0,1]; _reput_icon = "res\rep\rep0.paa" };
if (_reputation <= -100) then { _color_reput = [0.8,0,0,1]; _reput_icon = "res\rep\rep0.paa" };
(_overlay displayCtrl (104)) ctrlSetTextColor _color_reput;
(_overlay displayCtrl (1041)) ctrlSetText (getMissionPath _reput_icon);
};
(_overlay displayCtrl (107)) ctrlSetText format ["%1", (player getVariable ["GREUH_score_count",0])];
(_overlay displayCtrl (102)) ctrlSetText format ["%1", (player getVariable ["GREUH_ammo_count",0])];
(_overlay displayCtrl (103)) ctrlSetText format ["%1", (player getVariable ["GREUH_fuel_count",0])];
(_overlay displayCtrl (101)) ctrlSetText format ["%1/%2", resources_infantry, infantry_cap];
_reputation = [player] call F_getReput;
(_overlay displayCtrl (104)) ctrlSetText format ["%1", round(_reputation)];
(_overlay displayCtrl (105)) ctrlSetText format ["%1%2", round(combat_readiness),"%"];
(_overlay displayCtrl (106)) ctrlSetText format ["%1", round(resources_intel)];

_color_readiness = [0.8,0.8,0.8,1];
if (combat_readiness >= 25) then { _color_readiness = [0.8,0.8,0,1] };
if (combat_readiness >= 50) then { _color_readiness = [0.8,0.6,0,1] };
if (combat_readiness >= 75) then { _color_readiness = [0.8,0.3,0,1] };
if (combat_readiness >= 95) then { _color_readiness = [0.8,0,0,1] };

(_overlay displayCtrl (105)) ctrlSetTextColor _color_readiness;
(_overlay displayCtrl (135)) ctrlSetTextColor _color_readiness;

_color_reput = [0.8,0.8,0.8,1];
_reput_icon = "res\rep\rep3.paa";
if (_reputation >= 25) then { _color_reput = [0.8,0.8,0,1]; _reput_icon = "res\rep\rep4.paa" };
if (_reputation >= 50) then { _color_reput = [0.0,0.6,0,1]; _reput_icon = "res\rep\rep5.paa" };
if (_reputation >= 75) then { _color_reput = [0.0,0.8,0,1]; _reput_icon = "res\rep\rep6.paa" };
if (_reputation >= 100) then { _color_reput = [0,0.8,0.6,1]; _reput_icon = "res\rep\rep6.paa" };
if (_reputation <= -25) then { _color_reput = [0.8,0.8,0,1]; _reput_icon = "res\rep\rep2.paa" };
if (_reputation <= -50) then { _color_reput = [0.8,0.6,0,1]; _reput_icon = "res\rep\rep1.paa" };
if (_reputation <= -75) then { _color_reput = [0.8,0.3,0,1]; _reput_icon = "res\rep\rep0.paa" };
if (_reputation <= -100) then { _color_reput = [0.8,0,0,1]; _reput_icon = "res\rep\rep0.paa" };
(_overlay displayCtrl (104)) ctrlSetTextColor _color_reput;
(_overlay displayCtrl (1041)) ctrlSetText (getMissionPath _reput_icon);

if (_uiticks % 25 == 0) then {
private _opforcap = { alive _x && !(captive _x) } count (units GRLIB_side_enemy);
if (_opforcap >= GRLIB_opfor_cap || count active_sectors >= GRLIB_max_active_sectors) then {
if (opforcap_max || count active_sectors >= GRLIB_max_active_sectors) then {
(_overlay displayCtrl (517)) ctrlShow true;

if (!_active_sectors_hint) then {
Expand Down Expand Up @@ -145,8 +141,8 @@ while { true } do {
"zone_capture" setmarkerposlocal markers_reset;
};
};

};

_uiticks = _uiticks + 1;
if (_uiticks > 1000) then { _uiticks = 0 };
uiSleep 0.25;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ while { GRLIB_endgame == 0 && GRLIB_global_stop == 0 } do {

_target_lst = allPlayers select { [_x] call F_getScore >= GRLIB_perm_tank && rating _x > 1000 && isNull objectParent _x };
if ( GRLIB_endgame == 1 || GRLIB_global_stop == 1 ) exitWith {};
if ( (count _target_lst > 1) && (opforcap < GRLIB_battlegroup_cap) && (diag_fps > 30.0)) then {
if (count _target_lst > 1 && !opforcap_max && diag_fps >= 30.0) then {
_target = selectRandom _target_lst;
if (_target getVariable ["GRLIB_BN_timer", 0] < time) then {
_target setVariable ["GRLIB_BN_timer", round (time + (30 * 60))];
_msg = format ["<img size='1' image='%2'/> - <img size='1' image='%2'/> - <img size='1' image='%2'/><br/><t color='#0000FF'>%1</t> is now the <t color='#808080'>'Bete Noire'</t> of the <t color='#F00000'>OPFor</t>!<br/><br/>You better take cover...<br/><img size='1' image='%2'/> - <img size='1' image='%2'/> - <img size='1' image='%2'/>", name _target, getMissionPath "res\skull.paa"];
[_msg, 0, 0, 10, 0, 0, 90] remoteExec ["BIS_fnc_dynamicText", 0];

waitUntil {sleep 2; isNull objectParent _target};
diag_log format ["Spawn Attack on player %1 at %2", name _target, time];
[getPosATL _target, GRLIB_side_enemy, 3] spawn spawn_air;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ while { GRLIB_csat_aggressivity > 0.9 && GRLIB_endgame == 0 && GRLIB_global_stop
};

_countplayers = count (AllPlayers - (entities "HeadlessClient_F"));
if (((opforcap + 15) < GRLIB_battlegroup_cap) && (combat_readiness >= 75) && (diag_fps > 30.0) && _countplayers > 1) then {
if (!opforcap_max && combat_readiness >= 75 && diag_fps >= 30.0 && _countplayers > 1) then {
if (count GRLIB_all_fobs > 0) then {
diag_log format ["Spawn FOB BattleGroup at %1", time];
_all_fobs = (allMapMarkers select { _x select [0,9] == "fobmarker" });
Expand Down
7 changes: 6 additions & 1 deletion core.liberation/scripts/server/game/synchronise_vars.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@ while { true } do {
publicVariable "blufor_sectors";
};

opforcap_max = false;
if (opforcap >= GRLIB_opfor_cap) then {
opforcap_max = true;
};

publicVariable "civcap";
publicVariable "unitcap";
publicVariable "opforcap";
publicVariable "opforcap_max";
publicVariable "combat_readiness";
publicVariable "resources_intel";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if ( _liberated_sector in sectors_military ) then {
};
{
_x setVariable ["R3F_LOG_disabled", false, true];
_x setVariable ["GRLIB_vehicle_owner", "", true];
_x setVariable ["GRLIB_vehicle_owner", "", true];
[_x] call F_aceInitVehicle;
} forEach _boxlist;
};
Expand Down Expand Up @@ -86,8 +86,7 @@ private _nearRadioTower = ([markerPos _liberated_sector, GRLIB_side_enemy] call
if ( GRLIB_endgame == 0 && _nearRadioTower ) then {
if (
!(_liberated_sector in sectors_tower) &&
((combat_readiness > 70 && floor random 3 > 0) || (_liberated_sector in sectors_bigtown)) &&
(opforcap < GRLIB_battlegroup_cap)
((combat_readiness > 70 && floor random 3 > 0) || (_liberated_sector in sectors_bigtown))
) then {
sleep (floor random 300);
diag_log format ["Spawn Revenge BattlegGroup at %1", time];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ while { _continue } do {
};
};

if ((time > _last_send || opforcap < 50) && opforcap < GRLIB_opfor_cap ) then {
if ((time > _last_send || opforcap < 50) && !opforcap_max) then {
_last_send = round (time + 300);
_players = (AllPlayers - (entities "HeadlessClient_F")) select { _x distance2D lhd > GRLIB_sector_size && _x distance2D (markerPos GRLIB_respawn_marker) > GRLIB_sector_size};
_target = selectRandom _players;
Expand Down
7 changes: 4 additions & 3 deletions core.liberation/scripts/server/sector/manage_one_sector.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ if (count _squad5 > 0) then {
};

// Create vehicles
if (opforcap >= GRLIB_opfor_cap) then { _vehtospawn = [] };
if (opforcap_max) then { _vehtospawn = [] };
if (count _vehtospawn > 0) then {
{
private _spawn_pos = _sector_pos getPos [2 + (floor random 125), random 360];
Expand All @@ -205,7 +205,7 @@ if (count _vehtospawn > 0) then {
};

// Create garnison
if (opforcap >= GRLIB_opfor_cap) then { _building_ai_max = 0 };
if (opforcap_max) then { _building_ai_max = 0 };
if (_building_ai_max > 0) then {
_building_ai_max = (_building_ai_max * GRLIB_building_ai_ratio);
_managed_units = _managed_units + ([_infsquad1, _building_ai_max, _sector_pos, _building_range] call F_spawnBuildingSquad);
Expand Down Expand Up @@ -268,7 +268,8 @@ if (_nearRadioTower) then {
// Main loop
private _building_alive = count ((nearestObjects [_sector_pos, ["House"], _local_capture_size]) select { alive _x && !([_x, GRLIB_ignore_colisions] call F_itemIsInClass) });
diag_log format ["Sector %1 wait attack to finish", _sector];
sleep 30;

sleep 10;
GRLIB_sector_spawning = false;
publicVariable "GRLIB_sector_spawning";

Expand Down
2 changes: 1 addition & 1 deletion core.liberation/scripts/server/sector/manage_sectors.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ while { GRLIB_endgame == 0 && GRLIB_global_stop == 0 } do {
};

{
if (opforcap < GRLIB_opfor_cap && count active_sectors < GRLIB_max_active_sectors) then {
if (!opforcap_max && count active_sectors < GRLIB_max_active_sectors) then {
_unit = _x;
_nextsector = [GRLIB_sector_size, _unit, (opfor_sectors - active_sectors)] call F_getNearestSector;
if (_nextsector != "") then {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
params [ "_sector", "_infsquad", "_squadies_to_spawn" ];

if (opforcap >= GRLIB_opfor_cap) exitWith {grpNull};
if (opforcap_max) exitWith {grpNull};

diag_log format [ "Spawn regular squad type %1 (%2) at %3", _infsquad, count _squadies_to_spawn, time ];
private _max_try = 20;
Expand Down

0 comments on commit 7eb85df

Please sign in to comment.