From 72b3663fce9cdb641d10d992c18885ee035479c8 Mon Sep 17 00:00:00 2001 From: He-Man Date: Thu, 2 May 2019 23:07:51 +0200 Subject: [PATCH] PaintGarage - Update --- .../@epochhive/epochconfig.hpp | 1 + .../vehicles/EPOCH_vehicle_Paintgarage.sqf | 2 +- .../scripts/dynamenu/Epoch_dynamicMenu.sqf | 48 +++++- .../CfgActionMenu/CfgActionMenu_target.hpp | 2 +- Sources/epoch_config/Configs/CfgPainting.hpp | 140 +----------------- .../EPOCH_server_PaintVehicle.sqf | 2 +- Sources/epoch_server/init/server_init.sqf | 9 ++ 7 files changed, 65 insertions(+), 139 deletions(-) diff --git a/Server_Install_Pack/@epochhive/epochconfig.hpp b/Server_Install_Pack/@epochhive/epochconfig.hpp index 8e270a53..90db9435 100644 --- a/Server_Install_Pack/@epochhive/epochconfig.hpp +++ b/Server_Install_Pack/@epochhive/epochconfig.hpp @@ -86,6 +86,7 @@ forceRestartTime = 14400; // 4 hour restarts {"200Rnd_40mm_G_belt",{0}} }; disableVehicleTIE = "true"; + ReplaceCarService = "false"; // Replace all "Land_CarService_F" with "paintshop" on the Map on Server Start // BaseBuilding StorageSlotsLimit = 1500; // Max storage slots allowed. Warning! Higher the number lower performance. diff --git a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf index dcf65ffc..e676b1db 100644 --- a/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf +++ b/Sources/epoch_code/compile/vehicles/EPOCH_vehicle_Paintgarage.sqf @@ -8,7 +8,7 @@ _this spawn { _ok = true; _Check1 = { _out1 = true; - if (_Vehicle distance2D _Building > 1.5) exitwith { + if (_Vehicle distance2D _Building > 2.5) exitwith { ["Park in center of the Garage",5] call Epoch_Message; false }; diff --git a/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf b/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf index 7b21b9fd..f6e1ffd8 100644 --- a/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf +++ b/Sources/epoch_code/gui/scripts/dynamenu/Epoch_dynamicMenu.sqf @@ -55,14 +55,23 @@ _checkConfigs = { }; case "PaintGarage": { + private _garagevehs = nearestobjects [dyna_cursorTarget,["LandVehicle","AIR"],10]; + if (_garagevehs isEqualTo []) exitwith { + ["No Paintable Vehicle found in Garage",5] call Epoch_message; + (_cfg >> _selfOrTarget) + }; private _cfgtmp = "CfgPainting" call EPOCH_returnConfig; - _garageveh = ((dyna_cursorTarget nearentities 10) select {isclass (_cfgtmp >> (typeof _x))}) param [0, objnull]; - if (isnull _garageveh) exitwith { + _garageveh = _garagevehs select 0; + private _isclass = isclass (_cfgtmp >> (typeof _garageveh)); + if (!_isclass && (("true" configClasses (configFile >> "CfgVehicles" >> (typeof _garageveh) >> "TextureSources")) isEqualTo [])) exitwith { ["No Paintable Vehicle found in Garage",5] call Epoch_message; (_cfg >> _selfOrTarget) }; dyna_Paintobj = _garageveh; - (_cfgtmp >> (typeof _garageveh)) + if (_isclass) exitwith { + (_cfgtmp >> (typeof _garageveh)) + }; + (_cfgtmp >> "DefaultVehicle") }; case "": { @@ -112,8 +121,39 @@ _checkConfigs = { case "PaintGarage": { if !(isClass _config) exitWith {_in = "";}; - + private _usedefaultcolors = tolower (gettext (_config >> "UseArmaDefaultColors")); _icon = gettext (_config >> "icon"); + if (_usedefaultcolors isEqualTo "true") then { + { + private _textures = getarray (_x >> "textures"); + _tooltip = gettext (_x >> "displayName"); + _iconcolor = [1,1,1,1]; + { + if ((tolower _tooltip) find (_x select 0) > -1) exitwith { + _iconcolor = _x select 1; + }; + } foreach [ + ["red",[1,0,0,1]], + ["green",[0,1,0,1]], + ["blue",[0,0,1,1]], + ["yellow",[1,1,0,1]], + ["white",[1,1,1,1]], + ["black",[0,0,0,1]], + ["grey",[0.5, 0.5, 0.5]], + ["orange",[1, 0.9, 0, 1]], + ["hex",[0.74, 0.72, 0.42, 1]], + ["sand",[1, 0.9, 0.8, 1]], + ["olive",[0.33, 0.42, 0.185, 1]] + ]; + _action = format ["[dyna_cursorTarget,dyna_Paintobj,%1] call EPOCH_vehicle_Paintgarage; true call Epoch_dynamicMenuCleanup;",_textures]; + _buttonSettings pushBack [ + _icon, + _tooltip, + _action, + _iconcolor + ]; + } foreach ("true" configClasses (configFile >> "CfgVehicles" >> (typeof dyna_Paintobj) >> "TextureSources")); + }; { _tooltip = gettext (_x >> "ColorName"); _iconcolor = getarray (_x >> "iconcolor"); diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp index 6ba3749d..a997609f 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp @@ -24,7 +24,7 @@ class build_upgrade }; class PaintGarage { - condition = "dyna_cursortargettype in ['paintshop']"; + condition = "(dyna_cursortargettype isEqualTo 'paintshop' && {player distance2d (dyna_cursorTarget modelToWorld (dyna_cursorTarget selectionPosition 'action1')) < 1}) || dyna_cursortargettype in ['Add other Buildings here']"; action = ""; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Paint.paa"; tooltip = "Paint Garage"; diff --git a/Sources/epoch_config/Configs/CfgPainting.hpp b/Sources/epoch_config/Configs/CfgPainting.hpp index ec256f3d..df040cd3 100644 --- a/Sources/epoch_config/Configs/CfgPainting.hpp +++ b/Sources/epoch_config/Configs/CfgPainting.hpp @@ -1,67 +1,28 @@ class CfgPainting { class DefaultVehicle { + UseArmaDefaultColors = "true"; // Use all availabe default colours from Arma PaintingCosts = 500; icon = "x\addons\a3_epoch_code\Data\UI\buttons\Paint.paa"; - - // All color classes created in "DefaultVehicle" will be available for all sub-classes that inherits from ": DefaultVehicle" - class Pink + class Pink // Colour will be available for ALL Vehicles { ColorName = "Pink"; iconcolor[] = {1,0.0784,0.576,1}; textures[] = { - {0,"#(rgb,8,8,3)color(1,0.0784,0.576,1)"} + "#(rgb,8,8,3)color(1,0.0784,0.576,1)" }; }; }; +/* // Define custom colours for each Type like this class C_Hatchback_01_EPOCH : DefaultVehicle { - class White // Classname only to identify the color (not used in any script) - { - ColorName = "White"; // Used for the Tooltip in DynaMenu - iconcolor[] = {1, 1, 1, 1}; // If defined, the DynaMenu-Icon will get colored with this color (0-1 instead of 0-255!) {R,G,B,Alpha} - textures[] = { - {0,"\A3\soft_f_gamma\Hatchback_01\data\Hatchback_01_ext_CO.paa"} // {selectionNumber,texture} see also https://community.bistudio.com/wiki/setObjectTextureGlobal - }; - }; + UseArmaDefaultColors = "true"; // Use all availabe default colours from Arma class Green { ColorName = "Green"; - iconcolor[] = {0, 1, 0, 1}; + 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"} + "#(rgb,8,8,3)color(0,1,0,1)" }; }; }; @@ -74,90 +35,5 @@ class CfgPainting { 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_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf index 3c076390..0cf1eb3a 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_server_PaintVehicle.sqf @@ -20,7 +20,7 @@ if(_PaintingCosts > 0)then{ }; if (_ok) then { { - _vehicle SetObjectTextureGlobal _x; + _vehicle SetObjectTextureGlobal [_foreachindex,_x]; } foreach _Textures; _vehicle setVariable ["VEHICLE_TEXTURE", -1]; EPOCH_saveVehQueue pushBackUnique _vehicle; diff --git a/Sources/epoch_server/init/server_init.sqf b/Sources/epoch_server/init/server_init.sqf index 03229498..91838c9e 100644 --- a/Sources/epoch_server/init/server_init.sqf +++ b/Sources/epoch_server/init/server_init.sqf @@ -171,6 +171,15 @@ for "_i" from 0 to 9 do { UseCustomTextures = ([_serverSettingsConfig, "UseCustomTextures", false] call EPOCH_fnc_returnConfigEntry); +if (([_serverSettingsConfig, "ReplaceCarService", false] call EPOCH_fnc_returnConfigEntry)) then { + { + private _shop = "paintshop" createvehicle (getpos _x); + _shop setposatl (getposatl _x); + _shop setVectorDirAndUp [VectorDir _x, VectorUp _x]; + _x HideobjectGlobal true; + } foreach (epoch_centerMarkerPosition nearObjects ["Land_CarService_F", EPOCH_dynamicVehicleArea]); +}; + //Execute Server Functions diag_log "Epoch: Loading buildings"; EPOCH_BuildingSlotsLimit call EPOCH_server_loadBuildings;