Jump to content

Recommended Posts

I was trying to find a shortcut by going in and out of the cave, and I realized how inconvenient it was that I couldn't check the overworld map while inside the cave — and vice versa. Surprisingly, there didn't seem to be any mod for this functionality, so I decided to try making one myself after learning a bit of Lua.

My idea was to save the overworld or cave map before switching dimensions, store it in a component (since components have OnSave and OnLoad functions), and then load it when clicking a button in the destination world by pushing a new MapScreen. Like: TheFrontEnd:PushScreen( MapScreen(...) )

However, I ran into a problem: It seems that TheWorld.minimap is a table, while TheWorld.minimap.MiniMap is a userdata, which can't be serialized. As a result, the OnSave function doesn't work as expected, and I'm not even sure how to save the map data into a file. Since the minimap is rendered on the C side, I'm not sure how to proceed.

Does this mean my only option is to take screenshots and stitch them together manually? 😭

在我试图通过进出洞穴来找到一条主世界通行的捷径时,我发现洞穴里无法查看地表的地图,反之亦然。这确实很不方便,而且令我惊讶的是,似乎没一个模组可以实现类似的功能,所以我浅学了一点Lua语言打算自己写一个。

我的想法是在切换维度之前保存地表或洞穴地图,将它保存在一个component中(因为component有OnSave和OnLoad函数),然后在目标世界中通过点击一个按钮,调用这个函数 TheFrontEnd:PushScreen(MapScreen(...)) 来加载它。

然而,我就遇到了一个问题:TheWorld.minimap似乎是一个table,而TheWorld.minimap.MiniMap是一个userdata,没法序列化,所以OnSave函数无法正常工作。我也搞不懂如何将地图数据保存到文件中然后再加载出来。由于小地图是在C端渲染的,我看不到这部分代码,也不确定后续怎么做。

难道我唯一的手段就剩下截很多图然后手动拼在一起了吗?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...