Skip to content

Commit

Permalink
fix controls being enabled when notplayer from texting
Browse files Browse the repository at this point in the history
  • Loading branch information
bgkillas committed Dec 6, 2024
1 parent eb89c1c commit 6ba3ece
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions noita-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,7 @@ impl App {
let mut old_settings = netman.settings.lock().unwrap().clone();
old_settings.progress.clear();
old_settings.seed = new_settings.seed;
old_settings.world_num = new_settings.world_num;
netman
.dirty
.store(old_settings != new_settings, Ordering::Relaxed)
Expand Down
18 changes: 11 additions & 7 deletions quant.ew/files/system/text/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,30 @@ end

local function starttext()
enabled = true
local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent")
local g = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "InventoryGuiComponent")
if g ~= nil then
EntitySetComponentIsEnabled(ctx.my_player.entity, g, false)
end
if controls ~= nil then
ComponentSetValue2(controls, "enabled", false)
if not EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent")
if controls ~= nil then
ComponentSetValue2(controls, "enabled", false)
end
end
end

local function stoptext()
enabled = false
text = ""
local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent")
local g = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "InventoryGuiComponent")
if g ~= nil then
EntitySetComponentIsEnabled(ctx.my_player.entity, g, true)
end
if controls ~= nil then
ComponentSetValue2(controls, "enabled", true)
if not EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
local controls = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "ControlsComponent")
if controls ~= nil then
ComponentSetValue2(controls, "enabled", true)
end
end
end

Expand Down Expand Up @@ -162,4 +166,4 @@ function module.on_world_update()
end
end

return module
return module

0 comments on commit 6ba3ece

Please sign in to comment.