Obligatory "I ruined everything!" thread - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: Obligatory "I ruined everything!" thread (/thread-476.html) |
Obligatory "I ruined everything!" thread - Taugeshtu - 06-10-2012 Current wiki CONFIG revision: r593 Current wiki API revision: !!mixed!! So. I'm planning to fill wiki up-to-date, but for easy furthermore corrections and additions I encourage YOU, developers, to post any //tolua_export changes you do in the code in following format: Quote:r100500 I removed cRoot class from lua export. Feel free to post configuring-related changes as well (if you're too lazy to write them into wiki) RE: Obligatory "I ruined everything!" thread - FakeTruth - 06-10-2012 I don't get it, are we supposed to post in this thread? RE: Obligatory "I ruined everything!" thread - Taugeshtu - 06-10-2012 Yes. Post any changes you make to API and .ini keys/values there, please. This will help. RE: Obligatory "I ruined everything!" thread - xoft - 06-13-2012 Rev 598, big change Added hook names with HOOK prefix (but kept the E_PLUGIN_ -prefixed names for compatibility) Added three hooks: HOOK_PRE_CRAFTING, HOOK_CRAFTING_NO_RECIPE and HOOK_POST_CRAFTING Added two new objects: cCraftingGrid and cCraftingRecipe Crafting is now fully customizable in plugins, example code: Code: function Initialize( Plugin ) RE: Obligatory "I ruined everything!" thread - xoft - 06-14-2012 Rev 602 has a new hook, HOOK_BLOCK_TO_PICKUP, that is called each time a player breaks a block and it can modify the pickups that they receive. It is called when MCServer has already decided what the standard pickups should be, and the hook can add / modify / remove them. Hook parameters: BlockType, BlockMeta, cPlayer, cItem (equipped), cItems (pickups) Example code that makes grass drop 4 diamonds: Code: PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_TO_PICKUP) RE: Obligatory "I ruined everything!" thread - Taugeshtu - 06-14-2012 Could you please describe when crafting hooks are called? If I'll change recipe output in HOOK_PRE_CRAFTING - will crafting operation return changed item? RE: Obligatory "I ruined everything!" thread - FakeTruth - 06-14-2012 HOOK_PRE_CRAFTING is not called yet, it's not implemented EDIT: SORRY!! it is implemented RE: Obligatory "I ruined everything!" thread - xoft - 06-14-2012 PRE_CRAFTING: before the built-in recipes are checked. If it returns true, builtins are not checked and no other crafting hooks are called CRAFTING_NO_RECIPE: called only when no built-in recipe is found. Return value is ignored by MCServer (but if there are multiple plugins hooked, the first one returning true breaks the chain of calls, no other plugin will be called, just like with all the other hooks) POST_CRAFTING: called after the built-in recipes are checked and a recipe was found. Return value ignored, but returning true means no more plugins are called for that hook. RE: Obligatory "I ruined everything!" thread - xoft - 06-16-2012 Rev 620: Added cWorld:ForEachEntity and cWorld:ForEachEntityInChunk API functions. I have no idea if they work correctly, though - didn't do any testing. And additionally, I have no idea if there's a way for Lua to convert a cEntity into the more specific class, such as cPlayer, cPassiveMob or whatever. We might need to add these when needed. RE: Obligatory "I ruined everything!" thread - xoft - 06-17-2012 Rev 622: Added HOOK_UPDATING_SIGN and HOOK_UPDATED_SIGN hooks. They both receive the same arguments: cWorld - the world where the sign is x, y, z - the block coords of the sign line1, line2, line3, line4 - the four lines of text in the sign HOOK_UPDATING_SIGN is called before the sign text is updated. If the hook returns true, the sign text won't get updated. The hook can also return up to four texts, after the "false", those values will override the lines of text that the sign will receive. For example, the following Lua code flips the lines - the last line will become the first etc.: Code: function OnUpdatingSign(World, BlockX, BlockY, BlockZ, Line1, Line2, Line3, Line4) HOOK_UPDATED_SIGN is called after the sign text is updated, it is just a notification. Plugins cannot change the text anymore. When the callback returns true, no more plugins will be called with the notification (not recommended). |