Skip to content

Commit

Permalink
Merge pull request #238 from kcalbxof/disable_cursors
Browse files Browse the repository at this point in the history
add option to disable other players' cursors
  • Loading branch information
IntQuant authored Nov 30, 2024
2 parents 50b9c1a + 9737e47 commit e036116
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
5 changes: 4 additions & 1 deletion noita-proxy/assets/lang/en-US/main.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,13 @@ Info = Info

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
## 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.
hide-cursors-checkbox = Disable others' cursors
hide-cursors-checkbox-tooltip = Sometimes you can confuse your friends' cursors with yours. In that case, you can disable them altogether with this checkbox.
11 changes: 3 additions & 8 deletions noita-proxy/assets/lang/ru-RU/main.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,13 @@ Info = Info

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
## UX settings

ping-note = Параметры стрелочки-пинга
ping-lifetime = Время жизни стрелки в секундах.
ping-scale = Размер стрелки в юнитах.
ping-lifetime-tooltip = Этот параметр изменяет время жизни стрелочки (секунды*60, т.к. игра должна работать в 60 фпс?). Диапазон: 0-60 секунд.
ping-scale-tooltip = Этот параметр изменяет размер стрелочки. Не знаю какая единица измерения, но диапазон 0-1.5 юнита.
hide-cursors-checkbox = Отключить курсоры других игроков.
hide-cursors-checkbox-tooltip = Иногда можно перепутать курсоры других игроков со своим. Этой галочкой можно отключить их.
13 changes: 13 additions & 0 deletions noita-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ struct PlayerAppearance {
pub struct UXSettings {
ping_lifetime: Option<u32>,
ping_scale: Option<f32>,
hide_cursors: Option<bool>,
}

impl UXSettings {
Expand All @@ -409,6 +410,9 @@ impl UXSettings {
fn ping_scale(&self) -> f32 {
self.ping_scale.unwrap_or(0.5)
}
fn hide_cursors(self) -> bool {
self.hide_cursors.unwrap_or(false)
}
}

impl Default for PlayerAppearance {
Expand Down Expand Up @@ -1143,6 +1147,15 @@ impl App {
{
self.ux_settings.ping_scale = Some(tmp);
}

let mut tmp = self.ux_settings.hide_cursors();
if ui
.add(egui::Checkbox::new(&mut tmp, tr("hide-cursors-checkbox")))
.on_hover_text(tr("hide-cursors-checkbox-tooltip"))
.changed()
{
self.ux_settings.hide_cursors = Some(tmp);
}
}

fn connect_to_steam_lobby(&mut self, lobby_id: String) {
Expand Down
5 changes: 4 additions & 1 deletion noita-proxy/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,10 @@ impl NetManager {
self.init_settings.ux_settings.ping_lifetime(),
);
state.try_ws_write_option("ping_scale", self.init_settings.ux_settings.ping_scale());

state.try_ws_write_option(
"hide_cursors",
self.init_settings.ux_settings.hide_cursors(),
);
let progress = settings.progress.join(",");
state.try_ws_write_option("progress", progress.as_str());

Expand Down
8 changes: 7 additions & 1 deletion quant.ew/files/system/player_sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ function module.on_world_update()
local children = EntityGetAllChildren(ent) or {}
if ctx.my_id ~= peer_id then
for _, child in ipairs(children) do
if EntityGetName(child) == "cursor" or EntityGetName(child) == "notcursor" then
if EntityGetName(child) == "cursor" and ctx.proxy_opt.hide_cursors == true then
EntitySetComponentIsEnabled(child, EntityGetFirstComponent(child, "SpriteComponent"), false)
else
EntitySetComponentIsEnabled(child,
EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), true)
end
if EntityGetName(child) == "notcursor" then
EntitySetComponentIsEnabled(child, EntityGetFirstComponentIncludingDisabled(child, "SpriteComponent"), true)
end
end
Expand Down

0 comments on commit e036116

Please sign in to comment.