예제 #1
0
파일: Player.cs 프로젝트: jessegranger/Shiv
        public static EntHandle AimingAtEntity()
        {
            EntHandle t = 0;

            unsafe { Call <bool>(GET_ENTITY_PLAYER_IS_FREE_AIMING_AT, CurrentPlayer, new IntPtr(&t)); }
            return(t);
        }
예제 #2
0
파일: Player.cs 프로젝트: jessegranger/Shiv
        public static bool TryGetPlayerTarget(PlayerHandle p, out EntHandle ent)
        {
            EntHandle ret = 0;

            unsafe {
                try {
                    return(Call <bool>(GET_PLAYER_TARGET_ENTITY, p, new IntPtr(&ret)));
                } finally {
                    ent = ret;
                }
            }
        }
예제 #3
0
파일: Player.cs 프로젝트: jessegranger/Shiv
        public static bool TryGetFreeAimEntity(PlayerHandle p, out EntHandle ent)
        {
            EntHandle ret = 0;

            unsafe {
                try {
                    return(Call <bool>(GET_ENTITY_PLAYER_IS_FREE_AIMING_AT, p, new IntPtr(&ret)));
                } finally {
                    ent = ret;
                }
            }
        }
예제 #4
0
파일: World.cs 프로젝트: jessegranger/Shiv
            public RaycastResult(int result)
            {
                bool          hit;
                NativeVector3 hitPos;
                NativeVector3 normal;
                int           material;
                int           entity;

                unsafe { Call(_GET_SHAPE_TEST_RESULT_EX, result,
                              new IntPtr(&hit),
                              new IntPtr(&hitPos),
                              new IntPtr(&normal),
                              new IntPtr(&material),
                              new IntPtr(&entity)); }
                DidHit        = hit;
                HitPosition   = hitPos;
                SurfaceNormal = normal;
                Material      = (Materials)material;
                Entity        = (EntHandle)entity;
            }
예제 #5
0
 public static Vector3 Position(EntHandle ent) => Position(Matrix(ent));         // Read<Vector3>(Address(ent), 0x90);
예제 #6
0
 public static IntPtr Address(EntHandle ent) => GetEntityAddress((int)ent);
예제 #7
0
 public static BlipHandle GetBlip(EntHandle ent) => Call <BlipHandle>(GET_BLIP_FROM_ENTITY, ent);
예제 #8
0
파일: Player.cs 프로젝트: jessegranger/Shiv
 public static bool IsPlayerTargeting(PlayerHandle p, EntHandle ent) => Call <bool>(IS_PLAYER_TARGETTING_ENTITY, p, ent);
예제 #9
0
 public bool Contains(EntHandle ent) => Contains((ulong)ent);
예제 #10
0
 /// <summary>
 /// Blacklist an Entity.
 /// </summary>
 public void Add(EntHandle ent, uint duration) => Add((ulong)ent, duration);
예제 #11
0
        public override State OnTick()
        {
            if (GamePaused)
            {
                return(this);
            }
            if (!IsInMission())
            {
                return(Next);
            }
            BlipHandle blip;

            if (PlayerVehicle == VehicleHandle.Invalid)
            {
                if (TryGetBlip(BlipHUDColor.Blue, out blip))
                {
                    EntHandle ent = GetEntity(blip);
                    switch (GetEntityType(ent))
                    {
                    case EntityType.Ped:
                        return(new FollowPed((PedHandle)ent, this));

                    case EntityType.Vehicle:
                        return(new EnterVehicle((VehicleHandle)ent, this));
                    }
                }
                else if (TryGetBlip(BlipHUDColor.Red, out blip))
                {
                    EntHandle ent = GetEntity(blip);
                    switch (GetEntityType(ent))
                    {
                    case EntityType.Ped:
                        return(new FollowPed((PedHandle)ent, this));

                    case EntityType.Vehicle:
                        return(new EnterVehicle(First(NearbyVehicles()), this));
                    }
                }
            }
            else                 // we are in a vehicle
            {
                if (TryGetBlip(BlipHUDColor.Yellow, out blip))
                {
                    var pos = Position(blip);
                    if (pos != Vector3.Zero)
                    {
                        return(new DriveTo(pos, this)
                        {
                            DrivingFlags = VehicleDrivingFlags.Human
                        });
                    }
                }
                else if (TryGetBlip(BlipHUDColor.Red, out blip))
                {
                    EntHandle ent = GetEntity(blip);
                    switch (GetEntityType(ent))
                    {
                    case EntityType.Ped:
                        var ped = (PedHandle)ent;
                        if (CurrentVehicle(ped) != VehicleHandle.Invalid)
                        {
                            return(new ChaseAndKill()
                            {
                                Target = ped
                            });
                        }
                        break;

                    case EntityType.Vehicle:
                        if (!IsSeatFree((VehicleHandle)ent, VehicleSeat.Driver))
                        {
                            return(new ChaseAndKill()
                            {
                                Target = GetPedInSeat((VehicleHandle)ent, VehicleSeat.Driver)
                            });
                        }
                        break;
                    }
                }
            }
            return(this);
        }
