Пример #1
0
 public void ChangeOwner(Magma.Player p)
 {
     if (this.IsDeployableObject())
     {
         this.GetObject <DeployableObject>().SetupCreator(p.PlayerClient.controllable);
     }
 }
Пример #2
0
        public StructureMaster CreateSM(Magma.Player p, float x, float y, float z, Quaternion rot)
        {
            StructureMaster master = NetCull.InstantiateClassic <StructureMaster>(Bundling.Load <StructureMaster>("content/structures/StructureMasterPrefab"), new Vector3(x, y, z), rot, 0);

            master.SetupCreator(p.PlayerClient.controllable);
            return(master);
        }
Пример #3
0
 public void AirdropAtPlayer(Magma.Player p, int rep)
 {
     for (int i = 0; i < rep; i++)
     {
         SupplyDropZone.CallAirDropAt(p.Location);
     }
 }
Пример #4
0
        public static void PlayerHurt(ref DamageEvent e)
        {
            HurtEvent he = new HurtEvent(ref e);

            if (!(he.Attacker is NPC) && !(he.Victim is NPC))
            {
                Magma.Player attacker = he.Attacker as Magma.Player;
                Magma.Player victim   = he.Victim as Magma.Player;
                Zone3D       zoned    = Zone3D.GlobalContains(attacker);
                if ((zoned != null) && !zoned.PVP)
                {
                    attacker.Message("You are in a PVP restricted area.");
                    he.DamageAmount = 0f;
                    e = he.DamageEvent;
                    return;
                }
                zoned = Zone3D.GlobalContains(victim);
                if ((zoned != null) && !zoned.PVP)
                {
                    attacker.Message(victim.Name + " is in a PVP restricted area.");
                    he.DamageAmount = 0f;
                    e = he.DamageEvent;
                    return;
                }
            }
            if (OnPlayerHurt != null)
            {
                OnPlayerHurt(he);
            }
            e = he.DamageEvent;
        }
Пример #5
0
 public HurtEvent(ref DamageEvent d)
 {
     Magma.Player player = Magma.Player.FindByPlayerClient(d.attacker.client);
     if (player != null)
     {
         this.Attacker = player;
     }
     else
     {
         this.Attacker = new NPC(d.attacker.character);
     }
     Magma.Player player2 = Magma.Player.FindByPlayerClient(d.victim.client);
     if (player2 != null)
     {
         this.Victim = player2;
     }
     else
     {
         this.Victim = new NPC(d.victim.character);
     }
     this.DamageEvent = d;
     this.WeaponData  = null;
     this.IsDecay     = false;
     if (d.extraData != null)
     {
         WeaponImpact weaponImpact = d.extraData as WeaponImpact;
         this.WeaponData = weaponImpact;
         string weaponName = "";
         if (weaponImpact.dataBlock != null)
         {
             weaponName = weaponImpact.dataBlock.name;
         }
         this.WeaponName = weaponName;
     }
 }
Пример #6
0
        public static void EntityDeployed(object entity)
        {
            Entity e = new Entity(entity);

            Magma.Player creator = e.Creator;
            if (OnEntityDeployed != null)
            {
                OnEntityDeployed(creator, e);
            }
        }
Пример #7
0
        public static void PlayerSpawned(PlayerClient pc, Vector3 pos, bool camp)
        {
            Magma.Player player = Magma.Player.FindByPlayerClient(pc);
            SpawnEvent   se     = new SpawnEvent(pos, camp);

            if ((OnPlayerSpawned != null) && (player != null))
            {
                OnPlayerSpawned(player, se);
            }
        }
Пример #8
0
        public static Vector3 PlayerSpawning(PlayerClient pc, Vector3 pos, bool camp)
        {
            Magma.Player player = Magma.Player.FindByPlayerClient(pc);
            SpawnEvent   se     = new SpawnEvent(pos, camp);

            if ((OnPlayerSpawning != null) && (player != null))
            {
                OnPlayerSpawning(player, se);
            }
            return(new Vector3(se.X, se.Y, se.Z));
        }
Пример #9
0
 public static void PlayerDisconnect(NetUser user)
 {
     Magma.Player item = Magma.Player.FindByPlayerClient(user.playerClient);
     if (item != null)
     {
         Magma.Server.GetServer().Players.Remove(item);
     }
     if (OnPlayerDisconnected != null)
     {
         OnPlayerDisconnected(item);
     }
 }
Пример #10
0
        public static bool PlayerConnect(NetUser user)
        {
            Magma.Player item = new Magma.Player(user.playerClient);
            Magma.Server.GetServer().Players.Add(item);
            bool connected = user.connected;

            if (OnPlayerConnected != null)
            {
                OnPlayerConnected(item);
            }
            return(connected);
        }
Пример #11
0
 private void Hooks_OnPlayerKilled(DeathEvent de)
 {
     try
     {
         Magma.Player victim = de.Victim as Magma.Player;
         if (victim.GameID == this.GameID)
         {
             this.justDied = true;
         }
     }
     catch (Exception)
     {
         this.invError = true;
     }
 }
