Implement tick-based game loop, combat overhaul, and attack-any-NPC
Replace immediate combat with a 3-second tick engine that resolves actions, NPC AI, status effects, respawns, and passive regeneration. Players queue combat actions (attack/defend/flee/use) that resolve on the next tick. Any NPC can now be attacked — non-hostile targets incur attitude penalties instead of being blocked. Status effects persist in the database and continue ticking while players are offline. Made-with: Cursor
This commit is contained in:
@@ -9,6 +9,7 @@ use tokio::net::TcpListener;
|
||||
use mudserver::db;
|
||||
use mudserver::game;
|
||||
use mudserver::ssh;
|
||||
use mudserver::tick;
|
||||
use mudserver::world;
|
||||
|
||||
const DEFAULT_PORT: u16 = 2222;
|
||||
@@ -82,6 +83,13 @@ async fn main() {
|
||||
let config = Arc::new(config);
|
||||
|
||||
let state = Arc::new(Mutex::new(game::GameState::new(loaded_world, db)));
|
||||
|
||||
// Spawn tick engine
|
||||
let tick_state = state.clone();
|
||||
tokio::spawn(async move {
|
||||
tick::run_tick_engine(tick_state).await;
|
||||
});
|
||||
|
||||
let mut server = ssh::MudServer::new(state);
|
||||
|
||||
let listener = TcpListener::bind(("0.0.0.0", port)).await.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user