Use a proper mouse position for notplayer

This commit is contained in:
IQuant 2024-08-18 19:08:26 +03:00
parent 7b0a2a5cd5
commit c13502d4bb
3 changed files with 5 additions and 10 deletions

View file

@ -12,6 +12,7 @@ static LUA: LazyLock<Lua51> = LazyLock::new(|| unsafe {
// const EWEXT: [(&'static str, Function); 1] = [("testfn", None)]; // const EWEXT: [(&'static str, Function); 1] = [("testfn", None)];
extern "C" fn test_fn(lua: *mut lua_State) -> c_int { extern "C" fn test_fn(lua: *mut lua_State) -> c_int {
println!("test fn called");
0 0
} }

View file

@ -16,15 +16,7 @@ local function aim_at(world_x, world_y)
local dx, dy = world_x - ch_x, world_y - ch_y local dx, dy = world_x - ch_x, world_y - ch_y
ComponentSetValue2(state.control_component, "mAimingVector", dx, dy) ComponentSetValue2(state.control_component, "mAimingVector", dx, dy)
-- No idea what coordinate system that field uses. ComponentSetValue2(state.control_component, "mMousePosition", world_x, world_y)
-- Writing a big positive/negative value to turn to the right side seems to work.
local mouse_x
if dx > 0 then
mouse_x = 100000
else
mouse_x = -100000
end
ComponentSetValue2(state.control_component, "mMousePosition", mouse_x, 0)
local dist = math.sqrt(dx * dx + dy * dy) local dist = math.sqrt(dx * dx + dy * dy)
if dist > 0 then if dist > 0 then

View file

@ -4,7 +4,9 @@ np = require("noitapatcher")
package.cpath = package.cpath .. ";./mods/quant.ew/?.dll" package.cpath = package.cpath .. ";./mods/quant.ew/?.dll"
package.path = package.path .. ";./mods/quant.ew/?.lua" package.path = package.path .. ";./mods/quant.ew/?.lua"
print(package.cpath) print(package.cpath)
require("ewext")
ewext = require("ewext")
print(ewext)
dofile_once( "data/scripts/lib/utilities.lua" ) dofile_once( "data/scripts/lib/utilities.lua" )