A card game engine for TCGs, primarily Magic: The Gathering but with support for others
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adding in some stuff to the gdext crate, need to move it out of there and into the managrove-core crate

+58 -1
+2 -1
gdext/Cargo.toml
··· 7 7 crate-type = ["cdylib"] 8 8 9 9 [dependencies] 10 + uuid = { version = "1.23.1", features = ["v4", "v5"] } 10 11 11 12 [dependencies.managrove-core] 12 13 path = "../managrove-core" 13 14 14 15 [dependencies.godot] 15 16 version = "0.5.1" 16 - features = ["api-4-6"] 17 + features = ["api-4-6"]
+12
gdext/src/game/card.rs
··· 1 + use uuid::Uuid; 2 + 3 + pub struct CardDefId(Uuid); 4 + pub struct CardId(Uuid); 5 + 6 + pub struct Card { 7 + // TODO 8 + } 9 + 10 + pub struct CardInstance { 11 + // TODO 12 + }
+4
gdext/src/game/mod.rs
··· 1 + pub mod card; 2 + pub mod state; 3 + pub mod player; 4 + pub mod zone;
+7
gdext/src/game/player.rs
··· 1 + use uuid::Uuid; 2 + 3 + pub struct PlayerId(Uuid); 4 + 5 + pub struct Player { 6 + // TODO 7 + }
+18
gdext/src/game/state.rs
··· 1 + use std::collections::HashMap; 2 + use crate::game::{card::{CardId, CardInstance}, player::{PlayerId, Player}, zone::{ZoneId, Zone}}; 3 + 4 + pub struct GameState { 5 + players: HashMap<PlayerId, Player>, 6 + zones: HashMap<ZoneId, Zone>, 7 + cards: HashMap<CardId, CardInstance> 8 + } 9 + 10 + impl GameState { 11 + pub fn new() -> Self { 12 + Self { 13 + players: HashMap::new(), 14 + zones: HashMap::new(), 15 + cards: HashMap::new() 16 + } 17 + } 18 + }
+7
gdext/src/game/zone.rs
··· 1 + use uuid::Uuid; 2 + 3 + pub struct ZoneId(Uuid); 4 + 5 + pub struct Zone { 6 + // TODO 7 + }
+8
gdext/src/lib.rs
··· 1 + use std::collections::HashMap; 1 2 use godot::prelude::*; 3 + use crate::game::{card::{CardDefId, Card}, state::GameState}; 4 + 5 + mod game; 2 6 3 7 #[derive(GodotClass)] 4 8 #[class(base=Node)] ··· 6 10 #[base] 7 11 base: Base<Node>, 8 12 // other data 13 + cards: HashMap<CardDefId, Card>, 14 + state: GameState 9 15 } 10 16 11 17 #[gdextension] ··· 15 21 impl INode for ManaGroveNode { 16 22 fn init(base: Base<Node>) -> Self { 17 23 Self { 24 + cards: HashMap::new(), 25 + state: GameState::new(), 18 26 base 19 27 } 20 28 }