예제 #12
0
 public static void ApplyForce(EntHandle ent, Vector3 dir, Vector3 rot, ForceType forceType = ForceType.MaxForceRot2, bool isRelative = false) => Call(APPLY_FORCE_TO_ENTITY, ent, forceType, dir, rot, false, isRelative, true, true, false, true);
예제 #13
0
 public static EntHandle AttachedTo(EntHandle ent) => Call <EntHandle>(GET_ENTITY_ATTACHED_TO, ent);
예제 #14
0
 public static void Detach(EntHandle ent) => Call(DETACH_ENTITY, ent, true, true);
예제 #15
0
 public static bool IsAttachedTo(EntHandle a, EntHandle b) => Call <bool>(IS_ENTITY_ATTACHED_TO_ENTITY, a, b);
예제 #16
0
 public static bool IsAttached(EntHandle a) => Call <bool>(IS_ENTITY_ATTACHED, a);
예제 #17
0
 public static void AttachTo(EntHandle a, EntHandle b, BoneIndex bone = BoneIndex.Invalid, Vector3 offset = default, Vector3 rot = default) => Call(ATTACH_ENTITY_TO_ENTITY, a, b, bone, offset, rot, 0, 0, 0, 0, 2, 1);
예제 #18
0
        public static Vector3 Position(VehicleHandle ent) => Position(Matrix(ent));     // Read<Vector3>(Address(ent), 0x90);

        public static Matrix4x4 Matrix(EntHandle ent) => Read <Matrix4x4>(Address(ent), 0x60);
예제 #19
0
 public static BoneIndex GetBoneIndex(EntHandle ent, string name) => Call <BoneIndex>(GET_ENTITY_BONE_INDEX_BY_NAME, ent, name);
예제 #20
0
 public static bool IsDead(EntHandle ent) => ent == 0 ? false : Exists(ent) && Call <bool>(IS_ENTITY_DEAD, ent);
예제 #21
0
 public static void Delete(EntHandle ent)
 {
     IsMissionEntity(ent, false);
     unsafe { Call(DELETE_ENTITY, new IntPtr(&ent)); }
 }
예제 #22
0
 public static void NotNeeded(EntHandle ent)
 {
     IsMissionEntity(ent, false);
     unsafe { Call(SET_ENTITY_AS_NO_LONGER_NEEDED, new IntPtr(&ent)); }
 }
예제 #23
0
 public void Remove(EntHandle handle) => data.Remove((ulong)handle);
예제 #24
0
파일: Player.cs 프로젝트: jessegranger/Shiv
 public static bool IsFreeAimingAt(PlayerHandle p, EntHandle e) => Call <bool>(IS_PLAYER_FREE_AIMING_AT_ENTITY, p, e);
예제 #25
0
 public static bool IsInvincible(EntHandle ent) => ent == 0 ? false : IsBitSet(Address(ent), 392, 8);
예제 #26
0
 public static void IsCollisionProof(EntHandle ent, bool value) => SetBit(Address(ent), 392, 6, value);
예제 #27
0
 public static EntityType GetEntityType(EntHandle ent) => Call <EntityType>(GET_ENTITY_TYPE, ent);
예제 #28
0
 public static void IsInvincible(EntHandle ent, bool value) => Call(SET_ENTITY_INVINCIBLE, ent, value);
예제 #29
0
 public static bool Exists(EntHandle ent) => ent == 0 ? false : Call <bool>(DOES_ENTITY_EXIST, ent);
예제 #30
0
 public static bool IsCollisionProof(EntHandle ent) => ent == 0 ? false : IsBitSet(Address(ent), 392, 6);