Example #1
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (Music != null)
     {
         runtime.Player.PlayMusic(Music);
     }
 }
Example #2
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     foreach (var ship in script.GetShipsByLabel(Label))
     {
         SetVibe(runtime, ship.Nickname, Ship, Vibe);
     }
 }
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var sol  = script.Solars[Solar];
            var arch = sol.Archetype;

            runtime.Player.WorldAction(() => { runtime.Player.World.SpawnSolar(sol.Nickname, arch, sol.Loadout, sol.Position, sol.Orientation); });
        }
Example #4
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (!Ship.Equals("none", StringComparison.OrdinalIgnoreCase))
     {
         var p = runtime.Player;
         if (p.Game.GameData.TryGetLoadout(Loadout, out var loadout))
         {
             p.Character.Ship  = p.Game.GameData.GetShip(Ship);
             p.Character.Items = new List <NetCargo>();
             foreach (var equip in loadout.Equip)
             {
                 var e = p.Game.GameData.GetEquipment(equip.Nickname);
                 if (e == null)
                 {
                     continue;
                 }
                 p.Character.Items.Add(new NetCargo()
                 {
                     Equipment = e,
                     Hardpoint = equip.Hardpoint,
                     Health    = 1f,
                     Count     = 1
                 });
             }
         }
     }
 }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (script.Ships.ContainsKey(Target))
     {
         runtime.Player.WorldAction(() => { runtime.Player.World.NPCs.Despawn(runtime.Player.World.GameWorld.GetObject(Target)); });
     }
 }
Example #6
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var dlg    = script.Dialogs[Dialog];
            var netdlg = new NetDlgLine[dlg.Lines.Count];

            for (int i = 0; i < dlg.Lines.Count; i++)
            {
                var    d     = dlg.Lines[i];
                string voice = "trent_voice";
                if (!d.Source.Equals("Player", StringComparison.OrdinalIgnoreCase))
                {
                    var src = script.Ships[d.Source];
                    var npc = script.NPCs[src.NPC];
                    voice = npc.Voice;
                }

                var hash = FLHash.CreateID(d.Line);
                runtime.EnqueueLine(hash, d.Line);
                netdlg[i] = new NetDlgLine()
                {
                    Voice = voice,
                    Hash  = hash
                };
            }
            runtime.Player.PlayDialog(netdlg);
        }
Example #7
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var hash = FLHash.CreateID(Line);

            runtime.EnqueueLine(hash, Line);
            runtime.Player.PlayDialog(new NetDlgLine[] { new NetDlgLine()
                                                         {
                                                             Voice = Voice,
                                                             Hash  = hash
                                                         } });
        }
Example #8
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.WorldAction(() =>
     {
         var fuse    = runtime.Player.World.Server.GameData.GetFuse(Fuse);
         var gameObj = runtime.Player.World.GameWorld.GetObject(Target);
         if (!gameObj.TryGetComponent <SFuseRunnerComponent>(out var fr))
         {
             fr = new SFuseRunnerComponent(gameObj);
             gameObj.Components.Add(fr);
         }
         fr.Run(fuse);
     });
 }
Example #9
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     FLLog.Info("Act_CallThorn", Thorn);
     runtime.Player.WorldAction(() =>
     {
         int mainObject = 0;
         if (MainObject != null)
         {
             var gameObj = runtime.Player.World.GameWorld.GetObject(MainObject);
             mainObject  = gameObj?.NetID ?? 0;
         }
         FLLog.Info("Server", $"Calling Thorn {Thorn} with mainObject `{mainObject}`");
         runtime.Player.CallThorn(Thorn, mainObject);
     });
 }
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var form = script.Formations[Formation];
            var fpos = Position ?? form.Position;

            SpawnShip(form.Ships[0], fpos, form.Orientation, null, script, runtime);
            var mat = Matrix4x4.CreateFromQuaternion(form.Orientation) *
                      Matrix4x4.CreateTranslation(fpos);
            int j = 0;

            for (int i = 1; i < form.Ships.Count; i++)
            {
                var pos = Vector3.Transform(formationOffsets[j++], mat);
                SpawnShip(form.Ships[i], pos, form.Orientation, null, script, runtime);
            }
        }
