Noita
Advanced Map
ljiyin  [developer] 14 Nov, 2024 @ 6:04am
Do not activate with Apotheosis 不要与神化mod一起用
This will crash the game. 会导致游戏崩溃
This mod only shows unmodified world in the vanilla game. 只会显示原版未被修改的世界
< >
Showing 1-1 of 1 comments
520憨批猪 13 Dec, 2024 @ 8:08pm 
可以用ControlsComponent里的 mButtonFrameRightClick解决这个问题

代码示例
init.lua文件
function OnPlayerSpawned(player_entity)
GamePrint("$amap_open")
dofile("mods/advanced_map/button.lua")
DisposeMap()
EntityAddComponent( player_entity, "VariableStorageComponent", { _tags = "LastTeleportFram",value_int=0} )
end



map.lua文件
--mouse comp
local ctrl_components = EntityGetComponentIncludingDisabled( player_id, "ControlsComponent" )
local right_click = false
local right_clickfram =0
local mouse_x,mouse_y,map_gui_x,map_gui_y
if (ctrl_components ~= nil) then
edit_component2(player_id,"ControlsComponent",function (comp,vars)
right_click = ComponentGetValue2( comp, "mButtonDownRightClick")
right_clickfram = ComponentGetValue2( comp, "mButtonFrameRightClick")
mouse_x,mouse_y = ComponentGetValue2( comp, "mMousePosition")
map_gui_x,map_gui_y = ComponentGetValue2( comp, "mMousePositionRaw")
end )
end

--teleport
if right_click and ModSettingGet("advanced_map.teleport") then
local compClick = EntityGetFirstComponentIncludingDisabled( player_id, "VariableStorageComponent" ,"LastTeleportFram")
local lastright_clickfram = ComponentGetValue2(compClick,"value_int") or 0
if (right_clickfram-lastright_clickfram)>2 then

EntitySetTransform(player_id, msx, msy)
timer = 0
GamePrint( GameTextGet("$log_teleported").." "..tostring(right_clickfram)..tostring(lastright_clickfram )..tostring(msx).." , "..tostring(msy) )
ComponentSetValue2( compClick, "value_int", right_clickfram )
end
end
< >
Showing 1-1 of 1 comments
Per page: 1530 50