Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Commit

Permalink
Merge branch 'master' into pause_button_improved
Browse files Browse the repository at this point in the history
  • Loading branch information
sunreef committed May 3, 2019
2 parents 9a4d927 + b57aee5 commit 39e2292
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 34 deletions.
90 changes: 90 additions & 0 deletions Jenkinsfile
@@ -0,0 +1,90 @@
pipeline {
agent none
stages {
stage("Pull new images") {
agent {
label 'docker'
}
steps {
sh 'docker pull amethystrs/builder-linux:stable'
sh 'docker pull amethystrs/builder-linux:nightly'
}
}
stage('Cargo Fmt') {
environment {
RUSTFLAGS = "-D warnings"
}
agent {
docker {
image 'amethystrs/builder-linux:stable'
label 'docker'
}
}
steps {
echo 'Checking formatting...'
sh 'cargo fmt -- --check'
}
}
stage('Cargo Check') {
environment {
RUSTFLAGS = "-D warnings"
}
agent {
docker {
image 'amethystrs/builder-linux:stable'
label 'docker'
}
}
steps {
echo 'Running Cargo check...'
sh 'cargo check --all --all-targets'
}
}
stage('Run Tests') {
parallel {
stage("Test on Windows") {
environment {
CARGO_HOME = 'C:\\Users\\root\\.cargo'
RUSTUP_HOME = 'C:\\Users\\root\\.rustup'
}
agent {
label 'windows'
}
steps {
echo 'Beginning tests...'
bat 'C:\\Users\\root\\.cargo\\bin\\cargo test --all'
echo 'Tests done!'
}
}
stage("Test on Linux") {
agent {
docker {
image 'amethystrs/builder-linux:stable'
label 'docker'
}
}
steps {
echo 'Beginning tests...'
sh 'cargo test --all'
echo 'Tests done!'
}
}
// macOS is commented out due to needing to upgrade the OS, but MacStadium did not do the original install with APFS so we cannot upgrade easily
// stage("Test on macOS") {
// environment {
// CARGO_HOME = '/Users/jenkins/.cargo'
// RUSTUP_HOME = '/Users/jenkins/.rustup'
// }
// agent {
// label 'mac'
// }
// steps {
// echo 'Beginning tests...'
// sh '/Users/jenkins/.cargo/bin/cargo test --all'
// echo 'Tests done!'
// }
// }
}
}
}
}
6 changes: 2 additions & 4 deletions src/components/combat.rs
@@ -1,11 +1,9 @@
use amethyst::core::Named;
use amethyst::ecs::{
Component, DenseVecStorage, Entity, HashMapStorage, ReadStorage, VecStorage,
};
use amethyst::ecs::{Component, DenseVecStorage, Entity, HashMapStorage, ReadStorage, VecStorage};
use amethyst::prelude::*;
use amethyst_imgui::imgui;
use std::time::Duration;
use amethyst_inspector::Inspect;
use std::time::Duration;

