Custom Textures compatibility

This commit is contained in:
He-Man 2019-04-06 22:16:01 +02:00
parent 451d40b8bb
commit 981d1e6e8e
7 changed files with 62 additions and 27 deletions

View File

@ -68,6 +68,8 @@ forceRestartTime = 14400; // 4 hour restarts
"" // "NVG_EPOCH" or "radiation_mask_epoch" "" // "NVG_EPOCH" or "radiation_mask_epoch"
}; };
UseCustomTextures = "false"; // if true, Vehicles and Building parts textures will be saved and loaded to the DB (Paintshop)
// vehicles - Max vehicle slots is calculated from per vehicle limits below. Warning! Higher the number lower the performance. // vehicles - Max vehicle slots is calculated from per vehicle limits below. Warning! Higher the number lower the performance.
immuneIfStartInBase = "true"; // Protect vehicles from damage in bases until first unlocked after restart immuneIfStartInBase = "true"; // Protect vehicles from damage in bases until first unlocked after restart
ReservedVehSlots = 50; // Reserved Vehicle Slots (only needed, if you manually spawn in additional Vehicles - AdminTool / Blackmarket...) ReservedVehSlots = 50; // Reserved Vehicle Slots (only needed, if you manually spawn in additional Vehicles - AdminTool / Blackmarket...)

View File

@ -13,16 +13,20 @@
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_interact.sqf https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_interact.sqf
*/ */
//[[[cog import generate_private_arrays ]]] //[[[cog import generate_private_arrays ]]]
private ["_storSlot","_vehSlot"]; private ["_storSlot","_vehSlot","_buildSlot"];
//[[[end]]] //[[[end]]]
0 call EPOCH_refeshUI; 0 call EPOCH_refeshUI;
if (!isNull _this) then { if (!isNull _this) then {
_vehSlot = _this getVariable ["VEHICLE_SLOT", "ABORT"]; _vehSlot = _this getVariable ["VEHICLE_SLOT", "ABORT"];
if (_vehSlot != "ABORT") then { if !(_vehSlot isEqualTo "ABORT") then {
EPOCH_arr_interactedObjs pushBackUnique _this; EPOCH_arr_interactedObjs pushBackUnique _this;
}; };
_storSlot = _this getVariable["STORAGE_SLOT", "ABORT"]; _storSlot = _this getVariable["STORAGE_SLOT", "ABORT"];
if (_storSlot != "ABORT") then { if !(_storSlot isEqualTo "ABORT") then {
EPOCH_arr_interactedObjs pushBackUnique _this;
};
_buildSlot = _this getVariable["BUILD_SLOT", "ABORT"];
if !(_buildSlot isEqualTo "ABORT") then {
EPOCH_arr_interactedObjs pushBackUnique _this; EPOCH_arr_interactedObjs pushBackUnique _this;
}; };
}; };

View File

@ -28,7 +28,13 @@ if !(isNull _this) then {
{ {
_animPhases pushBack (_this animationPhase _x) _animPhases pushBack (_this animationPhase _x)
} foreach (getArray(_cfgBaseBuilding >> _class >> "persistAnimations")); } foreach (getArray(_cfgBaseBuilding >> _class >> "persistAnimations"));
_VAL = [_class, _worldspace, _this getVariable["EPOCH_secureStorage", "-1"], _this getVariable["BUILD_OWNER", "-1"], _this getVariable["TEXTURE_SLOT", 0], _animPhases];
_Textures = [];
if (missionnamespace getvariable ["UseCustomTextures",false]) then {
_Textures = getObjectTextures _this;
};
_VAL = [_class, _worldspace, _this getVariable["EPOCH_secureStorage", "-1"], _this getVariable["BUILD_OWNER", "-1"], _this getVariable["TEXTURE_SLOT", 0], _animPhases, _Textures];
["Building", _objHiveKey, EPOCH_expiresBuilding, _VAL] call EPOCH_fnc_server_hiveSETEX; ["Building", _objHiveKey, EPOCH_expiresBuilding, _VAL] call EPOCH_fnc_server_hiveSETEX;
_return = true; _return = true;
}; };

View File

@ -181,12 +181,20 @@ for "_i" from 0 to _this do {
}; };
_baseObj setVariable ["BUILD_SLOT", _i, true]; _baseObj setVariable ["BUILD_SLOT", _i, true];
if (_textureSlot != 0) then { if (_arrCount >= 7 && (missionnamespace getvariable ["UseCustomTextures",false])) then {
// get texture path from index _Textures = _arr select 6;
_color = getArray (_cfgBaseBuilding >> _class >> "availableTextures"); {
if !(_color isEqualTo []) then { _baseObj setobjecttextureglobal [_foreachindex,_x];
_baseObj setObjectTextureGlobal [0, (_color select _textureSlot)]; } foreach _Textures;
_baseObj setVariable ["TEXTURE_SLOT", _textureSlot, true]; }
else {
if (_textureSlot != 0) then {
// get texture path from index
_color = getArray (_cfgBaseBuilding >> _class >> "availableTextures");
if !(_color isEqualTo []) then {
_baseObj setObjectTextureGlobal [0, (_color select _textureSlot)];
_baseObj setVariable ["TEXTURE_SLOT", _textureSlot, true];
};
}; };
}; };

View File

