Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projectiles getting immediately deactivated in POV demos #111

Open
1 task done
in0finite opened this issue Oct 5, 2024 · 1 comment
Open
1 task done

Projectiles getting immediately deactivated in POV demos #111

in0finite opened this issue Oct 5, 2024 · 1 comment

Comments

@in0finite
Copy link
Contributor

Research

  • I've already searched and I could not find an existing issue or discussion about this issue.

Description

In POV demos, when a projectile is thrown, it gets immediately deactivated (IsActive = false) and his position doesn't update anymore.

Code to reproduce

using DemoFile;
using DemoFile.Game.Cs;
using System.Diagnostics;

internal class Program
{
    public static async Task Main(string[] args)
    {
        var path = "pov.dem";

        var sw = Stopwatch.StartNew();

        var demo = new CsDemoParser();

        List<CBaseCSGrenadeProjectile> projectiles = new();

        demo.EntityEvents.CBaseCSGrenadeProjectile.Create += e =>
        {
            projectiles.Add(e);
        };

        demo.EntityEvents.CBaseCSGrenadeProjectile.Delete += e =>
        {
            projectiles.Remove(e);
        };

        var reader = DemoFileReader.Create(demo, File.OpenRead(path));
        await reader.StartReadingAsync(CancellationToken.None);

        while (await reader.MoveNextAsync(CancellationToken.None))
        {
            //projectiles.RemoveAll(e => !e.IsActive);

            int numActive = projectiles.Count(e => e.IsActive);

            var projectile = projectiles.FirstOrDefault(e => e.IsActive);
            //if (projectile == null)
            //    continue;

            //if (demo.CurrentDemoTick.Value % 100 != 0) // rate-limit
            //    continue;

            Console.WriteLine($"[{demo.CurrentDemoTick.Value / 64f:F4}]  {numActive}  {projectile?.EntityHandle.Value}  {projectile?.Origin}  {projectile?.Rotation}");
        }

        Console.WriteLine($"Finished in {sw.Elapsed.TotalSeconds:N3} seconds");
    }
}

Affected demos

all POV demos

@in0finite
Copy link
Contributor Author

This also happens for weapon (CCSWeaponBase) entities. They seem to be randomly deactivated, even those that are held by demo recording player. It probably happens for other entities aswell, but I haven't checked them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant