diff --git a/Server_Install_Pack/@epochhive/epochconfig.hpp b/Server_Install_Pack/@epochhive/epochconfig.hpp index be4ab4fb..472d5050 100644 --- a/Server_Install_Pack/@epochhive/epochconfig.hpp +++ b/Server_Install_Pack/@epochhive/epochconfig.hpp @@ -27,6 +27,7 @@ forceRestartTime = 14400; // 4 hour restarts { 900, "ChangeWeather", 1 , 2, -1, {} ,{"VR"}}, { 1200, "ContainerSpawner", 0 , 2, -1, {} ,{"VR"}}, { 1440, "GardenManager", 0 , 2, -1, {} ,{"VR"}}, + { 1440, "SolarChargerManager", 0 , 2, -1, {} ,{"VR"}}, { 900, "MoneyDrop", 0 , 2 , -1, {} ,{"VR"}}, { 300, "PlantSpawner", 0 , 2 , -1, {} ,{"VR"}} //No comma on last Entry }; diff --git a/Sources/epoch_code/compile/EPOCH_PutHandler.sqf b/Sources/epoch_code/compile/EPOCH_PutHandler.sqf index 9756bdba..7839df46 100644 --- a/Sources/epoch_code/compile/EPOCH_PutHandler.sqf +++ b/Sources/epoch_code/compile/EPOCH_PutHandler.sqf @@ -12,10 +12,14 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_PutHandler.sqf */ -private _class = param [2]; +params ["_unit", "_container", "_class"]; //Radio Check if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _class)) == "ItemRadio") then { if !(_class in(assignedItems player)) then { EPOCH_equippedItem_PVS = [_class,false,player]; }; }; + +if (_class in ["EnergyPack","EnergyPackLg"] && (typeof _container) in ["SolarCharger_EPOCH","SolarChargerXL_EPOCH"]) then { + ["Charging ...",5,[[0,1,0,0.2],[1,1,1,1]]] call Epoch_Message; +}; diff --git a/Sources/epoch_code/compile/EPOCH_UnisexCheck.sqf b/Sources/epoch_code/compile/EPOCH_UnisexCheck.sqf index d4ce6e3b..e40a9b11 100644 --- a/Sources/epoch_code/compile/EPOCH_UnisexCheck.sqf +++ b/Sources/epoch_code/compile/EPOCH_UnisexCheck.sqf @@ -49,6 +49,10 @@ if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _item)) == "ItemRadio" }; }; +if (_item in ["EnergyPack","EnergyPackLg"] && (typeof _container) in ["SolarCharger_EPOCH","SolarChargerXL_EPOCH"]) then { + ["Stop Charging ...",5,[[1,0,0,0.2],[1,1,1,1]]] call Epoch_Message; +}; + // Unisex vest check _woman = getNumber(configFile >> "CfgVehicles" >> (typeOf player) >> "woman"); _config = configfile >> "cfgweapons" >> _item; diff --git a/Sources/epoch_config/Configs/CfgBaseBuilding.hpp b/Sources/epoch_config/Configs/CfgBaseBuilding.hpp index 655e2ea9..1c60e4d9 100644 --- a/Sources/epoch_config/Configs/CfgBaseBuilding.hpp +++ b/Sources/epoch_config/Configs/CfgBaseBuilding.hpp @@ -1131,6 +1131,30 @@ class CfgBaseBuilding removeParts[] = {}; }; class WorkBench_Ghost_EPOCH : WorkBench_SIM_EPOCH {}; + class SolarCharger_EPOCH : Default + { + removeParts[] = {{"KitSolarCharger",1}}; + GhostPreview = "SolarCharger_Ghost_EPOCH"; + staticClass = "SolarCharger_EPOCH"; + simulClass = "SolarCharger_SIM_EPOCH"; + }; + class SolarCharger_SIM_EPOCH : SolarCharger_EPOCH + { + removeParts[] = {}; + }; + class SolarCharger_Ghost_EPOCH : SolarCharger_SIM_EPOCH {}; + class SolarChargerXL_EPOCH : Default + { + removeParts[] = {{"KitSolarChargerXL",1}}; + GhostPreview = "SolarChargerXL_Ghost_EPOCH"; + staticClass = "SolarChargerXL_EPOCH"; + simulClass = "SolarChargerXL_SIM_EPOCH"; + }; + class SolarChargerXL_SIM_EPOCH : SolarChargerXL_EPOCH + { + removeParts[] = {}; + }; + class SolarChargerXL_Ghost_EPOCH : SolarChargerXL_SIM_EPOCH {}; class LockBox_EPOCH : Default { returnOnPack[] = {{"ItemLockbox",1}}; diff --git a/Sources/epoch_config/Configs/CfgCrafting.hpp b/Sources/epoch_config/Configs/CfgCrafting.hpp index e9de9137..9417930b 100644 --- a/Sources/epoch_config/Configs/CfgCrafting.hpp +++ b/Sources/epoch_config/Configs/CfgCrafting.hpp @@ -148,7 +148,7 @@ class CfgCrafting }; class CircuitParts : Part { - usedIn[] = {"EnergyPack","EnergyPackLg","KitPlotPole","ItemBattery","KitSolarGen","KitVehicleUpgradeI_200_EPOCH","KitVehicleUpgradeIV_200_EPOCH","BarrelBomb_EPOCH_Remote_Mag","BarrelBomb2_EPOCH_Remote_Mag","KitPortableLight_Single","KitPortableLight_Double"}; + usedIn[] = {"EnergyPack","EnergyPackLg","KitPlotPole","ItemBattery","KitSolarGen","KitSolarCharger","KitSolarChargerXL","KitVehicleUpgradeI_200_EPOCH","KitVehicleUpgradeIV_200_EPOCH","BarrelBomb_EPOCH_Remote_Mag","BarrelBomb2_EPOCH_Remote_Mag","KitPortableLight_Single","KitPortableLight_Double"}; previewPosition[] = {0.791044,1,0.256956}; previewScale = 2; previewVector = 2.3; @@ -819,7 +819,7 @@ class CfgCrafting }; class ItemCorrugatedLg : Item { - usedIn[] = {"KitPlotPole","KitTankTrap","KitHesco3","KitSolarGen","ItemRotor","EngineBlock","KitMetalFloor","KitMetalHalfFloor","KitMetalQuarterFloor","KitMetalTower","KitFieldToilet","KitSink","KitPortableLight_Single","KitPortableLight_Double","KitBarbedWire"}; + usedIn[] = {"KitPlotPole","KitTankTrap","KitHesco3","KitSolarGen","KitSolarCharger","KitSolarChargerXL","ItemRotor","EngineBlock","KitMetalFloor","KitMetalHalfFloor","KitMetalQuarterFloor","KitMetalTower","KitFieldToilet","KitSink","KitPortableLight_Single","KitPortableLight_Double","KitBarbedWire"}; recipe[] = {{"ItemCorrugated",3}}; nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH"}},3,1,0,1}}; previewPosition[] = {0.797491,1,0.32899}; @@ -1119,7 +1119,7 @@ class CfgCrafting }; class ItemSolar : Part { - usedIn[] = {"KitSolarGen"}; + usedIn[] = {"KitSolarGen","KitSolarCharger","KitSolarChargerXL"}; previewPosition[] = {0.802374,1,0.26}; previewScale = 0.19; previewVector = 3.3; @@ -1133,7 +1133,7 @@ class CfgCrafting }; class ItemCables : Item { - usedIn[] = {"KitSolarGen","KitPlotPole","ItemCopperBar","KitVehicleUpgradeI_200_EPOCH"}; + usedIn[] = {"KitSolarGen","KitSolarCharger","KitSolarChargerXL","KitPlotPole","ItemCopperBar","KitVehicleUpgradeI_200_EPOCH"}; nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH"}},3,1,0,1}}; recipe[] = {{"ItemCopperBar",1}}; previewPosition[] = {0.802374,1,0.26}; @@ -1227,7 +1227,7 @@ class CfgCrafting }; class ItemBattery : Item { - usedIn[] = {"KitSolarGen","KitPlotPole","BarrelBomb_EPOCH_Remote_Mag","BarrelBomb2_EPOCH_Remote_Mag"}; + usedIn[] = {"KitSolarGen","KitSolarCharger","KitSolarChargerXL","KitPlotPole","BarrelBomb_EPOCH_Remote_Mag","BarrelBomb2_EPOCH_Remote_Mag"}; nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH"}},3,1,0,1}}; recipe[] = {{"EnergyPackLg",3},{"CircuitParts",1}}; previewPosition[] = {0.802374,1,0.276733}; @@ -1241,6 +1241,24 @@ class CfgCrafting previewPosition[] = {0.804979,1,0.39189}; previewScale = 0.11; previewVector = 0; + }; + class KitSolarCharger : Kit + { + recipe[] = {{"ItemSolar",1},{"ItemCables",1},{"ItemBattery",1},{"ItemCorrugatedLg",2},{"CircuitParts",2}}; + nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH"}},3,1,0,1}}; + model = "\x\addons\a3_epoch_assets_3\CfgVehicles\Solar_Generator_Complete\Solar_generator.p3d"; + previewPosition[] = {0.804979,1,0.39189}; + previewScale = 0.11; + previewVector = 0; + }; + class KitSolarChargerXL : Kit + { + recipe[] = {{"ItemSolar",2},{"ItemCables",2},{"ItemBattery",2},{"ItemCorrugatedLg",2},{"CircuitParts",2}}; + nearby[] = {{"Workbench","","workbench",{1,{"WorkBench_EPOCH"}},3,1,0,1}}; + model = "\x\addons\a3_epoch_assets_3\CfgVehicles\Solar_Generator_Complete\Solar_generator.p3d"; + previewPosition[] = {0.804979,1,0.39189}; + previewScale = 0.11; + previewVector = 0; }; class MeleeRod : Kit { diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 5adcf467..9b231a94 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -216,7 +216,6 @@ class CfgEpochClient Fav_BannedItems[] = {"FAK"}; // Items that users are not allowed to pin EnableTempVehTrade = "false"; // Enable selling of temp Vehicles (not handled by Epoch). Temp Vehicles will not be stored in Traders, but can be sold - // Advanced Vehicle Repair UseAdvancedVehicleRepair = "true"; // Switch On / Off Advanced Vehicle Repair (Does not effect SuppressedCraftingItems !) EnableRemoveParts = "true"; // Enable removing Tires / Engines from Vehicles @@ -230,7 +229,9 @@ class CfgEpochClient "KitCinderQuarterFloor", // Item is Upgradeable, but you can remove it here to make it also Craftable "KitCinderHalfFloor", // Item is Upgradeable, but you can remove it here to make it also Craftable "KitCinderFloor", // Item is Upgradeable, but you can remove it here to make it also Craftable - "KitCinderTower" // Item is Upgradeable, but you can remove it here to make it also Craftable + "KitCinderTower", // Item is Upgradeable, but you can remove it here to make it also Craftable + "KitSolarCharger", // Supressed until Client Files update! + "KitSolarChargerXL" // Supressed until Client Files update! }; VehicleRepairs[] = { // {Hitpoint, dmg to repair, dmg to replace, mat to repair, mat to replace} {"HitHull",0.33,0.66,"ItemScraps","ItemCorrugated"}, diff --git a/Sources/epoch_config/Configs/CfgItemInteractions.hpp b/Sources/epoch_config/Configs/CfgItemInteractions.hpp index 8526defd..ebc8db69 100644 --- a/Sources/epoch_config/Configs/CfgItemInteractions.hpp +++ b/Sources/epoch_config/Configs/CfgItemInteractions.hpp @@ -504,6 +504,16 @@ class CfgItemInteractions buildClass = "Garden_EPOCH"; isStorage = 1; }; + class KitSolarCharger : Item_Build_base + { + buildClass = "SolarCharger_EPOCH"; + isStorage = 1; + }; + class KitSolarChargerXL : Item_Build_base + { + buildClass = "SolarChargerXL_EPOCH"; + isStorage = 1; + }; class KitBurnBarrel : Item_Build_base { buildClass = "BurnBarrel_EPOCH"; diff --git a/Sources/epoch_config/Configs/CfgItemSort.hpp b/Sources/epoch_config/Configs/CfgItemSort.hpp index be34030c..87c1c472 100644 --- a/Sources/epoch_config/Configs/CfgItemSort.hpp +++ b/Sources/epoch_config/Configs/CfgItemSort.hpp @@ -1068,6 +1068,8 @@ class CfgItemSort "KitPlotPole", "KitCinderWall", "KitSolarGen", + "KitSolarCharger", + "KitSolarChargerXL", "KitWorkbench", "KitWoodLadder", "KitWoodTower", diff --git a/Sources/epoch_config/Configs/CfgObjectInteractions.hpp b/Sources/epoch_config/Configs/CfgObjectInteractions.hpp index 82c3e258..e7832391 100644 --- a/Sources/epoch_config/Configs/CfgObjectInteractions.hpp +++ b/Sources/epoch_config/Configs/CfgObjectInteractions.hpp @@ -70,6 +70,14 @@ class CfgObjectInteractions { interactMode = 4; }; + class SolarCharger_EPOCH : Default + { + interactMode = 4; + }; + class SolarChargerXL_EPOCH : Default + { + interactMode = 4; + }; class FieldToilet_EPOCH : Default { interactMode = 4; diff --git a/Sources/epoch_config/Configs/CfgPricing.hpp b/Sources/epoch_config/Configs/CfgPricing.hpp index b9313d96..4e755d1c 100644 --- a/Sources/epoch_config/Configs/CfgPricing.hpp +++ b/Sources/epoch_config/Configs/CfgPricing.hpp @@ -3254,6 +3254,14 @@ class CfgPricing { price = 325; }; + class KitSolarCharger + { + price = 325; + }; + class KitSolarChargerXL + { + price = 325; + }; class KitCinderWall { price = 80; diff --git a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf index 36d97aa4..e2233996 100644 --- a/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf +++ b/Sources/epoch_server/compile/epoch_bases/EPOCH_server_saveBuilding.sqf @@ -46,6 +46,10 @@ if (isText _staticClassConfig) then { if (_staticClass isEqualTo "Garden_EPOCH") then { EPOCH_activeGardens pushBackUnique _storageObj; }; + + if (_staticClass in ["SolarCharger_EPOCH","SolarChargerXL_EPOCH"]) then { + EPOCH_activeSolars pushBackUnique _storageObj; + }; if (getNumber(_cfgBaseBuilding >> _staticClass >> "isSecureStorage") == 1) then{ _storageObj setVariable["EPOCH_Locked", false, true]; diff --git a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_storage.sqf b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_storage.sqf index 8c93705d..64c6061d 100644 --- a/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_storage.sqf +++ b/Sources/epoch_server/compile/epoch_vehicle/EPOCH_load_storage.sqf @@ -25,6 +25,7 @@ _ExceptedBaseObjects = [_serverSettingsConfig, "ExceptedBaseObjects", []] call E _diag = diag_tickTime; EPOCH_StorageSlots = []; EPOCH_activeGardens = []; +EPOCH_activeSolars = []; for "_i" from 1 to _maxStorageLimit do { _storageSlotIndex = EPOCH_StorageSlots pushBack str(_i); _vehHiveKey = format ["%1:%2", (call EPOCH_fn_InstanceID), _i]; @@ -79,6 +80,10 @@ for "_i" from 1 to _maxStorageLimit do { if (_class isEqualTo "Garden_EPOCH") then { EPOCH_activeGardens pushBack _vehicle; }; + + if (_class in ["SolarCharger_EPOCH","SolarChargerXL_EPOCH"]) then { + EPOCH_activeSolars pushBack _vehicle; + }; if (_UseIndestructible) then { if ({_vehicle iskindof _x} count _ExceptedBaseObjects == 0) then { diff --git a/Sources/epoch_server_events/EpochEvents/SolarChargerManager.sqf b/Sources/epoch_server_events/EpochEvents/SolarChargerManager.sqf new file mode 100644 index 00000000..97f009fe --- /dev/null +++ b/Sources/epoch_server_events/EpochEvents/SolarChargerManager.sqf @@ -0,0 +1,56 @@ +/* + Garden Manager + by Aaron Clark - EpochMod.com + + Improvements and or bugfixes and other contributions are welcome via the github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server_settings/EpochEvents/GardenManager.sqf +*/ +//[[[cog import generate_private_arrays ]]] +private ["_ChargeClasses","_MaxRounds","_ChargeValue","_modifiedSolars","_changed","_solar","_chargeables","_idx","_MaxRoundsTmp"]; +//[[[end]]] + +_ChargeClasses = ["EnergyPack","EnergyPackLg"]; +_MaxRounds = []; +{ + _MaxRounds pushback (getnumber (configfile >> "cfgMagazines" >> _x >> "count")); +} foreach _ChargeClasses; + +_ChargeValue = 1; + +if (isNil "EPOCH_activeSolars") then {EPOCH_activeSolars = []}; +EPOCH_activeSolars = EPOCH_activeSolars - [objNull]; + +_modifiedSolars = []; +{ + _changed = false; + _solar = _x; + _chargeables = (magazinesAmmoCargo _solar) select {(_x select 0) in _ChargeClasses}; + if !(_chargeables isequalto []) then { + _return = []; + { + _x params ["_type","_rounds"]; + _idx = _ChargeClasses find _type; + if (_idx > -1) then { + _MaxRoundsTmp = _MaxRounds select _idx; + if (_MaxRoundsTmp > _rounds) then { + _changed = true; + _x set [1, (_rounds + _ChargeValue) min _MaxRoundsTmp]; + }; + }; + } foreach _chargeables; + if (_changed) then { + clearWeaponCargoGlobal _solar; + clearMagazineCargoGlobal _solar; + clearBackpackCargoGlobal _solar; + clearItemCargoGlobal _solar; + { + _solar addmagazineammocargo [_x select 0,1,_x select 1]; + } foreach _chargeables; + _modifiedSolars pushBack _solar; + }; + }; +} forEach EPOCH_activeSolars; + +if !(_modifiedSolars isEqualTo []) then { + [_modifiedSolars] call EPOCH_server_save_vehicles; +};