Merge branch 'ewpratten/core' into ewpratten/object_defs
This commit is contained in:
commit
270ecf1f71
@ -25,5 +25,5 @@ thiserror = "1.0.30"
|
|||||||
approx = "0.5.1"
|
approx = "0.5.1"
|
||||||
poll-promise = { version = "0.1.0", features = ["tokio"] }
|
poll-promise = { version = "0.1.0", features = ["tokio"] }
|
||||||
tempfile = "3.3.0"
|
tempfile = "3.3.0"
|
||||||
nalgebra = "0.30.1"
|
|
||||||
tiled = { version = "0.10.1", path = "../../third_party/rs-tiled" }
|
tiled = { version = "0.10.1", path = "../../third_party/rs-tiled" }
|
||||||
|
nalgebra = { version = "0.30.1", features=["serde-serialize"]}
|
||||||
|
@ -1 +1,2 @@
|
|||||||
pub mod player;
|
pub mod player;
|
||||||
|
pub mod world_object;
|
43
game/game_logic/src/model/world_object.rs
Normal file
43
game/game_logic/src/model/world_object.rs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
use nalgebra as na;
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
pub struct PossiblyAnimatedTexture {
|
||||||
|
/// Signal if the texture is animated or static
|
||||||
|
pub animated: bool,
|
||||||
|
/// Relative file path from `dist` to the texture
|
||||||
|
pub rel_file_path: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
pub struct ObjectCollider {
|
||||||
|
/// Position, relative to the object's center (north east is 1,1 south west is -1,-1)
|
||||||
|
pub position: na::Vector2<f32>,
|
||||||
|
/// Possible sizing
|
||||||
|
pub size: Option<na::Vector2<f32>>,
|
||||||
|
/// Possible radius
|
||||||
|
pub radius: Option<f32>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
pub struct WorldObject {
|
||||||
|
/// Object name. Must match the name of the texture
|
||||||
|
pub name: String,
|
||||||
|
/// Object variant name. Must match the name of the texture, or None if there is only one variant
|
||||||
|
pub variant_name: Option<String>,
|
||||||
|
/// Object position. 1,1 being up and to the right
|
||||||
|
pub position: na::Vector2<f32>,
|
||||||
|
/// Object rotation, positive is clockwise
|
||||||
|
pub rotation_radians: f32,
|
||||||
|
/// The object's bottom texture
|
||||||
|
pub bottom_texture: PossiblyAnimatedTexture,
|
||||||
|
/// The object's top texture
|
||||||
|
pub top_texture: Option<PossiblyAnimatedTexture>,
|
||||||
|
/// colliders describing the object's footprint
|
||||||
|
pub footprint: Vec<ObjectCollider>,
|
||||||
|
/// Colliders for physics
|
||||||
|
pub physics_colliders: Vec<ObjectCollider>,
|
||||||
|
/// Temperature
|
||||||
|
pub temperature: Option<f32>,
|
||||||
|
}
|
Reference in New Issue
Block a user