Exemplo n.º 1
0
        private static void Command_GetBleedingListForAllWoundedPeds()
        {
            EcsWorld world  = GunshotWound3.EcsWorld;
            var      filter = world.GetFilter <EcsFilter <GswPedComponent, PedBleedingInfoComponent> >();

            if (filter.IsEmpty())
            {
                Game.Console.Print("There are no peds with bleedings!");
                return;
            }

            Game.Console.Print("Wounded Ped List:");
            foreach (int i in filter)
            {
                PedBleedingInfoComponent info = filter.Components2[i];
                if (info.BleedingEntities.Count > 0)
                {
                    EcsEntity pedEntity = filter.Entities[i];
                    Game.Console.Print($"Ped {pedEntity.GetEntityName()} has bleedings:");
                    foreach (EcsEntity bleedingEntity in info.BleedingEntities)
                    {
                        PrintInfoAboutBleeding(world, bleedingEntity, info);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private static void PrintInfoAboutBleeding(EcsWorld world, EcsEntity bleedingEntity, PedBleedingInfoComponent info)
        {
            var bleeding = world.GetComponent <BleedingComponent>(bleedingEntity);

            if (bleeding == null)
            {
                return;
            }

            string boneName = bleeding.DamagedBoneId.ToString();

            if (Enum.TryParse(boneName, out PedBoneId boneId))
            {
                boneName = boneId.ToString();
            }

            float estTime = bleeding.Severity / info.BleedingHealRate;

            Game.Console.Print($"{bleeding.MotherWoundEntity.GetEntityName()} " +
                               $"on {bleeding.BodyPartEntity.GetEntityName()}(bone {boneName}) " +
                               $"by weapon {bleeding.WeaponEntity.GetEntityName()}, " +
                               $"severity {bleeding.Severity}, time to heal {estTime} seconds");
        }