initial files
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
scriptName "[KPLIB] Enforce Whitelist";
|
||||
|
||||
[] call compileFinal preprocessFileLineNumbers "whitelist.sqf";
|
||||
|
||||
if (!GRLIB_use_whitelist) exitWith {};
|
||||
|
||||
waitUntil {alive player};
|
||||
sleep 1;
|
||||
|
||||
if (player isEqualTo ([] call KPLIB_fnc_getCommander) && !(serverCommandAvailable "#kick")) then {
|
||||
|
||||
private _match = false;
|
||||
|
||||
[] call {
|
||||
if ((getPlayerUID player) in GRLIB_whitelisted_steamids) exitWith {_match = true;};
|
||||
if ((name player) in GRLIB_whitelisted_names) exitWith {_match = true;};
|
||||
if (!((squadParams player) isEqualTo []) && {(((squadParams player) select 0) select 0) in GRLIB_whitelisted_tags}) exitWith {_match = true;};
|
||||
};
|
||||
|
||||
if (!_match) then {
|
||||
sleep 1;
|
||||
endMission "END1";
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,230 @@
|
||||
private ["_dialog", "_logi_count", "_listselect", "_selectedGroup", "_detailControls", "_nearfob", "_logi_destinations", "_mapdisplay", "_tempvariable"];
|
||||
|
||||
_dialog = createDialog "liberation_logistic";
|
||||
_logi_count = 0;
|
||||
_listselect = -1;
|
||||
_selectedGroup = [];
|
||||
_detailControls = [
|
||||
75805,75806,75807,75808,75809,758010,758011,758012,758013,758014,758015,758016,758017,758018,
|
||||
758019,758020,758021,758022,758023,758024,758025,758026,758027,758028,758029,758030,758031,
|
||||
758032,758080,758081
|
||||
];
|
||||
_nearfob = [] call KPLIB_fnc_getNearestFob;
|
||||
_logi_destinations = [];
|
||||
|
||||
{
|
||||
_logi_destinations pushBack [(format ["FOB %1", military_alphabet select _forEachIndex]), (_x select 0), (_x select 1), (_x select 2), (_x select 3)];
|
||||
} forEach KP_liberation_fob_resources;
|
||||
|
||||
{
|
||||
_logi_destinations pushBack [(_x select 0), (markerPos (_x select 1)), (_x select 9), (_x select 10), (_x select 11)];
|
||||
} forEach KP_liberation_production;
|
||||
|
||||
_logi_destinations sort true;
|
||||
|
||||
addLogiGroup = 0;
|
||||
deleteLogiGroup = 0;
|
||||
buyLogiTruck = 0;
|
||||
sellLogiTruck = 0;
|
||||
saveConvoySettings = 0;
|
||||
convoyStandby = 0;
|
||||
logiError = 0;
|
||||
_tempvariable = nil;
|
||||
|
||||
disableSerialization;
|
||||
|
||||
waitUntil {dialog};
|
||||
|
||||
_mapdisplay = ((findDisplay 75802) displayCtrl 758098);
|
||||
|
||||
ctrlMapAnimClear _mapdisplay;
|
||||
|
||||
while {dialog && (alive player)} do {
|
||||
|
||||
"spawn_marker" setMarkerPosLocal markers_reset;
|
||||
|
||||
ctrlEnable [75803, false];
|
||||
ctrlEnable [75804, false];
|
||||
ctrlEnable [758021, false];
|
||||
ctrlEnable [758022, false];
|
||||
ctrlEnable [758024, false];
|
||||
ctrlEnable [758025, false];
|
||||
ctrlEnable [758026, false];
|
||||
ctrlEnable [758027, false];
|
||||
ctrlEnable [758029, false];
|
||||
ctrlEnable [758030, false];
|
||||
ctrlEnable [758031, false];
|
||||
ctrlEnable [758032, false];
|
||||
ctrlEnable [758080, false];
|
||||
ctrlEnable [758081, false];
|
||||
|
||||
if (addLogiGroup == 1) then {
|
||||
addLogiGroup = 0;
|
||||
[_selectedGroup] remoteExec ["add_logiGroup_remote_call",2];
|
||||
waitUntil {sleep 0.5; _logi_count != (count KP_liberation_logistics)};
|
||||
};
|
||||
|
||||
if (deleteLogiGroup == 1) then {
|
||||
deleteLogiGroup = 0;
|
||||
[_selectedGroup] remoteExec ["del_logiGroup_remote_call",2];
|
||||
lbSetCurSel [75802,-1];
|
||||
waitUntil {sleep 0.5; _logi_count != (count KP_liberation_logistics)};
|
||||
};
|
||||
|
||||
if (buyLogiTruck == 1) then {
|
||||
buyLogiTruck = 0;
|
||||
_tempvariable = _selectedGroup select 1;
|
||||
[_listselect, _nearfob, clientOwner, KP_liberation_supplies, KP_liberation_ammo, KP_liberation_fuel] remoteExec ["add_logiTruck_remote_call",2];
|
||||
waitUntil {sleep 0.5; (_tempvariable != ((KP_liberation_logistics select _listselect) select 1)) || (logiError == 1)};
|
||||
};
|
||||
|
||||
if (sellLogiTruck == 1) then {
|
||||
sellLogiTruck = 0;
|
||||
_tempvariable = _selectedGroup select 1;
|
||||
[_listselect, _nearfob, clientOwner] remoteExec ["del_logiTruck_remote_call",2];
|
||||
waitUntil {sleep 0.5; (_tempvariable != ((KP_liberation_logistics select _listselect) select 1)) || (logiError == 1)};
|
||||
};
|
||||
|
||||
if (saveConvoySettings == 1) then {
|
||||
saveConvoySettings = 0;
|
||||
if (((lbCurSel 758024) != -1) && ((lbCurSel 758029) != -1)) then {
|
||||
[_listselect, ((_logi_destinations select lbCurSel 758024) select 1), [parseNumber ctrlText 758025,parseNumber ctrlText 758026,parseNumber ctrlText 758027], ((_logi_destinations select lbCurSel 758029) select 1), [parseNumber ctrlText 758030,parseNumber ctrlText 758031,parseNumber ctrlText 758032], clientOwner] remoteExec ["save_logi_remote_call",2];
|
||||
waitUntil {sleep 0.5; (!(_selectedGroup isEqualTo (KP_liberation_logistics select _listselect))) || (logiError == 1)};
|
||||
} else {
|
||||
hint localize "STR_LOGISTIC_SAVE_ERROR";
|
||||
};
|
||||
};
|
||||
|
||||
if (convoyStandby == 1) then {
|
||||
convoyStandby = 0;
|
||||
[_listselect, clientOwner] remoteExec ["abort_logi_remote_call",2];
|
||||
waitUntil {sleep 0.5; (!(_selectedGroup isEqualTo (KP_liberation_logistics select _listselect))) || (logiError == 1)};
|
||||
};
|
||||
|
||||
logiError = 0;
|
||||
_tempvariable = nil;
|
||||
ctrlEnable [75803, true];
|
||||
|
||||
if (_logi_count != (count KP_liberation_logistics)) then {
|
||||
_logi_count = (count KP_liberation_logistics);
|
||||
lbClear 75802;
|
||||
{
|
||||
lbAdd [75802, (_x select 0)];
|
||||
} forEach KP_liberation_logistics;
|
||||
};
|
||||
|
||||
if ((_logi_count > 0) && (lbCurSel 75802 == -1)) then {
|
||||
lbSetCurSel [75802,0];
|
||||
};
|
||||
|
||||
_listselect = (lbCurSel 75802);
|
||||
|
||||
if ((_listselect != -1) && (_logi_count > 0)) then {
|
||||
{ctrlShow [_x, true]} forEach _detailControls;
|
||||
|
||||
_selectedGroup = +(KP_liberation_logistics select _listselect);
|
||||
|
||||
if ((_selectedGroup select 7) == 0) then {
|
||||
ctrlEnable [758021, true];
|
||||
|
||||
if ((_selectedGroup select 1) <= 0) then {
|
||||
ctrlEnable [75804, true];
|
||||
} else {
|
||||
ctrlEnable [758022, true];
|
||||
ctrlEnable [758024, true];
|
||||
ctrlEnable [758025, true];
|
||||
ctrlEnable [758026, true];
|
||||
ctrlEnable [758027, true];
|
||||
ctrlEnable [758029, true];
|
||||
ctrlEnable [758030, true];
|
||||
ctrlEnable [758031, true];
|
||||
ctrlEnable [758032, true];
|
||||
ctrlEnable [758080, true];
|
||||
};
|
||||
};
|
||||
|
||||
ctrlSetText [75805, (_selectedGroup select 0)];
|
||||
|
||||
switch ((_selectedGroup select 7)) do {
|
||||
case 0: {ctrlSetText[758011, "-"]; ctrlSetText[75807, localize "STR_LOGISTIC_STANDBY"];};
|
||||
case 1: {ctrlSetText[758011, "B"]; ctrlSetText[75807, localize "STR_LOGISTIC_LOADING"]; ctrlEnable [758081, true]; "spawn_marker" setMarkerPosLocal (_selectedGroup select 2); _mapdisplay ctrlMapAnimAdd [0.5, 0.2,(_selectedGroup select 2)]; ctrlMapAnimCommit _mapdisplay;};
|
||||
case 2: {ctrlSetText[758011, "B"]; ctrlSetText[75807, localize "STR_LOGISTIC_TRAVEL"]; ctrlEnable [758081, true];};
|
||||
case 3: {ctrlSetText[758011, "A"]; ctrlSetText[75807, localize "STR_LOGISTIC_LOADING"]; ctrlEnable [758081, true]; "spawn_marker" setMarkerPosLocal (_selectedGroup select 3); _mapdisplay ctrlMapAnimAdd [0.5, 0.2,(_selectedGroup select 3)]; ctrlMapAnimCommit _mapdisplay;};
|
||||
case 4: {ctrlSetText[758011, "A"]; ctrlSetText[75807, localize "STR_LOGISTIC_TRAVEL"]; ctrlEnable [758081, true];};
|
||||
case 5: {ctrlSetText[758011, "A"]; ctrlSetText[75807, localize "STR_LOGISTIC_ABORT"];};
|
||||
case 6: {ctrlSetText[758011, "B"]; ctrlSetText[75807, localize "STR_LOGISTIC_ABORT"];};
|
||||
};
|
||||
|
||||
((findDisplay 75802) displayCtrl 75809) ctrlSetTextColor [1,1,1,1];
|
||||
if ((_selectedGroup select 8) != -1) then {
|
||||
switch (_selectedGroup select 9) do {
|
||||
case 2: {((findDisplay 75802) displayCtrl 75809) ctrlSetTextColor [0.9,0,0,1]; ctrlSetText[75809, localize "STR_LOGISTIC_NOSPACE"];};
|
||||
case 3: {((findDisplay 75802) displayCtrl 75809) ctrlSetTextColor [0.9,0,0,1]; ctrlSetText[75809, localize "STR_LOGISTIC_NORESSOURCES"];};
|
||||
default {ctrlSetText[75809,(format [localize "STR_PRODUCTION_MINUTES",(_selectedGroup select 8)])];};
|
||||
};
|
||||
} else {
|
||||
ctrlSetText[75809, "-"];
|
||||
};
|
||||
|
||||
ctrlSetText [758014, (str (_selectedGroup select 1))];
|
||||
ctrlSetText [758016, (str ((_selectedGroup select 6) select 0))];
|
||||
ctrlSetText [758018, (str ((_selectedGroup select 6) select 1))];
|
||||
ctrlSetText [758020, (str ((_selectedGroup select 6) select 2))];
|
||||
|
||||
lbClear 758024;
|
||||
lbClear 758029;
|
||||
{
|
||||
lbAdd [758024, format ["%1 (%2/%3/%4)",(_x select 0), (_x select 2), (_x select 3), (_x select 4)]];
|
||||
lbAdd [758029, format ["%1 (%2/%3/%4)",(_x select 0), (_x select 2), (_x select 3), (_x select 4)]];
|
||||
} forEach _logi_destinations;
|
||||
|
||||
if (!((_selectedGroup select 2) isEqualTo [0,0,0])) then {
|
||||
ctrlShow [758024,false];
|
||||
ctrlShow [758033,true];
|
||||
{
|
||||
// Why the hell does "if ((_selectedGroup select 2) isEqualTo (_x select 1)) ..." return false? -.-
|
||||
if (((_selectedGroup select 2) distance2D (_x select 1) < 10)) exitWith {ctrlSetText [758033, _x select 0];};
|
||||
} forEach _logi_destinations;
|
||||
} else {
|
||||
ctrlShow [758024,true];
|
||||
ctrlShow [758033,false];
|
||||
};
|
||||
|
||||
if (!((_selectedGroup select 3) isEqualTo [0,0,0])) then {
|
||||
ctrlShow [758029,false];
|
||||
ctrlShow [758034,true];
|
||||
{
|
||||
if (((_selectedGroup select 3) distance2D (_x select 1) < 10)) exitWith {ctrlSetText [758034, _x select 0];};
|
||||
} forEach _logi_destinations;
|
||||
} else {
|
||||
ctrlShow [758029,true];
|
||||
ctrlShow [758034,false];
|
||||
};
|
||||
|
||||
ctrlSetText [758025, (str ((_selectedGroup select 4) select 0))];
|
||||
ctrlSetText [758026, (str ((_selectedGroup select 4) select 1))];
|
||||
ctrlSetText [758027, (str ((_selectedGroup select 4) select 2))];
|
||||
|
||||
ctrlSetText [758030, (str ((_selectedGroup select 5) select 0))];
|
||||
ctrlSetText [758031, (str ((_selectedGroup select 5) select 1))];
|
||||
ctrlSetText [758032, (str ((_selectedGroup select 5) select 2))];
|
||||
|
||||
} else {
|
||||
{ctrlShow [_x, false]} forEach _detailControls;
|
||||
_selectedGroup = [];
|
||||
};
|
||||
|
||||
waitUntil {
|
||||
!dialog
|
||||
|| !(alive player)
|
||||
|| (lbCurSel 75802) != _listselect
|
||||
|| addLogiGroup != 0
|
||||
|| deleteLogiGroup != 0
|
||||
|| buyLogiTruck != 0
|
||||
|| sellLogiTruck != 0
|
||||
|| saveConvoySettings != 0
|
||||
|| convoyStandby != 0
|
||||
};
|
||||
};
|
||||
|
||||
"spawn_marker" setMarkerPosLocal markers_reset;
|
||||
@@ -0,0 +1,202 @@
|
||||
waitUntil {!isNil "GRLIB_permissions"};
|
||||
|
||||
private _players_array = [];
|
||||
private _uids_array = ["Default"];
|
||||
private _dialog = createDialog "liberation_permissions";
|
||||
permission_playerid = -1;
|
||||
permission_toset = -1;
|
||||
save_changes = 0;
|
||||
|
||||
color_authorized = [0,0.9,0,1];
|
||||
color_denied = [0.9,0,0,1];
|
||||
fontsize = 0.017 * safezoneH;
|
||||
|
||||
private _modify_permissions = +GRLIB_permissions;
|
||||
|
||||
disableSerialization;
|
||||
|
||||
waitUntil { dialog };
|
||||
|
||||
|
||||
permission_create_activetext = compileFinal '
|
||||
|
||||
params ["_idx", "_column", "_permission", "_text", "_tooltip"];
|
||||
|
||||
private _control = (findDisplay 5118) ctrlCreate ["RscActiveText", ((10 * _idx) + 111) + _column, (findDisplay 5118) displayCtrl 9969];
|
||||
_control ctrlSetPosition [0.072 * _column * safeZoneW, (_idx * 0.025) * safezoneH, 0.072 * safeZoneW, 0.025 * safezoneH];
|
||||
_control ctrlSetText _text;
|
||||
_control ctrlSetFontHeight fontsize;
|
||||
_control ctrlSetTooltip _tooltip;
|
||||
buttonSetAction [((10 * _idx) + 111) + _column, format ["permission_playerid = %1; permission_toset = %2;", _idx, _permission]];
|
||||
_control ctrlSetTextColor color_denied;
|
||||
_control ctrlSetActiveColor color_denied;
|
||||
_control ctrlCommit 0;
|
||||
|
||||
';
|
||||
|
||||
|
||||
|
||||
_players_array pushback ["Default", localize "STR_DEFAULT", 0];
|
||||
private _idx = 2;
|
||||
|
||||
{
|
||||
if (!((name _x) in ["HC1", "HC2", "HC3"])) then {
|
||||
private _nextplayer = _x;
|
||||
|
||||
private _displayname = "";
|
||||
if(count (squadParams _nextplayer) != 0) then {
|
||||
_displayname = "[" + ((squadParams _nextplayer select 0) select 0) + "] ";
|
||||
};
|
||||
_displayname = _displayname + name _nextplayer;
|
||||
|
||||
_players_array pushback [getPlayerUID _nextplayer, _displayname, _idx];
|
||||
_uids_array pushBack getPlayerUID _nextplayer;
|
||||
|
||||
_idx = _idx + 1;
|
||||
};
|
||||
} foreach allPlayers;
|
||||
|
||||
_idx = _idx + 1;
|
||||
|
||||
{
|
||||
if !((_x select 0) in _uids_array) then {
|
||||
_players_array pushBack [_x select 0, _x select 1, _idx];
|
||||
_idx = _idx + 1;
|
||||
}
|
||||
} forEach _modify_permissions;
|
||||
|
||||
{
|
||||
private _nextplayer = _x;
|
||||
private _idx = _nextplayer select 2;
|
||||
|
||||
if (_idx % 2 == 0) then {
|
||||
|
||||
private _control = (findDisplay 5118) ctrlCreate ["RscBackground", -1, (findDisplay 5118) displayCtrl 9969];
|
||||
_control ctrlSetPosition [0, (_idx * 0.025) * safezoneH, 0.595 * safeZoneW, 0.025 * safezoneH];
|
||||
_control ctrlSetBackgroundColor [0.75,1,0.75,0.12];
|
||||
_control ctrlCommit 0;
|
||||
};
|
||||
|
||||
private _control = (findDisplay 5118) ctrlCreate ["RscText", (10 * _idx), (findDisplay 5118) displayCtrl 9969];
|
||||
_control ctrlSetPosition [0, (_idx * 0.025) * safezoneH, 0.072 * safeZoneW, 0.025 * safezoneH];
|
||||
_control ctrlSetText (_nextplayer select 1);
|
||||
_control ctrlSetFontHeight fontsize;
|
||||
_control ctrlCommit 0;
|
||||
|
||||
[_idx, 1, 0, localize "STR_PERMISSIONS_LIGHT", localize "STR_PERMISSIONS_TOOLTIP_LIGHT"] call permission_create_activetext;
|
||||
[_idx, 2, 1, localize "STR_PERMISSIONS_ARMORED", localize "STR_PERMISSIONS_TOOLTIP_ARMORED"] call permission_create_activetext;
|
||||
[_idx, 3, 2, localize "STR_PERMISSIONS_AIR", localize "STR_PERMISSIONS_TOOLTIP_AIR"] call permission_create_activetext;
|
||||
[_idx, 4, 3, localize "STR_PERMISSIONS_CONSTRUCTION", localize "STR_PERMISSIONS_TOOLTIP_CONSTRUCTION"] call permission_create_activetext;
|
||||
[_idx, 5, 4, localize "STR_PERMISSIONS_RECYCLING", localize "STR_PERMISSIONS_TOOLTIP_RECYCLING"] call permission_create_activetext;
|
||||
[_idx, 6, 5, localize "STR_PERMISSIONS_MISC", localize "STR_PERMISSIONS_TOOLTIP_MISC"] call permission_create_activetext;
|
||||
|
||||
_control = (findDisplay 5118) ctrlCreate ["RscButton", ((10 * _idx) + 111) + 7, (findDisplay 5118) displayCtrl 9969];
|
||||
_control ctrlSetPosition [((0.075 * 7) - 0.02) * safeZoneW, ((_idx * 0.025) * safezoneH) + 0.0025, (0.035 * safeZoneW), 0.022 * safezoneH];
|
||||
_control ctrlSetText (localize "STR_PERMISSIONS_ALL");
|
||||
_control ctrlSetFontHeight fontsize;
|
||||
_control ctrlSetTooltip (localize "STR_PERMISSIONS_TOOLTIP_ALL");
|
||||
buttonSetAction [ ((10 * _idx) + 111) + 7, format ["permission_playerid = %1; permission_toset = 666;", _idx]];
|
||||
_control ctrlCommit 0;
|
||||
|
||||
_control = (findDisplay 5118) ctrlCreate ["RscButton", ((10 * _idx) + 111) + 8, (findDisplay 5118) displayCtrl 9969];
|
||||
_control ctrlSetPosition [((0.075 * 7) + 0.02) * safeZoneW, (_idx * 0.025) * safezoneH + 0.0025, 0.035 * safeZoneW, 0.022 * safezoneH];
|
||||
_control ctrlSetText (localize "STR_PERMISSIONS_NONE");
|
||||
_control ctrlSetFontHeight fontsize;
|
||||
_control ctrlSetTooltip (localize "STR_PERMISSIONS_TOOLTIP_NONE");
|
||||
buttonSetAction [((10 * _idx) + 111) + 8, format ["permission_playerid = %1; permission_toset = 999;", _idx]];
|
||||
_control ctrlCommit 0;
|
||||
|
||||
} foreach _players_array;
|
||||
|
||||
while {dialog && alive player} do {
|
||||
|
||||
if (permission_playerid != -1 || permission_toset != -1) then {
|
||||
|
||||
private _player_uid = "";
|
||||
private _player_name = "";
|
||||
{
|
||||
if (_x select 2 == permission_playerid) exitWith {_player_uid = _x select 0; _player_name = _x select 1;};
|
||||
} foreach _players_array;
|
||||
|
||||
if (_player_uid != "") then {
|
||||
|
||||
private _player_idx = -1;
|
||||
private _player_uids = [];
|
||||
private _player_permissions = [];
|
||||
{
|
||||
_player_uids pushback (_x select 0);
|
||||
} foreach _modify_permissions;
|
||||
|
||||
_player_idx = _player_uids find _player_uid;
|
||||
|
||||
if (permission_toset == 666) then {
|
||||
_player_permissions = [true, true, true, true, true, true];
|
||||
};
|
||||
if (permission_toset == 999) then {
|
||||
_player_permissions = [false, false, false, false, false, false];
|
||||
};
|
||||
|
||||
if (_player_idx == -1) then {
|
||||
|
||||
if (permission_toset != 666 && permission_toset != 999) then {
|
||||
_player_permissions = [false, false, false, false, false, false];
|
||||
_player_permissions set [permission_toset, true];
|
||||
};
|
||||
|
||||
_modify_permissions pushback [_player_uid, _player_name, _player_permissions];
|
||||
} else {
|
||||
|
||||
if (permission_toset != 666 && permission_toset != 999) then {
|
||||
|
||||
_player_permissions = (_modify_permissions select _player_idx) select 2;
|
||||
|
||||
private _idx = 0;
|
||||
{
|
||||
if (permission_toset == _idx) exitWith {
|
||||
if (_player_permissions select _idx) then {
|
||||
_player_permissions set [_idx, false];
|
||||
} else {
|
||||
_player_permissions set [_idx, true];
|
||||
};
|
||||
};
|
||||
_idx = _idx + 1;
|
||||
} foreach _player_permissions;
|
||||
};
|
||||
_modify_permissions set [_player_idx, [_player_uid, _player_name, _player_permissions]];
|
||||
};
|
||||
};
|
||||
|
||||
permission_playerid = -1;
|
||||
permission_toset = -1;
|
||||
};
|
||||
|
||||
{
|
||||
private _nextplayer = _x;
|
||||
{
|
||||
if (_nextplayer select 0 == _x select 0) exitWith {
|
||||
private _idx = _nextplayer select 2;
|
||||
private _player_permissions = _x select 2;
|
||||
|
||||
{
|
||||
private _control = ((findDisplay 5118) displayCtrl ((10 * _idx) + _x + 111));
|
||||
if (_player_permissions select (_x - 1)) then {
|
||||
_control ctrlSetTextColor color_authorized;
|
||||
_control ctrlSetActiveColor color_authorized;
|
||||
} else {
|
||||
_control ctrlSetTextColor color_denied;
|
||||
_control ctrlSetActiveColor color_denied;
|
||||
};
|
||||
} foreach [1, 2, 3, 4, 5, 6];
|
||||
};
|
||||
} foreach _modify_permissions;
|
||||
|
||||
} foreach _players_array;
|
||||
|
||||
if (save_changes == 1) then {
|
||||
GRLIB_permissions = +_modify_permissions;
|
||||
publicVariable "GRLIB_permissions";
|
||||
closeDialog 0;
|
||||
};
|
||||
|
||||
waitUntil {!dialog || !(alive player) || permission_playerid != -1 || permission_toset != -1 || save_changes != 0};
|
||||
};
|
||||
@@ -0,0 +1,136 @@
|
||||
private ["_dialog", "_color_positive", "_color_neutral", "_color_negative", "_color_actual", "_sectorType", "_storage", "_crateCount", "_crateMax", "_producing", "_storagespace", "_productiontime", "_saveChanges", "_listselect", "_listcolor", "_selectedSector", "_mapdisplay", "_supplyValue", "_ammoValue", "_fuelValue"];
|
||||
|
||||
_dialog = createDialog "liberation_production";
|
||||
saveSectorSetting = 0;
|
||||
new_production = 0;
|
||||
_color_positive = [0,0.9,0,1];
|
||||
_color_neutral = [1,1,1,1];
|
||||
_color_negative = [0.9,0,0,1];
|
||||
_color_actual = _color_neutral;
|
||||
_listselect = -1;
|
||||
_listcolor = [1,1,1,1];
|
||||
_selectedSector = [];
|
||||
|
||||
disableSerialization;
|
||||
|
||||
waitUntil {dialog};
|
||||
|
||||
_mapdisplay = ((findDisplay 75801) displayCtrl 758016);
|
||||
|
||||
lbClear 75802;
|
||||
{
|
||||
lbAdd [75802, (markerText (_x select 1))];
|
||||
} forEach KP_liberation_production;
|
||||
|
||||
ctrlMapAnimClear _mapdisplay;
|
||||
|
||||
while {dialog && (alive player)} do {
|
||||
if (lbCurSel 75802 == -1) then {
|
||||
lbSetCurSel [75802,0];
|
||||
};
|
||||
|
||||
if (saveSectorSetting == 1) then {
|
||||
saveSectorSetting = 0;
|
||||
[(_selectedSector select 1), new_production] remoteExec ["change_prod_remote_call",2];
|
||||
waitUntil {sleep 0.5; (!(_selectedSector isEqualTo (KP_liberation_production select _listselect)))};
|
||||
};
|
||||
|
||||
_listselect = -1;
|
||||
|
||||
{
|
||||
_listselect = _listselect + 1;
|
||||
|
||||
if ((count (_x select 3)) > 0) then {
|
||||
switch (_x select 7) do {
|
||||
case 1: {_listcolor = [0.75,0,0,1];};
|
||||
case 2: {_listcolor = [0.75,0.75,0,1];};
|
||||
case 3: {_listcolor = [1,1,1,1];};
|
||||
default {_listcolor = [0,0.75,0,1];};
|
||||
};
|
||||
} else {
|
||||
_listcolor = [0.6,0.6,0.6,0.8];
|
||||
};
|
||||
|
||||
lbSetColor [75802, _listselect, _listcolor];
|
||||
} forEach KP_liberation_production;
|
||||
|
||||
_listselect = (lbCurSel 75802);
|
||||
waitUntil {_listselect == (lbCurSel 75802)};
|
||||
_selectedSector = +(KP_liberation_production select _listselect);
|
||||
|
||||
ctrlSetText [75803,(_selectedSector select 0)];
|
||||
|
||||
if ((_selectedSector select 2) == 1) then {_sectorType = localize "STR_PRODUCTION_FACTORY";} else {_sectorType = localize "STR_PRODUCTION_CITY";};
|
||||
ctrlSetText [75804, _sectorType];
|
||||
|
||||
if ((count (_selectedSector select 3)) > 0) then {
|
||||
_storage = ((nearestObjects [((_selectedSector select 3) select 0), [KP_liberation_small_storage_building], 25]) select 0);
|
||||
_crateCount = count (attachedObjects _storage);
|
||||
_crateMax = count (KP_liberation_small_storage_positions);
|
||||
|
||||
if (_crateCount >= _crateMax) then {
|
||||
_color_actual = _color_negative;
|
||||
};
|
||||
|
||||
_storagespace = format ["%1 / %2",_crateCount,_crateMax];
|
||||
_productiontime = format [localize "STR_PRODUCTION_MINUTES",(_selectedSector select 8)];
|
||||
|
||||
switch (_selectedSector select 7) do {
|
||||
case 1: {_producing = localize "STR_AMMO";};
|
||||
case 2: {_producing = localize "STR_FUEL";};
|
||||
case 3: {_producing = localize "STR_PRODUCTION_NOTHING"; _productiontime = localize "STR_PRODUCTION_NOTIMER";};
|
||||
default {_producing = localize "STR_MANPOWER";};
|
||||
};
|
||||
|
||||
ctrlSetText [75805, _producing];
|
||||
if ((_selectedSector select 7) == 3) then {
|
||||
((findDisplay 75801) displayCtrl 75805) ctrlSetTextColor _color_negative;
|
||||
((findDisplay 75801) displayCtrl 75807) ctrlSetTextColor _color_negative;
|
||||
} else {
|
||||
((findDisplay 75801) displayCtrl 75805) ctrlSetTextColor _color_neutral;
|
||||
((findDisplay 75801) displayCtrl 75807) ctrlSetTextColor _color_neutral;
|
||||
};
|
||||
ctrlSetText [75806, _storagespace];
|
||||
((findDisplay 75801) displayCtrl 75806) ctrlSetTextColor _color_actual;
|
||||
ctrlSetText [75807, _productiontime];
|
||||
_color_actual = _color_neutral;
|
||||
} else {
|
||||
_producing = localize "STR_PRODUCTION_NOTHING";
|
||||
_storagespace = localize "STR_PRODUCTION_NOSTORAGE";
|
||||
_productiontime = localize "STR_PRODUCTION_NOTIMER";
|
||||
ctrlSetText [75805, _producing];
|
||||
((findDisplay 75801) displayCtrl 75805) ctrlSetTextColor _color_negative;
|
||||
ctrlSetText [75806, _storagespace];
|
||||
((findDisplay 75801) displayCtrl 75806) ctrlSetTextColor _color_negative;
|
||||
ctrlSetText [75807, _productiontime];
|
||||
((findDisplay 75801) displayCtrl 75807) ctrlSetTextColor _color_negative;
|
||||
};
|
||||
|
||||
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);
|
||||
_fuelValue = ceil ((_selectedSector select 11) / 100);
|
||||
|
||||
if (_supplyValue == 1) then {_supplyValue = format [localize "STR_PRODUCTION_CRATE", _supplyValue];} else {_supplyValue = format [localize "STR_PRODUCTION_CRATES", _supplyValue];};
|
||||
if (_ammoValue == 1) then {_ammoValue = format [localize "STR_PRODUCTION_CRATE", _ammoValue];} else {_ammoValue = format [localize "STR_PRODUCTION_CRATES", _ammoValue];};
|
||||
if (_fuelValue == 1) then {_fuelValue = format [localize "STR_PRODUCTION_CRATE", _fuelValue];} else {_fuelValue = format [localize "STR_PRODUCTION_CRATES", _fuelValue];};
|
||||
|
||||
ctrlSetText [758011, (str (_selectedSector select 9)) + " (" + _supplyValue + ")"];
|
||||
ctrlSetText [758012, (str (_selectedSector select 10)) + " (" + _ammoValue + ")"];
|
||||
ctrlSetText [758013, (str (_selectedSector select 11)) + " (" + _fuelValue + ")"];
|
||||
|
||||
"spawn_marker" setMarkerPosLocal (markerPos (_selectedSector select 1));
|
||||
_mapdisplay ctrlMapAnimAdd [0.5, 0.2,(markerPos (_selectedSector select 1))];
|
||||
ctrlMapAnimCommit _mapdisplay;
|
||||
|
||||
waitUntil {!dialog || !(alive player) || (lbCurSel 75802) != _listselect || saveSectorSetting != 0};
|
||||
};
|
||||
|
||||
"spawn_marker" setMarkerPosLocal markers_reset;
|
||||
Reference in New Issue
Block a user