Factory facility indicators at mapmarkers

This commit is contained in:
Christian 2017-09-29 14:45:47 +02:00
parent e358947eda
commit 1be48d2cae
14 changed files with 100 additions and 75 deletions

View File

@ -106,22 +106,13 @@ while {dialog && (alive player)} do {
((findDisplay 75801) displayCtrl 75807) ctrlSetTextColor _color_negative;
};
switch (_selectedSector select 2) do {
case 1: {
((findDisplay 75801) displayCtrl 75808) ctrlSetTextColor _color_positive;
((findDisplay 75801) displayCtrl 75809) ctrlSetTextColor _color_positive;
((findDisplay 75801) displayCtrl 758010) ctrlSetTextColor _color_positive;
};
default {
if (_selectedSector select 4) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 75808) ctrlSetTextColor _color_actual;
if (_selectedSector select 5) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 75809) ctrlSetTextColor _color_actual;
if (_selectedSector select 6) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 758010) ctrlSetTextColor _color_actual;
_color_actual = _color_neutral;
};
};
if (_selectedSector select 4) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 75808) ctrlSetTextColor _color_actual;
if (_selectedSector select 5) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 75809) ctrlSetTextColor _color_actual;
if (_selectedSector select 6) then {_color_actual = _color_positive;} else {_color_actual = _color_negative;};
((findDisplay 75801) displayCtrl 758010) ctrlSetTextColor _color_actual;
_color_actual = _color_neutral;
_supplyValue = ceil ((_selectedSector select 9) / 100);
_ammoValue = ceil ((_selectedSector select 10) / 100);

View File

