• Content count

  • Joined

  • Last visited

  1. Update: Some functions have been refactored for easy reference. I don't expect anyone will need this unless you are planning to do complex enumeration in lua. I created Bitwise operations that does whatever it needs to get it done. Original Source Code: https://github.com/The-Dialga-Team-Project-Zomboid-Mods/The-Dialga-Team-Mod-Collection/blob/master/mods/TDTModAPI/media/lua/shared/TheDialgaTeam/TDTModAPI/System/Bitwise.lua Dependent file: ( require "TheDialgaTeam/TDTModAPI/Lua/Table" ) https://github.com/The-Dialga-Team-Project-Zomboid-Mods/The-Dialga-Team-Mod-Collection/blob/master/mods/TDTModAPI/media/lua/shared/TheDialgaTeam/TDTModAPI/Lua/Table.lua Binary Table Types: (By default, it will choose the one that is the smallest possible type to reduce processing time) How to get Binary Table? Either use ConvertToBinaryTable(value, valueType) or use numeric values which will be automatically converted to binary table based on the smallest possible type. Note: It may affect the returned value based on the type of binary table. If you are unsure, you can always use "Bitwise.Types.int" as the valueType parameter. Example of a difference it can make: local Bitwise = require "TheDialgaTeam/TDTModAPI/System/Bitwise"; -- Test Case 1: local test = Bitwise.Not(Bitwise.ConvertToBinaryTable(5, Bitwise.Types.int)); print(test); -- Expected Result: -6 -- Test Case 2: local test2 = Bitwise.Not(5); -- Automatically resolved as a Byte type which is 0 to 255 only. print(test2); -- Expected Result: 250 -- Signed and Unsigned bits makes a difference when using NOT operation. NOT operation does two's complement, depending on the type, it may end up negative or positive whole number. --- Bitwise operation NOT (~) Bitwise.Not(binaryTable) --- Bitwise operation AND (&) Bitwise.And(binaryTable, binaryTable2) --- Bitwise operation OR (|) Bitwise.Or(binaryTable, binaryTable2) --- Bitwise operation XOR (^) Bitwise.Xor(binaryTable, binaryTable2) --- Bitwise operation LShift (<<) Bitwise.LShift(binaryTable, value) --- Bitwise operation RShift (>>) Bitwise.RShift(binaryTable, value) --- Convert numeric values into binary bits representation Bitwise.ConvertToBinaryTable(value, valueType) Return a table consist of: { type = "bool", minValue = 0, maxValue = 1, bits = 1, hasNegativeBits = false, value = { 0 } } --- Convert binary bits into numeric representation. Bitwise.ConvertToNumericValue(binaryTable) --- Trim padded zeros in the binary bits. Bitwise.TrimPaddedZeros(binaryTable) ============================================================================= Why is the default not integer when using numeric values for binaryTable? This is because lua is dynamic and usually resolve them so generically. I tried to simulate the same thing in lua. I figured using a smaller type yields smaller bits and less computational time is needed for each operation. If you notice, more bits require more loops. This is done to accurately calculate the actual bits within a specific constraint. I want to avoid looping too much as it may introduce unnecessary lag in-game. After all, using AND or OR or XOR operation doesn't affect anything when dynamic resolve technique is used. Just bare in mind NOT operation does affect the results.
  2. The Dialga Team Chat Box API

    The Dialga Team Chat Box API A custom ChatBox with API for custom commands. It is open sourced. Feel free to take a look and make a pull request for any bug fixes. https://github.com/The-Dialga-Team-Project-Zomboid-Mods/The-Dialga-Team-Mod-Collection/tree/master/Contents/mods/TDTModChatBoxAPI Features: 1. Mod Devs can create custom command and use them. 2. Customizable ChatBox. You can opt in for the custom chatbox which contains tons of moddable features. - Tabs - Name Colors - Font Colors - Color Picker - Server Message - Many More... 3. Server sided. Activation of chatbox is done by authentication of server packets. (LuaNet) No chatbox will be displayed if server fails to respond. Every request you make will also require server response or nothing will happen. More bandwidth are expected as we are sending a slightly bigger data that contains more information. There will be a few versions of this mod: - Standalone version - A separate module version - Mod pack version I understand that some modders do not like to subscribe many mods at one go so in order to make it easier for everyone, you choose whichever that fits your boat. Standalone version will only be released when it is stable. Modpack and modularized version have been released but are generally NOT stable and not for production use. Dev Log: 29 March 2018 - Under testing phase. Not stable at this point in time.
  3. Custom server commands

    I have bundled a new clone (with additional features like colors and custom commands) https://github.com/The-Dialga-Team-Project-Zomboid-Mods/The-Dialga-Team-Mods-Pack/blob/master/media/lua/client/TheDialgaTeam/TDTModChatBoxAPI/ChatBoxAPI.lua I made a placeholder repo to hold my mods for now. Though all these code are align closely to our own server, I am making it customizable via setting files. (I can bundle all the mods into one which allows easier usage) I ship my own chatbox in addition to the default chatbox. As default chatbox differs from version to version, it may break anytime. I am still looking for ways to make it simpler to inject custom command.
  4. Referencing

    Maybe your mod load earlier than hydrocraft by folder naming conventions. If your mod load earlier than anything else, you can't really spawn anything custom.
  5. I expected some mods that have global tables and worried that it loads in the wrong order. Fear not. You can always trick the game to load first or last depending on the file name. There are mods that prepend numbers to be first. Obviously nobody would try to outsmart your idea and that's fine by any means. From the ascii chart: ! is the first printable and valid file name. ~ is the last printable and valid file name (excluding other chars that aren't on keyboard). The more you append the specific char, the more you guarantee that it always load first/last! Nested folder will also have the same effect but the order remains as: shared/<files> shared/<folders> client/<files> client/<folders> server/<files> server/<folders> Now with this idea, let say you want to call something before anyone overrides it, you can now name your file "!MyModule.lua" to avoid that trouble. If you need to ensure it is first, prepend more "!!!MyModules.lua" and it will be first no matter what.
  6. Custom server commands

    Tldr at the bottom. Edit: There's a new update the ISChat again and thus well it broke a little but I fix it eventually. What I did was to write on top of the original ISChat. https://steamcommunity.com/sharedfiles/filedetails/?id=1265709605 How do I do this? I have injected one more event that take place before the command processing. It will first do all the command processing for the mods before doing the vanilla commands. What is the problem? This mod is still quite experimental and I just started doing something ambitious hence it may not work quite well and optimized. There is also chance that other mod that tries to override ISChat would fail to work as I have updated it to always load last but just before any event triggers. (Appending ~ to file name does that) It becomes mod specific and everyone had to use that specific mod api to add more functions.... Legion was talking about me I did custom mods for them. (Sux to say that my mod had a dependency and doesn't work on its own when I ship them individually as a module) In fact it is still early stage how it would work. I only did this for capping skills mod that has custom commands on it. It does not work on server side command prompt and will never work anyway. Tldr: My solution was same as the above discussion. It is by overwritting a global function and ensures it always load last.
  7. A mod that allows user to define custom actions and consumes it before the game process it as a normal chat or in-game commands. This idea came from the fact that I wanted to add custom command but found a dead end with the current events and limitations in place. I think some people wanted similar feature such as this but just couldn't do it. (I have made one but it isn't really well designed for public usage except for my own self xD) What are the expected features? - Able to get the message user have entered. - Define custom commands with custom prefix - Consume the commands before in-game commands (to add flexibility in design) - Print custom output or run a function based on the command. This should sum up the custom chatbox that allows anyone to change the output and create custom mod commands.
  8. I am the co-owner of the server in Newdawn (AGN / pz.aggressivegaming.org). This idea came from this server as we had issues with overwhelming perks / skills level in the past as players grind blindly without any RP. Hence this idea becoming a reality! I am working on this mod that allows server owner to change the skills max level so it will never be over powered when new player just joined trying to rp. The proposed idea is that it can be per character, per server and per steam account cap. This mod is still in work in progress and has no preview or anything. The features may increase overtime when the base intended features is done.
  9. RELEASED: Vehicle Test 41

    The tires inflation speed is rather TOO SLOW for anyone to really use. I mean seriously pumping a tire from 0 to 40 takes (40 x 50 x (40 / 5)) / 60 = 267 seconds = 4 minutes and 27 seconds. So if I replace 4 tires, am I going to wait 16+ minutes just to pump to full. Though I have made a mod just to solve this slow issue (while waiting for official game to release something better than this), it is rather insane for anyone to wait that long... Deflation speed however is like lighting... less than 30 seconds.
  10. RELEASED: Build 38.22

    For some reason, our players on our server are facing total city blackout after the update.
  11. [Updated][AGN][NA/EU][RP][PVP][Whitelist][24/7] New Dawn Role Play

    We don't need our heads checked. It is clear enough it is not safe for teenagers. (Even with discord warnings anyway) The misleading title "NSFW Memes" is just for fun. It is supposed to be for memes but it took it over to the next level. There's no rule about not able to post NSFW content as long as you don't do it on public channels that aren't marked as NSFW. In fact the rules are rather flexible enough that we do not ban anyone on their first attempt. Oh one more thing, PZ Admins are not in control over the discord channel. Obviously people thought it were but they had the same perms as regular players anyway.
  12. [Updated][AGN][NA/EU][RP][PVP][Whitelist][24/7] New Dawn Role Play

    Thread updated to reflect new and retired staffs. New lore is coming soon!
  13. [Updated][AGN][NA/EU][RP][PVP][Whitelist][24/7] New Dawn Role Play

    Server had some overhaul again. Hope for the better
  14. [Updated][AGN][NA/EU][RP][PVP][Whitelist][24/7] New Dawn Role Play

    Hi everyone, We have fixed rather some core stuff on our forums. One of which is the email system. SPF and DKIM records have been updated and thus important emails will start to reach to you as long as you are subscribed in our system. As part of our anti spam requirement, multiple accounts still remain frown upon. We are monitoring this. In addition, new XP system have been implemented in our server! You may want to read about it in our forum. If you still have issues with anything, do send us a support ticket in our forum so that we can solve it. Have fun! Your friendly Dialga, jianmingyong
  15. [Updated][AGN][NA/EU][RP][PVP][Whitelist][24/7] New Dawn Role Play

    I am glad that our staff could clear things up. Hope you have a nice day