- Use base Google style
- Drop column limit override
- Format all files
- Use tabs for indentation
- Move system headers after project headers
- Avoid breaking string literals
- Reflow usage text
- Match breaks before braces and colons to previous style
- Reduce spaces before trailing comments
- Reflow comments and fix macro usage in luascript.cpp
- Fix invalid code
- Don't align newline escapes
- Reflow comment to make more sense
The server crashes when you reload the CreatureEvents module, this happens when you create an event, and then delete it, the server still tries to use the copy of this event, but the copy is invalid, because it was cleaned in the reload.
* CreatureEvent fix
- This fixes so when you try to register more than one creature event with the same name, that it throws an error warning instead of crashing the server.
* changed to direct emplace
- instead of find, we directly apply emplace and get it's boolean return value.
* rework on /reload
- reworked the /reload command, from now on it does reload everything regardless of what you want to reload, because if we don't reload the entire scripts folder alongside it might bug/crash.
You can however still use '/reload global' which will reload global.lua and scripts/lib/
- added 'showScriptsLogInConsole = true' to config.lua.dist. If that option is enabled it also shows on /reload that the scripts are reloaded aswell
- removed all deconstructor (__gc) functions for the events as they where the cause of the crash on reload.
- made raw 'event' pointers to std::unique pointers, so on release it doesn't crash the server.
- fixed a bug which stacked attacks/defenses/loot on reload which could lead to a crash aswell.
* updated reload.lua
- removed all the deprecated reload types.
* trailing line space
- remove a trailing line space
* removed stuff
- removed the unnecessary pointers and pushed them directly into the event type list
* rework on /reload
- reworked the /reload command, from now on it does reload everything regardless of what you want to reload, because if we don't reload the entire scripts folder alongside it might bug/crash.
You can however still use '/reload global' which will reload global.lua and scripts/lib/
- added 'showScriptsLogInConsole = true' to config.lua.dist. If that option is enabled it also shows on /reload that the scripts are reloaded aswell
- removed all deconstructor (__gc) functions for the events as they where the cause of the crash on reload.
- made raw 'event' pointers to std::unique pointers, so on release it doesn't crash the server.
- fixed a bug which stacked attacks/defenses/loot on reload which could lead to a crash aswell.
* another rework
- You can now again reload different types again like usual (/reload actions) etc.
- You can also use /reload scripts and /reload libs now
* forgot to include globalevent.cpp
* another rework
- You can now again reload different types again like usual (/reload actions) etc.
- You can also use /reload scripts and /reload libs now
* another addition
- added removing lua stuff before reloading for /reload all
* ranisalt's change request
- clear() functions are now all override final
- removed get/set for fromLua
- added reInitState function to BaseEvents
- made oldEvent a std::unique_ptr
* another rework
- You can now again reload different types again like usual (/reload actions) etc.
- You can also use /reload scripts and /reload libs now
another addition
- added removing lua stuff before reloading for /reload all
ranisalt's change request
- clear() functions are now all override final
- removed get/set for fromLua
- added reInitState function to BaseEvents
- made oldEvent a std::unique_ptr
* initial revscriptsys
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>
* compiler fixes
added boost-filesystem to appveyor.yml
fixed a few more compiler errors.
* cleanup on script.cpp
removed using namespace for std / boost filesystem
* some fixes
had to make adjustment so lua callbacks and xml settings work alongside and don't crash the server
* 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
* revert to 'using' functions and suggestion of Djarek
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>
* small fixes
removed commentary from movement.cpp
added newline for position.lua
reworked spellbook.lua with table.concat
* 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
* fix compiler error
* forgot to remove test code
removed test outfit from MonsterType
* 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.
* compiler error fix
* minor change on createFunctions
* 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
* initial revscriptsys
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
- Modernize constructors with pass-by-value + move
- Modernize loops to use new range-based loops
- Use auto where it improves code readability and maintainability
Replaced reinterpret_casts where the semantic meaning of the type
cast is satisfied by a static_cast (in other word where we cast
pointers/references to objects that are related).
This commit breaks backwards compatibility with breakchance and
ammoaction in items.xml and also certain global event names. Break
chance and action for weapons are now specified in weapons.xml and can
be applied to any weapon. This commit also removes the config option
"removeAmmoWhenUsingDistanceWeapon" as there were issues with that and
it is preferred that end-users configure actions for their weapons
(which provides better customizability) instead of having a global
variable that toggles it for every weapon.
Closes#1125
You can now access Creature & Item userdata with these keys, "itemid",
"uid", "actionid" and "type".
Item.transform should not debug the client when setting the id to 0, it
does nothing in that case now.
This is a breaking change, and I think it's safe to assume that most NPC
scripts are broken and the NPC system needs a rewrite/some backwards
compatibility patch to pass id's instead of userdata to callbacks.
The event name in creatures.xml also changed from:
changehealth and changemana to healthchange and manachange
If you were utilizing any of these creature events, you must update
their names for them to function.
Added ItemType.usesSlot to global.lua, now the slot constants actually
have a use.
Changed onChangeHealth & onChangeMana to be more flexible.
Added table.create & Item.hasProperty.
Made Game::combatChangeHealth & combatChangeMana a bit faster.