예제 #1
0
        private void ReloadPickup()
        {
            var newPickup = Function.Call <int>(Hash.CREATE_PICKUP_ROTATE, PickupHash, RealPosition.X, RealPosition.Y, RealPosition.Z, 0, 0, 0, Flag, Amount, 0, false, 0);

            var tmpDyn = new DynamicPickup(newPickup);

            var start = 0;

            while (tmpDyn.ObjectHandle == -1 && start < 20)
            {
                start++;
                Script.Yield();
                tmpDyn.Position = RealPosition;
            }

            tmpDyn.Dynamic = Dynamic;
            tmpDyn.Timeout = Timeout;
            new Prop(tmpDyn.ObjectHandle).IsPersistent = true;

            if (PickupHandle != -1)
            {
                Remove();
            }


            PickupHandle = newPickup;
        }
예제 #2
0
        public static DynamicPickup GetPickupByUID(int uid)
        {
            DynamicPickup pc = null;

            foreach (var pickup in Pickups)
            {
                if (pickup.UID == uid)
                {
                    pc = pickup;
                    break;
                }
            }

            return(pc);
        }
예제 #3
0
        public static DynamicPickup GetPickup(int objectHandle)
        {
            DynamicPickup pc = null;

            foreach (var pickup in Pickups)
            {
                if (pickup.ObjectHandle == objectHandle)
                {
                    pc = pickup;
                    break;
                }
            }

            return(pc);
        }
예제 #4
0
        public static DynamicPickup CreatePickup(Model model, Vector3 position, float heading, int amount, bool dynamic, Quaternion q = null)
        {
            var v_4       = 515;
            int newPickup = -1;

            if (Game.Player.Character.IsInRangeOf(position, 30f))
            {
                newPickup = Function.Call <int>(Hash.CREATE_PICKUP_ROTATE, model.Hash, position.X, position.Y,
                                                position.Z, 0, 0, heading, v_4, amount, 0, false, 0);
            }

            var pcObj = new DynamicPickup(newPickup)
            {
                Flag         = v_4,
                Amount       = amount,
                RealPosition = position
            };

            if (newPickup != -1)
            {
                var start = 0;
                while (pcObj.ObjectHandle == -1 && start < 20)
                {
                    start++;
                    Script.Yield();
                }

                pcObj.Dynamic = false;
                new Prop(pcObj.ObjectHandle).IsPersistent = true;


                if (q != null)
                {
                    Quaternion.SetEntityQuaternion(new Prop(pcObj.ObjectHandle), q);
                }
                pcObj.UpdatePos();
            }

            Pickups.Add(pcObj);
            pcObj.PickupHash = model.Hash;
            pcObj.Timeout    = 1;
            pcObj.UID        = _pickupIds++;
            return(pcObj);
        }
예제 #5
0
        public static void RemovePickup(int objectHandle)
        {
            DynamicPickup pc = null;

            foreach (var pickup in Pickups)
            {
                if (pickup.ObjectHandle == objectHandle)
                {
                    pc = pickup;
                    pc.Remove();
                    break;
                }
            }

            if (pc != null)
            {
                Pickups.Remove(pc);
            }
        }
예제 #6
0
        public static DynamicPickup CreatePickup(Model model, Vector3 position, float heading, int amount, bool dynamic, Quaternion q = null)
        {
            var v_4 = 515;
            int newPickup = -1;

            if (Game.Player.Character.IsInRangeOf(position, 30f))
            {
                newPickup = Function.Call<int>(Hash.CREATE_PICKUP_ROTATE, model.Hash, position.X, position.Y,
                    position.Z, 0, 0, heading, v_4, amount, 0, false, 0);
            }

            var pcObj = new DynamicPickup(newPickup);
            pcObj.Flag = v_4;
            pcObj.Amount = amount;
            pcObj.RealPosition = position;
            if (newPickup != -1)
            {
                var start = 0;
                while (pcObj.ObjectHandle == -1 && start < 20)
                {
                    start++;
                    Script.Yield();
                }

                pcObj.Dynamic = false;
                new Prop(pcObj.ObjectHandle).IsPersistent = true;

                if (q != null)
                    Quaternion.SetEntityQuaternion(new Prop(pcObj.ObjectHandle), q);
                pcObj.UpdatePos();
            }

            Pickups.Add(pcObj);
            pcObj.PickupHash = model.Hash;
            pcObj.Timeout = 1;
            pcObj.UID = _pickupIds++;
            return pcObj;
        }
예제 #7
0
파일: MapObject.cs 프로젝트: Guad/MapEditor
        private void ReloadPickup()
        {
            var newPickup = Function.Call<int>(Hash.CREATE_PICKUP_ROTATE, PickupHash, RealPosition.X, RealPosition.Y, RealPosition.Z, 0, 0, 0, Flag, Amount, 0, false, 0);

            var tmpDyn = new DynamicPickup(newPickup);

            var start = 0;
            while (tmpDyn.ObjectHandle == -1 && start < 20)
            {
                start++;
                Script.Yield();
                tmpDyn.Position = RealPosition;
            }

            tmpDyn.Dynamic = Dynamic;
            tmpDyn.Timeout = Timeout;
            new Prop(tmpDyn.ObjectHandle).IsPersistent = true;

            if (PickupHandle != -1)
                Remove();

            PickupHandle = newPickup;
        }
예제 #8
0
파일: MapEditor.cs 프로젝트: Guad/MapEditor
 public void AddItemToEntityMenu(DynamicPickup pickup)
 {
     if (pickup == null) return;
     var name = pickup.PickupName;
     _currentObjectsMenu.AddItem(new UIMenuItem("~h~[PICKUP]~h~ " + name, "pickup-" + pickup.UID));
     _currentObjectsMenu.RefreshIndex();
 }