diff --git a/ewext/src/modules/entity_sync.rs b/ewext/src/modules/entity_sync.rs index 8166437a..e75fddf5 100644 --- a/ewext/src/modules/entity_sync.rs +++ b/ewext/src/modules/entity_sync.rs @@ -114,7 +114,13 @@ impl EntitySync { pub fn iter_peers(&self, player_map: BiHashMap) -> Vec<(bool, PeerId)> { player_map .left_values() - .map(|p| (self.interest_tracker.contains(*p), *p)) + .filter_map(|p| { + if *p != my_peer_id() { + Some((self.interest_tracker.contains(*p), *p)) + } else { + None + } + }) .collect::>() } fn should_be_tracked(&mut self, entity: EntityID) -> eyre::Result { @@ -439,7 +445,7 @@ impl Module for EntitySync { )?; } for peer in ctx.player_map.clone().left_values() { - if !self.interest_tracker.contains(*peer) { + if !self.interest_tracker.contains(*peer) && *peer != my_peer_id() { send_remotedes( ctx, true, diff --git a/noita-proxy/src/lib.rs b/noita-proxy/src/lib.rs index 33b471f1..8e399ae9 100644 --- a/noita-proxy/src/lib.rs +++ b/noita-proxy/src/lib.rs @@ -79,7 +79,7 @@ pub struct GameSettings { world_num: u16, debug_mode: Option, use_constant_seed: bool, - item_dedup: Option, + // item_dedup: Option, TODO enemy_hp_mult: Option, game_mode: Option, friendly_fire: Option, @@ -236,7 +236,7 @@ impl GameSettings { ui.add(DragValue::new(&mut game_settings.seed)); } }); - { + /*{ let mut temp = game_settings.item_dedup.unwrap_or(def.item_dedup); if ui .checkbox(&mut temp, tr("connect_settings_item_dedup")) @@ -244,7 +244,7 @@ impl GameSettings { { game_settings.item_dedup = Some(temp) } - } + }TODO*/ { let mut temp = game_settings .nice_terraforming @@ -340,7 +340,7 @@ impl GameSettings { } pub struct DefaultSettings { debug_mode: bool, - item_dedup: bool, + //item_dedup: bool, enemy_hp_mult: f32, game_mode: GameMode, friendly_fire: bool, @@ -361,7 +361,7 @@ impl Default for DefaultSettings { fn default() -> Self { DefaultSettings { debug_mode: false, - item_dedup: true, + //item_dedup: true, randomize_perks: true, enemy_hp_mult: 1.0, game_mode: GameMode::LocalHealth(LocalHealthMode::Normal), diff --git a/noita-proxy/src/net.rs b/noita-proxy/src/net.rs index 9765a287..a99a59db 100644 --- a/noita-proxy/src/net.rs +++ b/noita-proxy/src/net.rs @@ -640,7 +640,7 @@ impl NetManager { settings.same_loadout.unwrap_or(def.same_loadout), ); state.try_ws_write_option("debug", settings.debug_mode.unwrap_or(def.debug_mode)); - state.try_ws_write_option("item_dedup", settings.item_dedup.unwrap_or(def.item_dedup)); + // state.try_ws_write_option("item_dedup", settings.item_dedup.unwrap_or(def.item_dedup)); TODO state.try_ws_write_option( "randomize_perks", settings.randomize_perks.unwrap_or(def.randomize_perks), diff --git a/noita-proxy/src/net/world.rs b/noita-proxy/src/net/world.rs index 2a5951a9..b21d3ede 100644 --- a/noita-proxy/src/net/world.rs +++ b/noita-proxy/src/net/world.rs @@ -1782,15 +1782,15 @@ impl WorldManager { let atan: Vec = compute_atans(chunk_start_x, chunk_start_y, rays as f32, x, y); for icx in 0..CHUNK_SIZE as i32 { let cx = chunk_start_x + icx; - let dx = cx - x; + let dx = cx.abs_diff(x) as u64; let dd = dx * dx; for icy in 0..CHUNK_SIZE as i32 { let cy = chunk_start_y + icy; - let dy = cy - y; + let dy = cy.abs_diff(y) as u64; let px = icy as usize * CHUNK_SIZE + icx as usize; if (dx == 0 && dy == 0) || { let i = (atan[px] % rays as f32) as usize; - dd as u64 + dy.unsigned_abs() as u64 * dy.unsigned_abs() as u64 + dd + dy * dy <= list[i].0 } { if self @@ -2007,13 +2007,13 @@ impl WorldManager { mat, prob, } = ex; - let dx = cx - x; - let dy = cy - y; + let dx = cx.abs_diff(x) as u64; + let dy = cy.abs_diff(y) as u64; if ((dx == 0 && dy == 0) || { let rays = get_ray(r); let j = (atan[px] % rays as f32) as usize; - let dd = dx.unsigned_abs() as u64 * dx.unsigned_abs() as u64 - + dy.unsigned_abs() as u64 * dy.unsigned_abs() as u64; + let dd = dx * dx + + dy * dy; data.iter().any(|(i, r)| j == *i && dd <= *r) }) && self .materials @@ -3248,4 +3248,4 @@ fn test_cut_perf() { total += timer.elapsed().as_micros(); } println!("total micros: {}", total / iters); -} +} \ No newline at end of file diff --git a/quant.ew/files/system/telekenisis/telekenisis.lua b/quant.ew/files/system/telekenisis/telekenisis.lua index 1664ae37..3fd6d77c 100644 --- a/quant.ew/files/system/telekenisis/telekenisis.lua +++ b/quant.ew/files/system/telekenisis/telekenisis.lua @@ -53,6 +53,8 @@ local function body_to_ent(id) end end +local sent_track_req = {} + function tele.on_world_update() local n = EntitiesGetMaxID() for ent = last + 1, n do @@ -78,24 +80,29 @@ function tele.on_world_update() if ComponentGetValue2(com, "mState") ~= 0 then local body = ComponentGetValue(com, "mBodyID") local ent, num = body_to_ent(tonumber(body)) - local gid - for _, v in ipairs(EntityGetComponent(ent, "VariableStorageComponent") or {}) do - if ComponentGetValue2(v, "name") == "ew_gid_lid" then - gid = v - break + if ent ~= nil then + local gid + for _, v in ipairs(EntityGetComponent(ent, "VariableStorageComponent") or {}) do + if ComponentGetValue2(v, "name") == "ew_gid_lid" then + gid = v + break + end + end + if gid ~= nil then + has_tele = true + rpc.send_tele( + ComponentGetValue2(gid, "value_string"), + num, + ComponentGetValue2(com, "mStartBodyMaxExtent"), + ComponentGetValue2(com, "mStartAimAngle"), + ComponentGetValue2(com, "mStartBodyAngle"), + ComponentGetValue2(com, "mStartBodyDistance"), + ComponentGetValue2(com, "mMinBodyDistance") + ) + elseif not table.contains(sent_track_req, ent) then + table.insert(sent_track_req, ent) + ewext.track(ent) end - end - if gid ~= nil then - has_tele = true - rpc.send_tele( - ComponentGetValue2(gid, "value_string"), - num, - ComponentGetValue2(com, "mStartBodyMaxExtent"), - ComponentGetValue2(com, "mStartAimAngle"), - ComponentGetValue2(com, "mStartBodyAngle"), - ComponentGetValue2(com, "mStartBodyDistance"), - ComponentGetValue2(com, "mMinBodyDistance") - ) end elseif has_tele then has_tele = false diff --git a/quant.ew/init.lua b/quant.ew/init.lua index b9e5d3cb..0384dc09 100755 --- a/quant.ew/init.lua +++ b/quant.ew/init.lua @@ -111,9 +111,9 @@ local function load_modules() ctx.load_system("essence_sync") ctx.load_system("spectate") ctx.load_system("effect_data_sync") - if ctx.proxy_opt.item_dedup then - -- ctx.load_system("gen_sync") - end + -- if ctx.proxy_opt.item_dedup then + -- ctx.load_system("gen_sync") + -- end ctx.load_system("karl") ctx.load_system("remove_wand_sound") if ctx.proxy_opt.randomize_perks then @@ -270,7 +270,7 @@ function OnProjectileFired( or n == "data/entities/projectiles/deck/black_hole_giga.xml" or n == "data/entities/projectiles/deck/white_hole.xml" or n == "data/entities/projectiles/deck/white_hole_giga.xml" - or string.sub(n, 31) == "data/entities/items/pickup/egg_" + or string.sub(n, 1, 31) == "data/entities/items/pickup/egg_" or EntityHasTag(projectile_id, "ew_projectile_position_sync") then local body = EntityGetFirstComponentIncludingDisabled(projectile_id, "PhysicsBody2Component")