mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
switch to a temp directory thats reset on boot for player colors
This commit is contained in:
parent
10631bd56e
commit
4e3419011f
3 changed files with 17 additions and 8 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
target
|
||||
mat_data.txt
|
||||
save_state
|
||||
*png~
|
||||
*png~
|
||||
/quant.ew/files/system/player/tmp/
|
|
@ -27,6 +27,7 @@ use std::{
|
|||
thread::JoinHandle,
|
||||
time::Duration,
|
||||
};
|
||||
use std::fs::{create_dir, remove_dir_all};
|
||||
use steamworks::{LobbyId, SteamAPIInitError};
|
||||
use tangled::Peer;
|
||||
use tracing::info;
|
||||
|
@ -290,8 +291,15 @@ impl App {
|
|||
netman.accept_local.store(true, Ordering::SeqCst);
|
||||
}
|
||||
fn player_path(&self) -> PathBuf {
|
||||
ModmanagerSettings::mod_path(&self.modmanager_settings)
|
||||
.join("files/system/player/unmodified.png")
|
||||
let path = ModmanagerSettings::mod_path(&self.modmanager_settings)
|
||||
.join("files/system/player/unmodified.png");
|
||||
let tmp = path.parent().unwrap().join("tmp");
|
||||
if tmp.exists()
|
||||
{
|
||||
remove_dir_all(tmp.clone()).unwrap();
|
||||
}
|
||||
create_dir(tmp).unwrap();
|
||||
path
|
||||
}
|
||||
fn start_connect(&mut self, addr: SocketAddr) {
|
||||
let peer = Peer::connect(addr, None).unwrap();
|
||||
|
@ -885,4 +893,4 @@ pub fn replace_color(image: &mut RgbImage, main: Rgb<u8>, alt: Rgb<u8>) {
|
|||
*pixel = alt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -339,7 +339,7 @@ impl NetManager {
|
|||
.clone()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join(format!("{}.png", self.peer.my_id().unwrap()));
|
||||
.join(format!("tmp/{}.png", self.peer.my_id().unwrap()));
|
||||
img.save(path).unwrap();
|
||||
|
||||
let mut img = image::open(
|
||||
|
@ -361,7 +361,7 @@ impl NetManager {
|
|||
.clone()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join(format!("{}_arm.png", self.peer.my_id().unwrap()));
|
||||
.join(format!("tmp/{}_arm.png", self.peer.my_id().unwrap()));
|
||||
img.save(path).unwrap();
|
||||
|
||||
let file = File::open(
|
||||
|
@ -394,7 +394,7 @@ impl NetManager {
|
|||
.clone()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join(format!("{}_cape.xml", self.peer.my_id().unwrap()));
|
||||
.join(format!("tmp/{}_cape.xml", self.peer.my_id().unwrap()));
|
||||
let mut file = File::create(path).unwrap();
|
||||
for line in lines {
|
||||
writeln!(file, "{}", line).unwrap();
|
||||
|
@ -590,4 +590,4 @@ impl Drop for NetManager {
|
|||
info!("Skip saving run info: not a host");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue