Added SetCollider for Mob Vacuum
This commit is contained in:
parent
06d9360f58
commit
07ca7eb5bd
@ -22,7 +22,8 @@ namespace cheat::feature
|
|||||||
NF(f_Distance, "Distance", "MobVacuum", 1.5f),
|
NF(f_Distance, "Distance", "MobVacuum", 1.5f),
|
||||||
NF(f_Radius, "Radius", "MobVacuum", 10.0f),
|
NF(f_Radius, "Radius", "MobVacuum", 10.0f),
|
||||||
NF(f_OnlyTarget, "Only targeted", "MobVacuum", true),
|
NF(f_OnlyTarget, "Only targeted", "MobVacuum", true),
|
||||||
NF(f_Instantly, "Instantly", "MobVacuum", false)
|
NF(f_Instantly, "Instantly", "MobVacuum", false),
|
||||||
|
NF(f_SetCollider, "SetCollider", "MobVacuum", false)
|
||||||
{
|
{
|
||||||
events::GameUpdateEvent += MY_METHOD_HANDLER(MobVacuum::OnGameUpdate);
|
events::GameUpdateEvent += MY_METHOD_HANDLER(MobVacuum::OnGameUpdate);
|
||||||
events::MoveSyncEvent += MY_METHOD_HANDLER(MobVacuum::OnMoveSync);
|
events::MoveSyncEvent += MY_METHOD_HANDLER(MobVacuum::OnMoveSync);
|
||||||
@ -63,6 +64,7 @@ namespace cheat::feature
|
|||||||
|
|
||||||
ConfigWidget("Instant Vacuum", f_Instantly, "Vacuum entities instantly.");
|
ConfigWidget("Instant Vacuum", f_Instantly, "Vacuum entities instantly.");
|
||||||
ConfigWidget("Only Hostile/Aggro", f_OnlyTarget, "If enabled, vacuum will only affect monsters targeting you. Will not affect animals.");
|
ConfigWidget("Only Hostile/Aggro", f_OnlyTarget, "If enabled, vacuum will only affect monsters targeting you. Will not affect animals.");
|
||||||
|
ConfigWidget("Remove Collider", f_SetCollider, "If enabled, monsters won't be able to push you despite the distance or size");
|
||||||
ConfigWidget("Speed", f_Speed, 0.1f, 1.0f, 15.0f, "If 'Instant Vacuum' is not checked, mob will be vacuumed at the specified speed.");
|
ConfigWidget("Speed", f_Speed, 0.1f, 1.0f, 15.0f, "If 'Instant Vacuum' is not checked, mob will be vacuumed at the specified speed.");
|
||||||
ConfigWidget("Radius (m)", f_Radius, 0.1f, 5.0f, 150.0f, "Radius of vacuum.");
|
ConfigWidget("Radius (m)", f_Radius, 0.1f, 5.0f, 150.0f, "Radius of vacuum.");
|
||||||
ConfigWidget("Distance (m)", f_Distance, 0.1f, 0.5f, 10.0f, "Distance between the player and the monster.");
|
ConfigWidget("Distance (m)", f_Distance, 0.1f, 0.5f, 10.0f, "Distance between the player and the monster.");
|
||||||
@ -75,13 +77,13 @@ namespace cheat::feature
|
|||||||
|
|
||||||
void MobVacuum::DrawStatus()
|
void MobVacuum::DrawStatus()
|
||||||
{
|
{
|
||||||
ImGui::Text("Vacuum [%s]\n[%s|%.01fm|%.01fm|%s]",
|
ImGui::Text("Vacuum [%s]\n[%s|%.01fm|%.01fm|%s|%s]",
|
||||||
f_IncludeMonsters && f_IncludeAnimals ? "All" : f_IncludeMonsters ? "Monsters" : f_IncludeAnimals ? "Animals" : "None",
|
f_IncludeMonsters && f_IncludeAnimals ? "All" : f_IncludeMonsters ? "Monsters" : f_IncludeAnimals ? "Animals" : "None",
|
||||||
f_Instantly ? "Instant" : fmt::format("Normal|{:.1f}", f_Speed.value()).c_str(),
|
f_Instantly ? "Instant" : fmt::format("Normal|{:.1f}", f_Speed.value()).c_str(),
|
||||||
f_Radius.value(),
|
f_Radius.value(),
|
||||||
f_Distance.value(),
|
f_Distance.value(),
|
||||||
f_OnlyTarget ? "Aggro" : "All"
|
f_OnlyTarget ? "Aggro" : "All",
|
||||||
);
|
f_SetCollider ? "RCollider" : "ECollider");
|
||||||
}
|
}
|
||||||
|
|
||||||
MobVacuum& MobVacuum::GetInstance()
|
MobVacuum& MobVacuum::GetInstance()
|
||||||
@ -142,6 +144,18 @@ namespace cheat::feature
|
|||||||
return avatarEntity->relativePosition() + avatarEntity->forward() * f_Distance;
|
return avatarEntity->relativePosition() + avatarEntity->forward() * f_Distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set Monster's collider
|
||||||
|
// Taiga#5555: There might be an in-game function for this already I'm just not sure which one
|
||||||
|
void SetMonsterCollider(game::Entity* entity, bool v)
|
||||||
|
{
|
||||||
|
auto objName = entity->name();
|
||||||
|
auto name = objName.substr(0, objName.find_first_of(" "));
|
||||||
|
// path example: "EntityRoot/MonsterRoot/Monster_Fungus_Raptor_01(Clone)/Collider"
|
||||||
|
auto collider = app::GameObject_Find(string_to_il2cppi("/EntityRoot/MonsterRoot/" + name + "/Collider"), nullptr);
|
||||||
|
if (collider != nullptr)
|
||||||
|
app::GameObject_SetActive(collider, v, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
// Mob vacuum update function.
|
// Mob vacuum update function.
|
||||||
// Changes position of monster, if mob vacuum enabled.
|
// Changes position of monster, if mob vacuum enabled.
|
||||||
void MobVacuum::OnGameUpdate()
|
void MobVacuum::OnGameUpdate()
|
||||||
@ -169,6 +183,8 @@ namespace cheat::feature
|
|||||||
if (!IsEntityForVac(entity))
|
if (!IsEntityForVac(entity))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
SetMonsterCollider(entity, !f_SetCollider);
|
||||||
|
|
||||||
if (f_Instantly)
|
if (f_Instantly)
|
||||||
{
|
{
|
||||||
entity->setRelativePosition(targetPos);
|
entity->setRelativePosition(targetPos);
|
||||||
@ -211,6 +227,8 @@ namespace cheat::feature
|
|||||||
if (!IsEntityForVac(entity))
|
if (!IsEntityForVac(entity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SetMonsterCollider(entity, !f_SetCollider);
|
||||||
|
|
||||||
app::Vector3 targetPos = CalcMobVacTargetPos();
|
app::Vector3 targetPos = CalcMobVacTargetPos();
|
||||||
app::Vector3 entityPos = entity->relativePosition();
|
app::Vector3 entityPos = entity->relativePosition();
|
||||||
if (app::Vector3_Distance(targetPos, entityPos, nullptr) < 0.2)
|
if (app::Vector3_Distance(targetPos, entityPos, nullptr) < 0.2)
|
||||||
|
@ -29,6 +29,7 @@ namespace cheat::feature
|
|||||||
config::Field<float> f_Distance;
|
config::Field<float> f_Distance;
|
||||||
config::Field<bool> f_OnlyTarget;
|
config::Field<bool> f_OnlyTarget;
|
||||||
config::Field<bool> f_Instantly;
|
config::Field<bool> f_Instantly;
|
||||||
|
config::Field<config::Toggle<Hotkey>> f_SetCollider;
|
||||||
|
|
||||||
static MobVacuum& GetInstance();
|
static MobVacuum& GetInstance();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user