Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Not planning on modify the Lua source code. However I agree that having "&&" instead of "and" is more convenient.
I don't know what you mean by hooks. But in Onset you can use this function https://dev.playonset.com/wiki/AddEvent to add your function handler.
Events are listed here:
https://dev.playonset.com/wiki/Template:ServerEvents
https://dev.playonset.com/wiki/Template:ClientFunctions
Let me know if you have any other questions.
The AddEvent system - does it allow you to only add one of each kind, or multiples? The benefit of the hook system is you can add multiple. The first one to return a value is the one that overrides. So the main game function can be base behavior, then you can modify the behavior in certain situations.
Also, do you plan on having an auto-refresh style system implemented? If so, you could make it better than GMod by only reloading the single file which changed.
I had to create this type of system manually in GMod by enabling auto-refresh for the hook ( although, I could've constantly monitored hundreds of files for timestamps - and it would've worked but it would've been much slower ), then disabling the second refresh in my auto loader so it wouldn't refresh all files. Instead, it would find the one file that changed ( or more in case someone was that quick and hit a save-all button in an editor ), package them and network them if necessary and run / evaluate the code.
The way I made it work really well - even though this isn't necessary, but this allows for dynamically loading of game-modes, etc... Since Lua stores everything in tables and has special meta-table functions.. I stored each aspect in a separate table.
Base code > Base Game-Mode > Current Game-Mode > Addons / Overrides
and I'd have a simple controller in the GM / GAMEMODE table which I converted into a meta-table and added index / newindex checks. Newindex to properly sort the data to the appropriate table location based on path. And index to determine which to call.. Which was actually quite simple... > most has highest priority. If it doesn't exist, go lower.
It let you swap out the currently loaded game-mode without having to reload base gamemodes, unless those changed. It requires a little more work to keep track of hooks added for a specific game-mode, and if you want to keep a game-mode in memory ( for a mini-game environment ) then it would create a nested table within the Current Game-mode table, and a simple variable would track which one was active.
Meaning, you could load as many game-modes as you could possibly want and dynamically swap through them without having to reload any new files.
The biggest issue in GMod for this type of system is the 2000 file limit, which may have been removed, but I never re-tested. Because my auto-loader included files in a specific way, and my framework was organized in a very simple way - I could simply read the content of the files and make 2 files for the server to run on ( I could've done this for addons, but I didn't - so the addons were limited to 1998 files if the limit was still there ). And, I could easily enable or disable this one feature. I don't think I ever uploaded this variant to bitbucket.
So a simple server file, and a client file. The exact load-order was there. I started working on another project to map code for Sublime Text ( which would also help automatically generate wiki content, map the files to easily navigate without scrolling, minor error-checking [ not on the level of proper linting yet ], and more ) - so I ended up not finalizing the security measures or alternate transfer protocols to allow storing and downloading via http with a key - but all of those designs are complete, and solid.
Anyways - Do you plan on using tables to categorize functions? Right now they all just seem to be in the global namespace. AddEvent. etc.. etc.. etc..
Why not set up a library such as draw, math, networking, etc..? -- Not only would it help developers quickly, and easily find functions to use - but it would add a greater level of organization to the project.
gui could be for elements such as text boxes, and other interactables. draw could be for simple things such as drawing rectangles, lines, and so on. You could even add drawing text in here.