Example #11
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var netdlg = new NetDlgLine[1];
            var src    = script.Ships[Source];
            var npc    = script.NPCs[src.NPC];
            var voice  = npc.Voice;
            var hash   = FLHash.CreateID(Line);

            runtime.EnqueueLine(hash, Line);
            netdlg[0] = new NetDlgLine()
            {
                Voice = voice,
                Hash  = hash
            };
            runtime.Player.PlayDialog(netdlg);
        }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     if (Ship.Equals("player", StringComparison.OrdinalIgnoreCase))
     {
         runtime.Player.RemoteClient.ForceMove(Position);
     }
     else if (script.Ships.ContainsKey(Ship))
     {
         runtime.Player.WorldAction(() =>
         {
             var obj  = runtime.Player.World.GameWorld.GetObject(Ship);
             var quat = Quaternion ?? obj.LocalTransform.ExtractRotation();
             obj.SetLocalTransform(Matrix4x4.CreateFromQuaternion(quat) * Matrix4x4.CreateTranslation(Position));
         });
     }
 }
Example #13
0
        public override void Invoke(MissionRuntime runtime, MissionScript script)
        {
            var ol = script.ObjLists[List].Construct();

            if (script.Ships.ContainsKey(Target))
            {
                runtime.Player.World.NPCs.NpcDoAction(Target,
                                                      (npc) => { npc.GetComponent <SNPCComponent>().SetState(ol); });
            }
            else if (script.Formations.TryGetValue(Target, out var formation))
            {
                foreach (var s in formation.Ships)
                {
                    runtime.Player.World.NPCs.NpcDoAction(s,
                                                          (npc) => { npc.GetComponent <SNPCComponent>().SetState(ol); });
                }
            }
        }
Example #14
0
 protected void SetVibe(MissionRuntime runtime, string target, string other, VibeSet vibe)
 {
     runtime.Player.WorldAction(() =>
     {
         var tgt = runtime.Player.World.GameWorld.GetObject(target);
         var o   = runtime.Player.World.GameWorld.GetObject(other);
         if (tgt != null && o != null && tgt.TryGetComponent <SNPCComponent>(out var npc))
         {
             if (vibe == VibeSet.REP_FRIEND_MAXIMUM ||
                 vibe == VibeSet.REP_FRIEND_THRESHOLD)
             {
                 npc.HostileNPCs.Remove(o);
             }
             else
             {
                 npc.HostileNPCs.Add(o);
             }
         }
     });
 }
Example #15
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.ForceLand(Base);
 }
Example #16
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     SetVibe(runtime, Target, Other, Vibe);
 }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.RemoteClient.ForceMove(Position);
 }
Example #18
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.DeactivateTrigger(Trigger);
 }
Example #19
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.CallThorn(null, 0);
 }
Example #20
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.RemoteClient.PopupOpen(Title, Contents, ID);
 }
Example #21
0
 public abstract void Invoke(MissionRuntime runtime, MissionScript script);
Example #22
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.Character.UpdateCredits(runtime.Player.Character.Credits + Amount);
 }
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     SpawnShip(Ship, Position, Orientation, ObjList, script, runtime);
 }
Example #24
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.PlaySound(Effect);
 }
        protected void SpawnShip(string msnShip, Vector3?spawnpos, Quaternion?spawnorient, string objList, MissionScript script, MissionRuntime runtime)
        {
            var ship   = script.Ships[msnShip];
            var npcDef = script.NPCs[ship.NPC];

            script.NpcShips.TryGetValue(npcDef.NpcShipArch, out var shipArch);

            if (shipArch == null)
            {
                shipArch = runtime.Player.Game.GameData.Ini.NPCShips.ShipArches.First(x =>
                                                                                      x.Nickname.Equals(npcDef.NpcShipArch, StringComparison.OrdinalIgnoreCase));
            }

            var     pos    = spawnpos ?? ship.Position;
            var     orient = spawnorient ?? ship.Orientation;
            AiState state  = null;

            if (!string.IsNullOrEmpty(objList))
            {
                state = script.ObjLists[objList].Construct();
            }

            runtime.Player.WorldAction(() =>
            {
                runtime.Player.World.Server.GameData.TryGetLoadout(shipArch.Loadout, out var ld);
                var pilot = runtime.Player.World.Server.GameData.GetPilot(shipArch.Pilot);
                var obj   = runtime.Player.World.NPCs.DoSpawn(ship.Nickname, ld, pilot, pos, orient);
                obj.GetComponent <SNPCComponent>().SetState(state);
            });
        }
Example #26
0
 public override void Invoke(MissionRuntime runtime, MissionScript script)
 {
     runtime.Player.AddRTC(RTC);
 }