wip more lua stuff (events + cleanup/util)

This commit is contained in:
Luuk van Oijen
2023-11-26 00:22:28 +01:00
parent 56cd0eca11
commit 6a1baa249a
3 changed files with 30 additions and 11 deletions

View File

@@ -399,10 +399,6 @@ impl Server {
ip: String::from("not yet implemented"),
beammp_id: beammp_id.clone(),
} }, Some(tx)))).await;
// TODO: This never returns, because it blocks the entire process function
// from running, so it never manages to run the function correctly.
// let res = rx.await.unwrap_or(Argument::Number(-1f32));
// debug!("res: {:?}", res);
vrx.push(rx);
}
self.clients_queue.push((client, vrx, Vec::new()));
@@ -437,7 +433,13 @@ impl Server {
}
}
if allowed {
let pid = client.id;
self.clients.push(client);
for plugin in &mut self.plugins {
plugin.send_event(PluginBoundPluginEvent::CallEventHandler((ScriptEvent::OnPlayerConnecting { pid }, None))).await;
plugin.send_event(PluginBoundPluginEvent::CallEventHandler((ScriptEvent::OnPlayerJoining { pid }, None))).await;
}
} else {
// TODO: Custom kick message defined from within lua somehow?
// TODO: Kicking the client and then immediately dropping them results in the