Revert "Revert "Merge branch 'master' of https://github.com/EpochModTeam/DayZ-Epoch""

This reverts commit 109ec5c9a3.
This commit is contained in:
seelenapparat
2021-08-24 15:47:06 +02:00
parent c801365a1f
commit d1abb66e9f
145 changed files with 9200 additions and 627 deletions

View File

@@ -0,0 +1,152 @@
/*
Remote vehicle script by salival (https://github.com/oiad)
*/
if (dayz_actionInProgress) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_actionInProgress = true;
private ["_characterID","_checkDistance","_display","_distance","_fuel","_group","_vehicleFound","_keyID","_keyName","_option","_time","_vehicle","_vehicleType","_index","_control","_keyDisplay","_exit"];
_keyName = _this select 0;
_option = _this select 1;
_checkDistance = true; // Check to see if the player is too far away from the remote
_distance = 300; // Maximum distance the player can be away from the vehicle to be able to use the remote.
disableSerialization;
_exit = {
dayz_actionInProgress = false;
rv_vehicleList = nil;
rv_selected = nil;
};
_display = findDisplay 106;
_display closeDisplay 0;
_keyList = call epoch_tempKeys;
_keyID = 0;
_keyID = (_keyList select 0) select ((_keyList select 2) find _keyName);
_foundPos = (_keyList select 0) find _keyID;
if (_foundPos >= 0) then {
_keyDisplay = (_keyList select 1) select _foundPos;
};
if (_foundPos == -1) exitWith {systemChat localize "STR_CL_RV_NO_KEYS"; call _exit;};
rv_vehicleList = [];
_vehicleFound = false;
{
_vehicleType = typeOf _x;
_characterID = _x getVariable ["CharacterID","0"];
if ((_characterID == _keyID) && {_vehicleType isKindOf "Air" || _vehicleType isKindOf "LandVehicle" || _vehicleType isKindOf "Ship"}) then {
_vehicleFound = true;
rv_vehicleList set [count rv_vehicleList,_x];
};
} count vehicles;
if (count rv_vehicleList > 1) then {
rv_isOk = false;
createDialog "remoteVehicle";
_display = uiNamespace getVariable["rv_dialog", displayNull];
_display displayCtrl 8801 ctrlSetText(format[localize "STR_CL_RV_TITLE",_keyDisplay]);
_control = ((findDisplay 8800) displayCtrl 8802);
lbClear _control;
{
_control lbAdd getText(configFile >> "CfgVehicles" >> typeOf _x >> "displayName");
if (!isNull DZE_myVehicle && {local DZE_myVehicle} && {alive DZE_myVehicle} && {DZE_myVehicle == _x}) then {
_control lbSetColor [(lbSize _control)-1,[0, 1, 0, 1]];
};
} count rv_vehicleList;
_control lbSetCurSel 0;
waitUntil {!dialog};
} else {
rv_selected = rv_vehicleList select 0;
rv_isOk = true;
};
if (!rv_isOk) exitWith {call _exit;};
if (!_vehicleFound) exitWith {systemChat localize "STR_CL_RV_NO_VEHICLES"; call _exit;};
_vehicleType = typeOf rv_selected;
_displayName = getText(configFile >> "CfgVehicles" >> _vehicleType >> "displayName");
if (!alive rv_selected) exitWith {systemChat localize "STR_CL_RV_DESTROYED"; call _exit;};
if (_checkDistance && {(player distance rv_selected) >= _distance}) exitWith {format[localize "STR_CL_RV_RANGE_FAIL",_displayName] call dayz_rollingMessages; call _exit;};
if (_option == 1) then {
_group = units group player;
systemChat format[localize "STR_CL_RV_EJECT",_displayName];
{
if !(_x in _group) then {
_x action ["eject",rv_selected];
systemChat format[localize "STR_CL_RV_EJECT_PLAYER",name _x];
};
} forEach (crew rv_selected);
};
if (_option == 2) then {
systemChat format[localize "STR_CL_RV_ENGINE",if (isEngineOn rv_selected) then {localize "strwfoff"} else {localize "strwfon"},_displayName];
if (isEngineOn rv_selected) then {
if (rv_selected isKindOf "Helicopter") then { // This is needed because dayz_engineSwitch won't turn off the engine for a helicopter.
_fuel = fuel rv_selected;
rv_selected setFuel 0;
player action ["engineOff",rv_selected];
uiSleep 4.5;
rv_selected setFuel _fuel;
} else {
[rv_selected,false] call dayz_engineSwitch;
};
} else {
[rv_selected,true] call dayz_engineSwitch;
};
};
if (_option == 3) then {
systemChat format[localize "STR_BLD_UNLOCKED",_displayName];
PVDZE_veh_Lock = [rv_selected,false];
_time = diag_tickTime;
if (local rv_selected) then {
PVDZE_veh_Lock call local_lockUnlock;
} else {
publicVariable "PVDZE_veh_Lock";
waitUntil {uiSleep 0.1;(!locked rv_selected or (diag_tickTime - _time > 4))};
};
};
if (_option == 4) then {
systemChat format[localize "STR_EPOCH_PLAYER_117",_displayName];
PVDZE_veh_Lock = [rv_selected,true];
_time = diag_tickTime;
if (local rv_selected) then {
PVDZE_veh_Lock call local_lockUnlock;
} else {
publicVariable "PVDZE_veh_Lock";
waitUntil {uiSleep 0.1;(locked rv_selected or (diag_tickTime - _time > 4))};
};
};
if (_option == 5) then {
if !(rv_selected getVariable["vehicleLights",false]) then {
player action ["lightOn", rv_selected];
systemChat format[localize "STR_CL_RV_LIGHTS",localize "strwfon",_vehicleType];
rv_selected setVariable ["vehicleLights",true,true];
} else {
player action ["lightOff", rv_selected];
systemChat format[localize "STR_CL_RV_LIGHTS",localize "strwfoff",_vehicleType];
rv_selected setVariable ["vehicleLights",false,true];
};
};
call _exit;

