private string CanTeleportFrom(BasePlayer player) { if (Raid.IsRaidBlocked(player) != null) { return("raid block"); } if (!player.IsAlive()) { return("dead"); } if (player.IsWounded()) { return("wounded"); } if (!player.CanBuild()) { return("building blocked"); } if (player.IsSwimming()) { return("swimming"); } if (player.inventory.crafting.queue.Count > 0) { return("crafting"); } return(null); }
private string CanTeleportToPlayer(BasePlayer player, BasePlayer target, bool checkPendingRequests = true) { if (checkPendingRequests && FindTPR(player, target) != null) { return("pending request"); } if (checkPendingRequests && FindTPR(target, player) != null) { return("pending request"); } if (Raid.IsRaidBlocked(target) != null) { return("raid block"); } if (!target.IsAlive()) { return("dead"); } if (target.IsWounded()) { return("wounded"); } if (!target.CanBuild()) { return("building blocked"); } if (target.IsSwimming()) { return("swimming"); } return(null); }
private static void Remove(BasePlayer player) { RaycastHit hit; BaseEntity entity = Physics.Raycast(player.eyes.HeadRay(), out hit, 3.0f, colliderRemovable) ? hit.GetEntity() : null; if (entity == null) { player.ChatMessage("<color=#d00>Error</color> no valid entity, or entyity is too far."); return; } if (!player.CanBuild()) { player.ChatMessage("<color=#d00>Error</color> no building priviliges."); return; } if (entity.OwnerID != player.userID && !Friends.HasFriend(entity.OwnerID, player.userID)) { player.ChatMessage($"<color=#d00>Error</color> you are not the owner of this entity."); return; } if (Raid.IsRaidBlocked(player) != null) { player.ChatMessage($"<color=#d00>Error</color> you are in a raidblocked zone."); return; } if (entity is StorageContainer && (entity as StorageContainer).inventory.itemList.Count > 0) { DropUtil.DropItems((entity as StorageContainer).inventory, entity.transform.position); } entity.Kill(BaseNetworkable.DestroyMode.Gib); }