Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * KillzoneKid Way - Tankowanie pojazdu
- */
- HVR_fnc_setFuel = {
- params ["_vehicle"];
- if(local _vehicle) then {
- _vehicle setFuel 1;
- } else {
- HVR_PV_setFuel = _vehicle;
- if(isDedicated) then {
- (owner _vehicle) publicVariableClient "HVR_PV_setFuel";
- } else {
- publicVariableServer "HVR_PV_setFuel";
- };
- };
- };
- "HVR_PV_setFuel" addPublicVariableEventHandler {
- (_this select 1) call HVR_fnc_setFuel;
- };
- /*
- * KillzoneKid Way - Naprawianie pojazdu
- */
- HVR_fnc_setDamage = {
- params ["_vehicle"];
- if(local _vehicle) then {
- _vehicle setDamage 0;
- } else {
- HVR_PV_setDamage = _vehicle;
- if(isDedicated) then {
- (owner _vehicle) publicVariableClient "HVR_PV_setDamage";
- } else {
- publicVariableServer "HVR_PV_setDamage";
- };
- };
- };
- "HVR_PV_setDamage" addPublicVariableEventHandler {
- (_this select 1) call HVR_fnc_setDamage;
- };
- /*
- * KillzoneKid Way - Zmiana podwieszenia na pylonie
- */
- HVR_fnc_setPylonLoadout = {
- params ["_vehicle", "_pylonIndex", "_weapon"];
- if(local _vehicle) then {
- hint "OK_LOCAL";
- _vehicle setPylonLoadOut [(_pylonIndex + 1), _weapon];
- } else {
- HVR_PV_setPylonLoadout = [_vehicle, _pylonIndex, _weapon];
- if(isDedicated) then {
- hint str (owner _vehicle);
- (owner _vehicle) publicVariableClient "HVR_PV_setPylonLoadout";
- } else {
- hint "OK_PUBLIC_TO_SERVER";
- publicVariableServer "HVR_PV_setPylonLoadout";
- };
- };
- };
- "HVR_PV_setPylonLoadout" addPublicVariableEventHandler {
- hint "VAR_PUBLISHED";
- (_this select 1) call HVR_fnc_setPylonLoadout;
- };
- /* ***** ***** ***** */
- /* ***** ***** ***** */
- /* ***** ***** ***** */
- /*
- * Sprawdza czy gracz jest w jednej ze stref serwisowania
- */
- HVR_fnc_isPlayerInServiceArea = {
- _playerInArea = false;
- {
- if(player inArea _x) exitWith { _playerInArea = true; };
- } forEach HVR_arr_serviceAreas;
- _playerInArea;
- };
- /*
- * Zwraca strefę serwisowania w której aktualnie znajduje się gracz
- */
- HVR_fnc_getPlayerServiceArea = {
- _serviceArea = 0;
- {
- if(player inArea _x) exitWith { _serviceArea = _x; };
- } forEach HVR_arr_serviceAreas;
- _serviceArea;
- };
- /*
- * Zwraca tablicę z pojazdami które aktualnie są w danej strefie
- */
- HVR_fnc_getVehiclesInArea = {
- params ["_area"];
- _vehiclesInArea = [];
- {
- if(_x inArea _area) then { _vehiclesInArea pushBack _x; };
- } foreach vehicles;
- _vehiclesInArea;
- };
- /*
- * Sprawdza czy w danej strefie są jakieś pojazdy
- */
- HVR_fnc_areVehiclesInArea = {
- params ["_area"];
- _areVehicleInArea = false;
- _numOfVehicles = count (_area call HVR_fnc_getVehiclesInArea);
- if(_numOfVehicles > 0) then { _areVehicleInArea = true; };
- _areVehicleInArea;
- };
- /*
- * Zwraca tablicę z pojazdami, które są w strefie serwisowej, w której jest gracz
- */
- HVR_fnc_getVehiclesInPlayerArea = {
- _vehiclesInArea = ([] call HVR_fnc_getPlayerServiceArea) call HVR_fnc_getVehiclesInArea;
- _vehiclesInArea;
- };
- /*
- * Sprawdza czy gracz może otworzyć panel serwisowania
- */
- HVR_fnc_canOpenVssDialog = {
- _canPlayerOpen = false;
- _isVehicleInPlayerArea = false;
- if(([] call HVR_fnc_isPlayerInServiceArea)) then {
- _area = [] call HVR_fnc_getPlayerServiceArea;
- if((_area call HVR_fnc_areVehiclesInArea)) then {
- _canPlayerOpen = true;
- };
- };
- _canPlayerOpen;
- };
- /* *********************** */
- /* FUNKCJE OBSŁUGUJĄCE GUI */
- /* *********************** */
- /*
- * Ustawia nagłówek Dialogu
- */
- HVR_fnc_guiSetHeading = {
- params ["_string"];
- ctrlSetText [1202, _string];
- ctrlShow [1202, true];
- };
- /*
- * Ustawia tekst na przycisku
- */
- HVR_fnc_guiSetButtonText = {
- params ["_btnIndex","_string"];
- ctrlSetText [1601 + _btnIndex, _string];
- ctrlShow [1601 + _btnIndex, true];
- };
- /*
- * Ustawia akcję na przycisku
- */
- HVR_fnc_guiSetButtonAction = {
- params ["_btnIndex","_string"];
- buttonSetAction [1601 + _btnIndex, _string];
- ctrlShow [1601 + _btnIndex, true];
- };
- /*
- * Ukrywa przycisk
- */
- HVR_fnc_guiHideButton = {
- params ["_btnIndex"];
- ctrlShow [1601 + _btnIndex, false];
- };
- /*
- * Usuwa akcję, tekst z wszystkich przycisków i ukrywa je
- */
- HVR_fnc_guiResetView = {
- "" call HVR_fnc_guiSetHeading;
- for [{_i=0}, {_i<20}, {_i=_i+1}] do
- {
- [_i, ""] call HVR_fnc_guiSetButtonText;
- [_i, ""] call HVR_fnc_guiSetButtonAction;
- _i call HVR_fnc_guiHideButton;
- };
- };
- /*
- * Powraca do widoku bazowego
- */
- fnc_VssViewBackToBase = {
- _vehiclesArray = [] call HVR_fnc_getVehiclesInPlayerArea;
- [] call HVR_fnc_guiResetView;
- [_vehiclesArray] call HVR_fnc_guiBaseView;
- };
- /*
- * Wywołuje akcję naprawy pojazdu
- */
- HVR_fnc_repairVehicle = {
- params ["_netId"];
- [] call HVR_fnc_guiResetView;
- _vehicle = missionNamespace getVariable _netId;
- [2, [_vehicle], "HVR_fnc_setDamage"] call HVR_fnc_afterTime;
- //[_vehicle] call HVR_fnc_setDamage;
- _netId call HVR_fnc_guiVehicle;
- };
- /*
- * Wywołuje akcję tankowania pojazdu
- */
- HVR_fnc_refuelVehicle = {
- params ["_netId"];
- [] call HVR_fnc_guiResetView;
- _vehicle = missionNamespace getVariable _netId;
- [2, [_vehicle], "HVR_fnc_setFuel"] call HVR_fnc_afterTime;
- //[_vehicle] call HVR_fnc_setFuel;
- _netId call HVR_fnc_guiVehicle;
- };
- /*
- * Wywołuje akcję zmiany podwieszenia w pojeździe na wskazabyn pylonie
- */
- HVR_fnc_pylonLoadout = {
- params ["_netId", "_pylonIndex", "_weapon"];
- [] call HVR_fnc_guiResetView;
- _vehicle = missionNamespace getVariable _netId;
- [2, [_vehicle, _pylonIndex, _weapon], "HVR_fnc_setPylonLoadout"] call HVR_fnc_afterTime;
- //[_vehicle, _pylonIndex, _weapon] call HVR_fnc_setPylonLoadout;
- [_netId] call HVR_fnc_guiWeaponLoadout;
- };
- /*
- * Widok ustawiania uzbrojenia na pylonie
- */
- HVR_fnc_guiPylonLoadout = {
- params ["_vehicleNetId", "_pylonIndex"];
- [] call HVR_fnc_guiResetView;
- _compatiblePylonMagazines = (missionNamespace getVariable _vehicleNetId) getCompatiblePylonMagazines (_pylonIndex + 1);
- ("Wybierz jaki rodzaj uzbrojenia chcesz umieścić na podwieszeniu nr " + str (_pylonIndex + 1)) call HVR_fnc_guiSetHeading;
- _btnIndex = 1;
- {
- _magName = getText (configFile >> "CfgMagazines" >> _x >> "DisplayName");
- [_forEachIndex, _magName] call HVR_fnc_guiSetButtonText;
- [_forEachIndex, "[" + (str _vehicleNetId) + ", " + (str _pylonIndex) + ", " + (str _x) + "] call HVR_fnc_pylonLoadout"] call HVR_fnc_guiSetButtonAction;
- _btnIndex = _forEachIndex;
- } forEach _compatiblePylonMagazines;
- [(_btnIndex + 1), "Zdejmij uzbrojenie"] call HVR_fnc_guiSetButtonText;
- [(_btnIndex + 1), "[" + (str _vehicleNetId) + ", " + (str _pylonIndex) + ", """"] call HVR_fnc_pylonLoadout"] call HVR_fnc_guiSetButtonAction;
- [19, "Powrót"] call HVR_fnc_guiSetButtonText;
- [19, "[" + (str _vehicleNetId) + "] call HVR_fnc_guiWeaponLoadout"] call HVR_fnc_guiSetButtonAction;
- };
- /*
- * Widok wyboru pylonu do zmiany uzbrojenia
- */
- HVR_fnc_guiWeaponLoadout = {
- params ["_vehicleNetId"];
- [] call HVR_fnc_guiResetView;
- _vehicle = missionNamespace getVariable _vehicleNetId;
- _vehicleName = getText (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "DisplayName");
- ("Konfiguracja podwieszonego uzbrojenia: " + _vehicleName) call HVR_fnc_guiSetHeading;
- {
- _magName = getText (configFile >> "CfgMagazines" >> _x >> "DisplayName");
- if(_x == "") then { _magName = "Brak uzbrojenia"; };
- [_forEachIndex, _magName] call HVR_fnc_guiSetButtonText;
- [_forEachIndex, "[" + (str _vehicleNetId) + ", " + (str _forEachIndex) + "] call HVR_fnc_guiPylonLoadout"] call HVR_fnc_guiSetButtonAction;
- } forEach (getPylonMagazines _vehicle);
- [19, "Powrót"] call HVR_fnc_guiSetButtonText;
- [19, "[" + (str _vehicleNetId) + "] call HVR_fnc_guiVehicle"] call HVR_fnc_guiSetButtonAction;
- };
- /*
- * Widok pojazdu
- */
- HVR_fnc_guiVehicle = {
- params ["_vehicleNetId"];
- [] call HVR_fnc_guiResetView;
- _vehicle = missionNamespace getVariable _vehicleNetId;
- _vehicleName = getText (configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "DisplayName");
- ("Serwisowanie pojazdu: " + _vehicleName) call HVR_fnc_guiSetHeading;
- private _btnIndex = 0;
- _totalVehicleDamage = 0;
- {
- _totalVehicleDamage = _totalVehicleDamage + _x;
- } forEach ((getAllHitPointsDamage _vehicle) select 2);
- if(_totalVehicleDamage > 0) then {
- _damageLevel = str ( floor ( 100 * (damage _vehicle)));
- [_btnIndex, "Napraw pojazd (" + _damageLevel + "%)"] call HVR_fnc_guiSetButtonText;
- [_btnIndex, "[" + (str _vehicleNetId) + "] call HVR_fnc_repairVehicle"] call HVR_fnc_guiSetButtonAction;
- _btnIndex = _btnIndex + 1;
- // Pojazd uszkodzony - opcja naprawy
- };
- if((fuel _vehicle) < 1) then {
- _fuelLevel = str (floor (100 * (fuel _vehicle)));
- [_btnIndex, "Zatankuj pojazd (" + _fuelLevel + "%)"] call HVR_fnc_guiSetButtonText;
- [_btnIndex, "[" + (str _vehicleNetId) + "] call HVR_fnc_refuelVehicle"] call HVR_fnc_guiSetButtonAction;
- _btnIndex = _btnIndex + 1;
- // Brak paliwa - opcja tankowania
- };
- if(count (getPylonMagazines _vehicle) > 0) then {
- [_btnIndex, "Zarządzaj podwieszeniem"] call HVR_fnc_guiSetButtonText;
- [_btnIndex, "[" + (str _vehicleNetId) + "] call HVR_fnc_guiWeaponLoadout"] call HVR_fnc_guiSetButtonAction;
- _btnIndex = _btnIndex + 1;
- // Pojazd posiada podwieszenia - akcja zarządzania podwieszeniami
- };
- [19, "Powrót"] call HVR_fnc_guiSetButtonText;
- [19, "[] call fnc_VssViewBackToBase"] call HVR_fnc_guiSetButtonAction;
- };
- /*
- * Widok bazowy
- */
- HVR_fnc_guiBaseView = {
- params ["_vehicles"];
- "Wybierz pojazd do serwisowania" call HVR_fnc_guiSetHeading;
- {
- _vehicleName = getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "DisplayName");
- [_forEachIndex, _vehicleName] call HVR_fnc_guiSetButtonText;
- [_forEachIndex, "[" + (str (_x call BIS_fnc_objectVar)) + "] call HVR_fnc_guiVehicle"] call HVR_fnc_guiSetButtonAction;
- } forEach _vehicles;
- };
- /*
- * Otwarcie Dialogu
- */
- HVR_fnc_vssOpenDialog = {
- _vehiclesArray = [] call HVR_fnc_getVehiclesInPlayerArea;
- createDialog "MilTabletController";
- [] call HVR_fnc_guiResetView;
- [_vehiclesArray] call HVR_fnc_guiBaseView;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement