dont tether to areas like eye room/meditation cube/ snow room/ tower, dont show tether when it cant activate

This commit is contained in:
bgkillas 2024-09-01 08:18:44 -04:00
parent fc955cfeb0
commit ffb5d51e23
3 changed files with 49 additions and 44 deletions

52
noita-proxy/Cargo.lock generated
View file

@ -1072,15 +1072,6 @@ dependencies = [
"once_cell",
]
[[package]]
name = "fastrand"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
dependencies = [
"instant",
]
[[package]]
name = "fastrand"
version = "2.1.1"
@ -1664,9 +1655,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
[[package]]
name = "indexmap"
version = "2.4.0"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c"
checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
dependencies = [
"equivalent",
"hashbrown",
@ -1681,15 +1672,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "instant"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
dependencies = [
"cfg-if",
]
[[package]]
name = "intl-memoizer"
version = "0.5.2"
@ -2238,9 +2220,9 @@ dependencies = [
[[package]]
name = "object"
version = "0.36.3"
version = "0.36.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a"
dependencies = [
"memchr",
]
@ -2720,9 +2702,9 @@ dependencies = [
[[package]]
name = "rgb"
version = "0.8.48"
version = "0.8.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f86ae463694029097b846d8f99fd5536740602ae00022c0c50c5600720b2f71"
checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a"
dependencies = [
"bytemuck",
]
@ -2907,13 +2889,13 @@ dependencies = [
[[package]]
name = "self-replace"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7828a58998685d8bf5a3c5e7a3379a5867289c20828c3ee436280b44b598515"
checksum = "03ec815b5eab420ab893f63393878d89c90fdd94c0bcc44c07abb8ad95552fb7"
dependencies = [
"fastrand 1.9.0",
"fastrand",
"tempfile",
"windows-sys 0.48.0",
"windows-sys 0.52.0",
]
[[package]]
@ -3195,9 +3177,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.76"
version = "2.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525"
checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed"
dependencies = [
"proc-macro2",
"quote",
@ -3247,7 +3229,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
dependencies = [
"cfg-if",
"fastrand 2.1.1",
"fastrand",
"once_cell",
"rustix",
"windows-sys 0.59.0",
@ -3375,9 +3357,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.39.3"
version = "1.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
dependencies = [
"backtrace",
"bytes",
@ -4031,9 +4013,9 @@ dependencies = [
[[package]]
name = "webpki-roots"
version = "0.26.3"
version = "0.26.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd"
checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a"
dependencies = [
"rustls-pki-types",
]

View file

@ -24,7 +24,13 @@ end
local function not_in_hm(x, y)
local list = {1198, 2734, 4782, 6318, 8366, 10414}
return not (in_normal_hm(list, x, y) or is_in_box(1536, 2726, 12798, 13312, x, y))
return not (in_normal_hm(list, x, y)
or is_in_box(1536, 2726, 12798, 13312, x, y) --last holy mountain
or is_in_box(-4634, -4054, 2006, 2580, x, y) --meditation cube
or is_in_box(-4060, -3656, 5078, 5660, x, y) --eye room
or is_in_box(3578, 4080, 4048, 4640, x, y) --snow room
or is_in_box(8700, 11300, 3550, 10240, x, y) --tower
)
end
function module.on_client_spawned(peer_id, new_playerdata)
@ -41,19 +47,38 @@ local function is_suitable_target(entity)
return EntityGetIsAlive(entity) and not EntityHasTag(entity,"ew_notplayer")
end
function module.on_world_update_client()
local host_playerdata = player_fns.peer_get_player_data(ctx.host_id, true)
if host_playerdata == nil or not is_suitable_target(host_playerdata.entity) or not is_suitable_target(ctx.my_player.entity) then
return
local function tether_enable(to_enable, entity)
for _, child in ipairs(EntityGetAllChildren(entity) or {}) do
if EntityGetFilename(child) == "mods/quant.ew/files/system/player_tether/zone_entity.xml" then
local emmiter = EntityGetFirstComponentIncludingDisabled(child, "ParticleEmitterComponent")
EntitySetComponentIsEnabled(child, emmiter, to_enable)
break
end
end
end
function module.on_world_update_client()
if GameGetFrameNum() % 10 == 7 then
local host_playerdata = player_fns.peer_get_player_data(ctx.host_id, true)
if host_playerdata == nil or not is_suitable_target(host_playerdata.entity) or not is_suitable_target(ctx.my_player.entity) then
if host_playerdata ~= nil and host_playerdata.entity ~= nil and EntityGetIsAlive(host_playerdata.entity) then
tether_enable(false, host_playerdata.entity)
end
return
end
local x1, y1 = EntityGetTransform(host_playerdata.entity)
local x2, y2 = EntityGetTransform(ctx.my_player.entity)
local dx = x1-x2
local dy = y1-y2
local dist_sq = dx*dx + dy*dy
if dist_sq > tether_length_2 * tether_length_2 and not_in_hm(x1, y1) and not_in_hm(x2, y2) then
EntitySetTransform(ctx.my_player.entity, x1, y1)
if x1 ~= nil and x2 ~= nil and not_in_hm(x1, y1) and not_in_hm(x2, y2) then
tether_enable(true, host_playerdata.entity)
if dist_sq > tether_length_2 * tether_length_2 then
EntitySetTransform(ctx.my_player.entity, x1, y1)
end
else
tether_enable(false, host_playerdata.entity)
end
end
end

View file

@ -18,8 +18,6 @@ local KEY_WORLD_END = 1
local CHUNK_SIZE = 128
local iter_cam = false
local iter_fast = 0
local iter_slow = 0