Compare commits

..

62 commits

Author SHA1 Message Date
yuni b3ec9edb18 cleanup 2024-08-02 04:42:14 +02:00
yuni 75ed7f05db upgrade to Rust 1.80.0 2024-08-02 04:42:00 +02:00
yuni 322b99644a bump version to 0.10.1 2024-08-02 04:16:27 +02:00
yuni e54aea5b46 revert saving state about luna introduction 2024-08-02 04:09:01 +02:00
yuni b7838e0f5a The cake is a lie 🍰 2024-08-02 04:03:47 +02:00
yuni 9a091cd9f3 Add Leonard Nimoy's death poem 2024-08-02 02:34:44 +02:00
yuni 458b712394 cleanup 2024-08-02 02:27:36 +02:00
yuni 9d44a2db85 tweak conversation 2024-08-02 02:18:39 +02:00
yuni 2337da40ae save game state about Luna's introduction 2024-08-02 02:09:35 +02:00
yuni 03be6d176c add handcrafted collider for clippy, giving a huge performance boost 2024-08-01 20:53:00 +02:00
yuni b46b3bb284 Merge remote-tracking branch '71rd/flake-0.10' 2024-08-01 19:48:47 +02:00
yuni f33855c018 more conversation for Luna 2024-07-31 20:49:32 +02:00
71rd 0c8a626e73
nix: update inputs for rust 1.79 2024-07-31 13:50:23 +00:00
71rd d51fd52a24 nix: remove hardcoded version from flake 2024-07-31 12:15:59 +00:00
71rd df85f4bd08 nix: default remove hardcoded version 2024-07-31 12:15:59 +00:00
71rd c98931959f nix: move build support to dir, add .envrc for using nix dev env 2024-07-31 12:15:59 +00:00
71rd e25a563555 nix: init flake with release and shell and default 2024-07-31 12:15:59 +00:00
yuni 0af4b7dab9 add autogeneration warning to src/data/scenes.in 2024-07-31 06:43:11 +02:00
yuni 9d0fa985eb document Luna 2024-07-31 06:36:23 +02:00
yuni c4e75278fc extend conversation of Luna, add tuned MeteorAceGT 2024-07-31 06:35:29 +02:00
yuni f5154216e5 fix Luna chat 2024-07-31 05:22:35 +02:00
yuni 2998282462 add 2 light orbs near Luna 2024-07-31 05:21:12 +02:00
yuni 398266ea83 add a chat for Luna, he now repairs suit and refills oxygen tank 2024-07-31 05:04:21 +02:00
yuni a6c88e1344 add Luna's workshop with a couple of shipping containers 2024-07-31 04:49:11 +02:00
yuni 097c7c0c84 bump version to v0.10.0 2024-07-14 21:20:01 +02:00
yuni 5847fde332 fix matching velocity when inside vehicles 2024-07-14 21:16:32 +02:00
yuni 20b2ae049a cleanup (cargo fmt) 2024-07-14 21:16:19 +02:00
yuni f2ed30a5b6 brighter flashlight 2024-07-14 21:09:00 +02:00
yuni 6b0dd36859 cleanup (cargo fmt) 2024-07-14 21:08:41 +02:00
yuni ed0641d68e fix flashlight when in vehicles 2024-07-14 21:08:35 +02:00
yuni 534a313e21 place only 1 cruiser in test scene 2024-07-14 20:29:07 +02:00
yuni f3a5884dac wording 2024-07-14 20:28:51 +02:00
yuni 441efcabef rename "Eclipse the Sun with Jupiter" achievement to "Enter Jupiter's Shadow" 2024-07-14 20:24:39 +02:00
yuni fb82e3cc29 add comment about possible panic 2024-07-13 14:31:11 +02:00
yuni e5f9409fd8 automatically match velocity to the closest object 2024-07-13 14:30:02 +02:00
yuni 5e9441dd5e abstract out orbit calculation into nature::pos_offset_for_orbiting_body() 2024-07-12 15:32:45 +02:00
yuni 90c89fc3f3 add comments 2024-07-12 14:58:50 +02:00
yuni 4f787c33e8 cleanup (remove unnecessary scope block, unindenting by 1)
(I had this scope block before in order to release ownership of some
variable so that it can be used again after the scope block, but seems
like this is not necessary anymore by now)
2024-07-12 14:23:54 +02:00
yuni eb094945f2 update changelog 2024-07-11 22:50:15 +02:00
yuni cc45c7bc05 fix clippy colliders with "collider mesh" 2024-07-11 22:49:53 +02:00
yuni 4cc267b55c fix supply crate collider with "collider mesh" 2024-07-11 22:49:36 +02:00
yuni 45fac4d35f fix orange light orb collider with "collider mesh" 2024-07-11 22:49:20 +02:00
yuni 075520d68b Revert "fix collisions with light orbs (orange only)"
This reverts commit 4c4d776741.
2024-07-11 22:44:56 +02:00
yuni 252aabf16b fix bus stop light orb collisions 2024-07-11 22:42:05 +02:00
yuni 4c4d776741 fix collisions with light orbs (orange only) 2024-07-11 22:28:12 +02:00
yuni 9967c6feca add "I don't want to talk to you" option to Icarus 2024-07-09 04:59:23 +02:00
yuni 3e22d4d493 shorter dialog 2024-07-09 04:50:47 +02:00
yuni 3f5bb0c21a s/micros/micrometeorites 2024-07-09 04:49:11 +02:00
yuni ed7f88c1eb add CHANGELOG entry 2024-07-09 04:33:39 +02:00
yuni dc6b419afd cargo fmt 2024-07-09 04:33:31 +02:00
yuni d262796db0 Merge branch 'bevy14' 2024-07-09 04:00:47 +02:00
yuni 1ce56ac909 bevy14: update GLtf emission parameters (*1/1000) 2024-07-09 03:58:03 +02:00
yuni 21a800942e bevy14: fix suit animation 2024-07-09 03:32:03 +02:00
yuni a14dbcb5c7 bevy14: upgrade Translation::look_at with directional arguments 2024-07-09 02:45:44 +02:00
yuni 82ff5491a6 bevy14: Fix error with multiplying color by float 2024-07-09 02:42:10 +02:00
yuni f8cb84ccb1 bevy14: Upgrade Color method names (set_a -> set_alpha) 2024-07-09 02:41:05 +02:00
yuni b038468cfc bevy14: upgrade Color::hex usage 2024-07-09 02:38:28 +02:00
yuni 18760e43c8 bevy14: fix warnings about deprecated Color::rgb(a) usage 2024-07-09 02:32:56 +02:00
yuni 3165cfd754 bevy14: upgrade color palette usage 2024-07-09 02:28:55 +02:00
yuni b1ff21aec4 bevy14: upgrade AppExit enumerator 2024-07-09 02:19:44 +02:00
yuni ab226bbdfe bevy14: disable dynamic linking, doesn't work with jpeg feature in bevy14 2024-07-09 02:19:37 +02:00
yuni e7560957f2 upgrade bevy version to 0.14, rust version to 1.79 2024-07-09 02:13:16 +02:00
55 changed files with 1712 additions and 831 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake ./build/nix

View file

@ -1,5 +1,15 @@
# Git Development Version # git development version
- Upgrade to Rust 1.80
# v0.10.1
- Add character "Luna" near starting area
- Performance improvements
# v0.10.0
- Upgrade to Bevy 0.14, Rust 1.79
- Implement gravity and orbiting (everything's super fast now) - Implement gravity and orbiting (everything's super fast now)
- Implement radio stations - Implement radio stations
- Implement loading whole scenes from blender files - Implement loading whole scenes from blender files
@ -10,8 +20,8 @@
- Add suffocation sound effects - Add suffocation sound effects
- Add new character "Sus" near the pizzeria - Add new character "Sus" near the pizzeria
- More conversations - More conversations
- Fix flashlight when inside vehicles
- Regression: Broken generic asteroids -> disabled for now - Regression: Broken generic asteroids -> disabled for now
- Regression: Broken collision on light orbs, supply crates
# v0.9.2 # v0.9.2

1147
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -10,14 +10,14 @@
[package] [package]
name = "outfly" name = "outfly"
version = "0.9.2" version = "0.10.1"
edition = "2021" edition = "2021"
homepage = "https://codeberg.org/outfly/outfly" homepage = "https://codeberg.org/outfly/outfly"
repository = "https://codeberg.org/outfly/outfly" repository = "https://codeberg.org/outfly/outfly"
categories = ["game", "aerospace", "simulation"] categories = ["game", "aerospace", "simulation"]
keywords = ["game", "space", "3d"] keywords = ["game", "space", "3d"]
license = "GPL-3.0-only" license = "GPL-3.0-only"
rust-version = "1.76.0" rust-version = "1.80.0"
[dependencies] [dependencies]
# For parsing the game definition file, src/data/defs.txt # For parsing the game definition file, src/data/defs.txt
@ -36,27 +36,18 @@ toml_edit = { version = "0.22", features = ["serde"] }
[dependencies.bevy] [dependencies.bevy]
# The bevy game engine, the basis for this game # The bevy game engine, the basis for this game
# We temporarily use a fork with a custom bug fix, see https://codeberg.org/outfly/bevy version = "0.14"
version = "0.13.2"
git = "https://codeberg.org/outfly/bevy.git"
rev = "e4dc13639106aa86826f6243d58f3209e1e94b1b"
default-features = false default-features = false
features = ["animation", "bevy_asset", "bevy_audio", "bevy_scene", "bevy_winit", "bevy_core_pipeline", "bevy_pbr", "bevy_gltf", "bevy_render", "bevy_text", "bevy_ui", "jpeg", "multi-threaded", "png", "tonemapping_luts", "vorbis"] features = ["animation", "bevy_asset", "bevy_audio", "bevy_scene", "bevy_winit", "bevy_core_pipeline", "bevy_pbr", "bevy_gltf", "bevy_render", "bevy_text", "bevy_ui", "jpeg", "multi_threaded", "png", "tonemapping_luts", "vorbis"]
[dependencies.bevy_embedded_assets] [dependencies.bevy_embedded_assets]
# For embedding assets into the binary, creating a self-sufficient executable # For embedding assets into the binary, creating a self-sufficient executable
# We temporarily use a fork with a custom bug fix, see https://codeberg.org/outfly/bevy version = "0.11"
version = "0.10.2"
git = "https://codeberg.org/outfly/bevy_embedded_assets.git"
rev = "2696fcc0319e8660c50d4601e7d4e530cf0bb981"
optional = true optional = true
[dependencies.bevy_xpbd_3d] [dependencies.bevy_xpbd_3d]
# For physics and collision handling # For physics and collision handling
# We temporarily use a fork with a custom bug fix, see https://codeberg.org/outfly/bevy version = "0.5"
version = "0.4.2"
git = "https://codeberg.org/outfly/bevy_xpbd.git"
rev = "b6a03d6ec41e409d56f6b876f654a14d0b33afa7"
default-features = false default-features = false
features = ["3d", "f64", "parry-f64", "parallel", "async-collider"] features = ["3d", "f64", "parry-f64", "parallel", "async-collider"]
@ -70,7 +61,7 @@ blend = "0.8.0"
[features] [features]
default = ["x11", "embed_assets"] default = ["x11", "embed_assets"]
dev_mode = [] dev_mode = []
dev = ["dev_mode", "bevy/dynamic_linking", "bevy/file_watcher"] dev = ["dev_mode", "bevy/file_watcher"] #, "bevy/dynamic_linking"
release_linux = ["x11", "wayland", "embed_assets"] release_linux = ["x11", "wayland", "embed_assets"]
release_windows = ["embed_assets"] release_windows = ["embed_assets"]
wasm = ["bevy/webgl2"] wasm = ["bevy/webgl2"]

