Files
HEDZReloaded/crates/client/src/steam.rs
PROMETHIA-27 b83e506a4d Bevy 0.17 Migration Final PR (#76)
* Get bevy 0.17 compiling and running (#72)

* get bevy 0.17 compiling and running

* try to fix CI breaking from const assertion for client/server features

* fix `bin` -> `lib` for `shared` in CI

* typo

* fix some collider issues (#73)

* Physics/controller improvements (#74)

* trying to fix physics prediction

* fixed prediction desync

* substantial controller improvements

* Finish off main bevy 0.17 migration (#75)

* fix lookdir issues
- airplane moving backwards
- player model facing backwards
- camera was technically backwards the whole time, and player models were facing the right way; camera is now facing forwards
- firing without a target now respects lookdir

* fix aim targeting

* migrate to bevy_trenchbroom 0.10 crates release

* fixed colliders not being adjusted out of worldspace

* predict platforms to stop constant rollbacks while riding them

* fix key/head drop visuals not working

* Fix key/head drop random initial force

* fixed static head drops duplicating

* fix platform velocity inheritance

* fix thrown projectiles not autorotating

* fix inconsistent explosion animations

* update avian3d to 0.4.1

* fix controller snapping to fixed angle upon switching heads

* clean up commented code

* fix broken physics positions

* Clean comments, fix warnings (#77)

* clean comments, fix warnings

* fix missing import

* steamworks 162 libs

* fix mouselook

---------

Co-authored-by: extrawurst <mail@rusticorn.com>
2025-11-15 09:16:38 -05:00

75 lines
2.0 KiB
Rust

use bevy::prelude::*;
use bevy_steamworks::{Client, FriendFlags, SteamworksEvent};
use std::io::{Read, Write};
pub fn plugin(app: &mut App) {
app.add_plugins(shared::steam::plugin);
app.add_systems(
Startup,
(test_steam_system, log_steam_events)
.chain()
.run_if(resource_exists::<Client>),
);
}
fn log_steam_events(mut events: MessageReader<SteamworksEvent>) {
for e in events.read() {
info!("steam ev: {:?}", e);
}
}
fn test_steam_system(steam_client: Res<Client>) {
steam_client.matchmaking().request_lobby_list(|list| {
let Ok(list) = list else { return };
info!("lobby list: [{}]", list.len());
for (i, l) in list.iter().enumerate() {
info!("lobby [{i}]: {:?}", l);
}
});
steam_client
.matchmaking()
.create_lobby(
steamworks::LobbyType::FriendsOnly,
4,
|result| match result {
Ok(lobby_id) => {
info!("Created lobby with ID: {:?}", lobby_id);
}
Err(e) => error!("Failed to create lobby: {}", e),
},
);
for friend in steam_client.friends().get_friends(FriendFlags::IMMEDIATE) {
info!(
"Steam Friend: {:?} - {}({:?})",
friend.id(),
friend.name(),
friend.state()
);
}
steam_client
.remote_storage()
.set_cloud_enabled_for_app(true);
let f = steam_client.remote_storage().file("hedz_data.dat");
if f.exists() {
let mut buf = String::new();
if let Err(e) = f.read().read_to_string(&mut buf) {
error!("File read error: {}", e);
} else {
info!("File content: {}", buf);
}
} else {
info!("File does not exist");
if let Err(e) = f.write().write_all(String::from("hello world").as_bytes()) {
error!("steam cloud error: {}", e);
} else {
info!("steam cloud saved");
}
}
}