From 76ef193139265ee6d76e98bafcc405aee5a13b00 Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 1 May 2019 23:31:15 +0200 Subject: [PATCH] Painting Garage (WIP) --- .../sc/battleye/remoteexec.txt | 2 +- .../vehicles/EPOCH_vehicle_Paintgarage.sqf | 74 ++++++++ .../scripts/dynamenu/Epoch_dynamicMenu.sqf | 30 ++++ .../dynamenu/Epoch_dynamicMenuPopulate.sqf | 7 + .../CfgActionMenu/CfgActionMenu_core.hpp | 1 + .../CfgActionMenu/CfgActionMenu_target.hpp | 8 + .../Configs/CfgClientFunctions.hpp | 1 + Sources/epoch_config/Configs/CfgPainting.hpp | 161 ++++++++++++++++++ .../epoch_config/Configs/CfgRemoteExec.hpp | 5 + Sources/epoch_config/sandbox_config.hpp | 1 + .../epoch_vehicle/EPOCH_load_vehicles.sqf | 2 +- .../EPOCH_server_PaintVehicle.sqf | 27 +++ .../EPOCH_server_save_vehicle.sqf | 2 +- .../EPOCH_server_upgrade_vehicle.sqf | 49 +++--- Sources/epoch_server/config.cpp | 1 + 15 files changed, 348 insertions(+), 23 deletions(-) create mode 100644 Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf create mode 100644 Sources/epoch_config/Configs/CfgPainting.hpp create mode 100644 Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf diff --git a/Server_Install_Pack/sc/battleye/remoteexec.txt b/Server_Install_Pack/sc/battleye/remoteexec.txt index 109365ee..75313e4c 100644 --- a/Server_Install_Pack/sc/battleye/remoteexec.txt +++ b/Server_Install_Pack/sc/battleye/remoteexec.txt @@ -1 +1 @@ -5 "" !="bis_fnc_execvm \[\[.+\],\"initPlayerServer.sqf\"]" !="bis_fnc_effectkilled(airdestruction|secondaries) \[.+\]" !="epoch_server_(checkplayer|save(_vehicles|building)|(lock|pack)Storage|(upgrade|remove|paint|maint)build) \[.+\]" !="epoch_server_((load|respawn|dead|invite|revive|teleport)Player) \[.+\]" !="epoch_server_((upgrade|updateplayer|inviteplayer|create|delete)(Temp|)Group) \[.+\]" !="epoch_server_(deadplayerdetonate|triggerantagonist|playersetvariable|missioncomms|make(marker|SP)|removemarker) \[.+\]" !="epoch_server_(upgrade_vehicle|knockDownTree|mineRocks|lootAnimal|handle_(say3d|switchmove|sapperObjs)) \[.+\]" !="epoch_server_((repair|fill|lock)Vehicle|(loot|fill)Container|(store|take)Crypto|make(NPC|)Trade) \[.+\]" !="epoch_server_(paycrypto|tradeRequest|equippeditem|packJack|create(object|AirDrop)|airDropCrate|destroytrash|unpackBackpack) \[.+\]" !="epoch_(localcleanup|fnc_saveplayer|client_bitePlayer|serverlootobject|fnc_updateplayerstats) \[.+\]" !="cup_fnc_handletow \[.+\]" !="bis_fnc_reviveinitaddplayer \[.+\]" !="epoch_server_(setfinalplayerpos|defusebomb|putcrypto) \[.+\]" +5 "" !="bis_fnc_execvm \[\[.+\],\"initPlayerServer.sqf\"]" !="bis_fnc_effectkilled(airdestruction|secondaries) \[.+\]" !="epoch_server_(checkplayer|save(_vehicles|building)|(lock|pack)Storage|(upgrade|remove|paint|maint)build) \[.+\]" !="epoch_server_((load|respawn|dead|invite|revive|teleport)Player) \[.+\]" !="epoch_server_((upgrade|updateplayer|inviteplayer|create|delete)(Temp|)Group) \[.+\]" !="epoch_server_(deadplayerdetonate|triggerantagonist|playersetvariable|missioncomms|make(marker|SP)|removemarker) \[.+\]" !="epoch_server_(upgrade_vehicle|knockDownTree|mineRocks|lootAnimal|handle_(say3d|switchmove|sapperObjs)) \[.+\]" !="epoch_server_((repair|fill|lock)Vehicle|(loot|fill)Container|(store|take)Crypto|make(NPC|)Trade) \[.+\]" !="epoch_server_(paycrypto|tradeRequest|equippeditem|packJack|create(object|AirDrop)|airDropCrate|destroytrash|unpackBackpack) \[.+\]" !="epoch_(localcleanup|fnc_saveplayer|client_bitePlayer|serverlootobject|fnc_updateplayerstats) \[.+\]" !="cup_fnc_handletow \[.+\]" !="bis_fnc_reviveinitaddplayer \[.+\]" !="epoch_server_(setfinalplayerpos|defusebomb|putcrypto|paintvehicle) \[.+\]" diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf new file mode 100644 index 00000000..dcf65ffc --- /dev/null +++ b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf @@ -0,0 +1,74 @@ +_this spawn { + params ["_Building","_Vehicle",["_Textures",[]]]; + _PaintingCosts = getnumber (missionconfigfile >> "CfgPainting" >> (typeof _Vehicle) >> "PaintingCosts"); + if (EPOCH_playerCrypto < _PaintingCosts) exitWith { + _line = format ['You need %1 Crypto for Painting', _PaintingCosts]; + [_line,5] call Epoch_message; + }; + _ok = true; + _Check1 = { + _out1 = true; + if (_Vehicle distance2D _Building > 1.5) exitwith { + ["Park in center of the Garage",5] call Epoch_Message; + false + }; + if !((crew _Vehicle) isEqualTo []) exitwith { + ["All passengers have to leave the Vehicle",5] call Epoch_Message; + false + }; + { + _playerPosASL = visiblePositionASL _x; + _abovePlayerPosASL = [_playerPosASL select 0,_playerPosASL select 1,(_playerPosASL select 2) + 15]; + if (lineIntersects [_playerPosASL, _abovePlayerPosASL, _x]) exitwith { + ["All Players have to leave the Garage",5] call Epoch_Message; + _out1 = false; + }; + } foreach (_Building nearentities ["MAN",(sizeof (typeof _Building))/2]); + _out1 + }; + _DoorCheck = { + (_building animationPhase "Lroll_door") < 0.1 + }; + _Animate = { + _Building animate ["Lroll_door",_this]; + _Building animate ["Uroll_door",_this]; + _Building animate ["door_2",if (_this == 1) then {0} else {1}]; + }; + if !(call _Check1) exitwith {}; + 0 call _Animate; + waituntil {uisleep 0.2; !(call _Check1) || call _DoorCheck}; + if !(call _DoorCheck) exitwith {}; + _smokes = []; + _smokeclasses = ["SmokeShellOrange","SmokeShellBlue","SmokeShellPurple","SmokeShellRed","SmokeShellGreen","SmokeShellYellow"]; + for "_i" from 0 to 5 do { + _pos = switch _i do { + case 0: {[-1.5,2,-0.35]}; + case 1: {[1.5,2,-0.35]}; + case 2: {[-1.5,-2,-0.35]}; + case 3: {[1.5,-2,-0.35]}; + case 4: {[0,0,-0.35]}; + default {[0,0,0]}; + }; + if !(call _DoorCheck) exitwith {}; + _smoke = (_smokeclasses deleteat 0) createVehicle getPosATL _Vehicle; + _smoke attachTo [_Vehicle,_pos]; + _smokes pushback _smoke; + uisleep 3.5; + }; + if !(call _DoorCheck) exitwith { + ["Painting Abort - Someone has opened the Door",5] call Epoch_Message; + { + deletevehicle _x; + } foreach _smokes; + 1 call _Animate; + }; + if !(_Textures isEqualTo []) then { + [_vehicle,_PaintingCosts,_Textures,player,Epoch_personalToken] remoteexec ['epoch_server_paintvehicle',2]; + }; + { + deletevehicle _x; + } foreach _smokes; + uisleep 5; + ["Painting finished! Thank you very much...",5] call Epoch_Message; + 1 call _Animate; +}; diff --git a/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf b/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf index 3cbf87ee..7b21b9fd 100644 --- a/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf +++ b/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf @@ -53,6 +53,17 @@ _checkConfigs = { _cfg = "CfgBaseBuilding" call EPOCH_returnConfig; (_cfg >> dyna_cursorTargetType) }; + case "PaintGarage": + { + private _cfgtmp = "CfgPainting" call EPOCH_returnConfig; + _garageveh = ((dyna_cursorTarget nearentities 10) select {isclass (_cfgtmp >> (typeof _x))}) param [0, objnull]; + if (isnull _garageveh) exitwith { + ["No Paintable Vehicle found in Garage",5] call Epoch_message; + (_cfg >> _selfOrTarget) + }; + dyna_Paintobj = _garageveh; + (_cfgtmp >> (typeof _garageveh)) + }; case "": { (_cfg >> _selfOrTarget) @@ -97,6 +108,25 @@ _checkConfigs = { } forEach (getArray (_config >> "upgradeBuilding")); + }; + case "PaintGarage": + { + if !(isClass _config) exitWith {_in = "";}; + + _icon = gettext (_config >> "icon"); + { + _tooltip = gettext (_x >> "ColorName"); + _iconcolor = getarray (_x >> "iconcolor"); + private _textures = getarray (_x >> "textures"); + if (_textures isEqualTo []) exitwith {_in = "";}; + _action = format ["[dyna_cursorTarget,dyna_Paintobj,%1] call EPOCH_vehicle_Paintgarage; true call Epoch_dynamicMenuCleanup;",_textures]; + _buttonSettings pushBack [ + _icon, + _tooltip, + _action, + _iconcolor + ]; + } forEach (configProperties [_config, "isClass _x",true]); }; default { diff --git a/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenuPopulate.sqf b/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenuPopulate.sqf index a18b6cfc..c5677fc2 100644 --- a/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenuPopulate.sqf +++ b/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenuPopulate.sqf @@ -88,6 +88,13 @@ for "_e" from 0 to (_entries - 1) do { _ctrl2 ctrlSetTooltipColorBox [0, 0, 0, 0]; _ctrl2 ctrlSetTooltipColorShade [0, 0, 0, 0]; _ctrl2 ctrlSetText (_buttonSettings select _e select 0); + if (count (_buttonSettings select _e) > 3) then { + if ((_buttonSettings select _e select 3) isEqualType []) then { + if !((_buttonSettings select _e select 3) isEqualTo []) then { + _ctrl2 ctrlSetTextColor (_buttonSettings select _e select 3); + }; + }; + }; _ctrl2 ctrlSetPosition [0.5,0.5,0,0]; _ctrl2 ctrlCommit 0; diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp index 464434dc..1655d4f1 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_core.hpp @@ -51,6 +51,7 @@ class CfgActionMenu dyna_AtHome = "call {_nearjammers = (nearestObjects[player, call EPOCH_JammerClasses, call EPOCH_MaxJammerRange]) select {player distance _x < (getnumber (getmissionconfig 'cfgEpochClient' >> 'CfgJammers' >> (typeof _x) >> 'buildingJammerRange'))};if (_nearjammers isEqualTo []) exitwith {false};_nearestJammer = _nearjammers select 0;((_nearestJammer getVariable['BUILD_OWNER', '-1']) in[getPlayerUID player, Epoch_my_GroupUID])}"; dyna_Watersource = "call {_nearObjects = nearestObjects [player, [], 2];_check = 'water';_ok = false;{if (alive _x) then {_ok = [_x, _check] call EPOCH_worldObjectType;};if (_ok) exitWith {};} forEach _nearObjects;_ok}"; + dyna_Paintobj = "objnull"; // <--- internal use only! }; class self diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp index 44648da8..6ba3749d 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp @@ -22,6 +22,14 @@ class build_upgrade tooltipcode = "format['Upgrade %1',getText(configFile >> 'CfgVehicles' >> (typeof dyna_cursorTarget) >> 'displayName')]"; class special {}; //uses external config, hardcoded }; +class PaintGarage +{ + condition = "dyna_cursortargettype in ['paintshop']"; + action = ""; + icon = "x\addons\a3_epoch_code\Data\UI\buttons\Paint.paa"; + tooltip = "Paint Garage"; + class special {}; //uses external config, hardcoded +}; class build_remove { condition = "dyna_buildMode select 1"; diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index 799cd1eb..65c1b4e2 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -195,6 +195,7 @@ class CfgClientFunctions class vehicle_checkTurretAmmo {}; class vehicle_removeTurretAmmo {}; class vehicle_ChangeLicensePlate {}; + class vehicle_Paintgarage {}; }; class missions { diff --git a/Sources/epoch_config/Configs/CfgPainting.hpp b/Sources/epoch_config/Configs/CfgPainting.hpp new file mode 100644 index 00000000..93fac43f --- /dev/null +++ b/Sources/epoch_config/Configs/CfgPainting.hpp @@ -0,0 +1,161 @@ +class CfgPainting { + class DefaultVehicle + { + PaintingCosts = 500; + icon = "x\addons\a3_epoch_code\Data\UI\buttons\Paint.paa"; + class Pink + { + ColorName = "Pink"; + iconcolor[] = {1,0.0784,0.576,1}; + textures[] = { + {0,"#(rgb,8,8,3)color(1,0.0784,0.576,1)"} + }; + }; + }; + class C_Hatchback_01_EPOCH : DefaultVehicle + { + class White + { + ColorName = "White"; + iconcolor[] = {1, 1, 1, 1}; + textures[] = { + {0,"\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_CO.paa"} + }; + }; + class Green + { + ColorName = "Green"; + iconcolor[] = {0, 1, 0, 1}; + textures[] = { + {0,"\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE02_CO.paa"} + }; + }; + class Blue + { + ColorName = "Blue"; + iconcolor[] = {0, 0, 1, 1}; + textures[] = { + {0,"\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE04_CO.paa"} + }; + }; + class Yellow + { + ColorName = "Yellow"; + iconcolor[] = {1, 1, 0, 1}; + textures[] = { + {0,"\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE06_CO.paa"} + }; + }; + class Grey + { + ColorName = "Grey"; + iconcolor[] = {0.5, 0.5, 0.5, 1}; + textures[] = { + {0,"\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE07_CO.paa"} + }; + }; + class Black + { + ColorName = "Black"; + iconcolor[] = {0.1, 0.1, 0.1, 1}; + textures[] = { + {0,"\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_BASE09_CO.paa"} + }; + }; + }; + class C_Hatchback_01_EPOCH1: C_Hatchback_01_EPOCH{}; + class C_Hatchback_01_EPOCH2: C_Hatchback_01_EPOCH{}; + class C_Hatchback_01_EPOCH3: C_Hatchback_01_EPOCH{}; + class C_Hatchback_01_EPOCH4: C_Hatchback_01_EPOCH{}; + class C_Hatchback_02_EPOCH: C_Hatchback_01_EPOCH{}; + class C_Hatchback_02_EPOCH1: C_Hatchback_02_EPOCH{}; + class C_Hatchback_02_EPOCH2: C_Hatchback_02_EPOCH{}; + class C_Hatchback_02_EPOCH3: C_Hatchback_02_EPOCH{}; + class C_Hatchback_02_EPOCH4: C_Hatchback_02_EPOCH{}; + class C_Offroad_01_EPOCH : DefaultVehicle + { + class Red + { + ColorName = "Red"; + iconcolor[] = {1, 0, 0, 1}; + textures[] = { + {0,"\A3\soft_F\Offroad_01\Data\Offroad_01_ext_co.paa"} + }; + }; + class White + { + ColorName = "White"; + iconcolor[] = {1, 1, 1, 1}; + textures[] = { + {0,"\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE02_CO.paa"} + }; + }; + class Blue + { + ColorName = "Blue"; + iconcolor[] = {0, 0, 1, 1}; + textures[] = { + {0,"\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE03_CO.paa"} + }; + }; + class DarkRed + { + ColorName = "Dark Red"; + iconcolor[] = {0.8, 0, 0, 1}; + textures[] = { + {0,"\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE04_CO.paa"} + }; + }; + class BlackWhite + { + ColorName = "Black / White"; + iconcolor[] = {0.1, 0.1, 0.1, 1}; + textures[] = { + {0,"\A3\soft_F\Offroad_01\Data\Offroad_01_ext_BASE05_CO.paa"} + }; + }; + }; + class C_Offroad_01_EPOCH1: C_Offroad_01_EPOCH{}; + class C_Offroad_01_EPOCH2: C_Offroad_01_EPOCH{}; + class C_Offroad_01_EPOCH3: C_Offroad_01_EPOCH{}; + class C_Offroad_01_EPOCH4: C_Offroad_01_EPOCH{}; + class C_SUV_01_EPOCH : DefaultVehicle + { + class Red + { + ColorName = "Red"; + iconcolor[] = {1, 0, 0, 1}; + textures[] = { + {0,"\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_CO.paa"} + }; + }; + class Black + { + ColorName = "Black"; + iconcolor[] = {0.1, 0.1, 0.1, 1}; + textures[] = { + {0,"\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_02_CO.paa"} + }; + }; + class White + { + ColorName = "White"; + iconcolor[] = {1, 1, 1, 1}; + textures[] = { + {0,"\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_03_CO.paa"} + }; + }; + class Orange + { + ColorName = "Orange"; + iconcolor[] = {1, 0.9, 0, 1}; + textures[] = { + {0,"\A3\Soft_F_Gamma\SUV_01\Data\SUV_01_ext_04_CO.paa"} + }; + }; + }; + class C_SUV_01_EPOCH1: C_SUV_01_EPOCH{}; + class C_SUV_01_EPOCH2: C_SUV_01_EPOCH{}; + class C_SUV_01_EPOCH3: C_SUV_01_EPOCH{}; + class C_SUV_01_EPOCH4: C_SUV_01_EPOCH{}; +}; \ No newline at end of file diff --git a/Sources/epoch_config/Configs/CfgRemoteExec.hpp b/Sources/epoch_config/Configs/CfgRemoteExec.hpp index 01950c5e..b4669cb6 100644 --- a/Sources/epoch_config/Configs/CfgRemoteExec.hpp +++ b/Sources/epoch_config/Configs/CfgRemoteExec.hpp @@ -26,6 +26,11 @@ class CfgRemoteExec { mode = 1; jip = 0; + class EPOCH_server_PaintVehicle + { + allowedTargets=2; + jip = 0; + }; class EPOCH_server_PutCrypto { allowedTargets=2; diff --git a/Sources/epoch_config/sandbox_config.hpp b/Sources/epoch_config/sandbox_config.hpp index 4e3a9d05..5df352b4 100644 --- a/Sources/epoch_config/sandbox_config.hpp +++ b/Sources/epoch_config/sandbox_config.hpp @@ -73,6 +73,7 @@ showHUD[] = #include "Configs\cfgPricing.hpp" #include "Configs\CfgDynamicHUD.hpp" #include "Configs\CfgEPad.hpp" +#include "Configs\CfgPainting.hpp" #include "Configs\CfgEpochClient.hpp" diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf index ee65919f..11cb32ee 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -121,7 +121,7 @@ for "_i" from 1 to _maxVehicleLimit do { // set fuel level _vehicle setFuel _fuel; // apply persistent textures - if ((missionnamespace getvariable ["UseCustomTextures",false]) && {!(_Textures isEqualTo [])}) then { + if (((missionnamespace getvariable ["UseCustomTextures",false]) || _color isEqualTo -1) && {!(_Textures isEqualTo [])}) then { { _vehicle setobjecttextureglobal [_foreachindex,_x]; } foreach _Textures; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf new file mode 100644 index 00000000..3c076390 --- /dev/null +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf @@ -0,0 +1,27 @@ +private ["_ok"]; +_ok = true; +params [["_vehicle",objnull],["_PaintingCosts",0],["_textures",[]],["_player",objnull],["_token","",[""]]]; +if !([_player,_token] call EPOCH_server_getPToken) exitWith {}; +if (isnull _vehicle) exitwith {}; +if (_Textures isEqualTo []) exitwith {}; +if(_PaintingCosts > 0)then{ + _cIndex = EPOCH_customVars find "Crypto"; + _vars = _player getVariable["VARS", call EPOCH_defaultVars_SEPXVar]; + _current_crypto = _vars select _cIndex; + if (_current_crypto < _PaintingCosts) exitwith { + _ok = false; + }; + _playerCryptoLimit = EPOCH_customVarLimits select _cIndex; + _playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"]; + _current_crypto = ((_current_crypto - _PaintingCosts) min _playerCryptoLimitMax) max _playerCryptoLimitMin; + _current_crypto remoteExec ['EPOCH_effectCrypto',_player]; + _vars set[_cIndex, _current_crypto]; + _player setVariable["VARS", _vars]; +}; +if (_ok) then { + { + _vehicle SetObjectTextureGlobal _x; + } foreach _Textures; + _vehicle setVariable ["VEHICLE_TEXTURE", -1]; + EPOCH_saveVehQueue pushBackUnique _vehicle; +}; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf index a2156397..58613361 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_save_vehicle.sqf @@ -33,7 +33,7 @@ if (!isNull _vehicle) then { _baseType = _vehicle getVariable ["VEHICLE_BASECLASS",""]; _Textures = []; - if (missionnamespace getvariable ["UseCustomTextures",false]) then { + if (missionnamespace getvariable ["UseCustomTextures",false] || _colorSlot isEqualTo -1) then { _Textures = getObjectTextures _vehicle; }; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf index 30c86bd0..1f3b2497 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_upgrade_vehicle.sqf @@ -41,6 +41,7 @@ _OldHitPoints = getAllHitPointsDamage _veh; _typeVeh = typeOf _veh; _baseVeh = _veh getVariable ["VEHICLE_BASECLASS",_typeVeh]; _color = _veh getVariable ["VEHICLE_TEXTURE",""]; +_textures = getobjecttextures _veh; _fuel = fuel _veh; _lock = locked _veh; deletevehicle _veh; @@ -55,28 +56,36 @@ _newVeh call EPOCH_server_vehicleInit; _newVeh setFuel _fuel; _newVeh lock _lock; // apply persistent textures -_checkclass = _typeVeh; -if !(_newVeh iskindof _typeVeh) then { - _checkclass = _UpgradeVeh; -}; -_cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; -_availableColorsConfig = (_cfgEpochVehicles >> _checkclass >> "availableColors"); -if (isArray(_availableColorsConfig)) then{ - _colors = getArray (_availableColorsConfig); - _textureSelectionIndex = (_cfgEpochVehicles >> _checkclass >> "textureSelectionIndex"); - _selections = if (isArray(_textureSelectionIndex)) then{ getArray(_textureSelectionIndex) } else { [0] }; - _textures = _colors select 0; - if (!(_newVeh iskindof _typeVeh) || _color isequalto "") then { - _color = floor(random(count _textures)); - }; - _count = (count _colors) - 1; +if (_color isEqualTo -1 && {(_newVeh iskindof _typeVeh)}) then { { - if (_count >= _forEachIndex) then{ - _textures = _colors select _forEachIndex; - }; - _newVeh setObjectTextureGlobal[_x, (_textures select _color)]; - } forEach _selections; + _newVeh SetObjectTextureGlobal [_foreachindex,_x]; + } foreach _textures; _newVeh setVariable["VEHICLE_TEXTURE", _color]; +} +else { + _checkclass = _typeVeh; + if !(_newVeh iskindof _typeVeh) then { + _checkclass = _UpgradeVeh; + }; + _cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; + _availableColorsConfig = (_cfgEpochVehicles >> _checkclass >> "availableColors"); + if (isArray(_availableColorsConfig)) then{ + _colors = getArray (_availableColorsConfig); + _textureSelectionIndex = (_cfgEpochVehicles >> _checkclass >> "textureSelectionIndex"); + _selections = if (isArray(_textureSelectionIndex)) then{ getArray(_textureSelectionIndex) } else { [0] }; + _textures = _colors select 0; + if (!(_newVeh iskindof _typeVeh) || _color isequalto "") then { + _color = floor(random(count _textures)); + }; + _count = (count _colors) - 1; + { + if (_count >= _forEachIndex) then{ + _textures = _colors select _forEachIndex; + }; + _newVeh setObjectTextureGlobal[_x, (_textures select _color)]; + } forEach _selections; + _newVeh setVariable["VEHICLE_TEXTURE", _color]; + }; }; // disable thermal imaging equipment diff --git a/Sources/epoch_server/config.cpp b/Sources/epoch_server/config.cpp index b1a59ed2..e4e9e2dc 100644 --- a/Sources/epoch_server/config.cpp +++ b/Sources/epoch_server/config.cpp @@ -109,6 +109,7 @@ class CfgServerFunctions class server_CargoSave {}; class server_CargoFill {}; class server_removemagoritemcargo {}; + class server_PaintVehicle {}; }; class epoch_server { class precisionPos {};