2024-02-02 22:19:06 -08:00
|
|
|
fn init(state) {
|
2024-02-04 11:45:49 -08:00
|
|
|
|
|
|
|
conf_set_starfield(true);
|
|
|
|
conf_set_phys(false);
|
|
|
|
|
|
|
|
add_sprite(
|
2024-02-02 22:19:06 -08:00
|
|
|
"se_box",
|
|
|
|
"ui::outfitterbox",
|
|
|
|
Rect(
|
|
|
|
-1.0, -1.0, 202.345, 133.409,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::SouthWest,
|
|
|
|
Anchor::SouthWest
|
2024-02-02 22:19:06 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_textbox(
|
2024-02-03 16:45:47 -08:00
|
|
|
"exit_text", 10.0, 10.0,
|
2024-02-02 22:19:06 -08:00
|
|
|
Rect(
|
|
|
|
122.71, 48.0, 51.0, 12.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthWest,
|
|
|
|
Anchor::SouthWest
|
2024-02-03 16:21:21 -08:00
|
|
|
),
|
|
|
|
Color(1.0, 1.0, 1.0, 1.0)
|
2024-02-02 22:19:06 -08:00
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_font_serif("exit_text");
|
|
|
|
textbox_align_center("exit_text");
|
|
|
|
textbox_set_text("exit_text", "Exit");
|
2024-02-02 22:19:06 -08:00
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_sprite(
|
2024-02-02 22:19:06 -08:00
|
|
|
"exit_button",
|
|
|
|
"ui::button",
|
|
|
|
Rect(
|
|
|
|
113.35, 52.0, 69.8, 18.924,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthWest,
|
|
|
|
Anchor::SouthWest
|
2024-02-02 22:19:06 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_sprite(
|
2024-02-02 22:19:06 -08:00
|
|
|
"ship_bg",
|
|
|
|
"ui::outfitter-ship-bg",
|
|
|
|
Rect(
|
|
|
|
16.0, -16.0, 190.0, 353.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthWest,
|
|
|
|
Anchor::NorthWest
|
2024-02-02 22:19:06 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_sprite(
|
2024-02-02 22:19:06 -08:00
|
|
|
"ship_thumb",
|
|
|
|
"icon::gypsum",
|
|
|
|
Rect(
|
|
|
|
111.0, -95.45, 90.0, 90.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::Center,
|
|
|
|
Anchor::NorthWest
|
2024-02-02 22:19:06 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_textbox(
|
2024-02-03 16:45:47 -08:00
|
|
|
"ship_name", 10.0, 10.0,
|
2024-02-02 22:19:06 -08:00
|
|
|
Rect(
|
|
|
|
111.0, -167.27, 145.0, 10.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::Center,
|
|
|
|
Anchor::NorthWest
|
2024-02-03 16:21:21 -08:00
|
|
|
),
|
|
|
|
Color(1.0, 1.0, 1.0, 1.0)
|
2024-02-02 22:19:06 -08:00
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_font_serif("ship_name");
|
|
|
|
textbox_align_center("ship_name");
|
|
|
|
textbox_set_text("ship_name", "Hyperion");
|
2024-02-02 22:19:06 -08:00
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_textbox(
|
2024-02-03 16:45:47 -08:00
|
|
|
"ship_type", 7.0, 8.5,
|
2024-02-02 22:19:06 -08:00
|
|
|
Rect(
|
|
|
|
111.0, -178.0, 145.0, 8.5,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::Center,
|
|
|
|
Anchor::NorthWest
|
2024-02-03 16:21:21 -08:00
|
|
|
),
|
|
|
|
Color(0.7, 0.7, 0.7, 1.0)
|
2024-02-02 22:19:06 -08:00
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_font_sans("ship_type");
|
|
|
|
textbox_align_center("ship_type");
|
2024-02-03 16:06:11 -08:00
|
|
|
if state.player_ship().is_some() {
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_set_text("ship_type", state.player_ship().name());
|
2024-02-03 16:06:11 -08:00
|
|
|
}
|
2024-02-02 22:19:06 -08:00
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
|
|
|
|
add_textbox(
|
2024-02-03 16:45:47 -08:00
|
|
|
"ship_stats", 7.0, 8.5,
|
2024-02-02 22:19:06 -08:00
|
|
|
Rect(
|
|
|
|
38.526, -192.332, 144.948, 154.5,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthWest,
|
|
|
|
Anchor::NorthWest,
|
2024-02-03 16:21:21 -08:00
|
|
|
),
|
|
|
|
Color(1.0, 1.0, 1.0, 1.0)
|
2024-02-02 22:19:06 -08:00
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_font_mono("ship_stats");
|
|
|
|
textbox_set_text("ship_stats", "Earth");
|
2024-02-02 22:19:06 -08:00
|
|
|
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_sprite(
|
2024-02-02 22:19:06 -08:00
|
|
|
"outfit_bg",
|
|
|
|
"ui::outfitter-outfit-bg",
|
|
|
|
Rect(
|
|
|
|
-16.0, -16.0, 300.0, 480.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthEast,
|
|
|
|
Anchor::NorthEast
|
2024-02-02 22:19:06 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_sprite(
|
2024-02-02 22:19:06 -08:00
|
|
|
"outfit_thumb",
|
|
|
|
"icon::engine",
|
|
|
|
Rect(
|
|
|
|
-166.0, -109.0, 90.0, 90.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::Center,
|
|
|
|
Anchor::NorthEast
|
2024-02-02 22:19:06 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_textbox(
|
2024-02-03 16:45:47 -08:00
|
|
|
"outfit_name", 16.0, 16.0,
|
2024-02-02 22:19:06 -08:00
|
|
|
Rect(
|
|
|
|
-312.0, -20.0, 200.0, 16.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthWest,
|
|
|
|
Anchor::NorthEast,
|
2024-02-03 16:21:21 -08:00
|
|
|
),
|
|
|
|
Color(1.0, 1.0, 1.0, 1.0)
|
2024-02-02 22:19:06 -08:00
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_font_serif("outfit_name");
|
|
|
|
textbox_weight_bold("outfit_name");
|
|
|
|
textbox_set_text("outfit_name", "Earth");
|
2024-02-02 22:19:06 -08:00
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_textbox(
|
2024-02-03 16:45:47 -08:00
|
|
|
"outfit_desc", 7.0, 8.5,
|
2024-02-02 22:19:06 -08:00
|
|
|
Rect(
|
|
|
|
-166.0, -219.0, 260.0, 78.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::Center,
|
|
|
|
Anchor::NorthEast,
|
2024-02-03 16:21:21 -08:00
|
|
|
),
|
|
|
|
Color(1.0, 1.0, 1.0, 1.0)
|
2024-02-02 22:19:06 -08:00
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_font_serif("outfit_desc");
|
|
|
|
textbox_set_text("outfit_desc", "Earth");
|
2024-02-02 22:19:06 -08:00
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
|
|
|
|
add_textbox(
|
2024-02-03 16:45:47 -08:00
|
|
|
"outfit_stats", 7.0, 8.5,
|
2024-02-02 22:19:06 -08:00
|
|
|
Rect(
|
|
|
|
-295.0, -271.0, 164.0, 216.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthWest,
|
|
|
|
Anchor::NorthEast,
|
2024-02-03 16:21:21 -08:00
|
|
|
),
|
|
|
|
Color(1.0, 1.0, 1.0, 1.0)
|
2024-02-02 22:19:06 -08:00
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
textbox_font_mono("outfit_stats");
|
|
|
|
textbox_set_text("outfit_stats", "Earth");
|
|
|
|
|
2024-02-02 22:19:06 -08:00
|
|
|
}
|
|
|
|
|
2024-02-03 11:24:17 -08:00
|
|
|
|
|
|
|
fn event(state, event) {
|
|
|
|
if type_of(event) == "MouseHoverEvent" {
|
|
|
|
let element = event.element();
|
2024-02-04 11:45:49 -08:00
|
|
|
if element == "exit_button" {
|
2024-02-03 11:24:17 -08:00
|
|
|
if event.is_enter() {
|
2024-02-04 11:45:49 -08:00
|
|
|
sprite_take_edge("exit_button", "on:top", 0.1);
|
2024-02-03 11:24:17 -08:00
|
|
|
} else {
|
2024-02-04 11:45:49 -08:00
|
|
|
sprite_take_edge("exit_button", "off:top", 0.1);
|
2024-02-03 11:24:17 -08:00
|
|
|
}
|
2024-02-02 22:19:06 -08:00
|
|
|
}
|
2024-02-03 11:24:17 -08:00
|
|
|
return;
|
2024-02-02 22:19:06 -08:00
|
|
|
}
|
2024-02-03 11:24:17 -08:00
|
|
|
|
|
|
|
|
|
|
|
if type_of(event) == "MouseClickEvent" {
|
|
|
|
if !event.is_down() {
|
2024-02-04 11:45:49 -08:00
|
|
|
return;
|
2024-02-03 11:24:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
let element = event.element();
|
2024-02-04 11:45:49 -08:00
|
|
|
if element == "exit_button" {
|
|
|
|
go_to_scene("landed");
|
|
|
|
return;
|
2024-02-03 11:24:17 -08:00
|
|
|
}
|
|
|
|
return;
|
2024-02-02 22:19:06 -08:00
|
|
|
}
|
|
|
|
|
2024-02-03 11:24:17 -08:00
|
|
|
if type_of(event) == "PlayerShipStateEvent" {
|
|
|
|
if !state.player_ship().is_landed() {
|
2024-02-04 11:45:49 -08:00
|
|
|
go_to_scene("flying");
|
|
|
|
return;
|
2024-02-03 11:24:17 -08:00
|
|
|
}
|
|
|
|
return;
|
2024-02-02 22:19:06 -08:00
|
|
|
}
|
|
|
|
}
|