2019-08-19 12:39:23 +00:00
|
|
|
#![deny(unsafe_code)]
|
2019-06-27 14:37:33 +00:00
|
|
|
#![type_length_limit = "1664759"]
|
2020-01-29 16:56:28 +00:00
|
|
|
#![feature(
|
|
|
|
arbitrary_enum_discriminant,
|
2020-04-10 02:36:35 +00:00
|
|
|
option_unwrap_none,
|
2020-01-29 16:56:28 +00:00
|
|
|
bool_to_option,
|
|
|
|
label_break_value,
|
|
|
|
trait_alias,
|
|
|
|
type_alias_impl_trait
|
|
|
|
)]
|
2019-02-19 16:59:50 +00:00
|
|
|
|
2020-02-01 20:39:39 +00:00
|
|
|
#[macro_use] extern crate serde_derive;
|
|
|
|
#[macro_use] extern crate log;
|
2019-01-02 17:23:31 +00:00
|
|
|
|
2019-04-13 01:40:59 +00:00
|
|
|
pub mod assets;
|
2019-12-11 05:28:45 +00:00
|
|
|
pub mod astar;
|
2019-01-12 15:57:19 +00:00
|
|
|
pub mod clock;
|
2019-01-02 19:22:01 +00:00
|
|
|
pub mod comp;
|
2019-09-25 15:52:58 +00:00
|
|
|
pub mod effect;
|
2019-08-07 15:39:16 +00:00
|
|
|
pub mod event;
|
2019-01-13 20:53:55 +00:00
|
|
|
pub mod figure;
|
2020-01-22 03:12:17 +00:00
|
|
|
pub mod generation;
|
2019-03-03 22:02:38 +00:00
|
|
|
pub mod msg;
|
2019-06-01 19:49:34 +00:00
|
|
|
pub mod npc;
|
2020-01-22 03:12:17 +00:00
|
|
|
pub mod path;
|
2019-04-29 20:37:19 +00:00
|
|
|
pub mod ray;
|
2019-10-04 00:41:42 +00:00
|
|
|
pub mod region;
|
2020-02-06 22:32:26 +00:00
|
|
|
pub mod spiral;
|
2019-01-02 19:22:01 +00:00
|
|
|
pub mod state;
|
2020-01-12 23:06:52 +00:00
|
|
|
pub mod states;
|
2020-04-17 23:29:01 +00:00
|
|
|
pub mod store;
|
2019-11-24 20:12:03 +00:00
|
|
|
pub mod sync;
|
2019-03-02 03:48:30 +00:00
|
|
|
pub mod sys;
|
2019-01-02 19:22:01 +00:00
|
|
|
pub mod terrain;
|
2019-01-14 23:13:58 +00:00
|
|
|
pub mod util;
|
2019-01-02 19:22:01 +00:00
|
|
|
pub mod vol;
|
2019-04-29 20:37:19 +00:00
|
|
|
pub mod volumes;
|
2019-04-23 22:48:31 +00:00
|
|
|
|
2020-02-01 20:39:39 +00:00
|
|
|
/// The networking module containing high-level wrappers of `TcpListener` and
|
|
|
|
/// `TcpStream` (`PostOffice` and `PostBox` respectively) and data types used by
|
|
|
|
/// both the server and client. # Examples
|
2019-05-07 18:59:06 +00:00
|
|
|
/// ```
|
2019-02-19 16:59:50 +00:00
|
|
|
/// use std::net::SocketAddr;
|
2020-02-01 20:39:39 +00:00
|
|
|
/// use veloren_common::net::{PostBox, PostOffice};
|
2019-02-19 16:59:50 +00:00
|
|
|
///
|
|
|
|
/// let listen_addr = SocketAddr::from(([0, 0, 0, 0], 12345u16));
|
|
|
|
/// let conn_addr = SocketAddr::from(([127, 0, 0, 1], 12345u16));
|
|
|
|
///
|
2019-05-07 18:59:06 +00:00
|
|
|
/// let mut server: PostOffice<String, String> = PostOffice::bind(listen_addr).unwrap();
|
|
|
|
/// let mut client: PostBox<String, String> = PostBox::to(conn_addr).unwrap();
|
2019-02-19 16:59:50 +00:00
|
|
|
/// std::thread::sleep(std::time::Duration::from_millis(100));
|
|
|
|
///
|
2019-05-07 18:59:06 +00:00
|
|
|
/// let mut scon = server.new_postboxes().next().unwrap();
|
2019-02-19 16:59:50 +00:00
|
|
|
/// std::thread::sleep(std::time::Duration::from_millis(100));
|
|
|
|
///
|
2019-05-07 18:59:06 +00:00
|
|
|
/// scon.send_message(String::from("foo"));
|
|
|
|
/// client.send_message(String::from("bar"));
|
2019-02-19 16:59:50 +00:00
|
|
|
/// std::thread::sleep(std::time::Duration::from_millis(100));
|
|
|
|
///
|
2019-05-07 18:59:06 +00:00
|
|
|
/// assert_eq!("foo", client.next_message().unwrap());
|
|
|
|
/// assert_eq!("bar", scon.next_message().unwrap());
|
2019-02-19 16:59:50 +00:00
|
|
|
/// ```
|
|
|
|
pub mod net;
|
2019-07-17 22:10:42 +00:00
|
|
|
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
|
|
pub enum ChatType {
|
2019-07-21 18:34:52 +00:00
|
|
|
Broadcast,
|
2019-07-17 22:10:42 +00:00
|
|
|
Chat,
|
2019-07-21 18:34:52 +00:00
|
|
|
GameUpdate,
|
|
|
|
Private,
|
2019-07-17 22:10:42 +00:00
|
|
|
Tell,
|
2019-07-29 14:40:46 +00:00
|
|
|
Say,
|
|
|
|
Group,
|
|
|
|
Faction,
|
|
|
|
Meta,
|
|
|
|
Kill,
|
2019-07-17 22:10:42 +00:00
|
|
|
}
|