View file

@ -35,7 +35,7 @@ The `SPACE` key helps you move more intuitively by slowing you down. Hold it fo
When you're ready, take a look around, explore the starting area. There is a friendly person floating nearby in a red space suit that would love to talk to you. When you're ready, take a look around, explore the starting area. There is a friendly person floating nearby in a red space suit that would love to talk to you.
The game is dark. After all, space is dark. The planets and moons orbit in real time, the map changes depending on when you play, and if you're unlucky, the sun may be eclipsed and everything's even darker! Try the flashlight (`f` key), turning off shadows in the menu, and make sure that Augmented Reality is on (`TAB` key) which gives you a little extra light amplification. The game is dark. After all, space is dark. The planets and moons orbit in real time, the map changes depending on when you play, and if you're unlucky, you start in the shadow of Jupiter and everything's even darker! Try the flashlight (`f` key), turning off shadows in the menu, and make sure that Augmented Reality is on (`TAB` key) which gives you a little extra light amplification.
Press `Esc` for the menu to restart the game if you get lost, explore more key bindings, game features, and the **achievements** to get some guidance on what you can do in the game. Press `Esc` for the menu to restart the game if you get lost, explore more key bindings, game features, and the **achievements** to get some guidance on what you can do in the game.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -21,8 +21,11 @@ fn main() -> std::io::Result<()> {
let file = File::create("src/data/scenes.in"); let file = File::create("src/data/scenes.in");
if let Ok(mut file) = file { if let Ok(mut file) = file {
write!(&file, "// THIS FILE IS AUTOGENERATED BY build.rs BASED ON DATA IN src/blender/scene_*.blend FILES!\n")?;
write!(&file, "// DO NOT MODIFY MANUALLY, CHANGES WILL BE OVERWRITTEN!\n")?;
write!(&file, "[\n")?; write!(&file, "[\n")?;
extract_scene(&mut file, "test", "src/blender/scene_test.blend")?; extract_scene(&mut file, "test", "src/blender/scene_test.blend")?;
extract_scene(&mut file, "workshop", "src/blender/scene_workshop.blend")?;
write!(&file, "]\n")?; write!(&file, "]\n")?;
} }
Ok(()) Ok(())

View file

@ -1 +0,0 @@
This is a work-in-progress nix package. It successfully worked on one NixOS system, but failed on another due to obscure errors. It also failed using "nix build" on ArchLinux.

69
build/nix/build.nix Normal file
View file

@ -0,0 +1,69 @@
{ lib
, self ? null
, buildType ? "release"
, platform ? "linux"
, enableWayland ? true
, enableXorg ? true
, enableOpenGL ? true
, enableVulkan ? true
, rustPlatform
, makeDesktopItem
, pkg-config
, libxkbcommon
, alsa-lib
, libGL
, vulkan-loader
, wayland
, libXrandr
, libXcursor
, libX11
, libXi
, ...
}:
assert (platform == "linux" ) -> (enableWayland || enableXorg);
assert (platform == "linux" ) -> (enableVulkan || enableOpenGL);
rustPlatform.buildRustPackage rec {
name = "outfly";
inherit buildType;
src = ./../..;
version = if (self ? rev) then self.rev else "dirty";
buildNoDefaultFeatures = true;
buildFeatures = [ "embed_assets" ] ++ lib.optionals enableXorg [ "x11" ]
++ lib.optionals enableWayland [ "wayland" ];
runtimeInputs = [ libxkbcommon ]
++ lib.optionals enableOpenGL [ libGL ]
++ lib.optionals enableXorg [ libXrandr libX11 ]
++ lib.optionals enableVulkan [ vulkan-loader ];
buildInputs = [ alsa-lib.dev libXcursor libXi ]
++ lib.optionals enableWayland [ wayland ];
nativeBuildInputs = [ pkg-config ];
doCheck = false;
postFixup = ''
patchelf $out/bin/outfly \
--add-rpath ${lib.makeLibraryPath runtimeInputs}
'';
postPatch = ''
find ../cargo-vendor-dir -name Cargo.toml -exec sed -i 's/^workspace = true//' {} +
'';
cargoLock = { lockFile = ./../../Cargo.lock; };
desktopItems = [
(makeDesktopItem {
name = "outfly";
exec = "outfly";
desktopName = "OutFly";
categories = [ "Game" ];
})
];
}

View file

@ -1,47 +1 @@
{ with import <nixpkgs> { }; callPackage ./build.nix { }
rustPlatform,
pkg-config,
alsa-lib,
libcap,
libxkbcommon,
wayland,
udev,
vulkan-loader,
xorg,
lib,
}:
rustPlatform.buildRustPackage rec {
src = ../../..;
pname = "outfly";
version = "0.8.1";
cargoLock = {
lockFile = "${src}/Cargo.lock";
};
nativeBuildInputs = [ pkg-config ];
buildNoDefaultFeatures = true;
buildFeatures = [
"release_linux"
];
buildInputs = [
alsa-lib
libcap
wayland
];
postFixup =
let
runtimeDeps = [
vulkan-loader
libxkbcommon
xorg.libX11
xorg.libXrandr
xorg.libXi
xorg.libXcursor
];
libPath = lib.makeLibraryPath runtimeDeps;
in
''
patchelf $out/bin/outfly \
--add-rpath ${libPath}
'';
}

View file

@ -1,16 +1,34 @@
{ {
"nodes": { "nodes": {
"nixpkgs": { "flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1714076141, "lastModified": 1710146030,
"narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "nixos", "owner": "numtide",
"repo": "nixpkgs", "repo": "flake-utils",
"rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1722185531,
"narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
@ -18,8 +36,24 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -1,17 +1,48 @@
{ {
description = "A breathtaking 3D space game in the rings of Jupiter";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ ];
pkgs = import nixpkgs { inherit system overlays; };
in {
packages.outfly = pkgs.callPackage ./build.nix {};
packages.default = self.packages.${system}.outfly;
outputs = { self, nixpkgs }: { apps.outfly = {
type = "app";
packages.x86_64-linux.outfly = let program = "${self.packages.${system}.outfly}/bin/outfly";
pkgs = import nixpkgs { system = "x86_64-linux"; };
in pkgs.callPackage ./default.nix {};
packages.x86_64-linux.default = self.packages.x86_64-linux.outfly;
}; };
apps.default = self.apps.${system}.outfly;
devShells.default = let
buildInputs = [
pkgs.alsa-lib.dev
#opengl
pkgs.libGL
pkgs.libxkbcommon
pkgs.xorg.libXcursor
pkgs.xorg.libXi
pkgs.xorg.libXrandr
pkgs.xorg.libX11
pkgs.vulkan-loader
];
nativeBuildInputs = [
pkgs.cargo
pkgs.pkg-config
];
in pkgs.mkShell {
inherit buildInputs nativeBuildInputs;
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
};
});
} }

View file

@ -236,10 +236,12 @@ apart from the other characters. Let's outline the personalities/backstories:
- Totally a furry - Totally a furry
- Has big plans for this area, but not enough time to implement everything - Has big plans for this area, but not enough time to implement everything
- Nerd about high energy communications technology - Nerd about high energy communications technology
6. ??? @ workshop: 6. Luna @ workshop:
- Mechanic - Mechanic
- Operates a workshop to craft and mod space vehicles - Operates a workshop to craft and mod space vehicles
- Nerd about space suits and vehicles - Nerd about space suits and vehicles
- Just wants to get away from it all
- Attempts to reach the end of space and time through special relativity
7. Ash @ hideout: 7. Ash @ hideout:
- Monk master of a cult of Buddhist origins - Monk master of a cult of Buddhist origins
- Uptight, self-disciplined, driven, wise - Uptight, self-disciplined, driven, wise

View file

@ -428,11 +428,10 @@ pub fn handle_input(
pub fn handle_vehicle_enter_exit( pub fn handle_vehicle_enter_exit(
mut commands: Commands, mut commands: Commands,
mut settings: ResMut<Settings>,
mut er_vehicle: EventReader<VehicleEnterExitEvent>, mut er_vehicle: EventReader<VehicleEnterExitEvent>,
mut ew_achievement: EventWriter<game::AchievementEvent>, mut ew_achievement: EventWriter<game::AchievementEvent>,
mut q_playerflashlight: Query< mut q_playerflashlight: Query<
&mut Visibility, &mut Transform,
( (
With<PlayersFlashLight>, With<PlayersFlashLight>,
Without<ActorVehicleBeingEntered>, Without<ActorVehicleBeingEntered>,
@ -477,9 +476,9 @@ pub fn handle_vehicle_enter_exit(
commands.entity(vehicle).remove::<hud::IsTargeted>(); commands.entity(vehicle).remove::<hud::IsTargeted>();
commands.entity(vehicle).insert(PlayerCamera); commands.entity(vehicle).insert(PlayerCamera);
commands.entity(vehicle).insert(PlayerDrivesThis); commands.entity(vehicle).insert(PlayerDrivesThis);
if let Ok(mut flashlight_vis) = q_playerflashlight.get_single_mut() { if let Ok(mut flashlight_trans) = q_playerflashlight.get_single_mut() {
*flashlight_vis = Visibility::Hidden; flashlight_trans.rotation = Quat::from_rotation_y(0f32);
settings.flashlight_active = false; flashlight_trans.translation = Vec3::new(0.0, 0.0, 0.0);
} }
if let Some(vehicle_name) = &event.name { if let Some(vehicle_name) = &event.name {
ew_achievement.send(game::AchievementEvent::RideVehicle( ew_achievement.send(game::AchievementEvent::RideVehicle(
@ -491,6 +490,11 @@ pub fn handle_vehicle_enter_exit(
if let Some(collider) = &vehicle_component.stored_drivers_collider { if let Some(collider) = &vehicle_component.stored_drivers_collider {
commands.entity(driver).insert(collider.clone()); commands.entity(driver).insert(collider.clone());
} }
if let Ok(mut flashlight_trans) = q_playerflashlight.get_single_mut() {
flashlight_trans.rotation =
Quat::from_rotation_y(180f32.to_radians());
flashlight_trans.translation = Vec3::new(0.0, 0.0, 1.0);
}
commands.entity(driver).insert(RigidBody::Dynamic); commands.entity(driver).insert(RigidBody::Dynamic);
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Switch)); ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Switch));
commands.entity(vehicle).remove::<PlayerCamera>(); commands.entity(vehicle).remove::<PlayerCamera>();

BIN
src/blender/clippy.blend Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -25,6 +25,7 @@ use bevy_xpbd_3d::prelude::*;
use std::collections::HashMap; use std::collections::HashMap;
pub const INITIAL_ZOOM_LEVEL: f64 = 10.0; pub const INITIAL_ZOOM_LEVEL: f64 = 10.0;
pub const MAX_DIST_FOR_MATCH_VELOCITY: f64 = 10000.0;
pub struct CameraPlugin; pub struct CameraPlugin;
@ -33,7 +34,10 @@ impl Plugin for CameraPlugin {
app.add_systems(Startup, setup_camera); app.add_systems(Startup, setup_camera);
app.add_systems(Update, handle_input.run_if(in_control)); app.add_systems(Update, handle_input.run_if(in_control));
app.add_systems(Update, update_map_only_object_visibility.run_if(alive)); app.add_systems(Update, update_map_only_object_visibility.run_if(alive));
app.add_systems(Update, manage_player_actor.after(handle_input)); app.add_systems(
PostUpdate,
manage_player_actor.in_set(sync::SyncSet::PositionToTransform),
);
app.add_systems( app.add_systems(
PostUpdate, PostUpdate,
sync_camera_to_player sync_camera_to_player
@ -422,6 +426,15 @@ pub fn apply_input_to_player(
key_input: Res<ButtonInput<KeyCode>>, key_input: Res<ButtonInput<KeyCode>>,
q_audiosinks: Query<(&audio::Sfx, &AudioSink)>, q_audiosinks: Query<(&audio::Sfx, &AudioSink)>,
q_target: Query<&LinearVelocity, (With<hud::IsTargeted>, Without<actor::PlayerCamera>)>, q_target: Query<&LinearVelocity, (With<hud::IsTargeted>, Without<actor::PlayerCamera>)>,
q_closest: Query<
(&Position, &LinearVelocity),
(
Without<hud::IsTargeted>,
Without<actor::PlayerCamera>,
Without<actor::Player>,
Without<actor::PlayerDrivesThis>,
),
>,
mut q_playercam: Query< mut q_playercam: Query<
( (
Entity, Entity,
@ -458,9 +471,22 @@ pub fn apply_input_to_player(
{ {
let target_v: DVec3 = if let Ok(target) = q_target.get_single() { let target_v: DVec3 = if let Ok(target) = q_target.get_single() {
target.0 target.0
} else {
let mut closest_distance = MAX_DIST_FOR_MATCH_VELOCITY;
let mut closest_velocity = None;
for (testpos, v) in q_closest.iter() {
let distance = (pos.0 - testpos.0).length();
if distance < closest_distance {
closest_velocity = Some(v);
closest_distance = distance;
}
}
if closest_velocity.is_some() {
closest_velocity.unwrap().0
} else { } else {
let relative_pos = pos.0 - jupiter_pos.0; let relative_pos = pos.0 - jupiter_pos.0;
nature::orbital_velocity(relative_pos, nature::JUPITER_MASS) nature::orbital_velocity(relative_pos, nature::JUPITER_MASS)
}
}; };
// Handle key input // Handle key input
if focused { if focused {

View file

@ -12,6 +12,7 @@
// and manages the flow of conversations. // and manages the flow of conversations.
use crate::prelude::*; use crate::prelude::*;
use bevy::color::palettes::css;
use bevy::prelude::*; use bevy::prelude::*;
use bevy_xpbd_3d::prelude::*; use bevy_xpbd_3d::prelude::*;
use serde::Deserialize; use serde::Deserialize;
@ -794,7 +795,7 @@ pub fn handle_chat_events(
fn handle_reply_keys( fn handle_reply_keys(
keyboard_input: Res<ButtonInput<KeyCode>>, keyboard_input: Res<ButtonInput<KeyCode>>,
settings: ResMut<var::Settings>, settings: Res<var::Settings>,
q_choices: Query<&Choice>, q_choices: Query<&Choice>,
mut q_chats: Query<&mut Chat>, mut q_chats: Query<&mut Chat>,
mut evwriter_sfx: EventWriter<audio::PlaySfxEvent>, mut evwriter_sfx: EventWriter<audio::PlaySfxEvent>,
@ -926,14 +927,14 @@ pub fn handle_chat_scripts(
} }
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp)); ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
ew_effect.send(visual::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::CYAN), class: visual::Effects::FadeIn(css::AQUA.into()),
duration: 1.0, duration: 1.0,
}); });
} }
} }
"cryofadeout" => { "cryofadeout" => {
ew_effect.send(visual::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeOut(Color::CYAN), class: visual::Effects::FadeOut(css::AQUA.into()),
duration: 5.1, duration: 5.1,
}); });
} }
@ -949,6 +950,7 @@ pub fn handle_chat_scripts(
pub fn update_chat_variables( pub fn update_chat_variables(
mut vars: ResMut<var::GameVars>, mut vars: ResMut<var::GameVars>,
settings: Res<var::Settings>,
q_player: Query<&actor::Suit, With<actor::Player>>, q_player: Query<&actor::Suit, With<actor::Player>>,
) { ) {
if let Ok(suit) = q_player.get_single() { if let Ok(suit) = q_player.get_single() {
@ -957,5 +959,23 @@ pub fn update_chat_variables(
"player_oxygen_seconds", "player_oxygen_seconds",
(suit.oxygen / nature::OXY_S).to_string(), (suit.oxygen / nature::OXY_S).to_string(),
); );
vars.set_in_scope(
"$",
"player_suit_health_percent",
((suit.integrity * 100.0).round() as u8).to_string(),
);
let wears_chefhat = if let Some(ava) = hud::PLAYER_AR_AVATARS.get(settings.ar_avatar) {
match ava.0 {
hud::Avatar::ChefHat => 1,
_ => 0,
}
} else {
0
};
vars.set_in_scope(
"$",
"chefhat",
wears_chefhat.to_string(),
);
} }
} }

View file

@ -16,7 +16,7 @@
- Oh hey, you're awake! - Oh hey, you're awake!
- set: $met - set: $met
- I found you drifting out cold, and thought, I better watch over you. - I found you drifting out cold, and thought, I better watch over you.
- Took us here behind that moonlet, to shield you from the micros. - Took us here behind that moonlet, to shield you from the micrometeorites.
- if: "$$player_oxygen_seconds <= 0" - if: "$$player_oxygen_seconds <= 0"
HELP! I'M SUFFOCATING: HELP! I'M SUFFOCATING:
- goto: suffocating - goto: suffocating
@ -25,15 +25,19 @@
- No worries. Folks are stretched thin around this corner, we gotta watch out for each other. - No worries. Folks are stretched thin around this corner, we gotta watch out for each other.
- How are you feeling? - How are you feeling?
- goto: howru - goto: howru
- I didn't ask for this.: - I don't want to talk to you.:
- Huh? Then why did you chat me up?
- But ok, see you around.
- goto: EXIT
- I didn't ask you to help me!:
- label: didntask - label: didntask
- "Sure, 'cause you were unconscious. I just did what felt right. Is there a problem?" - "Sure, 'cause you were unconscious. I just did what felt right. Is there a problem?"
- Nevermind. Thank you.: - Nevermind. Thank you.:
- goto: thx - goto: thx
- Leave me alone!: - Leave me alone!:
- goto: EXIT - goto: EXIT
- Micros? What's that?: - Micrometeorites?:
- Micrometeorites. Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body. - Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body.
- Ouch! Thank you so much.: - Ouch! Thank you so much.:
- goto: thx - goto: thx
- Whatever... I didn't ask for this.: - Whatever... I didn't ask for this.:
@ -103,9 +107,9 @@
- That massive sphere over there, that's Jupiter. - That massive sphere over there, that's Jupiter.
- We're about 150,000km away from its surface, on the very outside of it's rings. - We're about 150,000km away from its surface, on the very outside of it's rings.
- This area is called the Thebe gossamer ring. - This area is called the Thebe gossamer ring.
- The moon Thebe is actually pretty close right now, flinging all those micros at us. - The moon Thebe is actually pretty close right now, flinging all those micrometeorites at us.
- Micros? What's that?: - Micrometeorites?:
- Micrometeorites. Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body. - Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body.
- goto: help - goto: help
- Why am I here?: - Why am I here?:
- That's a very philosophical question. - That's a very philosophical question.
@ -197,9 +201,7 @@
- goto: reservation - goto: reservation
- My head hurts, my suit is leaking, I think I'm dying...: - My head hurts, my suit is leaking, I think I'm dying...:
- 他妈的, that sound terrible. - 他妈的, that sound terrible.
- Unlikely that you'll die though. - Would you like me to patch up your suit up?
- You're wearing a SecondSkyn™. It's the best, it'll take care of you.
- Would you like me to patch it up?
- label: patchup - label: patchup
- Yes please!: - Yes please!:
- Here you go! - Here you go!
@ -338,6 +340,242 @@
- goto: eat - goto: eat
- goto: reservation - goto: reservation
---
- chat: Luna
- "if $$player_suit_health_percent < 100":
- Holy shit!
- Look at all those scratches and tears on your suit!
- script: repairsuit
- set: grateful
- Let me fix that!
- And I topped off your oxygen tank while I'm at it.
- script: refilloxygen 1
- goto: mainnode
- Oh hey you! Have an oxygen refill!
- script: refilloxygen 1
- set: grateful
- label: mainnode
- if: "$grateful"
Thank you so much!:
- No problem at all!
- set: grateful 0
- goto: mainnode
- if: "$$chefhat"
The cake is a lie.:
- if $explained:
- ...
- Yes, indeed.
- I memorized this phrase to tell anyone who claims to be able to travel back in time.
- If they can tell me one of those phrases *before* I tell them, it must mean that they traveled back in time! How else could they know the phrase?
- But... You're telling me the phrase *after* I told you.
- So you are proving nothing.
- Go kill yourself, magically rewind time, and *then* tell me the phrase with the chef hat on.
- goto: mainnode
- if ~$explained:
- Ooooh.
- Now why would you say that?
- I... don't really know.:
- You seem confused.
- It's ok. Just drift a bit, take some deep breaths, and come back when you are feeling better.
- goto: EXIT
- I was promised a cake. There was no cake.:
- How utterly disturbing.
- The real question is, why would I not say that?:
- Point taken.
- That's a great sentence to just randomly say.
- Congratulations on your creativity.
- Funny hat too.
- I'm just following orders.:
- YOU'RE AN ACTUAL FUCKING TIME TRAVELER?!
- set: believe
- Please, tell me everything you can about this!
- goto: node_ask
- Because cake is delicious!:
- That makes no sense whatsoever.
- Stop wasting my time, lunatic.
- goto: EXIT
- goto: mainnode
- What are you up to?:
- I'm running a workshop. Come by if you need any repairs!
- Tinkering on various projects.
- What kind of projects?:
- A tuned MotorAce spaceship, an impact dampener, and... a secret project.
- label: projects
- Tell me about the spaceship:
- Ohh this one is mind-bending.
- By redirecting the energy flux of the oversized reaction wheels into the ion engine capacitors, you can boost the thrust of this beast to flesh-ripping levels.
- It's not... really... safe for humans.
- But if you do want to give it a try, the ship is over there.
- IT IS PROVIDED TO YOU WITHOUT WARRANTY OF ANY KIND.
- IN NO EVENT WILL I BE LIABLE TO YOU FOR DAMAGES.
- goto: projects
- Tell me about the impact dampener:
- Well. This spaceship is not really safe for humans.
- So I'm working on a suit mod to dampen the effect of g-forces.
- Not much to show for now, maybe come back in a couple weeks!
- goto: projects
- Tell me about the secret project:
- You wish!
- goto: projects
- What keeps you going in your pursuits?:
- if ~$whatsyourmotivation:
- set: whatsyourmotivation
- This... uhm, is the first time anybody has ever asked me that.
- Well, it sounds a bit crazy.
- I'm trying to reach the end.
- The end of what?: []
- You're nuts.:
- A lunatic, you could say.
- goto: mainnode
- The end of everything. Of life, of stars, of protons themselves.
- You know how when you're close to the speed of light, time slows down?
- nowait: true
Yes.:
- goto: skiprelativityintro
- You age slower, can fly further, time dilation from special relativity.
- label: skiprelativityintro
- Given the right speed, you age so slowly that you can literally go anywhere you want.
- Any *time* you want.
- set: timetravel
- Time travel! Only into the future though, of course.:
- Exactly.
- goto: continuemonologue
- Can I go back into the past?:
- Nooo, that doesn't quite work.
- Well, maybe with exotic matter with negative mass, using a theoretical Alcubierre drive.
- If you ever stumble on particles with negative mass, *PLEASE* let me know right away!
- But no.
- goto: continuemonologue
- You're nuts, time travel doesn't exist.:
- Uh huh.
- Hey, I gotta do some stuff, see you around.
- goto: EXIT
- In the future only, of course.
- label: continuemonologue
- I want to get all the way out to the edge of the visible universe, to the end of time, and watch the world evaporate into nothingness.
- Got the popcorn waiting already.
- This is the ultimate engineering challenge, but I'm convinced that it is possible, and I just *have* to do this.
- And when I work on it, the whole universe turns silent.
- There is just me, my tools, and the metal.
- It's bliss.
- Fascinating.:
- Thanks for listening. I appreciate it.
- Usually nobody cares.
- goto: projects
- Wow, you're edgy.:
- And you're a rounding error.
- You'll be dead in a blink of the eye of the universe, when my journey will just begin.
- goto: EXIT
- Yeah, sorry for the monologue. Anything else?
- goto: projects
- Good luck with that!:
- Thanks!
- goto: mainnode
- goto: timeout
- Good luck with that!:
- Thanks!
- goto: mainnode
- goto: timeout
- What brings you here?:
- if $thinking:
- As said, I don't like people.
- if ~$thinking:
- Well, uh...
- set: thinking
- How should I put this? Don't take it personally, but...
- I really don't like people.
- I'm happy to help you, don't get me wrong.
- But... not really because I care about you.
- I enjoy the challenge of fixing, mending, creating.
- Humans in general, though, ravage and exploit.
- It's in their nature, and I can't stand it.
- I just want to get away. From all this insanity, triviality,...
- Just want to pursue my projects without anyone standing in my way.
- goto: mainnode
- if: "$timetravel"
Do you think time travel into the past is possible?:
- if $believe:
- Well, you just proved it to me, didn't you?
- How else would you know the phrase and the chef hat thing?
- I still can't believe it.
- Sad that we don't know *how* or *why* this is happening.
- This will give me a lot to think about. Thank you!
- goto: mainnode
- if ~$believe:
- No.
- Well, theoretically, there's all sorts of way to do this but none of them are feasible.
- Why do you ask?
- Just curious:
- It's good to stay curious.
- goto: mainnode
- If I die, I seem to wake up in the same spot over and over again...:
- Hey, let me be very clear here.
- Do not waste my time with bullshit, or I will scrap your body for raw materials.
- I'm serious. Everything reverts back to how it was before, and nobody remembers me.:
- Hm.
- Fascinating.
- I don't believe you.
- But there is obviously one way we can easily validate this.
- set: $explained
- Kill yourself to rewind time. Then come back to me wearing a silly chef hat and say "The cake is a lie."
- label: timetravelqanda
- Why? I don't get it.:
- You know, I think a lot about time travel.
- I memorized some phrases that I would tell anyone who claims to be able to travel back in time.
- If they can tell me one of those phrases *before* I tell them, it must mean that they traveled back in time! How else could they know the phrase?
- goto: timetravelqanda
- Where can I get a chef hat?:
- Not a real one, of course.
- Change the settings of your space suit to project an avatar in augmented reality.
- You should find a "Chef Hat" option somewhere. [Press ESC]
- goto: timetravelqanda
- That's genius.:
- Thank you!
- Now go kill yourself. Don't forget the chef hat.
- goto: EXIT
- I'm not going to kill myself.:
- Well, doesn't really matter how you die.
- "Just remember. Wear silly chef hat, and tell me: The cake is a lie."
- goto: EXIT
- Whatever.:
- Thank you.
- goto: mainnode
- Bye!:
- So long, drifter!
- goto: EXIT
- label: timeout
- Hm? Is your transmitter borked?
- goto: EXIT
- label: node_ask
- When I die, I just wake up and everything is back as it was before.:
- What? Just like that? This is so wild.
- label: node_ask2
- We have talked before. You told me to die, come back to you with a chef hat, and say that sentence.:
- Hah, so the plan worked out! YES!
- Let me apologize though. I must have been rude before you showed me proof for your story.
- There are just so many bullshiters in the world and I don't have the patience anymore.
- But I believe you now.
- If there is *anything* I can do for you, let me know. This is amazing!
- goto: mainnode
- Leave me alone.:
- goto: gtfo
- goto: node_ask2
- Leave me alone.:
- label: gtfo
- What? No!
- Argh.
- You damn teaser.
- Fine.
- goto: EXIT
- Please, I *have* to know.
- goto: node_ask
--- ---
@ -363,7 +601,7 @@
- Where are we?: - Where are we?:
- Inside Jupiter's rings, obviously. - Inside Jupiter's rings, obviously.
- We're about 150,000km away from the gas giant. - We're about 150,000km away from the gas giant.
- This region is called Serenity by its inhabitants, due to the relative safety from Jupiter's magnetic field and the micros. - This region is called Serenity by its inhabitants, due to the relative safety from Jupiter's magnetic field and the micrometeorites.
- goto: generic_questions - goto: generic_questions
- I think I'm good for now.: [] - I think I'm good for now.: []

View file

@ -16,7 +16,6 @@ use bevy::pbr::{NotShadowCaster, NotShadowReceiver};
use bevy::prelude::*; use bevy::prelude::*;
use bevy_xpbd_3d::prelude::*; use bevy_xpbd_3d::prelude::*;
use regex::Regex; use regex::Regex;
use std::time::SystemTime;
pub const ID_SPECIAL_PLAYERCAM: &str = "PLAYERCAMERA"; pub const ID_SPECIAL_PLAYERCAM: &str = "PLAYERCAMERA";
pub const ID_EARTH: &str = "earth"; pub const ID_EARTH: &str = "earth";
@ -377,9 +376,17 @@ pub fn load_defs(mut ew_spawn: EventWriter<SpawnEvent>) {
} }
} }
["relativeto", id] => { ["relativeto", id] => {
// Offsets this actor's position by the pos. of the actor with the given id.
state.relative_to = Some(id.to_string()); state.relative_to = Some(id.to_string());
} }
["orbitaround", object_id, radius_str] => { ["orbitaround", object_id, radius_str] => {
// Places the actor into an orbit around the object_id so that it's position
// will be offset by the orbital distance (radius_str) and the phase will
// be set dynamically based on the current day+time.
// Unlike the "orbit" command, this position is not static, and there is no
// parameter for a phase offset, though you can set that with the
// "orbit_phase_offset" command.
// Make sure to use this with "relativeto" with the object that's being orbited.
if let Ok(r) = radius_str.parse::<f64>() { if let Ok(r) = radius_str.parse::<f64>() {
state.orbit_distance = Some(r); state.orbit_distance = Some(r);
state.orbit_object_id = Some(object_id.to_string()); state.orbit_object_id = Some(object_id.to_string());
@ -389,6 +396,11 @@ pub fn load_defs(mut ew_spawn: EventWriter<SpawnEvent>) {
} }
} }
["orbit", radius_str, phase_str] => { ["orbit", radius_str, phase_str] => {
// Offsets the actor's position by the given distance (radius_str)
// in the direction as defined by the angle in phase_str.
// Unlike "orbitaround", the position is static though and will not
// change over time.
// Make sure to use this with "relativeto" with the object that's being orbited.
if let (Ok(r), Ok(phase)) = (radius_str.parse::<f64>(), phase_str.parse::<f64>()) { if let (Ok(r), Ok(phase)) = (radius_str.parse::<f64>(), phase_str.parse::<f64>()) {
state.orbit_distance = Some(r); state.orbit_distance = Some(r);
state.orbit_phase = Some(phase * PI * 2.0); state.orbit_phase = Some(phase * PI * 2.0);
@ -398,6 +410,8 @@ pub fn load_defs(mut ew_spawn: EventWriter<SpawnEvent>) {
} }
} }
["orbit_phase_offset", value] => { ["orbit_phase_offset", value] => {
// When used in combination with "orbitaround", this command allows
// you to move the actor ahead (or behind) in its orbit by the given offset.
if let Ok(value_float) = value.parse::<f64>() { if let Ok(value_float) = value.parse::<f64>() {
let offset_radians = 2.0 * PI * value_float; let offset_radians = 2.0 * PI * value_float;
if let Some(phase_radians) = state.orbit_phase { if let Some(phase_radians) = state.orbit_phase {
@ -609,8 +623,8 @@ pub fn load_defs(mut ew_spawn: EventWriter<SpawnEvent>) {
} }
["light", color_hex, brightness] => { ["light", color_hex, brightness] => {
if let Ok(brightness_float) = brightness.parse::<f32>() { if let Ok(brightness_float) = brightness.parse::<f32>() {
if let Ok(color) = Color::hex(color_hex) { if let Ok(color) = Srgba::hex(color_hex) {
state.light_color = Some(color); state.light_color = Some(Color::Srgba(color));
state.light_brightness = brightness_float; state.light_brightness = brightness_float;
} else { } else {
error!("Can't parse hexadecimal color code: {line}"); error!("Can't parse hexadecimal color code: {line}");
@ -754,6 +768,39 @@ fn spawn_scenes(
state.is_point_of_interest = true; state.is_point_of_interest = true;
ew_spawn.send(SpawnEvent(state)); ew_spawn.send(SpawnEvent(state));
} }
"shippingcontainer" => {
let mut state = ParserState::default();
state.class = DefClass::Actor;
state.pos = DVec3::new(
root_state.pos[0] + pos[0],
root_state.pos[1] - pos[2],
root_state.pos[2] + pos[1],
);
state.model = Some("shippingcontainer".to_string());
state.rotation = Quat::from_euler(EulerRot::XYZ, rot[0], rot[1], rot[2]);
// command: relativeto ?
state.relative_to = root_state.relative_to.clone();
// command: name Cruiser
state.name = Some("Shipping Container".to_string());
// command: scale 8
state.model_scale = 8.0;
// command: angularmomentum 0 0 0
state.angular_momentum = DVec3::ZERO;
// command: collider handcrafted
state.collider_is_one_mesh_of_scene = true;
// command: density 500
state.density = 500.0;
// command: pointofinterest yes
ew_spawn.send(SpawnEvent(state));
}
_ => {} _ => {}
} }
} }
@ -796,30 +843,19 @@ fn spawn_entities(
state.pos state.pos
}; };
if let Some(r) = state.orbit_distance { if let Some(r) = state.orbit_distance {
let mut phase_radians = 0.0f64; let mass: Option<f64> = if let Some(id) = &state.orbit_object_id {
if let Some(phase) = state.orbit_phase { match id.as_str() {
phase_radians += phase; "jupiter" => Some(nature::JUPITER_MASS),
} "sol" => Some(nature::JUPITER_MASS),
if let Some(id) = &state.orbit_object_id {
let mass = match id.as_str() {
"jupiter" => nature::JUPITER_MASS,
"sol" => nature::JUPITER_MASS,
_ => { _ => {
error!("Found no mass for object `{id}`"); error!("Found no mass for object `{id}`");
continue; continue;
} }
};
let orbital_period = nature::simple_orbital_period(mass, r);
phase_radians +=
if let Ok(epoch) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
let now = epoch.as_secs_f64() + 614533234154.0; // random
PI * 2.0 * (now % orbital_period) / orbital_period
} else {
error!("Can't determine current time `{id}`");
0.0
};
} }
absolute_pos += nature::phase_dist_to_coords(-phase_radians, r); } else {
None
};
absolute_pos += nature::pos_offset_for_orbiting_body(r, mass, state.orbit_phase);
} }
let scale = Vec3::splat( let scale = Vec3::splat(
if state.is_sun { if state.is_sun {
@ -840,7 +876,6 @@ fn spawn_entities(
// Spawn the actor // Spawn the actor
let actor_entity; let actor_entity;
{
let mut actor = commands.spawn_empty(); let mut actor = commands.spawn_empty();
actor.insert(actor::Actor { actor.insert(actor::Actor {
id: state.id.clone(), id: state.id.clone(),
@ -925,7 +960,7 @@ fn spawn_entities(
if state.is_sun { if state.is_sun {
let (r, g, b) = nature::star_color_index_to_rgb(0.656); let (r, g, b) = nature::star_color_index_to_rgb(0.656);
actor.insert(materials.add(StandardMaterial { actor.insert(materials.add(StandardMaterial {
base_color: Color::rgb(r, g, b) * 13.0, base_color: Color::srgb(r * 13.0, g * 13.0, b * 13.0),
unlit: true, unlit: true,
..default() ..default()
})); }));
@ -1041,12 +1076,12 @@ fn spawn_entities(
..default() ..default()
}, },
spot_light: SpotLight { spot_light: SpotLight {
intensity: 40_000_000.0, // lumens intensity: 400_000_000.0, // lumens
color: Color::WHITE, color: Color::WHITE,
shadows_enabled: true, shadows_enabled: true,
inner_angle: PI32 / 8.0 * 0.85, inner_angle: PI32 / 8.0 * 0.85,
outer_angle: PI32 / 4.0, outer_angle: PI32 / 4.0,
range: 2000.0, range: 3000.0,
..default() ..default()
}, },
visibility: Visibility::Hidden, visibility: Visibility::Hidden,
@ -1056,7 +1091,6 @@ fn spawn_entities(
}); });
} }
actor_entity = actor.id(); actor_entity = actor.id();
}
if let Some(ar_asset_name) = &state.ar_model { if let Some(ar_asset_name) = &state.ar_model {
let mut entitycmd = commands.spawn(( let mut entitycmd = commands.spawn((

View file

@ -1,3 +1,10 @@
A life is like a garden.
Perfect moments can be had,
but not preserved,
except in memory.
Live long and prosper.
- Leonard Nimoy, 2015
Though I heard Though I heard
Everyone goes this road Everyone goes this road
Eventually Eventually

View file

@ -271,6 +271,45 @@ actor 0 59305 0 suitv2
scene 10 -30 20 test scene 10 -30 20 test
relativeto player relativeto player
actor 700 -100 -1100 suitv2
template person
relativeto player
name Luna
id Luna
chatid Luna
angularmomentum 0 0 0
wants maxrotation 0
wants maxvelocity none
rotationy 108
rotationx 180
pronoun he
scene 22 0 0 workshop
relativeto Luna
actor -20 10 -23 MeteorAceGT
name "MeteorAceGT™"
relativeto Luna
scale 5
vehicle yes
collider mesh
thrust 50.25 9.84 6.765 10000 5
engine ion
camdistance 50
density 500
angularmomentum 0 0 0.2
pointofinterest yes
actor -9 4 11 lightorb
relativeto Luna
name "Light Orb"
collider mesh
scale 0.25
light FF8F4A 4000000
actor -8 1 -9 lightorb
relativeto Luna
name "Light Orb"
collider mesh
scale 0.25
light FF8F4A 4000000
actor -55e3 44e3 0 suitv2 actor -55e3 44e3 0 suitv2
template person template person
relativeto thebe relativeto thebe
@ -316,15 +355,18 @@ actor 13200 300 -3000 hollow_asteroid
actor 6 11 4 lightorb actor 6 11 4 lightorb
relativeto cultasteroid relativeto cultasteroid
name "Light Orb" name "Light Orb"
collider mesh
scale 0.25 scale 0.25
light FF8F4A 2000000 light FF8F4A 2000000
actor -6 4 8 lightorb actor -6 4 8 lightorb
relativeto cultasteroid relativeto cultasteroid
name "Light Orb" name "Light Orb"
collider mesh
scale 0.25 scale 0.25
light FF8F4A 2000000 light FF8F4A 2000000
actor -10 -14 0 crate actor -10 -14 0 crate
relativeto cultasteroid relativeto cultasteroid
collider mesh
name "Supply Crate" name "Supply Crate"
actor -8200 -4400 -8100 asteroid_lum actor -8200 -4400 -8100 asteroid_lum
@ -339,6 +381,7 @@ actor -8200 -4400 -8100 asteroid_lum
actor 70 30 30 lightorb actor 70 30 30 lightorb
relativeto Lum relativeto Lum
name "Light Orb" name "Light Orb"
collider mesh
scale 3 scale 3
light FF8F4A 500000000 light FF8F4A 500000000
@ -436,11 +479,13 @@ actor -3300 10 0 pizzeria
actor -52 -10 0 lightorb actor -52 -10 0 lightorb
name "Light Orb" name "Light Orb"
relativeto pizzeria relativeto pizzeria
collider mesh
scale 0.25 scale 0.25
light FF8F4A 5000000 light FF8F4A 5000000
actor -50 -3 -2 lightorb actor -50 -3 -2 lightorb
name "Light Orb" name "Light Orb"
relativeto pizzeria relativeto pizzeria
collider mesh
scale 0.25 scale 0.25
light FF8F4A 5000000 light FF8F4A 5000000
actor -33 0 4 clippy actor -33 0 4 clippy
@ -452,6 +497,7 @@ actor -3300 10 0 pizzeria
wants matchvelocitywith pizzeria wants matchvelocitywith pizzeria
rotationy -126 rotationy -126
chatid SubduedClippy chatid SubduedClippy
collider handcrafted
actor -45 -4 -4 suitv2 actor -45 -4 -4 suitv2
template person template person
@ -480,21 +526,25 @@ actor 30 -12 -40 suitv2
actor 12 -35 -27 lightorb actor 12 -35 -27 lightorb
name "Light Orb" name "Light Orb"
relativeto Icarus relativeto Icarus
collider mesh
scale 0.25 scale 0.25
light FF8F4A 5000000 light FF8F4A 5000000
actor -2 -11 -9 lightorb actor -2 -11 -9 lightorb
name "Light Orb" name "Light Orb"
relativeto Icarus relativeto Icarus
collider mesh
scale 0.25 scale 0.25
light FF8F4A 5000000 light FF8F4A 5000000
actor 26 -39 4 lightorb actor 26 -39 4 lightorb
name "Light Orb" name "Light Orb"
relativeto Icarus relativeto Icarus
collider mesh
scale 0.25 scale 0.25
light FF8F4A 5000000 light FF8F4A 5000000
actor 1.8 -15.5 16 lightorb actor 1.8 -15.5 16 lightorb
name "Light Orb" name "Light Orb"
relativeto Icarus relativeto Icarus
collider mesh
scale 0.25 scale 0.25
light FF8F4A 5000000 light FF8F4A 5000000
@ -519,132 +569,163 @@ actor 100 -18000 2000 clippy
wants matchvelocitywith orbbusstopserenity wants matchvelocitywith orbbusstopserenity
rotationy -90 rotationy -90
chatid ClippyTransSerenity chatid ClippyTransSerenity
collider handcrafted
actor 60 0 0 "orb_busstop" actor 60 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
id orbbusstopserenity id orbbusstopserenity
collider mesh
scale 5 scale 5
actor 80 0 0 "orb_busstop" actor 80 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 100 0 0 "orb_busstop" actor 100 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 120 0 0 "orb_busstop" actor 120 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 140 0 0 "orb_busstop" actor 140 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor -60 0 0 "orb_busstop" actor -60 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor -80 0 0 "orb_busstop" actor -80 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor -100 0 0 "orb_busstop" actor -100 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor -120 0 0 "orb_busstop" actor -120 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor -140 0 0 "orb_busstop" actor -140 0 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 60 0 "orb_busstop" actor 0 60 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 80 0 "orb_busstop" actor 0 80 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 100 0 "orb_busstop" actor 0 100 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 120 0 "orb_busstop" actor 0 120 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 140 0 "orb_busstop" actor 0 140 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 -60 0 "orb_busstop" actor 0 -60 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 -80 0 "orb_busstop" actor 0 -80 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 -100 0 "orb_busstop" actor 0 -100 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 -120 0 "orb_busstop" actor 0 -120 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 -140 0 "orb_busstop" actor 0 -140 0 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 60 "orb_busstop" actor 0 0 60 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 80 "orb_busstop" actor 0 0 80 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 100 "orb_busstop" actor 0 0 100 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 120 "orb_busstop" actor 0 0 120 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 140 "orb_busstop" actor 0 0 140 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 -60 "orb_busstop" actor 0 0 -60 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 -80 "orb_busstop" actor 0 0 -80 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 -100 "orb_busstop" actor 0 0 -100 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 -120 "orb_busstop" actor 0 0 -120 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 0 0 -140 "orb_busstop" actor 0 0 -140 "orb_busstop"
name "StarTrans Bus Stop: Serenity Station" name "StarTrans Bus Stop: Serenity Station"
relativeto busstopclippy relativeto busstopclippy
collider mesh
scale 5 scale 5
actor 8 20 0 suitv2 actor 8 20 0 suitv2
@ -665,132 +746,163 @@ actor -184971e3 149410e3 -134273e3 clippy
wants matchvelocitywith orbbusstopfarview wants matchvelocitywith orbbusstopfarview
rotationy -90 rotationy -90
chatid ClippyTransFarview chatid ClippyTransFarview
collider handcrafted
actor 60 0 0 "orb_busstop" actor 60 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
id orbbusstopfarview id orbbusstopfarview
collider mesh
scale 5 scale 5
actor 80 0 0 "orb_busstop" actor 80 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 100 0 0 "orb_busstop" actor 100 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 120 0 0 "orb_busstop" actor 120 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 140 0 0 "orb_busstop" actor 140 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor -60 0 0 "orb_busstop" actor -60 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor -80 0 0 "orb_busstop" actor -80 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor -100 0 0 "orb_busstop" actor -100 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor -120 0 0 "orb_busstop" actor -120 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor -140 0 0 "orb_busstop" actor -140 0 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 60 0 "orb_busstop" actor 0 60 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 80 0 "orb_busstop" actor 0 80 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 100 0 "orb_busstop" actor 0 100 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 120 0 "orb_busstop" actor 0 120 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 140 0 "orb_busstop" actor 0 140 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 -60 0 "orb_busstop" actor 0 -60 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 -80 0 "orb_busstop" actor 0 -80 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 -100 0 "orb_busstop" actor 0 -100 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 -120 0 "orb_busstop" actor 0 -120 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 -140 0 "orb_busstop" actor 0 -140 0 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 60 "orb_busstop" actor 0 0 60 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 80 "orb_busstop" actor 0 0 80 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 100 "orb_busstop" actor 0 0 100 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 120 "orb_busstop" actor 0 0 120 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 140 "orb_busstop" actor 0 0 140 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 -60 "orb_busstop" actor 0 0 -60 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 -80 "orb_busstop" actor 0 0 -80 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 -100 "orb_busstop" actor 0 0 -100 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 -120 "orb_busstop" actor 0 0 -120 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
actor 0 0 -140 "orb_busstop" actor 0 0 -140 "orb_busstop"
name "StarTrans Bus Stop: Farview Station" name "StarTrans Bus Stop: Farview Station"
relativeto busstopclippy2 relativeto busstopclippy2
collider mesh
scale 5 scale 5
@ -806,132 +918,163 @@ actor 0 -44e3 0 clippy
orbit_phase_offset -0.002 orbit_phase_offset -0.002
rotationy -90 rotationy -90
chatid ClippyTransMetis chatid ClippyTransMetis
collider handcrafted
actor 60 0 0 "orb_busstop" actor 60 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
id orbbusstopmetis id orbbusstopmetis
collider mesh
scale 5 scale 5
actor 80 0 0 "orb_busstop" actor 80 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 100 0 0 "orb_busstop" actor 100 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 120 0 0 "orb_busstop" actor 120 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 140 0 0 "orb_busstop" actor 140 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor -60 0 0 "orb_busstop" actor -60 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor -80 0 0 "orb_busstop" actor -80 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor -100 0 0 "orb_busstop" actor -100 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor -120 0 0 "orb_busstop" actor -120 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor -140 0 0 "orb_busstop" actor -140 0 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 60 0 "orb_busstop" actor 0 60 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 80 0 "orb_busstop" actor 0 80 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 100 0 "orb_busstop" actor 0 100 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 120 0 "orb_busstop" actor 0 120 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 140 0 "orb_busstop" actor 0 140 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 -60 0 "orb_busstop" actor 0 -60 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 -80 0 "orb_busstop" actor 0 -80 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 -100 0 "orb_busstop" actor 0 -100 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 -120 0 "orb_busstop" actor 0 -120 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 -140 0 "orb_busstop" actor 0 -140 0 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 60 "orb_busstop" actor 0 0 60 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 80 "orb_busstop" actor 0 0 80 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 100 "orb_busstop" actor 0 0 100 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 120 "orb_busstop" actor 0 0 120 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 140 "orb_busstop" actor 0 0 140 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 -60 "orb_busstop" actor 0 0 -60 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 -80 "orb_busstop" actor 0 0 -80 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 -100 "orb_busstop" actor 0 0 -100 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 -120 "orb_busstop" actor 0 0 -120 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 0 0 -140 "orb_busstop" actor 0 0 -140 "orb_busstop"
name "StarTrans Bus Stop: Metis Prime Station" name "StarTrans Bus Stop: Metis Prime Station"
relativeto busstopclippy3 relativeto busstopclippy3
collider mesh
scale 5 scale 5
actor 110 0 2000 whale actor 110 0 2000 whale

View file

@ -1,6 +1,8 @@
// THIS FILE IS AUTOGENERATED BY build.rs BASED ON DATA IN src/blender/scene_*.blend FILES!
// DO NOT MODIFY MANUALLY, CHANGES WILL BE OVERWRITTEN!
[ [
("test", "cruiser", [0.0, 10.971298, 1.222765], [-0.27833763, 0.74558806, 0.31813696]), ("test", "cruiser", [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]),
("test", "cruiser", [-0.46667862, -1.2666901, -7.938822], [1.7932074, 0.10752687, 0.15762906]), ("workshop", "shippingcontainer", [0.0, 0.0, 0.0], [-0.026294278, 0.000376441, 0.014312184]),
("test", "cruiser", [-7.409776, -1.4187636, 11.451159], [-0.27833763, 0.74558806, 0.31813696]), ("workshop", "shippingcontainer", [0.0, 12.0, 0.0], [-0.053937975, -0.013098141, 0.0]),
("test", "cruiser", [6.8125467, -11.003204, 0.5323599], [-0.019556522, -1.0606266, -3.0019674]), ("workshop", "shippingcontainer", [0.0, -12.0, 0.0], [0.061487854, 0.08236491, -0.051188234]),
] ]

View file

@ -11,6 +11,7 @@
// This module handles player input, and coordinates interplay between other modules // This module handles player input, and coordinates interplay between other modules
use crate::prelude::*; use crate::prelude::*;
use bevy::color::palettes::css;
use bevy::pbr::ExtendedMaterial; use bevy::pbr::ExtendedMaterial;
use bevy::prelude::*; use bevy::prelude::*;
use bevy::scene::SceneInstance; use bevy::scene::SceneInstance;
@ -304,21 +305,21 @@ fn handle_player_death(
actor::DamageType::Trauma => { actor::DamageType::Trauma => {
settings.death_cause = "Trauma".to_string(); settings.death_cause = "Trauma".to_string();
ew_effect.send(visual::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::MAROON), class: visual::Effects::FadeIn(css::MAROON.into()),
duration: 1.0, duration: 1.0,
}); });
} }
actor::DamageType::GForce => { actor::DamageType::GForce => {
settings.death_cause = "Trauma from excessive g forces".to_string(); settings.death_cause = "Trauma from excessive g forces".to_string();
ew_effect.send(visual::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::MAROON), class: visual::Effects::FadeIn(css::MAROON.into()),
duration: 1.0, duration: 1.0,
}); });
} }
_ => { _ => {
settings.death_cause = "Unknown".to_string(); settings.death_cause = "Unknown".to_string();
ew_effect.send(visual::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: visual::Effects::FadeIn(Color::MAROON), class: visual::Effects::FadeIn(css::MAROON.into()),
duration: 1.0, duration: 1.0,
}); });
} }
@ -506,9 +507,7 @@ fn handle_achievement_event(
} }
AchievementEvent::InJupitersShadow => { AchievementEvent::InJupitersShadow => {
if !tracker.in_jupiters_shadow { if !tracker.in_jupiters_shadow {
ew_game.send(GameEvent::Achievement( ew_game.send(GameEvent::Achievement("Enter Jupiter's Shadow".into()));
"Eclipse the sun with Jupiter".into(),
));
} }
tracker.in_jupiters_shadow = true; tracker.in_jupiters_shadow = true;
} }

View file

@ -970,7 +970,7 @@ fn update_hud(
LogLevel::Info => settings.hud_color_console_system, LogLevel::Info => settings.hud_color_console_system,
_ => settings.hud_color_console, _ => settings.hud_color_console,
}; };
chat.sections[row].style.color.set_a(opacity); chat.sections[row].style.color.set_alpha(opacity);
row += 1; row += 1;
} }
@ -1094,6 +1094,7 @@ fn handle_target_event(
play_sfx = true; play_sfx = true;
} }
if let Some(entity) = target { if let Some(entity) = target {
// TODO: This can panic if the entity despawns in the meantime
commands.entity(*entity).insert(IsTargeted); commands.entity(*entity).insert(IsTargeted);
play_sfx = true; play_sfx = true;
@ -1134,7 +1135,7 @@ fn update_target_selectagon(
} }
selectagon_trans.translation = target_trans.translation; selectagon_trans.translation = target_trans.translation;
selectagon_trans.scale = target_trans.scale; selectagon_trans.scale = target_trans.scale;
selectagon_trans.look_at(camera_trans.translation, camera_trans.up().into()); selectagon_trans.look_at(camera_trans.translation, camera_trans.up());
// Enlarge Selectagon to a minimum angular diameter // Enlarge Selectagon to a minimum angular diameter
let (angular_diameter, _, _) = let (angular_diameter, _, _) =
@ -1221,7 +1222,7 @@ fn update_poi_overlays(
if angular_diameter < min_angular_diameter { if angular_diameter < min_angular_diameter {
trans.scale *= min_angular_diameter / angular_diameter; trans.scale *= min_angular_diameter / angular_diameter;
} }
trans.look_at(camera_trans.translation, camera_trans.up().into()); trans.look_at(camera_trans.translation, camera_trans.up());
} }
} }
} }

View file

@ -44,6 +44,7 @@ pub fn asset_name_to_path(name: &str) -> &'static str {
"crate" => "models/crate.glb#Scene0", "crate" => "models/crate.glb#Scene0",
"MeteorAceGT" => "models/MeteorAceGT.glb#Scene0", "MeteorAceGT" => "models/MeteorAceGT.glb#Scene0",
"cruiser" => "models/cruiser.glb#Scene0", "cruiser" => "models/cruiser.glb#Scene0",
"shippingcontainer" => "models/shippingcontainer.glb#Scene0",
"satellite" => "models/satellite.glb#Scene0", "satellite" => "models/satellite.glb#Scene0",
"pizzeria" => "models/pizzeria2.glb#Scene0", "pizzeria" => "models/pizzeria2.glb#Scene0",
"pizzasign" => "models/pizzasign.glb#Scene0", "pizzasign" => "models/pizzasign.glb#Scene0",
@ -121,7 +122,7 @@ impl AsteroidSurface {
pub fn material() -> ExtendedMaterial<StandardMaterial, AsteroidSurface> { pub fn material() -> ExtendedMaterial<StandardMaterial, AsteroidSurface> {
ExtendedMaterial { ExtendedMaterial {
base: StandardMaterial { base: StandardMaterial {
base_color: Color::rgb(0.29, 0.255, 0.208), base_color: Color::srgb(0.29, 0.255, 0.208),
perceptual_roughness: 1.0, perceptual_roughness: 1.0,
opaque_render_method: OpaqueRendererMethod::Auto, opaque_render_method: OpaqueRendererMethod::Auto,
..default() ..default()

View file

@ -186,7 +186,7 @@ pub fn setup(
MenuElement, MenuElement,
NodeBundle { NodeBundle {
style: style_fullscreen(), style: style_fullscreen(),
background_color: Color::rgba(0.0, 0.0, 0.0, 0.8).into(), background_color: Color::srgba(0.0, 0.0, 0.0, 0.8).into(),
visibility: Visibility::Hidden, visibility: Visibility::Hidden,
..default() ..default()
}, },
@ -517,7 +517,7 @@ pub fn handle_input(
keyboard_input: Res<ButtonInput<KeyCode>>, keyboard_input: Res<ButtonInput<KeyCode>>,
mut settings: ResMut<Settings>, mut settings: ResMut<Settings>,
mut menustate: ResMut<MenuState>, mut menustate: ResMut<MenuState>,
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>, mut app_exit_events: ResMut<Events<AppExit>>,
mut ew_game: EventWriter<game::GameEvent>, mut ew_game: EventWriter<game::GameEvent>,
mut ew_playerdies: EventWriter<game::PlayerDiesEvent>, mut ew_playerdies: EventWriter<game::PlayerDiesEvent>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
@ -601,7 +601,7 @@ pub fn handle_input(
ew_playerdies.send(game::PlayerDiesEvent(actor::DamageType::Depressurization)); ew_playerdies.send(game::PlayerDiesEvent(actor::DamageType::Depressurization));
} }
MenuAction::Quit => { MenuAction::Quit => {
app_exit_events.send(bevy::app::AppExit); app_exit_events.send(AppExit::Success);
} }
}; };
} }

View file

@ -11,6 +11,7 @@
// This module manages the messy, impure parts of our universe. // This module manages the messy, impure parts of our universe.
use crate::prelude::*; use crate::prelude::*;
use std::time::SystemTime;
pub const OXYGEN_USE_KG_PER_S: f32 = 1e-5; pub const OXYGEN_USE_KG_PER_S: f32 = 1e-5;
pub const OXY_S: f32 = OXYGEN_USE_KG_PER_S; pub const OXY_S: f32 = OXYGEN_USE_KG_PER_S;
@ -33,6 +34,9 @@ pub const SOL_MASS: f64 = 1.9885e30;
pub const JUPITER_MASS: f64 = 1.8982e27; pub const JUPITER_MASS: f64 = 1.8982e27;
pub const EARTH_MASS: f64 = 5.972168e24; pub const EARTH_MASS: f64 = 5.972168e24;
// Arbitrary offset to time epoch, to generate more interesting orbital arrangements:
pub const ORBIT_TIME_OFFSET: f64 = 614533234154.0;
// Each star's values: (x, y, z, magnitude, color index, distance, name) // Each star's values: (x, y, z, magnitude, color index, distance, name)
pub const STARS: &[(f32, f32, f32, f32, f32, f32, &str)] = &include!("data/stars.in"); pub const STARS: &[(f32, f32, f32, f32, f32, f32, &str)] = &include!("data/stars.in");
@ -204,3 +208,25 @@ pub fn phase_dist_to_coords(phase_radians: f64, distance: f64) -> DVec3 {
distance * phase_radians.sin(), distance * phase_radians.sin(),
); );
} }
pub fn pos_offset_for_orbiting_body(
orbit_distance: f64,
orbited_mass: Option<f64>,
phase_offset: Option<f64>,
) -> DVec3 {
let r = orbit_distance;
let mut phase_radians = 0.0f64;
if let Some(phase_offset) = phase_offset {
phase_radians += phase_offset
}
if let Some(mass) = orbited_mass {
if let Ok(epoch) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
let orbital_period = simple_orbital_period(mass, r);
let now = epoch.as_secs_f64() + ORBIT_TIME_OFFSET;
phase_radians += PI * 2.0 * (now % orbital_period) / orbital_period;
} else {
eprintln!("WARNING: Can't determine current time in calculate_position_offset_for_orbiting_body().");
}
}
return phase_dist_to_coords(-phase_radians, r);
}

View file

@ -204,24 +204,24 @@ impl Default for Settings {
font_size_achievement_header: 32.0, font_size_achievement_header: 32.0,
font_size_keybindings: 20.0, font_size_keybindings: 20.0,
font_size_version: 20.0, font_size_version: 20.0,
hud_color: Color::hex(COLOR_PRIMARY).unwrap(), hud_color: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
hud_color_fps: Color::hex("#181818").unwrap(), hud_color_fps: Srgba::hex("#181818").unwrap().into(),
hud_color_console: Color::hex(COLOR_PRIMARY).unwrap(), hud_color_console: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
hud_color_console_achievement: Color::hex(COLOR_SUCCESS).unwrap(), hud_color_console_achievement: Srgba::hex(COLOR_SUCCESS).unwrap().into(),
hud_color_console_warn: Color::hex(COLOR_WARNING).unwrap(), hud_color_console_warn: Srgba::hex(COLOR_WARNING).unwrap().into(),
hud_color_console_system: Color::hex(COLOR_SECONDARY).unwrap(), hud_color_console_system: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_alert: Color::hex(COLOR_SECONDARY).unwrap(), hud_color_alert: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_subtitles: Color::hex(COLOR_SECONDARY).unwrap(), hud_color_subtitles: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_choices: Color::hex(COLOR_BODY).unwrap(), hud_color_choices: Srgba::hex(COLOR_BODY).unwrap().into(),
hud_color_speedometer: Color::hex(COLOR_PRIMARY).unwrap(), hud_color_speedometer: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
hud_color_deathpoem: Color::hex("#CC2200").unwrap(), hud_color_deathpoem: Srgba::hex("#CC2200").unwrap().into(),
hud_color_achievement: Color::hex(COLOR_DIM).unwrap(), hud_color_achievement: Srgba::hex(COLOR_DIM).unwrap().into(),
hud_color_achievement_accomplished: Color::hex(COLOR_SUCCESS).unwrap(), hud_color_achievement_accomplished: Srgba::hex(COLOR_SUCCESS).unwrap().into(),
hud_color_achievement_header: Color::hex(COLOR_PRIMARY).unwrap(), hud_color_achievement_header: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
hud_color_death: Color::hex(COLOR_SECONDARY).unwrap(), hud_color_death: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_death_achievements: Color::hex(COLOR_SECONDARY).unwrap(), hud_color_death_achievements: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_keybindings: Color::hex(COLOR_DIM).unwrap(), hud_color_keybindings: Srgba::hex(COLOR_DIM).unwrap().into(),
hud_color_version: Color::hex(COLOR_PRIMARY).unwrap(), hud_color_version: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 }, chat_speed: DEFAULT_CHAT_SPEED * if dev_mode { 2.5 } else { 1.0 },
ar_avatar: 0, ar_avatar: 0,
flashlight_active: false, flashlight_active: false,
@ -405,7 +405,7 @@ impl AchievementTracker {
format!("Ride Every Vehicle{ride}\n"), format!("Ride Every Vehicle{ride}\n"),
format!("Talk To Everyone{talk}\n"), format!("Talk To Everyone{talk}\n"),
"Find Earth\n".to_string(), "Find Earth\n".to_string(),
"Eclipse The Sun With Jupiter\n".to_string(), "Enter Jupiter's Shadow\n".to_string(),
] ]
} }
pub fn to_overview(&self) -> Vec<(bool, String)> { pub fn to_overview(&self) -> Vec<(bool, String)> {
@ -415,10 +415,7 @@ impl AchievementTracker {
(self.ride_every_vehicle, "ride every vehicle".into()), (self.ride_every_vehicle, "ride every vehicle".into()),
(self.talk_to_everyone, "talk to everyone".into()), (self.talk_to_everyone, "talk to everyone".into()),
(self.find_earth, "find Earth".into()), (self.find_earth, "find Earth".into()),
( (self.in_jupiters_shadow, "enter Jupiter's shadow".into()),
self.in_jupiters_shadow,
"eclipse the Sun with Jupiter".into(),
),
] ]
} }
pub fn to_summary(&self) -> String { pub fn to_summary(&self) -> String {

View file

@ -12,6 +12,7 @@
use crate::prelude::*; use crate::prelude::*;
use bevy::prelude::*; use bevy::prelude::*;
use std::time::Duration;
pub struct VisualPlugin; pub struct VisualPlugin;
@ -57,13 +58,36 @@ pub struct SpawnEffectEvent {
pub duration: f64, pub duration: f64,
} }
pub fn setup(settings: Res<var::Settings>, mut ew_effect: EventWriter<SpawnEffectEvent>) { #[derive(Resource)]
pub struct SuitAnimation {
index: AnimationNodeIndex,
graph: Handle<AnimationGraph>,
}
pub fn setup(
settings: Res<var::Settings>,
asset_server: Res<AssetServer>,
mut commands: Commands,
mut ew_effect: EventWriter<SpawnEffectEvent>,
mut graphs: ResMut<Assets<AnimationGraph>>,
) {
if !settings.dev_mode { if !settings.dev_mode {
ew_effect.send(SpawnEffectEvent { ew_effect.send(SpawnEffectEvent {
class: Effects::FadeIn(Color::BLACK), class: Effects::FadeIn(Color::BLACK),
duration: 4.0, duration: 4.0,
}); });
} }
let mut graph = AnimationGraph::new();
let index = graph.add_clip(
asset_server.load(GltfAssetLabel::Animation(0).from_asset("models/suit_v2/suit_v2.glb")),
1.0,
graph.root,
);
let graph = graphs.add(graph);
commands.insert_resource(SuitAnimation { index, graph });
// Blackout disabled for now // Blackout disabled for now
// commands.spawn(( // commands.spawn((
// BlackOutOverlay, // BlackOutOverlay,
@ -115,7 +139,7 @@ pub fn spawn_effects(
FadeOut, FadeOut,
NodeBundle { NodeBundle {
style: style_fullscreen(), style: style_fullscreen(),
background_color: color.with_a(0.0).into(), background_color: color.with_alpha(0.0).into(),
..default() ..default()
}, },
)); ));
@ -136,7 +160,7 @@ pub fn update_fadein(
continue; continue;
} }
let alpha = (1.3 - 1.3 * (now - effect.start_time) / effect.duration).clamp(0.0, 1.0); let alpha = (1.3 - 1.3 * (now - effect.start_time) / effect.duration).clamp(0.0, 1.0);
bgcolor.0.set_a(alpha as f32); bgcolor.0.set_alpha(alpha as f32);
} }
} }
@ -152,17 +176,25 @@ pub fn update_fadeout(
continue; continue;
} }
let alpha = ((now - effect.start_time) / effect.duration).clamp(0.0, 1.0); let alpha = ((now - effect.start_time) / effect.duration).clamp(0.0, 1.0);
bgcolor.0.set_a(alpha as f32); bgcolor.0.set_alpha(alpha as f32);
} }
} }
fn play_animations( fn play_animations(
mut players: Query<&mut AnimationPlayer, Added<AnimationPlayer>>, mut commands: Commands,
asset_server: Res<AssetServer>, mut players: Query<(Entity, &mut AnimationPlayer), Added<AnimationPlayer>>,
suit_animation: Res<SuitAnimation>,
) { ) {
for mut player in &mut players { for (entity, mut player) in &mut players {
let animation = asset_server.load("models/suit_v2/suit_v2.glb#Animation0"); let mut transitions = AnimationTransitions::new();
player.play(animation.clone()).repeat(); transitions
.play(&mut player, suit_animation.index, Duration::ZERO)
.repeat();
commands
.entity(entity)
.insert(suit_animation.graph.clone())
.insert(transitions);
//player.play(suit_ani_node_index.0).repeat();
} }
} }
@ -175,6 +207,6 @@ fn play_animations(
// let threshold = 0.3; // let threshold = 0.3;
// let factor = 1.0 / (1.0 - threshold); // let factor = 1.0 / (1.0 - threshold);
// let alpha = (factor * (gforce.blackout - threshold)).clamp(0.0, 1.0); // let alpha = (factor * (gforce.blackout - threshold)).clamp(0.0, 1.0);
// bgcolor.0.set_a(alpha as f32); // bgcolor.0.set_alpha(alpha as f32);
// } // }
//} //}

View file

@ -115,7 +115,7 @@ pub fn setup(
//(radius as f64 * nature::SOL_RADIUS).powf(0.02) as f32 * //(radius as f64 * nature::SOL_RADIUS).powf(0.02) as f32 *
let star_color_handle = materials.add(StandardMaterial { let star_color_handle = materials.add(StandardMaterial {
base_color: Color::rgb(scale_color(r), scale_color(g), scale_color(b)), base_color: Color::srgb(scale_color(r), scale_color(g), scale_color(b)),
unlit: true, unlit: true,
..default() ..default()
}); });