Skip to content

Commit

Permalink
fix culling, dont sync wand ghost, fix world sync when spectating
Browse files Browse the repository at this point in the history
  • Loading branch information
bgkillas committed Sep 29, 2024
1 parent 62e117e commit 1a729d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion noita-proxy/src/net/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl WorldManager {
fn should_kill(my_pos: (i32, i32), cam_pos: (i32, i32), chx: i32, chy: i32, is_notplayer: bool) -> bool {
let (x, y) = my_pos;
let (cx, cy) = cam_pos;
if (x - cx).abs() > 2 && (y - cy).abs() > 2 {
if (x - cx).abs() > 2 || (y - cy).abs() > 2 {
!(chx <= x + 2 && chx >= x - 2 && chy <= y + 2 && chy >= y - 2)
&& !(chx <= cx + 2 && chx >= cx - 2 && chy <= cy + 2 && chy >= cy - 2)
} else if is_notplayer {
Expand Down
10 changes: 5 additions & 5 deletions quant.ew/files/system/enemy_sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ end
local function get_sync_entities(return_all)
local entities = {}
table_extend_filtered(entities, EntityGetWithTag("enemy"), function (ent)
return not (EntityHasTag(ent, "ew_no_enemy_sync"))
end)
table_extend_filtered(entities, EntityGetWithTag("mimic_potion"), function (ent)
return not (EntityHasTag(ent, "ew_no_enemy_sync"))
return not EntityHasTag(ent, "ew_no_enemy_sync") and not EntityHasTag(ent, "wand_ghost")
end)
table_extend(entities, EntityGetWithTag("ew_enemy_sync_extra"))
table_extend(entities, EntityGetWithTag("mimic_potion"))
table_extend_filtered(entities, EntityGetWithTag("prop_physics"), function (ent)
return constants.phys_sync_allowed[EntityGetFilename(ent)]
end)
Expand Down Expand Up @@ -439,9 +437,11 @@ function rpc.handle_enemy_data(enemy_data)
local dont_cull = enemy_info_raw[9]
local remote_enemy_id = en_data.enemy_id
local my_x, my_y = GameGetCameraPos()
local c_x, c_y = GameGetCameraPos()
local x, y = en_data.x, en_data.y
local dx, dy = my_x - x, my_y - y
if not dont_cull and dx * dx + dy * dy > DISTANCE_LIMIT * DISTANCE_LIMIT then
local cdx, cdy = c_x - x, c_y - y
if not dont_cull and dx * dx + dy * dy > DISTANCE_LIMIT * DISTANCE_LIMIT and cdx * cdx + cdy * cdy > DISTANCE_LIMIT * DISTANCE_LIMIT then
if ctx.entity_by_remote_id[remote_enemy_id] ~= nil then
EntityKill(ctx.entity_by_remote_id[remote_enemy_id])
end
Expand Down

0 comments on commit 1a729d1

Please sign in to comment.