mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Ping arrow parameters & tweaks
This commit is contained in:
parent
891c6d41ab
commit
d8f8cfecb5
5 changed files with 75 additions and 8 deletions
|
@ -151,4 +151,12 @@ info_stress_tests = We're doing public lobbies (a.k.a stress tests) every saturd
|
|||
Info = Info
|
||||
## Local settings
|
||||
|
||||
connect_settings_random_ports = Don't use a predetermined port. Makes things a bit more robust and allows multiple proxies to be launched on the same computer, but Noita will have to be launched through the proxy.
|
||||
connect_settings_random_ports = Don't use a predetermined port. Makes things a bit more robust and allows multiple proxies to be launched on the same computer, but Noita will have to be launched through the proxy.
|
||||
|
||||
##Arrow UX settings
|
||||
|
||||
ping-note = Ping arrow parameters
|
||||
ping-lifetime = Ping arrow lifetime in seconds.
|
||||
ping-scale = Ping arrow size.
|
||||
ping-lifetime-tooltip = This parameter changes how much frames (seconds*60, since game is supposed to run 60 fps?) ping arrow lives. Range: 0-60 seconds.
|
||||
ping-scale-tooltip = This parameter changes size of ping arrow. I dont know which units it is, but range is 0-1.5 units.
|
||||
|
|
|
@ -149,4 +149,20 @@ info_stress_tests = We're doing public lobbies (a.k.a stress tests) every saturd
|
|||
Info = Info
|
||||
## Local settings
|
||||
|
||||
connect_settings_random_ports = Don't use a predetermined port. Makes things a bit more robust and allows multiple proxies to be launched on the same computer, but Noita will have to be launched through the proxy.
|
||||
connect_settings_random_ports = Don't use a predetermined port. Makes things a bit more robust and allows multiple proxies to be launched on the same computer, but Noita will have to be launched through the proxy.
|
||||
|
||||
##Arrow UX settings
|
||||
|
||||
ping-note = Параметры стрелочки-пинга
|
||||
ping-lifetime = Время жизни стрелки в секундах.
|
||||
ping-scale = Размер стрелки в юнитах.
|
||||
ping-lifetime-tooltip = Этот параметр изменяет время жизни стрелочки (секунды*60, т.к. игра должна работать в 60 фпс?). Диапазон: 0-60 секунд.
|
||||
ping-scale-tooltip = Этот параметр изменяет размер стрелочки. Не знаю какая единица измерения, но диапазон 0-1.5 юнита.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -395,6 +395,21 @@ struct PlayerAppearance {
|
|||
cosmetics: (bool, bool, bool),
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Decode, Encode, Copy, Clone)]
|
||||
pub struct UXSettings {
|
||||
ping_lifetime: u32,
|
||||
ping_scale: f32,
|
||||
}
|
||||
|
||||
impl Default for UXSettings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
ping_lifetime: 5,
|
||||
ping_scale: 0.5,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PlayerAppearance {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
@ -524,6 +539,7 @@ pub struct App {
|
|||
appearance: PlayerAppearance,
|
||||
connected_menu: ConnectedMenu,
|
||||
show_host_settings: bool,
|
||||
ux_settings: UXSettings
|
||||
}
|
||||
|
||||
fn filled_group<R>(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
|
||||
|
@ -563,6 +579,7 @@ pub struct Settings {
|
|||
color: PlayerAppearance,
|
||||
app: AppSavedState,
|
||||
modmanager: ModmanagerSettings,
|
||||
ux: UXSettings,
|
||||
}
|
||||
|
||||
fn settings_get() -> Settings {
|
||||
|
@ -580,12 +597,13 @@ fn settings_get() -> Settings {
|
|||
}
|
||||
}
|
||||
|
||||
fn settings_set(app: AppSavedState, color: PlayerAppearance, modmanager: ModmanagerSettings) {
|
||||
fn settings_set(app: AppSavedState, color: PlayerAppearance, modmanager: ModmanagerSettings, ux: UXSettings) {
|
||||
if let Ok(s) = std::env::current_exe() {
|
||||
let settings = Settings {
|
||||
app,
|
||||
color,
|
||||
modmanager,
|
||||
ux
|
||||
};
|
||||
let file = s.parent().unwrap().join("proxy.ron");
|
||||
let settings = ron::to_string(&settings).unwrap();
|
||||
|
@ -603,6 +621,7 @@ impl App {
|
|||
let mut saved_state: AppSavedState = settings.app;
|
||||
let modmanager_settings: ModmanagerSettings = settings.modmanager;
|
||||
let appearance: PlayerAppearance = settings.color;
|
||||
let ux_settings: UXSettings = settings.ux;
|
||||
saved_state.times_started += 1;
|
||||
|
||||
info!("Setting fonts...");
|
||||
|
@ -661,6 +680,7 @@ impl App {
|
|||
appearance,
|
||||
connected_menu: ConnectedMenu::Normal,
|
||||
show_host_settings: false,
|
||||
ux_settings,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,6 +689,7 @@ impl App {
|
|||
self.app_saved_state.clone(),
|
||||
self.appearance.clone(),
|
||||
self.modmanager_settings.clone(),
|
||||
self.ux_settings.clone(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -706,6 +727,7 @@ impl App {
|
|||
my_nickname,
|
||||
save_state: self.run_save_state.clone(),
|
||||
player_color: self.appearance.player_color,
|
||||
ux_settings: self.ux_settings.clone(),
|
||||
cosmetics,
|
||||
mod_path,
|
||||
player_path: player_path(self.modmanager_settings.mod_path()),
|
||||
|
@ -1081,6 +1103,17 @@ impl App {
|
|||
self.appearance.cosmetics = old.cosmetics;
|
||||
self.appearance.player_picker = old.player_picker;
|
||||
}
|
||||
ui.add_space(10.0);
|
||||
ui.label(tr("ping-note"));
|
||||
ui.add_space(10.0);
|
||||
ui.add(egui::Slider::new(&mut self.ux_settings.ping_lifetime, 1..=60).text(tr("ping-lifetime"))
|
||||
.min_decimals(0)
|
||||
.max_decimals(0)
|
||||
.step_by(1.0)).on_hover_text(tr("ping-lifetime-tooltip"));
|
||||
ui.add(egui::Slider::new(&mut self.ux_settings.ping_scale, 0.0..=1.5).text(tr("ping-scale"))
|
||||
.min_decimals(0)
|
||||
.max_decimals(1)
|
||||
.step_by(0.1)).on_hover_text(tr("ping-scale-tooltip"));
|
||||
}
|
||||
|
||||
fn connect_to_steam_lobby(&mut self, lobby_id: String) {
|
||||
|
@ -1663,6 +1696,7 @@ fn cli_setup() -> (steam_helper::SteamState, NetManagerInit) {
|
|||
my_nickname,
|
||||
save_state: run_save_state,
|
||||
player_color: PlayerColor::default(),
|
||||
ux_settings: UXSettings::default(),
|
||||
cosmetics,
|
||||
mod_path: mod_manager.mod_path(),
|
||||
player_path,
|
||||
|
|
|
@ -26,7 +26,7 @@ use crate::player_cosmetics::{create_player_png, PlayerPngDesc};
|
|||
use crate::{
|
||||
bookkeeping::save_state::{SaveState, SaveStateEntry},
|
||||
recorder::Recorder,
|
||||
DefaultSettings, GameSettings, PlayerColor,
|
||||
DefaultSettings, GameSettings, PlayerColor, UXSettings,
|
||||
};
|
||||
pub mod messages;
|
||||
mod proxy_opt;
|
||||
|
@ -105,6 +105,7 @@ pub struct NetManagerInit {
|
|||
pub my_nickname: Option<String>,
|
||||
pub save_state: SaveState,
|
||||
pub player_color: PlayerColor,
|
||||
pub ux_settings: UXSettings,
|
||||
pub cosmetics: (bool, bool, bool),
|
||||
pub mod_path: PathBuf,
|
||||
pub player_path: PathBuf,
|
||||
|
@ -599,6 +600,10 @@ impl NetManager {
|
|||
"mina_color",
|
||||
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_scale", self.init_settings.ux_settings.ping_scale);
|
||||
|
||||
let progress = settings.progress.join(",");
|
||||
state.try_ws_write_option("progress", progress.as_str());
|
||||
|
||||
|
|
|
@ -63,11 +63,15 @@ function module.on_world_update()
|
|||
end
|
||||
|
||||
local i = 1
|
||||
--ternary operators ahead
|
||||
local lifetime = (ctx.proxy_opt.ping_lifetime ~= nil and {ctx.proxy_opt.ping_lifetime} or {900})[1]*60
|
||||
local custom_scale = (ctx.proxy_opt.ping_scale ~= nil and {ctx.proxy_opt.ping_scale} or {0.5})[1]
|
||||
while i <= #pings do
|
||||
local pos = pings[i]
|
||||
local frame = pos[3]
|
||||
local peer_id = pos[4]
|
||||
if frame + 300 < GameGetFrameNum() then
|
||||
local alpha = 1 - ((GameGetFrameNum() - frame) / lifetime)
|
||||
if frame + lifetime < GameGetFrameNum() then
|
||||
table.remove(pings, i)
|
||||
goto continue
|
||||
end
|
||||
|
@ -107,12 +111,12 @@ function module.on_world_update()
|
|||
|
||||
local img_path = "mods/quant.ew/files/system/player/tmp/".. peer_id .."_ping.png"
|
||||
if outside then
|
||||
local scale = math.max(1 / 6, 0.75 - math.atan((math.sqrt(dist_sq) - tch) / 1280) / math.pi)
|
||||
local scale = math.max(1 / 6, 0.75 - math.atan((math.sqrt(dist_sq) - tch) / 1280) / math.pi) + custom_scale
|
||||
local x, y = world2gui(ccx+player_dir_x, ccy+player_dir_y)
|
||||
GuiImage(gui, gui_id, x, y, img_path, 1, scale, 0, math.atan2(player_dir_y, player_dir_x) + math.pi/2)
|
||||
GuiImage(gui, gui_id, x, y, img_path, alpha, scale, 0, math.atan2(player_dir_y, player_dir_x) + math.pi/2)
|
||||
else
|
||||
local x, y = world2gui(pos[1], pos[2])
|
||||
GuiImage(gui, gui_id, x, y, img_path, 1, 0.75, 0, math.pi)
|
||||
GuiImage(gui, gui_id, x, y, img_path, alpha, 0.75 + custom_scale, 0, math.pi)
|
||||
end
|
||||
gui_id = gui_id + 1
|
||||
i = i + 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue