add option to fast travel *into* jupiter
This commit is contained in:
parent
0ce3d03e1f
commit
facfa26ef2
59
src/chat.rs
59
src/chat.rs
|
@ -1026,6 +1026,65 @@ pub fn handle_chat_scripts(
|
|||
});
|
||||
}
|
||||
}
|
||||
"jupiterdive" => {
|
||||
let dest = vars.get("$$dive_destination");
|
||||
let speed_kmh = vars.getf("$$dive_speed");
|
||||
let angle = vars.getf("$$dive_angle");
|
||||
|
||||
if let (Some(dest), Some(speed_kmh), Some(angle)) = (dest, speed_kmh, angle) {
|
||||
let distance = if angle < 10.0 {
|
||||
if speed_kmh >= 1e7 {
|
||||
1e8
|
||||
} else if speed_kmh >= 1e6 {
|
||||
1e7
|
||||
} else {
|
||||
1e6
|
||||
}
|
||||
} else {
|
||||
1e6
|
||||
};
|
||||
let jupiter_pos = id2pos
|
||||
.0
|
||||
.get(cmd::ID_JUPITER)
|
||||
.unwrap_or_else(|| &DVec3::ZERO);
|
||||
let latitude: f64 = match dest.as_str() {
|
||||
"aurora" => 70.0,
|
||||
"equator" => -4.0,
|
||||
"redspot" => -25.0,
|
||||
_ => {
|
||||
error!("Unknown destination for jupiterdive chat script: '{dest}'");
|
||||
0.0
|
||||
}
|
||||
};
|
||||
let offset = DQuat::from_rotation_z(latitude.to_radians())
|
||||
* DVec3::new(nature::JUPITER_RADIUS + distance, 0.0, 0.0);
|
||||
//let offset = DQuat::from_rotation_z(angle.to_radians()) * DVec3::new(distance, 0.0, 0.0);
|
||||
let target_pos = *jupiter_pos + offset;
|
||||
|
||||
let v_horizontal = DVec3::X * speed_kmh / 3.6; // km/h -> m/s
|
||||
let v_requested_steepness =
|
||||
DQuat::from_rotation_y((180.0 - angle).to_radians()) * v_horizontal;
|
||||
let v_target =
|
||||
DQuat::from_rotation_z(latitude.to_radians()) * v_requested_steepness;
|
||||
let towards_jupiter =
|
||||
look_at_quat(target_pos, *jupiter_pos, Dir3::X.as_dvec3());
|
||||
if let Ok((mut pos, mut rot, mut v)) = q_playercam.get_single_mut() {
|
||||
v.0 = v_target;
|
||||
pos.0 = target_pos;
|
||||
rot.0 = towards_jupiter;
|
||||
}
|
||||
|
||||
suit.oxygen = suit.oxygen_max;
|
||||
gforce.ignore_gforce_seconds = 1.0;
|
||||
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
|
||||
ew_effect.send(visual::SpawnEffectEvent {
|
||||
class: visual::Effects::FadeIn(css::AQUA.into()),
|
||||
duration: 1.0,
|
||||
});
|
||||
} else {
|
||||
error!("Chat script 'jupiterdive' needs the '$$dive_*' variables to be set.");
|
||||
}
|
||||
}
|
||||
"cryofadeout" => {
|
||||
ew_effect.send(visual::SpawnEffectEvent {
|
||||
class: visual::Effects::FadeOut(css::AQUA.into()),
|
||||
|
|
|
@ -63,15 +63,67 @@
|
|||
- Metis Prime is an abandoned asteroid mining area with dangerous radiation.
|
||||
- Farview is a tourist lookout spot with no current human population.
|
||||
- goto: travel_node_stationselect
|
||||
- Can you shoot me into Jupiter?:
|
||||
- But of course! For such an unhinged request, please submit to a breath analyzer check to confirm that you are sober.
|
||||
- "[Accept breath analyzer request]":
|
||||
- Test passed. Where exactly would you like to go?
|
||||
- To the aurora!:
|
||||
- set: $$dive_destination aurora
|
||||
- goto: travel_dive
|
||||
- Equator, please!:
|
||||
- set: $$dive_destination equator
|
||||
- goto: travel_dive
|
||||
- The great red spot!:
|
||||
- set: $$dive_destination redspot
|
||||
- goto: travel_dive
|
||||
- I changed my mind.:
|
||||
- Very reasonable of you. Anything else I can help you with?
|
||||
- I changed my mind.:
|
||||
- Very reasonable of you. Anything else I can help you with?
|
||||
- Where can I find you?:
|
||||
- We advertise our stations with a large green cross.
|
||||
- Just look around, chances are that you are near one.
|
||||
- If not, simply request a pick-up and we will find you.
|
||||
- goto: travel_mainnode
|
||||
- I just wanted to say that you're awesome!:
|
||||
- Thank you so much!
|
||||
- Hearing this makes my day!
|
||||
- Satisfying our customers is what I'm programmed to live for.
|
||||
- goto: travel_mainnode
|
||||
- "[Hang up]":
|
||||
- goto: EXIT
|
||||
- goto: travel_mainnode
|
||||
|
||||
- label: travel_dive
|
||||
- What speed?
|
||||
- Just drop me off in the atmosphere.:
|
||||
- set: $$dive_speed 0
|
||||
- set: $$dive_angle 0
|
||||
- goto: travel_dive_confirm
|
||||
- "10,000km/h":
|
||||
- set: $$dive_speed 10000
|
||||
- "100,000km/h":
|
||||
- set: $$dive_speed 100000
|
||||
- "1,000,000km/h":
|
||||
- set: $$dive_speed 1000000
|
||||
- "10,000,000km/h":
|
||||
- set: $$dive_speed 10000000
|
||||
- "[Hang up]":
|
||||
- goto: EXIT
|
||||
|
||||
- What angle?
|
||||
- Straight in, zero degrees:
|
||||
- set: $$dive_angle 0
|
||||
- Steep, 30 degrees:
|
||||
- set: $$dive_angle 30
|
||||
- Flat, 60 degrees:
|
||||
- set: $$dive_angle 60
|
||||
- Horizontal, 90 degrees:
|
||||
- set: $$dive_angle 90
|
||||
- "[Hang up]":
|
||||
- goto: EXIT
|
||||
|
||||
- label: travel_dive_confirm
|
||||
- Parameters confirmed. Are you ready?
|
||||
- Let's do this!:
|
||||
- script: jupiterdive
|
||||
- "[Hang up]": []
|
||||
- goto: EXIT
|
||||
|
|
|
@ -95,7 +95,7 @@ actor 0 0 0
|
|||
atmosphere jupiter
|
||||
physics off
|
||||
rotationy 3.13
|
||||
rotationz 135
|
||||
rotationz 55
|
||||
angularmomentum 30 30 30
|
||||
actor 0 0 0 orbitring
|
||||
scale 778.479e9
|
||||
|
|
Loading…
Reference in a new issue