Skip to content

Commit

Permalink
Merge pull request #198 from red-life-project/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Nereuxofficial authored Dec 6, 2022
2 parents ad436b6 + 9ba8acd commit 5cee30a
Show file tree
Hide file tree
Showing 65 changed files with 1,627 additions and 472 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ jobs:
run: cargo test -- --test-threads=1
#env:
#RUSTFLAGS: "-D warnings"
- name: Run cargo doc
if: ${{ runner.os == 'Linux' }}
run: cargo doc --no-deps --document-private-items --all-features

- name: Run build --release
run: cargo build --release

rustfmt:
runs-on: ubuntu-20.04
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .github/workflows/release.yml

on:
release:
types: [created]

jobs:
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64-pc-windows-gnu, x86_64-unknown-linux-musl]
steps:
- uses: actions/checkout@master
- name: Compile and release
uses: rust-build/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
RUSTTARGET: ${{ matrix.target }}
EXTRA_FILES: "README.md LICENSE"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ saves/

game/saves/

logs/*

2 changes: 2 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ Red Life is a small game about an astronaut who is trying to survive in the host
To run the game, you need to have [Rust](https://rustup.rs) installed. Then, run the following command in the root
directory of the project:
```bash
rustup install nightly
rustup override set nightly
cargo run
```
Binary file added assets/3d_printer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/3d_printer_Broken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/3d_printer_Idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/3d_printer_Running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Handbook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Introscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Kommunikationsmodul_Broken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Kommunikationsmodul_Idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Kommunikationsmodul_Running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Loch_Broken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Loch_Idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Loch_Running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Notstromgenerator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Oxygen_Broken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Oxygen_Idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Oxygen_Running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Sauerstoffgenerator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Stromgenerator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Stromgenerator_Broken.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Stromgenerator_Idle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Stromgenerator_Running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Winningscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/deathscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/test_Broken.png
Binary file added assets/test_Idle.png
Binary file added assets/test_Running.png
File renamed without changes
Binary file added assets/werkermaschine.png
Binary file added assets/werkermaschine_Broken.png
Binary file added assets/werkermaschine_Idle.png
Binary file added assets/werkermaschine_Running.png
4 changes: 3 additions & 1 deletion game/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

# saves folder

saves /*
saves /*

logs/*
3 changes: 1 addition & 2 deletions game/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ggez = { git="https://github.com/ggez/ggez", branch="devel" }
serde = "1.0.145"
serde_yaml = "0.9.13"
ggez = "0.8.1"
dyn-clone = "1.0.9"
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
fastrand = "1.8.0"
Expand Down
14 changes: 0 additions & 14 deletions game/src/backend/area.rs

This file was deleted.

282 changes: 282 additions & 0 deletions game/src/backend/constants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
//! This file contains constants that are necessary for the game.
use crate::backend::rlcolor::RLColor;
use crate::backend::utils::gen_inventory;
use crate::game_core::resources::Resources;
use crate::machines::machine::State;
use crate::machines::trade::Trade;
use ggez::graphics::{Color, Rect};
use std::string::ToString;

/// Contains the screen resolution of the game.
pub const SCREEN_RESOLUTION: (f32, f32) = (1920., 1080.);

/// Contains the desired FPS of the game-loop.
pub(crate) const DESIRED_FPS: u32 = 60;

/// Contains the map border( x-right, y-bottom, x-left, y-top)
pub const MAP_BORDER: [usize; 4] = [1780, 860, 270, 220];

/// Contains the position of the resource bars.
pub(crate) const RESOURCE_POSITION: [f32; 3] = [316.0, 639.0, 1373.0];

/// Contains the color used for the resource bars.
pub(crate) const COLORS: [Color; 3] = [RLColor::BLUE, RLColor::GOLD, RLColor::DARK_RED];

/// Contains the size of the player icon to scale the collision area.
pub(crate) const PLAYER_ICON_SIZE: (usize, usize) = (58, 96);

/// Contains the interaction radius of the player.
pub(crate) const PLAYER_INTERACTION_RADIUS: f32 = 50.;
// pub const MACHINE_POSITIONS: [[i32; 4]; 4] = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
pub const HANDBOOK_TEXT: &str = "Werker macht was Sauerstoff auch Ich auch";

#[allow(clippy::too_many_lines)]
pub(crate) fn gen_all_machines() -> [(String, Rect, Vec<Trade>, Resources<i16>); 7] {
[
//Die Test maschine wird zu testen des spieles genutzt. Sie gibt einem free items
(
"test".to_string(),
Rect {
x: 284.0,
y: 230.0,
w: 100.0,
h: 100.0,
},
vec![
Trade::new(
"free_items".to_string(),
10,
State::Broken,
State::Idle,
true,
gen_inventory(-100, -100, -100),
),
Trade::new(
"reset_items".to_string(),
0,
State::Idle,
State::Running,
true,
gen_inventory(100, 97, 99),
),
Trade::new(
"free_items".to_string(),
0,
State::Running,
State::Idle,
true,
gen_inventory(-100, -100, -100),
),
],
Resources {
oxygen: -25,
energy: -25,
life: -4,
},
),
//Definition Oxygen Maschine
(
"Oxygen".to_string(),
Rect {
x: 600.0,
y: 250.0,
w: 100.0,
h: 100.0,
},
vec![
Trade::new(
"repair_Oxygen".to_string(),
100,
State::Broken,
State::Idle,
false,
gen_inventory(2, 0, 0),
),
Trade::new(
"start_Oxygen".to_string(),
0,
State::Idle,
State::Running,
true,
gen_inventory(0, 0, 0),
),
Trade::new(
"stop_Oxygen".to_string(),
0,
State::Running,
State::Idle,
true,
gen_inventory(0, 0, 0),
),
],
Resources {
oxygen: 20,
energy: -30,
life: 0,
},
),
//Definition Stromgenerator Maschine
(
"Stromgenerator".to_string(),
Rect {
x: 284.0,
y: 740.0,
w: 200.0,
h: 200.0,
},
vec![
Trade::new(
"fueling_Stromgenerator".to_string(),
1000,
State::Broken,
State::Running,
true,
gen_inventory(0, 1, 0),
),
Trade::new(
"start_Stromgenerator".to_string(),
1,
State::Idle,
State::Running,
true,
gen_inventory(0, 0, 0),
),
Trade::new(
"stop_Stromgenerator".to_string(),
0,
State::Running,
State::Idle,
true,
gen_inventory(0, 0, 0),
),
],
Resources {
oxygen: -5,
energy: 50,
life: 0,
},
),
//Definition werkermaschine Maschine
(
"werkermaschine".to_string(),
Rect {
x: 600.0,
y: 600.0,
w: 200.0,
h: 100.0,
},
vec![
Trade::new(
"repair_werkermaschine".to_string(),
100,
State::Broken,
State::Idle,
false,
gen_inventory(0, 0, 1),
),
Trade::new(
"produce_superglue".to_string(),
120,
State::Idle,
State::Running,
true,
gen_inventory(-1, 0, 0),
),
],
Resources {
oxygen: 0,
energy: -15,
life: 0,
},
),
//Definition 3d_printer Maschine
(
"3d_printer".to_string(),
Rect {
x: 1722.0,
y: 840.0,
w: 100.0,
h: 100.0,
},
vec![
Trade::new(
"repair_3d_printer".to_string(),
300,
State::Broken,
State::Idle,
false,
gen_inventory(2, 1, 0),
),
Trade::new(
"produce_3d_teil".to_string(),
200,
State::Idle,
State::Running,
true,
gen_inventory(2, 0, -1),
),
],
Resources {
oxygen: 0,
energy: -25,
life: 0,
},
),
//Definition Kommunikationsmodul Maschine
(
"Kommunikationsmodul".to_string(),
Rect {
x: 1000.0,
y: 230.0,
w: 300.0,
h: 100.0,
},
vec![
Trade::new(
"Kommunikationsmodul_reparieren".to_string(),
400,
State::Broken,
State::Idle,
false,
gen_inventory(5, 0, 3),
),
Trade::new(
"Notfall_signal_absetzen".to_string(),
1000,
State::Idle,
State::Running,
true,
gen_inventory(0, 0, 0),
),
],
Resources {
oxygen: 0,
energy: -20,
life: 0,
},
),
//Definition vom ersten Loch
(
"Loch".to_string(),
Rect {
x: 1722.0,
y: 230.0,
w: 100.0,
h: 100.0,
},
vec![Trade::new(
"repair_Loch".to_string(),
100,
State::Running,
State::Idle,
false,
gen_inventory(2, 0, 0),
)],
Resources {
oxygen: -20,
energy: -5,
life: -2,
},
),
]
}
3 changes: 2 additions & 1 deletion game/src/backend/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub enum RLError {
AssetError(String),
Deserialization(serde_yaml::Error),
IO(io::Error),
InitError(String),
}

impl From<GameError> for RLError {
Expand Down Expand Up @@ -39,7 +40,7 @@ impl From<SendError<StackCommand>> for RLError {
error!("Could not send StackCommand: {}", value);
RLError::IO(io::Error::new(
io::ErrorKind::Other,
format!("Could not send StackCommand: {}", value),
format!("Could not send StackCommand: {value}"),
))
}
}
Loading

0 comments on commit 5cee30a

Please sign in to comment.