public void ChangeOwner(Magma.Player p) { if (this.IsDeployableObject()) { this.GetObject <DeployableObject>().SetupCreator(p.PlayerClient.controllable); } }
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); }
public void AirdropAtPlayer(Magma.Player p, int rep) { for (int i = 0; i < rep; i++) { SupplyDropZone.CallAirDropAt(p.Location); } }
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; }
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; } }
public static void EntityDeployed(object entity) { Entity e = new Entity(entity); Magma.Player creator = e.Creator; if (OnEntityDeployed != null) { OnEntityDeployed(creator, e); } }
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); } }
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)); }
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); } }
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); }
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; } }
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; }
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; }
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); }
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); }
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); }
public void AirdropAtPlayer(Magma.Player p) { this.AirdropAtPlayer(p, 1); }
public void TeleportTo(Magma.Player p) { this.TeleportTo(p.X, p.Y, p.Z); }
public PlayerInv(Magma.Player player) { this.player = player; this._inv = player.PlayerClient.controllable.GetComponent <Inventory>(); this.InitItems(); }
public void OnPlayerGathering(Magma.Player p, GatherEvent ge) { this.Invoke("On_PlayerGathering", new object[] { p, ge }); }
public void OnPlayerSpawned(Magma.Player p, SpawnEvent se) { this.Invoke("On_PlayerSpawned", new object[] { p, se }); }
public void OnEntityDeployed(Magma.Player p, Entity e) { this.Invoke("On_EntityDeployed", new object[] { p, e }); }
public void OnPlayerDisconnected(Magma.Player player) { this.Invoke("On_PlayerDisconnected", new object[] { player }); }
public void OnCommand(Magma.Player player, string command, string[] args) { this.Invoke("On_Command", new object[] { player, command, args }); }
public void OnDoorUse(Magma.Player p, DoorEvent de) { this.Invoke("On_DoorUse", new object[] { p, de }); }
public void OnChat(Magma.Player player, ref ChatString text) { this.Invoke("On_Chat", new object[] { player, text }); }
public void OnBlueprintUse(Magma.Player p, BPUseEvent ae) { this.Invoke("On_BlueprintUse", new object[] { p, ae }); }
public Vector3 Infront(Magma.Player p, float length) { return(p.PlayerClient.controllable.transform.position + ((Vector3)(p.PlayerClient.controllable.transform.forward * length))); }
public object SpawnAtPlayer(string prefab, Magma.Player p, int rep) { return(this.Spawn(prefab, p.Location, p.PlayerClient.transform.rotation, rep)); }
public bool Contains(Magma.Player p) { return(this.Contains(p.Location)); }