mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Run cargo fmt
This commit is contained in:
parent
b506dac333
commit
d3023add3a
7 changed files with 49 additions and 34 deletions
|
@ -450,12 +450,15 @@ impl Mods {
|
|||
self.mod_entries.insert(0, entry);
|
||||
&mut self.mod_entries[0]
|
||||
} else {
|
||||
self.mod_entries.insert(0, ModEntry {
|
||||
enabled: 0,
|
||||
name: name.to_owned(),
|
||||
settings_fold_open: 0,
|
||||
workshop_item_id: 0,
|
||||
});
|
||||
self.mod_entries.insert(
|
||||
0,
|
||||
ModEntry {
|
||||
enabled: 0,
|
||||
name: name.to_owned(),
|
||||
settings_fold_open: 0,
|
||||
workshop_item_id: 0,
|
||||
},
|
||||
);
|
||||
&mut self.mod_entries[0]
|
||||
}
|
||||
}
|
||||
|
@ -474,4 +477,4 @@ fn enable_mod(saves_path: &Path) -> Result<(), Box<dyn Error>> {
|
|||
let xml = quick_xml::se::to_string(&data)?;
|
||||
fs::write(&mod_config_path, xml)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ impl NetManager {
|
|||
&NetMsg::PlayerColor(
|
||||
self.init_settings.player_png_desc,
|
||||
self.is_host(),
|
||||
Some(self.peer.my_id())
|
||||
Some(self.peer.my_id()),
|
||||
),
|
||||
Reliability::Reliable,
|
||||
);
|
||||
|
@ -423,7 +423,7 @@ impl NetManager {
|
|||
&NetMsg::PlayerColor(
|
||||
self.init_settings.player_png_desc,
|
||||
self.is_host(),
|
||||
None
|
||||
None,
|
||||
),
|
||||
Reliability::Reliable,
|
||||
);
|
||||
|
@ -601,7 +601,10 @@ impl NetManager {
|
|||
rgb[0] as u32 + ((rgb[1] as u32) << 8) + ((rgb[2] as u32) << 16),
|
||||
);
|
||||
|
||||
state.try_ws_write_option("ping_lifetime", self.init_settings.ux_settings.ping_lifetime);
|
||||
state.try_ws_write_option(
|
||||
"ping_lifetime",
|
||||
self.init_settings.ux_settings.ping_lifetime,
|
||||
);
|
||||
state.try_ws_write_option("ping_scale", self.init_settings.ux_settings.ping_scale);
|
||||
|
||||
let progress = settings.progress.join(",");
|
||||
|
|
|
@ -92,7 +92,7 @@ impl PeerVariant {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub(crate) fn flush(&self) {
|
||||
if let PeerVariant::Steam(p) = self {
|
||||
p.flush()
|
||||
|
|
|
@ -341,11 +341,10 @@ impl SteamPeer {
|
|||
for (i, p) in self.inner.lock().unwrap().remote_peers.iter().enumerate() {
|
||||
if *p == Into::<SteamId>::into(peer) {
|
||||
n = i as isize;
|
||||
break
|
||||
break;
|
||||
}
|
||||
}
|
||||
if n >= 0
|
||||
{
|
||||
if n >= 0 {
|
||||
self.inner.lock().unwrap().remote_peers.remove(n as usize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,15 @@ pub fn arrows_path(path: PathBuf, is_host: bool) -> (PathBuf, PathBuf, PathBuf)
|
|||
let parent = path.parent().unwrap();
|
||||
let p = parent.join("player_arrows");
|
||||
let o = parent.join("player_ping");
|
||||
(if is_host {
|
||||
p.join("arrow_host.png")
|
||||
} else {
|
||||
p.join("arrow.png")
|
||||
}, o.join("arrow.png"), parent.join("map/icon.png"))
|
||||
(
|
||||
if is_host {
|
||||
p.join("arrow_host.png")
|
||||
} else {
|
||||
p.join("arrow.png")
|
||||
},
|
||||
o.join("arrow.png"),
|
||||
parent.join("map/icon.png"),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn cursor_path(path: PathBuf) -> PathBuf {
|
||||
|
@ -136,16 +140,22 @@ pub fn get_lch(color: [f64; 4]) -> (f64, f64, f64) {
|
|||
}
|
||||
|
||||
pub fn rgb_to_oklch(color: &mut [f64; 4]) {
|
||||
let mut l = 0.4122214694707629 * color[0] + 0.5363325372617349 * color[1] + 0.0514459932675022 * color[2];
|
||||
let mut m = 0.2119034958178251 * color[0] + 0.6806995506452344 * color[1] + 0.1073969535369405 * color[2];
|
||||
let mut s = 0.0883024591900564 * color[0] + 0.2817188391361215 * color[1] + 0.6299787016738222 * color[2];
|
||||
let mut l = 0.4122214694707629 * color[0]
|
||||
+ 0.5363325372617349 * color[1]
|
||||
+ 0.0514459932675022 * color[2];
|
||||
let mut m = 0.2119034958178251 * color[0]
|
||||
+ 0.6806995506452344 * color[1]
|
||||
+ 0.1073969535369405 * color[2];
|
||||
let mut s = 0.0883024591900564 * color[0]
|
||||
+ 0.2817188391361215 * color[1]
|
||||
+ 0.6299787016738222 * color[2];
|
||||
|
||||
l = l.cbrt();
|
||||
m = m.cbrt();
|
||||
s = s.cbrt();
|
||||
|
||||
color[0] = 0.210454268309314 * l + 0.7936177747023054 * m - 0.0040720430116193 * s;
|
||||
color[1] = 1.9779985324311684 * l - 2.42859224204858 * m + 0.450593709617411 * s;
|
||||
color[0] = 0.210454268309314 * l + 0.7936177747023054 * m - 0.0040720430116193 * s;
|
||||
color[1] = 1.9779985324311684 * l - 2.42859224204858 * m + 0.450593709617411 * s;
|
||||
color[2] = 0.0259040424655478 * l + 0.7827717124575296 * m - 0.8086757549230774 * s;
|
||||
}
|
||||
|
||||
|
@ -158,7 +168,7 @@ fn oklch_to_rgb(color: &mut [f64; 4]) {
|
|||
m = m.powi(3);
|
||||
s = s.powi(3);
|
||||
|
||||
color[0] = 4.07674163607596 * l - 3.3077115392580635 * m + 0.2309699031821046 * s;
|
||||
color[0] = 4.07674163607596 * l - 3.3077115392580635 * m + 0.2309699031821046 * s;
|
||||
color[1] = -1.2684379732850317 * l + 2.6097573492876887 * m - 0.3413193760026572 * s;
|
||||
color[2] = -0.0041960761386754 * l - 0.7034186179359363 * m + 1.7076146940746116 * s;
|
||||
}
|
||||
|
@ -400,12 +410,11 @@ pub fn create_player_png(
|
|||
edit_by_replacing(
|
||||
tmp_path.join("unmodified_lukki.xml"),
|
||||
tmp_path.join("tmp/".to_owned() + &id.clone() + "_lukki.xml"),
|
||||
&[
|
||||
(
|
||||
"MARKER_LUKKI_PNG",
|
||||
format!("mods/quant.ew/files/system/player/tmp/{}_lukki.png", id),
|
||||
),
|
||||
]);
|
||||
&[(
|
||||
"MARKER_LUKKI_PNG",
|
||||
format!("mods/quant.ew/files/system/player/tmp/{}_lukki.png", id),
|
||||
)],
|
||||
);
|
||||
edit_by_replacing(
|
||||
tmp_path.join("unmodified_base.xml"),
|
||||
tmp_path.join("tmp/".to_owned() + &id.clone() + "_base.xml"),
|
||||
|
@ -504,4 +513,4 @@ fn edit_by_replacing(
|
|||
|
||||
fn rgb_to_hex(rgb: [u8; 4]) -> String {
|
||||
format!("{:02X}{:02X}{:02X}", rgb[0], rgb[1], rgb[2])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ impl SteamState {
|
|||
}
|
||||
let app_id = env::var("NP_APPID").ok().and_then(|x| x.parse().ok());
|
||||
info!("Initializing steam client...");
|
||||
let (client, single) = steamworks::Client::init_app(app_id.unwrap_or(if spacewars {480} else {881100}))?;
|
||||
let (client, single) =
|
||||
steamworks::Client::init_app(app_id.unwrap_or(if spacewars { 480 } else { 881100 }))?;
|
||||
info!("Initializing relay network accesss...");
|
||||
client.networking_utils().init_relay_network_access();
|
||||
if let Err(err) = client.networking_sockets().init_authentication() {
|
||||
|
|
|
@ -49,7 +49,7 @@ impl Peer {
|
|||
connection_manager.start()?;
|
||||
Ok(Peer { shared })
|
||||
}
|
||||
|
||||
|
||||
pub fn remove(&self, peer: PeerId) {
|
||||
self.shared.remote_peers.remove(&peer);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue