mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
make notplayer react a bit better near stay away objects
This commit is contained in:
parent
51ed3e28ea
commit
2026bf2340
1 changed files with 20 additions and 14 deletions
|
@ -770,6 +770,7 @@ local function choose_movement()
|
|||
end
|
||||
end
|
||||
|
||||
local closest = {500 * 500, 500, 500}
|
||||
for i = #state.stay_away, 1, -1 do
|
||||
local pos = state.stay_away[i]
|
||||
local x, y = pos[1], pos[2]
|
||||
|
@ -779,7 +780,15 @@ local function choose_movement()
|
|||
else
|
||||
local pdx, pdy = x - my_x, y - my_y
|
||||
local r = pdx * pdx + pdy * pdy
|
||||
if r <= 64 * 64 then
|
||||
if r < closest[1] then
|
||||
closest = {r, pdx, pdy}
|
||||
end
|
||||
end
|
||||
end
|
||||
local pdx, pdy = closest[2], closest[3]
|
||||
GamePrint(pdx)
|
||||
GamePrint(pdy)
|
||||
if math.abs(pdy) < 60 and math.abs(pdx) < 55 then
|
||||
if pdx < 0 then
|
||||
state.control_d = true
|
||||
state.control_a = false
|
||||
|
@ -792,9 +801,6 @@ local function choose_movement()
|
|||
else
|
||||
state.control_w = true
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ComponentGetValue2(state.damage_model, "mLiquidCount") == 0 then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue