GeezerVison is showing github.com — Add 'tick_count' field to 'Game'. (#378) · lineargraph/feather@b9249fe
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: feather/common/src/game.rs +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,6 +48,9 @@ pub struct Game { |
48 | 48 | /// A spatial index to efficiently find which entities are in a given chunk. |
49 | 49 | pub chunk_entities: ChunkEntities, |
50 | 50 |
|
| 51 | + /// Total ticks elapsed since the server started. |
| 52 | + pub tick_count: u64, |
| 53 | + |
51 | 54 | entity_spawn_callbacks: Vec<EntitySpawnCallback>, |
52 | 55 |
|
53 | 56 | entity_builder: EntityBuilder, |
@@ -68,6 +71,7 @@ impl Game { |
68 | 71 | system_executor: Rc::new(RefCell::new(SystemExecutor::new())), |
69 | 72 | resources: Arc::new(Resources::new()), |
70 | 73 | chunk_entities: ChunkEntities::default(), |
| 74 | + tick_count: 0, |
71 | 75 | entity_spawn_callbacks: Vec::new(), |
72 | 76 | entity_builder: EntityBuilder::new(), |
73 | 77 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: feather/server/src/main.rs +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -89,6 +89,7 @@ fn create_tick_loop(mut game: Game) -> TickLoop { |
89 | 89 | TickLoop::new(move || { |
90 | 90 | let systems = Rc::clone(&game.system_executor); |
91 | 91 | systems.borrow_mut().run(&mut game); |
| 92 | + game.tick_count += 1; |
92 | 93 |
|
93 | 94 | false |
94 | 95 | }) |
|