#[derive(Clone, Default, Inspect)]
pub struct Damage {
Expand Down
3 changes: 1 addition & 2 deletions src/components/creatures.rs
@@ -1,7 +1,7 @@
use amethyst::{
assets::{AssetLoaderSystemData, Handle, Prefab},
core::{nalgebra::Vector3, transform::Transform},
ecs::{Component, DenseVecStorage, LazyUpdate, NullStorage, Read, ReadStorage, Entity},
ecs::{Component, DenseVecStorage, Entity, NullStorage},
prelude::*,
renderer::{Mesh, PosNormTex, PosTex, Shape},
utils::scene::BasicScenePrefab,
Expand All @@ -12,7 +12,6 @@ use crate::components::collider;
use crate::components::combat;
use crate::components::digestion;
use crate::components::health::Health;
use amethyst_imgui::imgui;

#[derive(Default, Inspect)]
pub struct CarnivoreTag;
Expand Down
12 changes: 8 additions & 4 deletions src/components/digestion.rs
@@ -1,5 +1,4 @@
use amethyst::ecs::{Component, DenseVecStorage, LazyUpdate, Read, ReadStorage};
use amethyst_imgui::imgui;
use amethyst::ecs::{Component, DenseVecStorage};
use amethyst_inspector::Inspect;

#[derive(Default, Inspect, Clone)]
Expand All @@ -14,7 +13,9 @@ impl Component for Digestion {

impl Digestion {
pub fn new(nutrition_burn_rate: f32) -> Digestion {
Digestion { nutrition_burn_rate }
Digestion {
nutrition_burn_rate,
}
}
}

Expand All @@ -30,6 +31,9 @@ impl Component for Fullness {

impl Fullness {
pub fn new(initial: f32, max: f32) -> Fullness {
Fullness { value: initial, max }
Fullness {
value: initial,
max,
}
}
}
3 changes: 1 addition & 2 deletions src/components/health.rs
@@ -1,5 +1,4 @@
use amethyst::ecs::{Component, DenseVecStorage, ReadStorage};
use amethyst_imgui::imgui;
use amethyst::ecs::{Component, DenseVecStorage};
use amethyst_inspector::Inspect;

#[derive(Clone, Default, Inspect)]
Expand Down
8 changes: 3 additions & 5 deletions src/resources/audio.rs
@@ -1,15 +1,13 @@
use amethyst::{
assets::{Loader},
assets::Loader,
audio::{AudioSink, OggFormat, SourceHandle},
ecs::prelude::World,
};

use std::iter::Cycle;
use std::vec::IntoIter;

const BACKGROUND_MUSIC: &'static [&'static str] = &[
"assets/ambient.ogg"
];
const BACKGROUND_MUSIC: &'static [&'static str] = &["assets/ambient.ogg"];

pub struct Music {
pub music: Cycle<IntoIter<SourceHandle>>,
Expand Down Expand Up @@ -39,4 +37,4 @@ pub fn initialise_audio(world: &mut World) {

// Add sounds to the world
world.add_resource(music);
}
}
18 changes: 9 additions & 9 deletions src/systems/combat.rs
@@ -1,14 +1,17 @@
use amethyst::{
core::Time,
shrev::{EventChannel, ReaderId},
ecs::*,

shrev::{EventChannel, ReaderId},
};

use crate::components::combat;
use crate::components::combat::{Cooldown, Damage, Speed};
use crate::components::health::Health;
use crate::systems::collision::CollisionEvent;
#[cfg(test)]
use amethyst::Error;
#[cfg(test)]
use amethyst_test::AmethystApplication;
use std::time::Duration;

pub struct CooldownSystem;
Expand Down Expand Up @@ -84,7 +87,9 @@ impl<'s> System<'s> for PerformDefaultAttackSystem {
}

if let Some(value) = cooldown {
cooldowns.insert(event.attacker, value).expect("Unreachable: we are inserting now.");
cooldowns
.insert(event.attacker, value)
.expect("Unreachable: we are inserting now.");
}
}
}
Expand Down Expand Up @@ -114,12 +119,7 @@ impl<'s> System<'s> for FindAttackSystem {

fn run(
&mut self,
(
collision_events,
mut attack_events,
has_faction,
faction_enemies,
): Self::SystemData,
(collision_events, mut attack_events, has_faction, faction_enemies): Self::SystemData,
) {
let event_reader = self
.event_reader
Expand Down
6 changes: 2 additions & 4 deletions src/systems/debug.rs
@@ -1,10 +1,8 @@
use crate::resources::world_bounds::WorldBounds;
use amethyst::{
ecs::{
System, Write
},
ecs::{System, Write},
renderer::DebugLines,
};
use crate::resources::world_bounds::WorldBounds;

pub struct DebugSystem;
impl<'s> System<'s> for DebugSystem {
Expand Down
8 changes: 4 additions & 4 deletions src/systems/mod.rs
@@ -1,9 +1,9 @@
pub mod debug;
pub mod collision;
pub mod combat;
pub mod debug;
pub mod decision;
pub mod movement;
pub mod wander;
pub mod digestion;
pub mod combat;
pub mod health;
pub mod movement;
pub mod time_control;
pub mod wander;

0 comments on commit 39e2292

Please sign in to comment.