@ -18,7 +18,7 @@ private ["_actualHitpoints","_allHitpoints","_allVehicles","_allowDamage","_arr"
params [["_maxVehicleLimit",0]]; params [["_maxVehicleLimit",0]];
_diag = diag_tickTime; _diag = diag_tickTime;
_dataFormat = ["", [], 0, [], 0, [], [], 0, "", ""]; _dataFormat = ["", [], 0, [], 0, [], [], 0, "", "", []];
_dataFormatCount = count _dataFormat; _dataFormatCount = count _dataFormat;
EPOCH_VehicleSlots = []; EPOCH_VehicleSlots = [];
_allVehicles = []; _allVehicles = [];
@ -60,7 +60,7 @@ for "_i" from 1 to _maxVehicleLimit do {
if !((_arr select _forEachIndex) isEqualType _x) then {_arr set[_forEachIndex, _x]}; if !((_arr select _forEachIndex) isEqualType _x) then {_arr set[_forEachIndex, _x]};
} forEach _dataFormat; } forEach _dataFormat;
_arr params ["_class","_worldspace","_damage","_hitpoints","_fuel","_inventory","_ammo","_color","_baseClass",["_plateNumber",""]]; _arr params ["_class","_worldspace","_damage","_hitpoints","_fuel","_inventory","_ammo","_color","_baseClass",["_plateNumber",""],["_Textures",[]]];
if (_class != "" && _damage < 1) then { if (_class != "" && _damage < 1) then {
// remove location from worldspace and set to new var // remove location from worldspace and set to new var
@ -121,21 +121,28 @@ for "_i" from 1 to _maxVehicleLimit do {
// set fuel level // set fuel level
_vehicle setFuel _fuel; _vehicle setFuel _fuel;
// apply persistent textures // apply persistent textures
_cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; if (missionnamespace getvariable ["UseCustomTextures",false]) then {
_availableColorsConfig = (_cfgEpochVehicles >> _class >> "availableColors");
if (isArray(_availableColorsConfig)) then {
_colors = getArray(_availableColorsConfig);
_textureSelectionIndex = (_cfgEpochVehicles >> _class >> "textureSelectionIndex");
_selections = if (isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] };
_count = (count _colors) - 1;
{ {
_textures = _colors select 0; _vehicle setobjecttextureglobal [_foreachindex,_x];
if (_count >= _forEachIndex) then { } foreach _Textures;
_textures = _colors select _forEachIndex; }
}; else {
_vehicle setObjectTextureGlobal [_x, _textures select _color]; _cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig;
} forEach _selections; _availableColorsConfig = (_cfgEpochVehicles >> _class >> "availableColors");
_vehicle setVariable ["VEHICLE_TEXTURE", _color]; if (isArray(_availableColorsConfig)) then {
_colors = getArray(_availableColorsConfig);
_textureSelectionIndex = (_cfgEpochVehicles >> _class >> "textureSelectionIndex");
_selections = if (isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] };
_count = (count _colors) - 1;
{
_textures = _colors select 0;
if (_count >= _forEachIndex) then {
_textures = _colors select _forEachIndex;
};
_vehicle setObjectTextureGlobal [_x, _textures select _color];
} forEach _selections;
_vehicle setVariable ["VEHICLE_TEXTURE", _color];
};
}; };
if !(_baseClass isequalto "") then { if !(_baseClass isequalto "") then {
_vehicle setvariable ["VEHICLE_BASECLASS",_baseClass]; _vehicle setvariable ["VEHICLE_BASECLASS",_baseClass];

View File

@ -31,7 +31,13 @@ if (!isNull _vehicle) then {
_colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0]; _colorSlot = _vehicle getVariable ["VEHICLE_TEXTURE",0];
_baseType = _vehicle getVariable ["VEHICLE_BASECLASS",""]; _baseType = _vehicle getVariable ["VEHICLE_BASECLASS",""];
_VAL = [typeOf _vehicle,[getposworld _vehicle,vectordir _vehicle,vectorup _vehicle,true],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot,_baseType, getPlateNumber _vehicle];
_Textures = [];
if (missionnamespace getvariable ["UseCustomTextures",false]) then {
_Textures = getObjectTextures _vehicle;
};
_VAL = [typeOf _vehicle,[getposworld _vehicle,vectordir _vehicle,vectorup _vehicle,true],damage _vehicle,_hitpoints,fuel _vehicle,_inventory,[true,magazinesAllTurrets _vehicle],_colorSlot,_baseType, getPlateNumber _vehicle, _Textures];
["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX; ["Vehicle", _vehHiveKey, EPOCH_expiresVehicle, _VAL] call EPOCH_fnc_server_hiveSETEX;
}; };
}; };

View File

@ -169,6 +169,8 @@ for "_i" from 0 to 9 do {
EPOCH_customChannels pushBack _index; EPOCH_customChannels pushBack _index;
}; };
UseCustomTextures = ([_serverSettingsConfig, "UseCustomTextures", false] call EPOCH_fnc_returnConfigEntry);
//Execute Server Functions //Execute Server Functions
diag_log "Epoch: Loading buildings"; diag_log "Epoch: Loading buildings";
EPOCH_BuildingSlotsLimit call EPOCH_server_loadBuildings; EPOCH_BuildingSlotsLimit call EPOCH_server_loadBuildings;