Age | Commit message (Collapse) | Author | Files | Lines |
|
This introduces two callbacks:
- on_update_derived_attribute -> Called to recalculate other derived
attributes.
- on_recalculate_base_attribute -> Called to recalculate a base attribute
(only called for characters. However the
function passed as callback can be useful
for recalculating the derived attributes
as well)
Monsters no longer block recalculation of attributes except HP and Speed.
I saw no sense to keep this.
Fixed constant value in libmana-constants.lua
Dropped bool type of the recalculation functions. It would be difficult to
keep it while pushing all to the script engine and it was unused anyway.
All in all this adds a LOT more flexibillity to projects since they can now
adapt all attributes in the way they want.
|
|
Previously each map had its own scope. They got merged now but the atinit
function was forgotten to adapt.
Reviewed-by: bjorn.
|
|
This was due to a naming conflict between the 'debug' function I had recently
introduced and the 'debug' library provided by Lua. This caused problems when
trying to use debug.traceback for printing a backtrace of the error.
There's multiple ways to avoid the naming conflict. I opted for writing the
related helper functions in all-caps.
Also added an ERROR log function now. As Erik pointed out, there is no conflict
anymore with Lua's 'error' function with the new naming style.
Reviewed-by: Erik Schilling
|
|
Reviewed-by: bjorn.
|
|
Global functions 'warn', 'info', 'debug' as shortcuts to the respective
'log' call, which also support passing multiple parameters at the same
time, which will be separated by spaces.
Global tables 'map' and 'world' which provide convenient read/write
access to map and world state variables.
Reviewed-by: Yohann Ferreira
|
|
Scripts mostly execute the Mana script API, and it seems like just
unnecessary verbosity to refer to the 'mana' table all the time. This table
no longer exists now.
Reviewed-by: Erik Schilling
|
|
When creating an NPC, you now provide its optional talk and update functions
directly rather than them being stored in a table on the Lua side and then
called in response to a global callback.
Also fixed an issue with a missing gender parameter to the delayed NPC
creation callback used by NPCs defined on the map (found by Erik while
reviewing this patch).
Reviewed-by: Erik Schilling
|
|
Reviewed-by: Erik Schilling
|
|
Reviewed-by: bjorn.
|
|
Rather than wrapping NPC functions up in coroutines in the Lua side, they
are now managed on the C++ side as "script threads", which are essentially
the same thing.
The main purpose is that the server can now know whether any of these long
running script interactions are still active, which will probably be useful
when adding the ability to reload scripts.
Reviewed-by: Erik Schilling
|
|
mana.map_get_pvp() now returns one of the constants in libmana-constants.lua
Reviewed-by: Bertram.
|
|
We have to be careful with introducing globals now that there is only a
single Lua state, so we shouldn't use globals unnecessarily. Any variable
should be declared 'local' unless there is a reason to make it global.
For additional safety we can also think about disallowing the use of globals
entirely. This also helps to catch typos in scripts.
Reviewed-by: Erik Schilling
|
|
Reviewed-by: bjorn.
|
|
This includes the quest reply, post reply, death notification and
remove notification.
Also, Script::Ref was changed from a typedef to a small class,
automating initialization and making the check for validness clearer.
Reviewed-by: Erik Schilling
|
|
No more Lua state for each status effect, monster, item effect or map. All
scripts are loaded into the same state. This should be more efficient overall
and make it easier to implement dynamic reloading of the scripts in the
future.
Now, this introduces the problem of name collisions between different Lua
scripts. For now this is solved by using more specific function names, like
'tick_plague' and 'tick_jump' rather than just 'tick'. The plan is however
to get rid of these globals, and register these callbacks from the script,
so that they can be local functions without the danger of colliding with
other scripts.
Reviewed-by: Erik Schilling
Reviewed-by: Yohann Ferreira
|
|
Reviewed-by: o11c, bjorn, Bertram.
|
|
Reviewed-by: Bertram.
|
|
Reviewed-by: o11c.
|
|
You can now call mana.log(loglevel, message) to log messages with scripts.
For loglevel you can use the new constants defined in
libmana-constants.lua
Resolves: Mana-Mantis #359
|
|
|
|
Reviewed-by: Thorbjorn.
|
|
An misleading error was raised when the function dealt
with its last remaining job as it didn't return after removing it.
Reviewed-by: Ablu.
|
|
Reviewed-by: Ablu, Freeyorp.
|
|
Reviewed-by: Freeyorp.
|
|
Trivial.
|
|
The function is named mana.chr_get_gender. It returns 0 for male
and 1 for female. libmana-constants.lua defines the variables
GENDER_MALE and GENDER_FEMALE with these values. Also made the
banker NPC refer to the gender of the player character.
Reviewed-by: Jaxad0127
|
|
The dummy data is currently mostly empty data though, so still nothing
to see as far as the example content is concerned.
Reviewed-by: Bertram
|