forgottenserver/data/scripts/lib/defaults_move_event.lua
Mario Tettei 62dac47c01 revscriptsys (#2558)
* 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
2019-04-16 16:33:38 +02:00

25 lines
461 B
Lua

-- default callbacks
function defaultStepIn(creature, item, position, fromPosition)
return true
end
function defaultStepOut(creature, item, position, fromPosition)
return true
end
function defaultAddItem(moveitem, tileitem, pos)
return true
end
function defaultRemoveItem(moveitem, tileitem, pos)
return true
end
function defaultEquip(player, item, slot, isCheck)
return true
end
function defaultDeEquip(player, item, slot, isCheck)
return true
end