Jump to content

Overriding update.lua, and the update loop.


Zinfidel

Recommended Posts

I just got started with Don't Starve modding, and while I am no stranger to coding/modding, I am new to Lua.

 

I'm currently trying to reimplement the telnet.lua file (appears to be deprecated and non-functional) in the base game as an exercise, but I'm running into problems now when it comes to updating the TCP server because I need to insert an update function into the game's loop. Putting a copy of update.lua in my mod folder doesn't appear to work like other files - I suspect it has to do with load order, or the file is protected from mods in some way.

 

telnet.lua references a defunct function AddWallUpdateFn(fn) that would do exactly what I need, and I have failed to find anything similar to that while perusing the codebase. Does a similar function exist to add stuff to the game loop? I discovered that I couldn't easily override update.lua when I tried to reimplement this functionality, but it never got loaded.

 

Given that I'm doing this primarily as an exercise, I will probably just edit the core files to see some results, but it would be nice to learn how to do this kind of thing "properly" for future modding.

 

TL;DR: Overriding update.lua doesn't seem to work as I'm trying to do it, is it possible to do this? Also, is it possible to run arbitrary functions (not attached to a specific entity or something like that) inside the game loop (WallUpdate(), Update()), such as stepping a copas server?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...