Beispiel #1
0
 public SerializablePickupObjective CreatePickupObjective(SerializablePickupObjective orig)
 {
     var tmpObject = new Rage.Object(new Model("prop_mp_repair"), orig.GetObject().Position);
     tmpObject.Rotation = orig.GetObject().Rotation;
     tmpObject.Position = orig.GetObject().Position;
     tmpObject.IsPositionFrozen = true;
     var tmpObj = (SerializablePickupObjective)orig.Clone();
     tmpObj.SetObject(tmpObject);
     CurrentMission.Objectives.Add(tmpObj);
     return tmpObj;
 }
Beispiel #2
0
        public void LoadMission(MissionData tmpMiss)
        {

            if(tmpMiss.Cutscenes == null)
                tmpMiss.Cutscenes = new List<SerializableCutscene>();


            GameFiber.StartNew(delegate
            {
                LoadInteriors(tmpMiss);

                foreach (var vehicle in tmpMiss.Vehicles)
                {
                    var newv = new Vehicle(Util.RequestModel(vehicle.ModelHash), vehicle.Position)
                    {
                        PrimaryColor = Color.FromArgb((int)vehicle.PrimaryColor.X, (int)vehicle.PrimaryColor.Y,
                            (int)vehicle.PrimaryColor.Z),
                        SecondaryColor = Color.FromArgb((int)vehicle.SecondaryColor.X, (int)vehicle.SecondaryColor.Y,
                            (int)vehicle.SecondaryColor.Z),
                    };

                    var blip = newv.AttachBlip();
                    blip.Color = Color.Orange;
                    blip.Scale = 0.7f;
                    _blips.Add(blip);

                    newv.Rotation = vehicle.Rotation;
                    vehicle.SetEntity(newv);
                }

                foreach (var ped in tmpMiss.Actors)
                {
                    ped.SetEntity(new Ped(Util.RequestModel(ped.ModelHash), ped.Position - new Vector3(0,0,1), ped.Rotation.Yaw)
                    {
                        BlockPermanentEvents = true,
                    });
                    var blip = ped.GetEntity().AttachBlip();
                    blip.Color = Color.Orange;
                    blip.Scale = 0.7f;
                    _blips.Add(blip);
                    if (ped.WeaponHash != 0)
                        ((Ped)ped.GetEntity()).GiveNewWeapon(ped.WeaponHash, ped.WeaponAmmo, true);

                }

                foreach (var o in tmpMiss.Objects)
                {
                    var newo = new Object(o.ModelHash, o.Position);
                    newo.Position = o.Position;
                    o.SetEntity(newo);
                }

                foreach (var spawnpoint in tmpMiss.Spawnpoints)
                {
                    spawnpoint.SetEntity(new Ped(spawnpoint.ModelHash, spawnpoint.Position - new Vector3(0,0,1), spawnpoint.Rotation.Yaw)
                    {
                        BlockPermanentEvents = true,
                    });
                    if(spawnpoint.WeaponHash != 0)
                    ((Ped)spawnpoint.GetEntity()).GiveNewWeapon(spawnpoint.WeaponHash, spawnpoint.WeaponAmmo, true);
                    var blip = spawnpoint.GetEntity().AttachBlip();
                    blip.Color = Color.White;
                    _blips.Add(blip);
                }

                foreach (var pickup in tmpMiss.Pickups)
                {
                    var tmpObject = new Rage.Object("prop_mp_repair", pickup.Position);
                    tmpObject.Rotation = pickup.Rotation;
                    tmpObject.Position = pickup.Position;
                    tmpObject.IsPositionFrozen = true;
                    pickup.SetEntity(tmpObject);
                }

                foreach (var ped in tmpMiss.Objectives.OfType<SerializableActorObjective>())
                {
                    ped.SetPed(new Ped(Util.RequestModel(ped.ModelHash), ped.Position - new Vector3(0,0,1), ped.Rotation.Yaw)
                    {
                        BlockPermanentEvents = true,
                    });
                    if (ped.WeaponHash != 0)
                        ((Ped)ped.GetPed()).GiveNewWeapon(ped.WeaponHash, ped.WeaponAmmo, true);
                    var blip = ped.GetPed().AttachBlip();
                    blip.Color = Color.Red;
                    blip.Scale = 0.7f;
                    _blips.Add(blip);
                }

                foreach (var vehicle in tmpMiss.Objectives.OfType<SerializableVehicleObjective>())
                {
                    var newv = new Vehicle(Util.RequestModel(vehicle.ModelHash), vehicle.Position)
                    {
                        PrimaryColor = Color.FromArgb((int)vehicle.PrimaryColor.X, (int)vehicle.PrimaryColor.Y,
                            (int)vehicle.PrimaryColor.Z),
                        SecondaryColor = Color.FromArgb((int)vehicle.SecondaryColor.X, (int)vehicle.SecondaryColor.Y,
                            (int)vehicle.SecondaryColor.Z),
                    };
                    newv.Rotation = vehicle.Rotation;
                    var blip = newv.AttachBlip();
                    blip.Color = Color.Red;
                    blip.Scale = 0.7f;
                    _blips.Add(blip);
                    vehicle.SetVehicle(newv);
                }

                foreach (var pickup in tmpMiss.Objectives.OfType<SerializablePickupObjective>())
                {
                    var tmpObject = new Rage.Object("prop_mp_repair", pickup.Position);

                    tmpObject.Rotation = pickup.Rotation;
                    tmpObject.Position = pickup.Position;
                    tmpObject.IsPositionFrozen = true;
                    pickup.SetObject(tmpObject);
                }
            });
            CurrentMission = tmpMiss;

            EnterFreecam();
            menuDirty = true;
        }
Beispiel #3
0
 public SerializablePickupObjective CreatePickupObjective(int weaponHash, Vector3 pos, Rotator rot)
 {
     var tmpObject = new Rage.Object(new Model("prop_mp_repair"), pos);
     tmpObject.Rotation = rot;
     tmpObject.Position = pos;
     tmpObject.IsPositionFrozen = true;
     var tmpObj = new SerializablePickupObjective();
     tmpObj.SetObject(tmpObject);
     tmpObj.SpawnAfter = 0;
     tmpObj.ActivateAfter = 0;
     tmpObj.Respawn = false;
     tmpObj.Ammo = 9999;
     tmpObj.PickupHash = weaponHash;
     CurrentMission.Objectives.Add(tmpObj);
     return tmpObj;
 }