feat(noclip): fix aim nullifying noclip speed. (#1791)
* keep using SET_ENTITY_VELOCITY when not aiming * provide GUI for editing speed of noclip
This commit is contained in:
parent
ae486ca129
commit
84e3262694
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
static constexpr ControllerInputs controls[] = {ControllerInputs::INPUT_SPRINT, ControllerInputs::INPUT_MOVE_UP_ONLY, ControllerInputs::INPUT_MOVE_DOWN_ONLY, ControllerInputs::INPUT_MOVE_LEFT_ONLY, ControllerInputs::INPUT_MOVE_RIGHT_ONLY, ControllerInputs::INPUT_DUCK};
|
||||
|
||||
static constexpr float speed = 20.f;
|
||||
static constexpr float speed = 1.0f;
|
||||
|
||||
class noclip : looped_command
|
||||
{
|
||||
@ -39,7 +39,7 @@ namespace big
|
||||
m_entity = ent;
|
||||
}
|
||||
|
||||
Vector3 vel = {0.f, 0.f, 0.f};
|
||||
Vector3 vel{};
|
||||
|
||||
// Left Shift
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_SPRINT))
|
||||
@ -76,13 +76,29 @@ namespace big
|
||||
|
||||
ENTITY::FREEZE_ENTITY_POSITION(ent, false);
|
||||
|
||||
const auto is_aiming = PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM);
|
||||
if (is_aiming)
|
||||
{
|
||||
vel = vel * g.self.noclip_aim_speed_multiplier;
|
||||
|
||||
const auto offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x * m_speed_multiplier, vel.y * m_speed_multiplier, vel.z * m_speed_multiplier);
|
||||
|
||||
ENTITY::SET_ENTITY_VELOCITY(ent, 0, 0, 0);
|
||||
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(ent, offset.x, offset.y, offset.z, true, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = vel * g.self.noclip_speed_multiplier;
|
||||
|
||||
const auto offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(ent, vel.x, vel.y, 0.f);
|
||||
vel.x = offset.x - location.x;
|
||||
vel.y = offset.y - location.y;
|
||||
|
||||
ENTITY::SET_ENTITY_MAX_SPEED(ent, 999999999999);
|
||||
ENTITY::SET_ENTITY_VELOCITY(ent, vel.x * m_speed_multiplier, vel.y * m_speed_multiplier, vel.z * m_speed_multiplier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual void on_disable() override
|
||||
{
|
||||
|
@ -311,6 +311,8 @@ namespace big
|
||||
bool never_wanted = false;
|
||||
bool no_ragdoll = false;
|
||||
bool noclip = false;
|
||||
float noclip_aim_speed_multiplier = 0.25f;
|
||||
float noclip_speed_multiplier = 20.f;
|
||||
bool off_radar = false;
|
||||
bool ghost_org = false;
|
||||
bool super_run = false;
|
||||
@ -359,7 +361,7 @@ namespace big
|
||||
// do not save below entries
|
||||
bool dance_mode = false;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ipls, ptfx_effects, clean_player, force_wanted_level, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman, custom_weapon_stop, persist_outfit, persist_outfits_mis)
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(self, ipls, ptfx_effects, clean_player, force_wanted_level, free_cam, invisibility, local_visibility, never_wanted, no_ragdoll, noclip, noclip_aim_speed_multiplier, noclip_speed_multiplier, off_radar, super_run, no_collision, unlimited_oxygen, no_water_collision, wanted_level, god_mode, part_water, proof_bullet, proof_fire, proof_collision, proof_melee, proof_explosion, proof_steam, proof_drown, proof_water, proof_mask, mobile_radio, fast_respawn, auto_tp, super_jump, beast_jump, healthregen, healthregenrate, hud, superman, custom_weapon_stop, persist_outfit, persist_outfits_mis)
|
||||
} self{};
|
||||
|
||||
struct session
|
||||
|
@ -46,6 +46,17 @@ namespace big
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::command_checkbox<"noclip">();
|
||||
components::options_modal("Noclip", [] {
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
ImGui::Text("NOCLIP_AIM_SPEED_MULTIPLIER"_T.data());
|
||||
ImGui::SliderFloat("##noclipaimspeedmult", &g.self.noclip_aim_speed_multiplier, 0.1f, 1.0f);
|
||||
ImGui::Text("NOCLIP_SPEED_MULTIPLIER"_T.data());
|
||||
ImGui::SliderFloat("##noclipspeedmult", &g.self.noclip_speed_multiplier, 1.f, 100.f);
|
||||
ImGui::EndGroup();
|
||||
});
|
||||
|
||||
components::command_checkbox<"noragdoll">();
|
||||
components::command_checkbox<"fastrun">();
|
||||
components::command_checkbox<"noidlekick">();
|
||||
|
Reference in New Issue
Block a user