Compare commits

...

3 commits

5 changed files with 44 additions and 6 deletions

View file

@ -2,6 +2,7 @@
- Implement fast travel (must be unlocked by getting phone number of FASTravel) - Implement fast travel (must be unlocked by getting phone number of FASTravel)
- Implement phone calls - Implement phone calls
- Implement factory reset
- Chats don't automatically advance now, the player has to press "Continue" - Chats don't automatically advance now, the player has to press "Continue"
- Add sparkles to Jupiter's ring ✨😍✨ best visible from Farview Station - Add sparkles to Jupiter's ring ✨😍✨ best visible from Farview Station
- Add setting to change pointer - Add setting to change pointer

View file

@ -894,7 +894,7 @@ pub fn handle_chat_scripts(
), ),
With<actor::Player>, With<actor::Player>,
>, >,
mut q_playercam: Query<(&mut Position, &mut LinearVelocity), With<actor::PlayerCamera>>, mut q_playercam: Query<(&mut Position, &mut Rotation, &mut LinearVelocity), With<actor::PlayerCamera>>,
mut q_chats: Query<&mut Chat>, mut q_chats: Query<&mut Chat>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>, mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
@ -960,16 +960,23 @@ pub fn handle_chat_scripts(
if param1.is_empty() { if param1.is_empty() {
error!("Chat script cryotrip needs a parameter"); error!("Chat script cryotrip needs a parameter");
} else { } else {
if let Ok((mut pos, mut v)) = q_playercam.get_single_mut() { if let Ok((mut pos, mut rot, mut v)) = q_playercam.get_single_mut() {
let busstop = match param1 { let busstop = match param1 {
"serenity" => Some("busstopclippy"), "serenity" => Some("busstopclippy"),
"farview" => Some("busstopclippy2"), "farview" => Some("busstopclippy2"),
"metisprime" => Some("busstopclippy3"), "metisprime" => Some("busstopclippy3"),
_ => None, _ => None,
}; };
let looktarget = match param1 {
"serenity" => Some("pizzeria"),
"farview" => Some("jupiter"),
"metisprime" => Some("busstopclippy3"),
_ => None,
};
if let Some(station) = busstop { if let Some(station) = busstop {
if let Some(target_pos) = id2pos.0.get(&station.to_string()) { if let Some(target_pos) = id2pos.0.get(&station.to_string()) {
pos.0 = *target_pos + DVec3::new(0.0, -1000.0, 0.0); pos.0 = *target_pos + DVec3::new(0.0, 9000.0, 0.0);
} else { } else {
error!( error!(
"Could not determine position of actor with ID: '{}'", "Could not determine position of actor with ID: '{}'",
@ -987,6 +994,12 @@ pub fn handle_chat_scripts(
} else { } else {
error!("Invalid destination for cryotrip chat script: '{}'", param1); error!("Invalid destination for cryotrip chat script: '{}'", param1);
} }
if let Some(looktarget) = looktarget {
if let Some(target_pos) = id2pos.0.get(&looktarget.to_string()) {
rot.0 = look_at_quat(**pos, *target_pos, Dir3::X.as_dvec3());
}
}
} }
if let Ok((_, mut suit, mut gforce)) = q_player.get_single_mut() { if let Ok((_, mut suit, mut gforce)) = q_player.get_single_mut() {
suit.oxygen = suit.oxygen_max; suit.oxygen = suit.oxygen_max;

View file

@ -613,7 +613,7 @@ actor -300 0 40 suitv2
oxygen 0.08 oxygen 0.08
pronoun she pronoun she
actor 100 -18000 2000 clippy actor 100 -12000 2000 clippy
template clippy template clippy
relativeto "player" relativeto "player"
id "busstopclippy" id "busstopclippy"

View file

@ -105,6 +105,7 @@ pub enum Turn {
On, On,
Off, Off,
Toggle, Toggle,
Unchanged,
} }
impl Turn { impl Turn {
@ -113,6 +114,7 @@ impl Turn {
Turn::On => true, Turn::On => true,
Turn::Off => false, Turn::Off => false,
Turn::Toggle => !current_state, Turn::Toggle => !current_state,
Turn::Unchanged => current_state,
} }
} }
} }
@ -122,6 +124,7 @@ pub enum Cycle {
Last, Last,
Next, Next,
Previous, Previous,
Unchanged,
} }
impl Cycle { impl Cycle {
@ -147,6 +150,9 @@ impl Cycle {
Some(current_index - 1) Some(current_index - 1)
} }
} }
Cycle::Unchanged => {
Some(current_index)
}
} }
} }
} }
@ -170,7 +176,7 @@ pub fn handle_game_event(
mut ew_togglemusic: EventWriter<audio::ToggleMusicEvent>, mut ew_togglemusic: EventWriter<audio::ToggleMusicEvent>,
mut q_window: Query<&mut Window, With<PrimaryWindow>>, mut q_window: Query<&mut Window, With<PrimaryWindow>>,
mut q_light: Query<&mut DirectionalLight>, mut q_light: Query<&mut DirectionalLight>,
mut q_flashlight: Query<&mut SpotLight, With<actor::PlayersFlashLight>>, mut q_flashlight: Query<(&mut Visibility, &mut SpotLight), With<actor::PlayersFlashLight>>,
mut mapcam: ResMut<camera::MapCam>, mut mapcam: ResMut<camera::MapCam>,
mut log: ResMut<hud::Log>, mut log: ResMut<hud::Log>,
opt: Res<var::CommandLineOptions>, opt: Res<var::CommandLineOptions>,
@ -268,8 +274,9 @@ pub fn handle_game_event(
); );
} }
GameEvent::UpdateFlashlight => { GameEvent::UpdateFlashlight => {
for mut spotlight in &mut q_flashlight { for (mut visibility, mut spotlight) in &mut q_flashlight {
spotlight.intensity = actor::FLASHLIGHT_INTENSITY[prefs.flashlight_power]; spotlight.intensity = actor::FLASHLIGHT_INTENSITY[prefs.flashlight_power];
*visibility = bool2vis(settings.flashlight_active);
} }
} }
GameEvent::PhoneCall => { GameEvent::PhoneCall => {

View file

@ -79,6 +79,7 @@ pub const MENUDEF: &[(&str, MenuAction)] = &[
("", MenuAction::ToggleCamera), ("", MenuAction::ToggleCamera),
("", MenuAction::ToggleShadows), ("", MenuAction::ToggleShadows),
("Fullscreen [F11]", MenuAction::ToggleFullscreen), ("Fullscreen [F11]", MenuAction::ToggleFullscreen),
("FACTORY RESET", MenuAction::ResetSettings),
("Take Off Helmet", MenuAction::Restart), ("Take Off Helmet", MenuAction::Restart),
("Quit", MenuAction::Quit), ("Quit", MenuAction::Quit),
]; ];
@ -99,6 +100,7 @@ pub enum MenuAction {
ToggleCamera, ToggleCamera,
ToggleFullscreen, ToggleFullscreen,
ToggleShadows, ToggleShadows,
ResetSettings,
Restart, Restart,
Quit, Quit,
} }
@ -780,6 +782,21 @@ pub fn handle_input(
ew_game.send(GameEvent::SetMenu(Turn::Off)); ew_game.send(GameEvent::SetMenu(Turn::Off));
ew_updatemenu.send(UpdateMenuEvent); ew_updatemenu.send(UpdateMenuEvent);
} }
MenuAction::ResetSettings => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::PowerDown));
*settings = Settings::default();
*prefs = Preferences::default();
prefs.save();
ew_game.send(GameEvent::SetShadows(Turn::Unchanged));
ew_game.send(GameEvent::SetFullscreen(Turn::Unchanged));
ew_game.send(GameEvent::SetSound(game::Cycle::Unchanged));
ew_game.send(GameEvent::SetMusic(game::Cycle::Unchanged));
ew_game.send(GameEvent::SetAR(Turn::Unchanged));
ew_game.send(GameEvent::UpdateFlashlight);
ew_updatepointer.send(hud::UpdatePointerEvent);
ew_updateavatar.send(hud::UpdateAvatarEvent);
ew_updatemenu.send(UpdateMenuEvent);
}
MenuAction::Restart => { MenuAction::Restart => {
settings.god_mode = false; settings.god_mode = false;
ew_playerdies.send(game::PlayerDiesEvent(actor::DamageType::Depressurization)); ew_playerdies.send(game::PlayerDiesEvent(actor::DamageType::Depressurization));