Skip to content

Commit

Permalink
Remove hard coded base beam block list and replace with default confi…
Browse files Browse the repository at this point in the history
…g setting
  • Loading branch information
oliverpechey committed Aug 4, 2023
1 parent 07c36cf commit cceb8ac
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 30 deletions.
27 changes: 27 additions & 0 deletions include/FLHook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,33 @@ struct DLL FLHookConfig final : Reflectable, Singleton<FLHookConfig>
uint antiBaseIdle = 600;
//! Amount of time spent idly on character select screen resulting in a server kick, in seconds.
uint antiCharMenuIdle = 600;
//! Bases that beam commands will not work for
std::vector<std::string> noBeamBases = {"br_m_beryllium_miner",
"[br_m_hydrocarbon_miner]",
"[br_m_niobium_miner]",
"[co_khc_copper_miner]",
"[co_khc_cobalt_miner]",
"[co_kt_hydrocarbon_miner]",
"[co_shi_h-fuel_miner]",
"[co_shi_water_miner]",
"[co_ti_water_miner]",
"[gd_gm_h-fuel_miner]",
"[gd_im_oxygen_miner]",
"[gd_im_copper_miner]",
"[gd_im_silver_miner]",
"[gd_im_water_miner]",
"[rh_m_diamond_miner]",
"intro3_base",
"intro2_base",
"intro1_base",
"st03b_01_base",
"st02_01_base",
"st01_02_base",
"iw02_03_base",
"rh02_07_base",
"li04_06_base",
"li01_15_base"};
std::vector<uint> noBeamBasesHashed = {};
};

struct Plugins final : Reflectable
Expand Down
30 changes: 1 addition & 29 deletions source/Helpers/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,34 +256,6 @@ namespace Hk::Player

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Bases that will cause crashes if jumped to
const std::array<uint, 25> bannedBases = {
CreateID("br_m_beryllium_miner"),
CreateID("[br_m_hydrocarbon_miner]"),
CreateID("[br_m_niobium_miner]"),
CreateID("[co_khc_copper_miner]"),
CreateID("[co_khc_cobalt_miner]"),
CreateID("[co_kt_hydrocarbon_miner]"),
CreateID("[co_shi_h-fuel_miner]"),
CreateID("[co_shi_water_miner]"),
CreateID("[co_ti_water_miner]"),
CreateID("[gd_gm_h-fuel_miner]"),
CreateID("[gd_im_oxygen_miner]"),
CreateID("[gd_im_copper_miner]"),
CreateID("[gd_im_silver_miner]"),
CreateID("[gd_im_water_miner]"),
CreateID("[rh_m_diamond_miner]"),
CreateID("intro3_base"),
CreateID("intro2_base"),
CreateID("intro1_base"),
CreateID("st03b_01_base"),
CreateID("st02_01_base"),
CreateID("st01_02_base"),
CreateID("iw02_03_base"),
CreateID("rh02_07_base"),
CreateID("li04_06_base"),
CreateID("li01_15_base"),
};
cpp::result<void, Error> Beam(const std::variant<uint, std::wstring>& player, const std::variant<uint, std::wstring>& baseVar)
{
ClientId client = Hk::Client::ExtractClientID(player);
Expand Down Expand Up @@ -316,7 +288,7 @@ namespace Hk::Player
baseId = std::get<uint>(baseVar);
}

if (std::ranges::find(bannedBases, baseId) != bannedBases.end())
if (std::ranges::find(FLHookConfig::c()->general.noBeamBasesHashed, baseId) != FLHookConfig::c()->general.noBeamBasesHashed.end())
{
return cpp::fail(Error::InvalidBaseName);
}
Expand Down
9 changes: 8 additions & 1 deletion source/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ void LoadSettings()
config.general.noPVPSystemsHashed.emplace_back(systemId);
}

// No Beam Bases
config.general.noBeamBasesHashed.clear();
for (const auto& base : config.general.noBeamBases)
{
config.general.noBeamBasesHashed.emplace_back(CreateID(base.c_str()));
}

auto ptr = std::make_unique<FLHookConfig>(config);
FLHookConfig::i(&ptr);
}
Expand All @@ -42,7 +49,7 @@ void LoadSettings()
REFL_AUTO(type(FLHookConfig::General), field(antiDockKill), field(antiF1), field(changeCruiseDisruptorBehaviour), field(debugMode),
field(disableCharfileEncryption), field(disconnectDelay), field(disableNPCSpawns), field(localTime), field(maxGroupSize), field(persistGroup),
field(reservedSlots), field(torpMissileBaseDamageMultiplier), field(logPerformanceTimers), field(chatSuppressList), field(noPVPSystems),
field(antiBaseIdle), field(antiCharMenuIdle));
field(antiBaseIdle), field(antiCharMenuIdle), field(noBeamBases));
REFL_AUTO(type(FLHookConfig::Plugins), field(loadAllPlugins), field(plugins));
REFL_AUTO(type(FLHookConfig::Socket), field(activated), field(port), field(wPort), field(ePort), field(eWPort), field(encryptionKey), field(passRightsMap));
REFL_AUTO(type(FLHookConfig::Message), field(defaultLocalChat), field(echoCommands), field(suppressInvalidCommands), field(dieMsg), field(dockingMessages));
Expand Down

0 comments on commit cceb8ac

Please sign in to comment.