Open homonovus opened 2 hours ago
Please explain how this would work and how it would solve the issue mentioned.
CS:GO uses this for its looping inspect animations, which simply jumps backwards into the same sequence repeatedly
i propose adding the m_fCycleOffset variable to the CBaseViewModel class, as well as the changes to CBaseAnimating, and a change to ENT:SetCycle that accommodate for viewmodels
using the animation event's code as the base for the change
LUA_FUNCTION(ENT_SetCycle)
{
auto pEntity = Get_Entity(1);
CBaseViewModel* pViewModel = assert_cast<CBaseViewModel>(pEntity);
if (pViewModel)
{
float flDesiredCycle = LUA->GetNumber(2);
float flCycle = pViewModel->GetCycle();
pViewModel->SetCycle(flDesiredCycle);
pViewModel->m_fCycleOffset += (pViewModel->GetCycle() - flCycle)
return 0;
}
else
{
// existing behavior
}
}
Details
CS:GO added a variable to CBaseViewModel that I believe would let us set the cycle arbitrarily for viewmodels changing ENT:SetCycle to accommodate for ViewModels would allow lua to set the value to close https://github.com/Facepunch/garrysmod-issues/issues/3038
relevant links: https://github.com/lua9520/source-engine-2018-cstrike15_src/blob/master/game/client/c_baseviewmodel.cpp#L340 https://github.com/lua9520/source-engine-2018-cstrike15_src/blob/master/game/client/c_baseanimating.cpp#L5967-L5969 prospective addition to ENT:SetCycle