Пример #12
0
        public static void PlayerGatherWood(IMeleeWeaponItem rec, ResourceTarget rt, ref ItemDataBlock db, ref int amount, ref string name)
        {
            Magma.Player player = Magma.Player.FindByNetworkPlayer(rec.inventory.networkView.owner);
            GatherEvent  ge     = new GatherEvent(rt, db, amount)
            {
                Item = "Wood"
            };

            if (OnPlayerGathering != null)
            {
                OnPlayerGathering(player, ge);
            }
            db     = Magma.Server.GetServer().Items.Find(ge.Item);
            amount = ge.Quantity;
            name   = ge.Item;
        }
Пример #13
0
        public static void PlayerGather(Inventory rec, ResourceTarget rt, ResourceGivePair rg, ref int amount)
        {
            Magma.Player player = Magma.Player.FindByNetworkPlayer(rec.networkView.owner);
            GatherEvent  ge     = new GatherEvent(rt, rg, amount);

            if (OnPlayerGathering != null)
            {
                OnPlayerGathering(player, ge);
            }
            amount = ge.Quantity;
            if (!ge.Override)
            {
                amount = Mathf.Min(amount, rg.AmountLeft());
            }
            rg._resourceItemDatablock = ge.Item;
            rg.ResourceItemName       = ge.Item;
        }
Пример #14
0
 public static bool BlueprintUse(IBlueprintItem item, BlueprintDataBlock bdb)
 {
     Magma.Player player = Magma.Player.FindByPlayerClient(item.controllable.playerClient);
     if (player != null)
     {
         BPUseEvent ae = new BPUseEvent(bdb);
         if (OnBlueprintUse != null)
         {
             OnBlueprintUse(player, ae);
         }
         if (!ae.Cancel)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #15
0
 public Magma.Player FindPlayer(string s)
 {
     Magma.Player player = Magma.Player.FindBySteamID(s);
     if (player != null)
     {
         return(player);
     }
     player = Magma.Player.FindByGameID(s);
     if (player != null)
     {
         return(player);
     }
     player = Magma.Player.FindByName(s);
     if (player != null)
     {
         return(player);
     }
     return(null);
 }
Пример #16
0
 public Magma.Player Find(string search)
 {
     Magma.Player player = FindBySteamID(search);
     if (player != null)
     {
         return(player);
     }
     player = FindByGameID(search);
     if (player != null)
     {
         return(player);
     }
     player = FindByName(search);
     if (player != null)
     {
         return(player);
     }
     return(null);
 }
Пример #17
0
 public void AirdropAtPlayer(Magma.Player p)
 {
     this.AirdropAtPlayer(p, 1);
 }
Пример #18
0
 public void TeleportTo(Magma.Player p)
 {
     this.TeleportTo(p.X, p.Y, p.Z);
 }
Пример #19
0
 public PlayerInv(Magma.Player player)
 {
     this.player = player;
     this._inv   = player.PlayerClient.controllable.GetComponent <Inventory>();
     this.InitItems();
 }
Пример #20
0
 public void OnPlayerGathering(Magma.Player p, GatherEvent ge)
 {
     this.Invoke("On_PlayerGathering", new object[] { p, ge });
 }
Пример #21
0
 public void OnPlayerSpawned(Magma.Player p, SpawnEvent se)
 {
     this.Invoke("On_PlayerSpawned", new object[] { p, se });
 }
Пример #22
0
 public void OnEntityDeployed(Magma.Player p, Entity e)
 {
     this.Invoke("On_EntityDeployed", new object[] { p, e });
 }
Пример #23
0
 public void OnPlayerDisconnected(Magma.Player player)
 {
     this.Invoke("On_PlayerDisconnected", new object[] { player });
 }
Пример #24
0
 public void OnCommand(Magma.Player player, string command, string[] args)
 {
     this.Invoke("On_Command", new object[] { player, command, args });
 }
Пример #25
0
 public void OnDoorUse(Magma.Player p, DoorEvent de)
 {
     this.Invoke("On_DoorUse", new object[] { p, de });
 }
Пример #26
0
 public void OnChat(Magma.Player player, ref ChatString text)
 {
     this.Invoke("On_Chat", new object[] { player, text });
 }
Пример #27
0
 public void OnBlueprintUse(Magma.Player p, BPUseEvent ae)
 {
     this.Invoke("On_BlueprintUse", new object[] { p, ae });
 }
Пример #28
0
 public Vector3 Infront(Magma.Player p, float length)
 {
     return(p.PlayerClient.controllable.transform.position + ((Vector3)(p.PlayerClient.controllable.transform.forward * length)));
 }
Пример #29
0
 public object SpawnAtPlayer(string prefab, Magma.Player p, int rep)
 {
     return(this.Spawn(prefab, p.Location, p.PlayerClient.transform.rotation, rep));
 }
Пример #30
0
 public bool Contains(Magma.Player p)
 {
     return(this.Contains(p.Location));
 }