@ -57,6 +57,7 @@ if (!KP_liberation_ace) then {[] spawn compileFinal preprocessFileLineNumbers "s
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\spawn\redeploy_manager.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\ui\ui_manager.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\ui\tutorial_manager.sqf";
[] spawn compileFinal preprocessFileLineNumbers "scripts\client\markers\update_production_sites.sqf";
player addMPEventHandler ["MPKilled", {_this spawn kill_manager}];
player addEventHandler ["GetInMan", {[_this select 2] execVM "scripts\client\misc\kp_fuel_consumption.sqf";}];

View File

@ -0,0 +1,22 @@
waitUntil {!isNil "save_is_loaded"};
waitUntil {!isNil "KP_liberation_production_markers"};
private _KP_liberation_production_markers_old = [0];
while {GRLIB_endgame == 0} do {
waitUntil {sleep 5;
!(_KP_liberation_production_markers_old isEqualTo KP_liberation_production_markers)
};
{
private _marker_text = (_x select 4) + " [";
if (_x select 1) then {_marker_text = _marker_text + "S";};
if (_x select 2) then {_marker_text = _marker_text + "A";};
if (_x select 3) then {_marker_text = _marker_text + "F";};
_marker_text = _marker_text + "]";
(_x select 0) setMarkerTextLocal _marker_text;
} forEach KP_liberation_production_markers;
_KP_liberation_production_markers_old = +KP_liberation_production_markers;
};

View File

@ -1,20 +1,14 @@
one_eco_done = false;
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Clientside sync eco starts intitializing on: %1", debug_source];_text remoteExec ["diag_log",2];};
waitUntil {!isNil "sync_eco"};
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Clientside sync eco intitialized for: %1", debug_source];_text remoteExec ["diag_log",2];};
while {true} do {
waitUntil {
sleep 0.2;
count sync_eco > 0;
};
KP_liberation_production = sync_eco select 0;
KP_liberation_logistics = sync_eco select 1;
KP_liberation_production_markers = sync_eco select 2;
sync_eco = [];
one_eco_done = true;
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Clientside eco received at: %1", debug_source];_text remoteExec ["diag_log",2];};
};

View File

@ -1,23 +1,21 @@
waitUntil { time > 1 };
waitUntil { !isNil "GRLIB_all_fobs" };
waitUntil { !isNil "save_is_loaded" };
waitUntil {time > 1};
waitUntil {!isNil "GRLIB_all_fobs"};
waitUntil {!isNil "save_is_loaded"};
private [ "_fobbox" ];
if (count GRLIB_all_fobs == 0) then {
if ( count GRLIB_all_fobs == 0 ) then {
if ( GRLIB_build_first_fob ) then {
if (GRLIB_build_first_fob) then {
_potentialplaces = [];
{
_nextsector = _x;
_acceptsector = true;
{
if ( ( ( markerPos _nextsector ) distance ( markerPos _x ) ) < 800 ) then {
if (((markerPos _nextsector) distance (markerPos _x)) < 800) then {
_acceptsector = false;
};
} foreach sectors_allSectors;
if ( _acceptsector ) then {
if (_acceptsector) then {
_potentialplaces pushBack _nextsector;
};
} foreach sectors_opfor;
@ -28,8 +26,8 @@ if ( count GRLIB_all_fobs == 0 ) then {
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Preplaced FOB placed by: %1", debug_source];_text remoteExec ["diag_log",2];};
} else {
while { count GRLIB_all_fobs == 0 } do {
_fobbox = FOB_box_typename createVehicle (getposATL base_boxspawn);
while {count GRLIB_all_fobs == 0} do {
private _fobbox = FOB_box_typename createVehicle (getposATL base_boxspawn);
_fobbox setposATL (getposATL base_boxspawn);
_fobbox setdir getDir base_boxspawn;
@ -53,16 +51,14 @@ if ( count GRLIB_all_fobs == 0 ) then {
waitUntil {sleep 5; (count GRLIB_all_fobs) > 0};
private ["_crate","_crateArray", "_smoke"];
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] First FOB built at %1. Sending resource package.", (GRLIB_all_fobs select 0)];_text remoteExec ["diag_log",2];};
_crateArray = [];
private _crateArray = [];
uiSleep 10;
for [{_i = 0;}, {_i < 6}, {_i = _i + 1;}] do {
_crate = createVehicle [
private _crate = createVehicle [
(KP_liberation_crates select (_i % 3)),
[((GRLIB_all_fobs select 0) select 0), ((GRLIB_all_fobs select 0) select 1), 150],
[],
@ -73,7 +69,6 @@ if ( count GRLIB_all_fobs == 0 ) then {
clearMagazineCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
_crate addMPEventHandler ['MPKilled', {_this spawn kill_manager}];
_crate setVariable ["KP_liberation_crate_value", 100, true];
[_crate, 500] remoteExec ["F_setMass",_crate];
[objNull, _crate] call BIS_fnc_curatorObjectEdited;
@ -81,7 +76,7 @@ if ( count GRLIB_all_fobs == 0 ) then {
};
uiSleep 25;
{
_smoke = "SmokeShellGreen" createVehicle (getPos _x);
private _smoke = "SmokeShellGreen" createVehicle (getPos _x);
_smoke attachTo [_x];
} forEach _crateArray;

View File

@ -1,3 +1,5 @@
waitUntil {sleep 10; ({_x in sectors_capture || _x in sectors_bigtown} count blufor_sectors) > 0};
if (KP_liberation_civinfo_debug > 0) then {private _text = format ["[KP LIBERATION] [CIVINFO] Loop spawned on: %1", debug_source];_text remoteExec ["diag_log",2];};
while {true} do {
@ -7,12 +9,13 @@ while {true} do {
waitUntil {
sleep 10;
({_x in sectors_capture || _x in sectors_bigtown} count blufor_sectors) > 0 &&
KP_liberation_civ_rep >= 25
};
if (KP_liberation_civinfo_debug > 0) then {private _text = "[KP LIBERATION] [CIVINFO] Informant waitUntil passed";_text remoteExec ["diag_log",2];};
if (KP_liberation_civinfo_chance >= (random 100)) then {
if ((KP_liberation_civinfo_chance >= (random 100)) && GRLIB_endgame == 0) then {
private _sector = selectRandom ([blufor_sectors, {_x in sectors_capture || _x in sectors_bigtown}] call BIS_fnc_conditionalSelect);
private _house = (nearestObjects [[((getMarkerPos _sector select 0) - 100 + (random 200)), ((getMarkerPos _sector select 1) - 100 + (random 200))],["House", "Building"], 100]) select 0;

View File

@ -57,6 +57,7 @@ ai_groups = [];
resources_intel = 0;
GRLIB_player_scores = [];
KP_liberation_civ_rep = 0;
KP_liberation_production_markers = [];
no_kill_handler_classnames = [FOB_typename, huron_typename];
_classnames_to_save = [FOB_typename, huron_typename];
@ -151,6 +152,10 @@ if ( !isNil "greuh_liberation_savegame" ) then {
KP_liberation_civ_rep = greuh_liberation_savegame select 15;
};
if (count greuh_liberation_savegame > 16) then {
KP_liberation_production_markers = greuh_liberation_savegame select 16;
};
setDate [ 2045, 6, 6, time_of_day, 0];
if (KP_liberation_savegame_debug > 0) then {private _text = format ["[KP LIBERATION] [SAVE] Loaded savegame: %1", greuh_liberation_savegame];_text remoteExec ["diag_log",2];};
@ -638,7 +643,7 @@ while { true } do {
greuh_liberation_savegame = [blufor_sectors, GRLIB_all_fobs, buildings_to_save, time_of_day, round combat_readiness, KP_liberation_storages,
KP_liberation_production, KP_liberation_logistics, _stats, [round infantry_weight, round armor_weight, round air_weight], GRLIB_vehicle_to_military_base_links,
GRLIB_permissions, ai_groups, resources_intel, GRLIB_player_scores, KP_liberation_civ_rep];
GRLIB_permissions, ai_groups, resources_intel, GRLIB_player_scores, KP_liberation_civ_rep, KP_liberation_production_markers];
profileNamespace setVariable [GRLIB_save_key, greuh_liberation_savegame];
saveProfileNamespace;

View File

@ -1,27 +1,39 @@
sync_eco = []; publicVariable "sync_eco";
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Serverside sync eco starts intitializing on: %1", debug_source];_text remoteExec ["diag_log",2];};
waitUntil{!isNil "save_is_loaded"};
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Serverside sync eco: save_is_loaded"];_text remoteExec ["diag_log",2];};
waitUntil{!isNil "KP_liberation_production"};
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Serverside sync eco: KP_liberation_production"];_text remoteExec ["diag_log",2];};
waitUntil{!isNil "KP_liberation_logistics"};
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Serverside sync eco: KP_liberation_logistics"];_text remoteExec ["diag_log",2];};
waitUntil{!isNil "KP_liberation_production_markers"};
if (KP_liberation_production_markers isEqualTo []) then {
{
private _facility = selectRandom [[true,false,false], [false,true,false], [false,false,true]];
KP_liberation_production_markers pushBack [_x, _facility select 0, _facility select 1, _facility select 2, markerText _x];
} forEach sectors_factory;
};
_KP_liberation_production_old = [0];
_KP_liberation_logistics_old = [0];
if (KP_liberation_debug) then {private _text = format ["[KP LIBERATION] [DEBUG] Serverside sync eco intitializing finished on: %1", debug_source];_text remoteExec ["diag_log",2];};
while {true} do {
waitUntil {sleep 0.25;
!(_KP_liberation_production_old isEqualTo KP_liberation_production)
|| !(_KP_liberation_logistics_old isEqualTo KP_liberation_logistics)
};
{
private _sector = _x;
{
if ((_sector select 1) == (_x select 0)) exitWith {
_x set [1, (_sector select 4)];
_x set [2, (_sector select 5)];
_x set [3, (_sector select 6)];
};
} forEach KP_liberation_production_markers;
} forEach KP_liberation_production;
sleep 0.25;
sync_eco = [KP_liberation_production,KP_liberation_logistics];
sync_eco = [KP_liberation_production,KP_liberation_logistics,KP_liberation_production_markers];
publicVariable "sync_eco";
_KP_liberation_production_old = +KP_liberation_production;

View File

@ -2,30 +2,31 @@ if (!isServer) exitWith {};
params ["_sector", "_fac","_clientID"];
private ["_tempProduction","_checkFor","_price_s","_price_a","_price_f","_hint"];
_tempProduction = KP_liberation_production;
private _tempProduction = +KP_liberation_production;
private _checkFor = 0;
private _price_s = 100;
private _price_a = 100;
private _price_f = 100;
private _success = false;
switch (_fac) do {
case "supply": {_checkFor = 4;_price_s = 50;_price_a = 100;_price_f = 100;};
case "ammo": {_checkFor = 5;_price_s = 100;_price_a = 50;_price_f = 100;};
case "fuel": {_checkFor = 6;_price_s = 100;_price_a = 100;_price_f = 50;};
case "supply": {_checkFor = 4;_price_s = 50};
case "ammo": {_checkFor = 5;_price_a = 50;};
case "fuel": {_checkFor = 6;_price_f = 50;};
};
{
if ((_x select 1) == (_sector select 1)) then {
if ((_x select 1) == (_sector select 1)) exitWith {
if (((_x select 9) >= _price_s) && ((_x select 10) >= _price_a) && ((_x select 11) >= _price_f)) then {
private ["_storage","_storedCrates","_crateValue"];
_storage = nearestObjects [(markerPos (_x select 1)), [KP_liberation_small_storage_building], GRLIB_fob_range];
private _storage = nearestObjects [(markerPos (_x select 1)), [KP_liberation_small_storage_building], GRLIB_fob_range];
_storage = [_storage, {(_x getVariable ["KP_liberation_storage_type",-1]) == 1}] call BIS_fnc_conditionalSelect;
if ((count _storage) == 0) exitWith {};
_storage = (_storage select 0);
_storedCrates = (attachedObjects _storage);
private _storedCrates = (attachedObjects _storage);
reverse _storedCrates;
{
_crateValue = _x getVariable ["KP_liberation_crate_value",0];
private _crateValue = _x getVariable ["KP_liberation_crate_value",0];
switch ((typeOf _x)) do {
case KP_liberation_supply_crate: {
@ -86,14 +87,17 @@ switch (_fac) do {
} forEach (attachedObjects _storage);
_x set [_checkFor, true];
_hint = format [localize "STR_PRODUCTION_FACBUILD_SUCCESS"];
private _hint = format [localize "STR_PRODUCTION_FACBUILD_SUCCESS"];
_hint remoteExec ["hint",_clientID];
recalculate_sectors = true;
_success = true;
} else {
_hint = format [localize "STR_PRODUCTION_FACBUILD_ERROR",_price_s,_price_a,_price_f];
private _hint = format [localize "STR_PRODUCTION_FACBUILD_ERROR",_price_s,_price_a,_price_f];
_hint remoteExec ["hint",_clientID];
};
};
} forEach _tempProduction;
KP_liberation_production = _tempProduction;
if (_success) then {
KP_liberation_production = +_tempProduction;
recalculate_sectors = true;
};

View File

@ -38,8 +38,8 @@ if (isServer) then {
if (_liberated_sector in sectors_factory) then {
private _sectorType = 1;
private _sectorFacilities = true;
private _producing = 0;
private _sectorFacilities = ([KP_liberation_production_markers, {_liberated_sector == (_x select 0)}] call BIS_fnc_conditionalSelect) select 0;
private _producing = 3;
{
if (_liberated_sector in _x) exitWith {KP_liberation_production = KP_liberation_production - [_x];};
@ -50,9 +50,9 @@ if (isServer) then {
_liberated_sector,
_sectorType,
[],
_sectorFacilities,
_sectorFacilities,
_sectorFacilities,
_sectorFacilities select 1,
_sectorFacilities select 2,
_sectorFacilities select 3,
_producing,
KP_liberation_production_interval,
0,

View File

@ -51,7 +51,6 @@ while {GRLIB_endgame == 0} do {
_crate setVariable ["KP_liberation_crate_value", 100, true];
[_crate, 500] remoteExec ["F_setMass",_crate];
[_crate, _storage] call F_crateToStorage;
};
} else {
_time = _time - 1;

View File

@ -36,7 +36,6 @@ while { _boxes_loaded < _boxes_amount } do {
_next_box setVariable ["KP_liberation_crate_value", 100, true];
[_next_box, 500] remoteExec ["F_setMass",_next_box];
[ _next_box, 50 ] call _load_box_fnc;
_next_box addMPEventHandler ['MPKilled', {_this spawn kill_manager}];
};
sleep 0.5;

View File

@ -1,5 +1,3 @@
params [ "_sector" ];
private [ "_sectorpos", "_stopit", "_spawncivs", "_building_ai_max", "_infsquad", "_building_range", "_local_capture_size", "_iedcount","_combat_readiness_increase","_vehtospawn","_managed_units","_squad1", "_squad2", "_squad3", "_squad4", "_minimum_building_positions", "_popfactor", "_sector_despawn_tickets", "_opforcount" ];

View File

@ -176,6 +176,8 @@ class Missions
* Added: Automatic server restart script for dedicated servers. Thanks to [k4s0](https://github.com/k4s0)
* Added: Settings in the mission parameters for particular debug messages.
* Added: Civil informant can rarely spawn in blufor sectors, when reputation is high enough.
* Added: Factory map markers now indicate which production facilities are available there.
* Added: Asymmetric Threats.
* Removed: Liberation skill handling of AI units, as BI do this good enough now concerning wounds, etc.
* Removed: Vehicle explosion chance script for convoy ambush.
* Tweaked: Terrain aligment will be persistent during repeat building of objects (like walls). Thanks to [veteran29](https://github.com/veteran29)