View File

@@ -0,0 +1,54 @@
private ["_backPackCount","_backPackCount_raw","_backPackSlots","_formattedText","_gearCount","_magazineCount","_magazineCount_raw","_magazineSlots","_name","_picture","_price","_text","_typeOf","_weaponSlots","_weaponsCount","_weaponsCount_raw","_control","_index"];
_gearCount = {
private ["_counter"];
_counter = 0;
{_counter = _counter + _x;} count _this;
_counter
};
_control = (_this select 0) select 0;
_index = (_this select 0) select 1;
rv_selected = rv_vehicleList select _index;
_typeOf = typeOf rv_selected;
_weaponsCount_raw = getWeaponCargo rv_selected;
_magazineCount_raw = getMagazineCargo rv_selected;
_backPackCount_raw = getBackpackCargo rv_selected;
_weaponSlots = getNumber(configFile >> "CfgVehicles" >> _typeOf >> "transportMaxWeapons");
_magazineSlots = getNumber(configFile >> "CfgVehicles" >> _typeOf >> "transportMaxMagazines");
_backPackSlots = getNumber(configFile >> "CfgVehicles" >> _typeOf >> "transportmaxbackpacks");
_name = getText(configFile >> "CfgVehicles" >> _typeOf >> "displayName");
_picture = getText(configFile >> 'CfgVehicles' >> _typeOf >> 'picture');
_weaponsCount = (_weaponsCount_raw select 1) call _gearCount;
_magazineCount = (_magazineCount_raw select 1) call _gearCount;
_backPackCount = (_backPackCount_raw select 1) call _gearCount;
_formattedText = format [
"<img image='%1' size='3' align='center'/><br />" +
"<t color='#33BFFF' size='0.7'>%2: </t><t color='#ffffff' size='0.7'>%3</t><br />" +
"<t color='#33BFFF' size='0.7'>%4: </t><t color='#ffffff' size='0.7'>%5</t><br />" +
"<t color='#33BFFF' size='0.7'>%6: </t><t color='#ffffff' size='0.7'><img image='%7'/> %13/%10 <img image='%8'/> %14/%11 <img image='%9'/> %15/%12</t><br />",
_picture,
localize "STR_EPOCH_NAME",
_name,
localize "STR_EPOCH_CLASS",
_typeOf,
localize "STR_EPOCH_CARGO_SPACE",
"\z\addons\dayz_code\gui\gear\gear_ui_slots_weapons_white.paa",
"\z\addons\dayz_code\gui\gear\gear_ui_slots_items_white.paa",
"\z\addons\dayz_code\gui\gear\gear_ui_slots_backPacks_white.paa",
_weaponSlots,
_magazineSlots,
_backPackSlots,
_weaponsCount,
_magazineCount,
_backPackCount,
_text
];
((findDisplay 8800) displayCtrl 8803) ctrlSetStructuredText parseText _formattedText;
ctrlShow [8803,true];