New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
revscriptsys #2558
revscriptsys #2558
Conversation
creates a new folder called 'scripts' in the data folder. lua files placed in the 'scripts' or sub folders will automaticly get registered on load with the right setup ofcourse. Registering happens in the lua file itself, doesn't require xml settings. lua files can be deactivated by placing a '#' infront of the filename ex: '#positions.lua' it wont get loaded then. Currently it supports: -Actions -TalkActions -CreatureEvents -GlobalEvents -MoveEvents There is still stuff on the todo list but they'll get added sooner or later. Co-Authored-By: Sam <thesumm@users.noreply.github.com>
added boost-filesystem to appveyor.yml fixed a few more compiler errors.
removed using namespace for std / boost filesystem
had to make adjustment so lua callbacks and xml settings work alongside and don't crash the server
Have to revert the function + callback for stepin/stepout & additem/removeitem as it doesn't make sense on the second look and might cause a stackoverflow I've also reworked the equip/dequip so it doesn't get double calls. It'll first check if functions return true if not it won't bother to read the callback accidently used an old spellbook.lua added :aid(ids) :uid(ids) functions for MoveEvents
Could revert most of movements.h made the declaration of the static functions more clear Co-Authored-By: Damian Jarek <djarek@users.noreply.github.com>
The basic system is now working without any problems so far, would be good to have a few more reviews before I expand to Monsters / NPC's and such. |
removed commentary from movement.cpp added newline for position.lua reworked spellbook.lua with table.concat
- MonsterType's can now be created through lua functions. - added an interface to create MonsterType's easily through lua files (register_monster_type.lua) - added #example.lua in 'scripts\monsters\' - renamed action vector functions for a better standard - renamed _lib folder to lib, this folder gets now loaded when the other lib folder gets loaded aswell - moved loading lua scripts out of the scriptfilemanager, we need to load everything after monsters etc. is loaded so MonsterType script manipulation does work - added Loot() & MonsterSpell() metatables
removed test outfit from MonsterType
Feel free to keep suggesting stuff, if someone thinks I'm missing something just let me know |
This comment was marked as abuse.
This comment was marked as abuse.
I think we should consider creating a new branch for fully implementing revscriptsys and all the useful metatables and new events we can think of, as well as completely getting rid of XML by converting everything to revscriptsys to test its features and stability until it is considered stable... and maybe also implement OTFB map format, and maybe using a .json for instead of xml for items 🌮 . |
As for example this system will implement something similar to items.srv https://github.com/TwistedScorpio/Nostalrius/blob/master/data/items/items.srv |
There are alot of ideas spawning from this pull request, but currently it does not break backwards compatibility, and functions as a partial port of a few sample scripts. Lets keep it that way, once it gets merged we can send additional pull requests that "revscriptify" the repo, without sending this particular pull request into complete development hell. Since there is no issues merging this as is (once the remaining checklist tasks are done), we can branch off and work on suggestions provided by @raymondtfr, @andersonfaaria and @mattyx14 in separate branches and pull requests. At least thats what I think, get this "core" merged, then begin to play with innovation that expands on this. If said innovation takes time, no problem since this is already functioning as mods pack and can be utilized by the community right away. |
Those are my future plans for it, but before all that we need to make the transition for it and I have to create some xml parsers which automaticly transfers old xml/lua stuff into the new lua format, because taking away xml dependency will give a huge hit to people who have tons of custom stuff already, if we don't provide an auto parser so people have to do it by hand. I'm not familiar with OTFB (would be nice to provide a link)
same as above.
I'm completly on your side, the entire revscriptsys for now will be completly vanilla, just a bridge between core and lua to register the events, anything beyond that can be done by future PR's once it's implemented |
I have to strip down the check list, neither of the remaining can be easily ported without major rework which could most likely break stuff. |
- added createFunctions(class) it virtually creates the get/set functions for the class passed on - 'events' folder in monsters is excluded from auto parsing files, as we load callbacks for specific monsters which have an eventFile set to 'true' or 'filename' in this folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- added Game.createMonsterType(name) - reworked MonsterType(name) to return nil if the MonsterType does not exist, so we don't suddenly create a MonsterType if we do not even want to. - changed reinterpret_cast to static_cast
- added an option to disable scripts console logging, it can be disabled by placing 'showScriptsLogInConsole = false' into config.lua
creates a new folder called 'scripts' in the data folder. lua files placed in the 'scripts' or sub folders will automaticly get registered on load with the right setup ofcourse. Registering happens in the lua file itself, doesn't require xml settings. lua files can be deactivated by placing a '#' infront of the filename ex: '#positions.lua' it wont get loaded then. Currently it supports: -Actions -TalkActions -CreatureEvents -GlobalEvents -MoveEvents There is still stuff on the todo list but they'll get added sooner or later. Co-Authored-By: Sam <thesumm@users.noreply.github.com> cleanup on script.cpp removed using namespace for std / boost filesystem small fixes on movements & function additions Have to revert the function + callback for stepin/stepout & additem/removeitem as it doesn't make sense on the second look and might cause a stackoverflow I've also reworked the equip/dequip so it doesn't get double calls. It'll first check if functions return true if not it won't bother to read the callback accidently used an old spellbook.lua added :aid(ids) :uid(ids) functions for MoveEvents Monster handler & other stuff - MonsterType's can now be created through lua functions. - added an interface to create MonsterType's easily through lua files (register_monster_type.lua) - added #example.lua in 'scripts\monsters\' - renamed action vector functions for a better standard - renamed _lib folder to lib, this folder gets now loaded when the other lib folder gets loaded aswell - moved loading lua scripts out of the scriptfilemanager, we need to load everything after monsters etc. is loaded so MonsterType script manipulation does work - added Loot() & MonsterSpell() metatables small changes - added createFunctions(class) it virtually creates the get/set functions for the class passed on - 'events' folder in monsters is excluded from auto parsing files, as we load callbacks for specific monsters which have an eventFile set to 'true' or 'filename' in this folder. stripping path string added Game.createMonsterType(name) and small fixes - added Game.createMonsterType(name) - reworked MonsterType(name) to return nil if the MonsterType does not exist, so we don't suddenly create a MonsterType if we do not even want to. - changed reinterpret_cast to static_cast config.lua option for console - added an option to disable scripts console logging, it can be disabled by placing 'showScriptsLogInConsole = false' into config.lua
Wiki must be updated because these changes requires You should update Using talkaction |
creates a new folder called 'scripts' in the data folder.
lua files placed in the 'scripts' or sub folders will automaticly get registered on load with the right setup ofcourse.
Registering happens in the lua file itself, doesn't require xml settings.
lua files can be deactivated by placing a '#' infront of the filename ex: '#position.lua' it wont get loaded then.
It provides the normal lua interface error system
Currently supports:
For a longer explanation and examples #2555
Co-Authored-By: Sam thesumm@users.noreply.github.com