From 10f97fc448fa6925abb5d11f537a8596e2d5a4de Mon Sep 17 00:00:00 2001 From: vbawol Date: Mon, 13 Jun 2016 12:05:10 -0500 Subject: [PATCH] moved persistent color configs server side. --- .../compile/epoch_vehicle/EPOCH_load_vehicles.sqf | 8 ++++---- .../compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf | 8 ++++---- Sources/epoch_server/init/server_securityfunctions.sqf | 6 +++--- Sources/epoch_server_settings/config.cpp | 2 ++ .../configs}/CfgEpochVehicles.hpp | 7 ++++--- 5 files changed, 17 insertions(+), 14 deletions(-) rename Sources/{epoch_config/Configs => epoch_server_settings/configs}/CfgEpochVehicles.hpp (96%) 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 aa811461..b3844de9 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf @@ -12,7 +12,7 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_vehicles.sqf */ -private ["_availableColorsConfig","_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_cfgBaseBuilding","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_immuneVehicleSpawnTime","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig","_simulationHandler","_immuneVehicleSpawn"]; +private ["_availableColorsConfig","_location","_class","_dmg","_actualHitpoints","_hitpoints","_textures","_color","_colors","_textureSelectionIndex","_selections","_count","_objTypes","_objQty","_wMags","_wMagsArray","_attachments","_magazineSizeMax","_magazineName","_magazineSize","_qty","_objType","_marker","_found","_vehicle","_allHitpoints","_cfgEpochVehicles","_worldspace","_damage","_arr","_arrNum","_vehicleSlotIndex","_vehHiveKey","_response","_immuneVehicleSpawnTime","_diag","_dataFormat","_dataFormatCount","_allVehicles","_serverSettingsConfig","_simulationHandler","_immuneVehicleSpawn"]; params [["_maxVehicleLimit",0]]; _diag = diag_tickTime; @@ -94,12 +94,12 @@ for "_i" from 1 to _maxVehicleLimit do { _vehicle setFuel (_arr select 4); - _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig; - _availableColorsConfig = (_cfgBaseBuilding >> _class >> "availableColors"); + _cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; + _availableColorsConfig = (_cfgEpochVehicles >> _class >> "availableColors"); if (isArray(_availableColorsConfig)) then { _color = _arr select 7; _colors = getArray(_availableColorsConfig); - _textureSelectionIndex = (_cfgBaseBuilding >> _class >> "textureSelectionIndex"); + _textureSelectionIndex = (_cfgEpochVehicles >> _class >> "textureSelectionIndex"); _selections = if (isArray(_textureSelectionIndex)) then { getArray(_textureSelectionIndex) } else { [0] }; _count = (count _colors) - 1; { diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf index 924d2a35..69fcab5a 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf @@ -12,7 +12,7 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_vehicle/EPOCH_spawn_vehicle.sqf */ -private ["_maxDamage","_textures","_textureSelectionIndex","_selections","_colors","_color","_count","_vehLockHiveKey","_marker","_cfgBaseBuilding","_vehObj"]; +private ["_maxDamage","_textures","_textureSelectionIndex","_selections","_colors","_color","_count","_vehLockHiveKey","_marker","_cfgEpochVehicles","_vehObj"]; params ["_vehClass","_position","_direction","_locked","_slot",["_lockOwner",""],["_can_collide","CAN_COLLIDE"],["_spawnLoot",false],["_spawnDamaged",true]]; if !(isClass (configFile >> "CfgVehicles" >> _vehClass)) exitWith {objNull}; _vehObj = createVehicle[_vehClass, _position, [], 0, _can_collide]; @@ -50,11 +50,11 @@ if !(isNull _vehObj) then{ }; // get colors from config - _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig; - _availableColorsConfig = (_cfgBaseBuilding >> _vehClass >> "availableColors"); + _cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; + _availableColorsConfig = (_cfgEpochVehicles >> _vehClass >> "availableColors"); if (isArray(_availableColorsConfig)) then{ - _textureSelectionIndex = (_cfgBaseBuilding >> _vehClass >> "textureSelectionIndex"); + _textureSelectionIndex = (_cfgEpochVehicles >> _vehClass >> "textureSelectionIndex"); _selections = if (isArray(_textureSelectionIndex)) then{ getArray(_textureSelectionIndex) } else { [0] }; _colors = getArray(_availableColorsConfig); _textures = _colors select 0; diff --git a/Sources/epoch_server/init/server_securityfunctions.sqf b/Sources/epoch_server/init/server_securityfunctions.sqf index f0893484..18aaf9ba 100644 --- a/Sources/epoch_server/init/server_securityfunctions.sqf +++ b/Sources/epoch_server/init/server_securityfunctions.sqf @@ -1164,11 +1164,11 @@ call compile ("'"+_skn_doAdminRequest+"' addPublicVariableEventHandler { _vehLockHiveKey = format['%1:%2', (call EPOCH_fn_InstanceID), _slot]; ['VehicleLock', _vehLockHiveKey, EPOCH_vehicleLockTime, [_lockOwner]] call EPOCH_fnc_server_hiveSETEX; - _cfgBaseBuilding = 'CfgBaseBuilding' call EPOCH_returnConfig; - _availableColorsConfig = (_cfgBaseBuilding >> _item >> 'availableColors'); + _cfgEpochVehicles = 'CfgEpochVehicles' call EPOCH_returnConfig; + _availableColorsConfig = (_cfgEpochVehicles >> _item >> 'availableColors'); if (isArray(_availableColorsConfig)) then { - _textureSelectionIndex = (_cfgBaseBuilding >> _item >> 'textureSelectionIndex'); + _textureSelectionIndex = (_cfgEpochVehicles >> _item >> 'textureSelectionIndex'); _selections = if (isArray(_textureSelectionIndex)) then {getArray(_textureSelectionIndex)} else {[0]}; _colors = getArray(_availableColorsConfig); _textures = _colors select 0; diff --git a/Sources/epoch_server_settings/config.cpp b/Sources/epoch_server_settings/config.cpp index 9b97f990..0323634e 100644 --- a/Sources/epoch_server_settings/config.cpp +++ b/Sources/epoch_server_settings/config.cpp @@ -30,6 +30,8 @@ class CfgPatches { #include "configs\CfgMainTable.h" #include "configs\CfgLootTable.h" #include "configs\CfgLootTable_CUP.h" +// vehicle textures +#include "configs\CfgEpochVehicles.h" // security checks #include "configs\security\security_checks.h" // props template diff --git a/Sources/epoch_config/Configs/CfgEpochVehicles.hpp b/Sources/epoch_server_settings/configs/CfgEpochVehicles.hpp similarity index 96% rename from Sources/epoch_config/Configs/CfgEpochVehicles.hpp rename to Sources/epoch_server_settings/configs/CfgEpochVehicles.hpp index 5e32af92..ac5ee9b7 100644 --- a/Sources/epoch_config/Configs/CfgEpochVehicles.hpp +++ b/Sources/epoch_server_settings/configs/CfgEpochVehicles.hpp @@ -1,17 +1,18 @@ /* Author: Aaron Clark - EpochMod.com + Contributors: Description: - Main Client side configs for the Epoch gamemode + Epoch Server side config to persist vehicle colors, these are also used to randomly colorize new spawns. Licence: Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike Github: - https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_config/Configs/CfgEpochVehicles.hpp + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settngs/configs/CfgEpochVehicles.h */ -class CfgPersistentVehicles +class CfgEpochVehicles { class C_Hatchback_01_EPOCH { textureSelectionIndex[] = {0};