~comcloudway/little_town

d83c9b89d845e1b1780765dec2e7e431ef66b305 — Jakob Meier 1 year, 8 months ago 8a1dfbc
Disabled linux-gnu ci for now
3 files changed, 23 insertions(+), 21 deletions(-)

M .build.yml
M src/screens/build.rs
M src/screens/inventory.rs
M .build.yml => .build.yml +7 -7
@@ 9,7 9,7 @@ packages:
  - protoc
artifacts:
  - ./LittleTown-amd64-musl
  - ./LittleTown-amd64-gnu
  #- ./LittleTown-amd64-gnu
  - ./LittleTown.exe
tasks:
  - setup: |


@@ 25,12 25,12 @@ tasks:
      cd little_town
      cargo build --release --target x86_64-unknown-linux-musl
      mv target/x86_64-unknown-linux-musl/release/little_town ../LittleTown-amd64-musl
  - build-amd64-gnu: |
      source $HOME/.cargo/env
      cd little_town
      rustup target add x86_64-unknown-linux-gnu
      cargo build --release --target x86_64-unknown-linux-gnu
      mv target/x86_64-unknown-linux-gnu/release/little_town ../LittleTown-amd64-gnu
  #- build-amd64-gnu: |
  #    source $HOME/.cargo/env
  #    cd little_town
  #    rustup target add x86_64-unknown-linux-gnu
  #    cargo build --release --target x86_64-unknown-linux-gnu
  #    mv target/x86_64-unknown-linux-gnu/release/little_town ../LittleTown-amd64-gnu
  - build-amd64-win: |
      source $HOME/.cargo/env
      cd little_town

M src/screens/build.rs => src/screens/build.rs +1 -3
@@ 113,7 113,7 @@ impl BuildScreen {
                grid: HashMap::new(),
                cam: Camera::new(),
                show_inv: false,
                inv: Inventory::new(),
                inv: Inventory::empty(),
                mouse_position: None,
                #[cfg(feature="multiplayer")]
                multiplayer: Some(Peer::client())


@@ 509,11 509,9 @@ impl GameComponent for BuildScreen {
                // and perform neccesarry action
                match task {
                    GameAction::RequestMap => {
                        println!("Sending map");
                        mp.perform_action(GameAction::TransmitMap(self.grid.clone()));
                    },
                    GameAction::RequestInventory => {
                        println!("Sending inv");
                        mp.perform_action(GameAction::TransmitInventory(self.inv.contents.clone(), self.inv.has_infinite_items()));
                    },
                    GameAction::PlaceBlock(pos, block, dir) => {

M src/screens/inventory.rs => src/screens/inventory.rs +15 -11
@@ 43,23 43,27 @@ impl Inventory {
    pub fn toggle_infinite_items(&mut self, toggle: bool) {
        self.infinite_items = toggle;
    }
    /// creates an empty inventory
    pub fn empty() -> Self {
        Self {
            infinite_items: false,
            contents: HashMap::new(),
            selected: None,
            direction: Direction::North,
            page: 0,
        }
    }
    pub fn new() -> Self {
        let mut cont = HashMap::new();
        let infinite_items = true;
        let mut this = Self::empty();
        this.infinite_items = true;

        if infinite_items {
        if this.infinite_items {
            for block in Block::all() {
                cont.insert(block, 1);
                this.contents.insert(block, 1);
            }
        }

        Self {
            infinite_items,
            contents: cont,
            selected: None,
            direction: Direction::North,
            page: 0,
        }
        this
    }
    /// adds a block to the players inventory
    pub fn add(&mut self, block: Block) {