Make fake ping exportable
This commit is contained in:
parent
953df8d2d0
commit
1f7f412882
@ -27,6 +27,9 @@ use crate::{
|
|||||||
#[derive(GodotClass)]
|
#[derive(GodotClass)]
|
||||||
#[class(base=Node)]
|
#[class(base=Node)]
|
||||||
pub struct NetworkManager {
|
pub struct NetworkManager {
|
||||||
|
#[export]
|
||||||
|
fake_ping: u64,
|
||||||
|
|
||||||
pub peer: Option<PeerKind>,
|
pub peer: Option<PeerKind>,
|
||||||
|
|
||||||
last_hello: Instant,
|
last_hello: Instant,
|
||||||
@ -42,6 +45,7 @@ pub const NETWORK_SINGLETON_NAME: &str = "NetworkManagerGlob";
|
|||||||
impl INode for NetworkManager {
|
impl INode for NetworkManager {
|
||||||
fn init(base: Base<Node>) -> Self {
|
fn init(base: Base<Node>) -> Self {
|
||||||
NetworkManager {
|
NetworkManager {
|
||||||
|
fake_ping: 0,
|
||||||
peer: None,
|
peer: None,
|
||||||
|
|
||||||
last_hello: Instant::now(),
|
last_hello: Instant::now(),
|
||||||
@ -271,7 +275,7 @@ impl NetworkManager {
|
|||||||
None,
|
None,
|
||||||
PeerConfig::default()
|
PeerConfig::default()
|
||||||
.with_identifier(NetworkManager::identifier())
|
.with_identifier(NetworkManager::identifier())
|
||||||
.with_additional_ping(Duration::from_millis(1000)),
|
.with_additional_ping(Duration::from_millis(self.fake_ping)),
|
||||||
);
|
);
|
||||||
match peer {
|
match peer {
|
||||||
Ok(mut peer) => {
|
Ok(mut peer) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user