Working on Portals, related questions - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Working on Portals, related questions (/thread-551.html) |
RE: Working on Portals, related questions - Taugeshtu - 09-10-2012 Can I have cWorld::ForEachChunkInRect() exported in Lua? This seems to be a good thing for plugins optimisation... And this will shrink lua code ammount Since it's already there, won't be a big deal, right? RE: Working on Portals, related questions - xoft - 09-10-2012 Well that one is a bit more involved, since it is using a multi-callback - one callback for coords, one for heightmap, another for biome map, blocktypes, blockmeta, ... Have a look at cChunkDataCallback in ChunkDef.h. Now I don't know how to make that Lua-accessible easily - should the function take a gazillion arguments, one for each callback function? Or a Lua object with functions assigned to it for each callback? Also, my Lua hacking skills are not up to this megatask. RE: Working on Portals, related questions - Taugeshtu - 11-03-2012 Wonderful. I updated from r856 (yeah, it's been a while) to r1017. Guess what? Portals are broken. And I have NO IDEA why, because this code: Code: Player:SendMessage("SOME YOUR PORTAL STATE BELONG TO US! "..PlayersData[_name].portal_state) So, somehow if (PlayersData[_name].portal_state == -1) then is not a valid statement. Although it is. As it should be. But it isn't. Using == "-1" helped, but make whole code somewhat messy. tonumber() had no effect. Any ideas on why the f*ck did it happened? RE: Working on Portals, related questions - Taugeshtu - 11-04-2012 Ok, seems like bug is fixed. What it was: Somehow using file = io.open(PLUGIN:GetLocalDirectory().."/portals_portals.dat", "w+") with "w+" mode caused data to be corrupted upon re-writing. Using just "w" mode works just fine (or, at least, seems to be fine at first test). I'll do some more my lua magic and then will upload updated version, I guess. In case anyone suffers the bug and needs it immediately I can provide quick-fixed version. RE: Working on Portals, related questions - Taugeshtu - 11-07-2012 Alright, it's not fixed still. For no obvious reason table with portals data corrupts. I have no idea why right now. |