Would it be possible to make an object that would keep anything nearby it loaded, even if there are no players on the planet that it is on? It would allow certain machines to continue operating while the player an away.
I would absolutely use this. The quarry from Steambound Reloaded is a perfect example of something that would be amazing with a chunk / world loader.
Yes this is possible, and not even difficult. It needs only a single function. Code: world.loadRegion()
Sure. Code: init = function() local range = config.getParameter("range", 8) local position = entity.position() storage.region = { position[1] - range, position[2] - range, position[1] + range, position[2] + range } end update = function() world.loadRegion(storage.region) end That's throwing in the optional ability to load "range" from the object doing the loading. That range applies to every direction from the object. So a range of 8(the default if not set), will get you a 16 x 16 tile area.
Put "keepAlive" : true in the .object file, and set its "scriptDelta" : 60 which should be plenty fast enough (to run the update at once per second) if you create such an object. I think the Frackin' Universe already has one (Watcher?) If you keep too many chunks loaded it will likely cause fps drop though.
You know scrolling back up to this part I realized that a chunk loader might not be what you need. There is a better way. I made code that handles machine production while the player is away - even off planet. This is part of my init function Code: storage.inactiveTime = storage.inactiveTime or 0 storage.was_inactive = storage.was_inactive or false Some of the code I'm using Code: uninit = function() if storage.state and not storage.was_inactive then storage.was_inactive = true storage.inactiveTime = os.time() end end update = function(dt) if storage.ship then return end local active = world.regionActive(storage.region) if storage.state then storage.harvest_countDown = storage.harvest_countDown - dt if storage.harvest_countDown > 0 then --nothing else storage.harvest_countDown = storage.harvest_timer + math.fRandom(0, storage.harvest_time_over) if hasFuel() and active then addItem( pickOre(storage.biome) ) useFuel() else processWireInput() --this will actually handle the change well end end if active then if storage.was_inactive then local diff = os.difftime(os.time(), storage.inactiveTime) local cycles = math.floor(diff / ( storage.harvest_timer + math.fRandom(0, storage.harvest_time_over))) cycles = math.max(math.min(cycles, 10000), 0) makeup_cycles(cycles) storage.was_inactive = false end else if not storage.was_inactive then storage.was_inactive = true storage.inactiveTime = os.time() end end updateAnimation() end end makeup_cycles = function(cycles) --sb.logInfo("\nmakeup_cycles(" .. tostring(cycles) .. ")") while cycles > 0 and hasFuel() do addItem( pickOre(storage.biome) ) useFuel() cycles = cycles - 1 end end You wouldn't use that exact code per say. But it shows how you can handle continued work without need of chunk loading. If you want to see the whole script, download ISE4, and look at \objects\machines\ise4_miner_script.lua Obviously that script could use cleaned up and all that, but it works as is. And thinking about it, maybe I should update to prevent that working in stations(where it doesn't make sense) just like ships. For a short time I did chunk loading before deciding this was better. The minor downside to the current code is that it will totally loose the cycles if you exit the game. If that really bothered me(it doesn't), then I could get the object a UUID, and write the time into world properties with that UUID as part of the property's nameSpace.
So has a viable chunk loader actually been released yet?? I just started using the Garden bot mod and have been looking for some sort of placeable object to keep my farm fully operational when I head back to the ship. Crops can still grow when your not around but NPC's like the bots stop functioning which makes things grind to a halt.
As a stand alone mod? Don't think so. FU has the watcher which IIRC keeps a 16 x 16 tile area active. It wouldn't be hard at all to make a stand alone mod if you wanted.
The Watcher has to be activated every time you come back to your world, and doesn't work while you're off-world though. At least according to the wiki: http://frackinuniverse.wikia.com/wiki/Watcher