Commit Graph

1168 Commits

Author SHA1 Message Date
Gary Tierney b17ad487ab Add Jenkinsfile 2017-06-20 08:00:06 +01:00
Gary Tierney 97e85868ff Add support for asynchronous Mob actions
Adds asynchronous implementations of the Action and DistancedAction
classes, allowing plugins to make use of suspendable functions in Kotlin
instead of creating mini state machines to keep track of state.

The asynchronicity works by creating coroutine backed Channels for each
asynchronous action and having them listen on "pulse" events from the
action scheduler.  The action can then suspend execution until a pulse is
received or until some expensive operation has completed (i.e.,
pathfinding).

If an asynchronous action is still busy when a pulse arrives then the
number of missed pulses will be accumulated and sent to the action at
the next possible time.

The training dummy plugin has been updated to use asycnrhonous actions
as an example.
2017-06-20 07:31:07 +01:00
Gary Tierney 182de0330f Allow multiple players per test
Refactors the test helpers to use receiver functions so multiple players
can exist in the world per test case.  The AddFriendsTest is an example
of where this is needed.

Additionally, Hamcrest has been replaced with AssertJ for fluent
assertions.
2017-06-20 02:33:27 +01:00
Gary Tierney b532168551 Remove test context from plugin testing framework 2017-06-19 17:14:24 +01:00
Gary Tierney b536b2ed9d Add start of test framework for plugins
Adds a basic testing framework suitable for plugins that start simple
Actions for players, which can be expanded on in the future.  The
banking and training dummy tests have been updated to use this framework
and serve as samples.
2017-06-19 02:59:57 +01:00
Gary Tierney d0fec15a84 Add missing name normalization to lookup plugin 2017-06-18 21:45:52 +01:00
Gary Tierney f40a3a3a5d Update travis-ci configuration to cache build deps 2017-06-18 21:39:55 +01:00
Gary Tierney 1019cc8e6a Check for conflicting plugin names at build-time 2017-06-18 21:37:44 +01:00
Gary Tierney 3f714831c7 Make plugin classes dependant on scripts 2017-06-18 21:25:04 +01:00
Gary Tierney adaaae2129 Refactor the plugin compile task for performance
Integrates the plugin script compilation task with Gradle so we no
longer need to start a new instance of the JVM for each set of plugin
scripts that we want to compile.
2017-06-18 21:13:30 +01:00
Gary Tierney df305bd775 Merge pull request #340 from cubeee/kotlin-port/commands
Convert commands to Kotlin
2017-06-18 19:09:08 +01:00
Cube c082f407ad Add input type checking to commands 2017-06-16 23:10:07 +03:00
Cube 4ca8978ff3 Convert lookup commands to Kotlin 2017-06-16 23:10:07 +03:00
Cube 3616753d7f Convert npc spawn commands to Kotlin 2017-06-16 23:10:07 +03:00
Cube 4f45f5f1ff Convert experience commands to Kotlin 2017-06-16 23:10:07 +03:00
Cube 9f67c30893 Convert teleport commands to Kotlin 2017-06-16 23:10:06 +03:00
Cube 72c0be8ac6 Convert punishment commands to Kotlin 2017-06-16 23:10:06 +03:00
Cube 6db98406d5 Overload valid_arg_length 2017-06-16 23:10:06 +03:00
Cube 5ea52e00f0 Convert messaging commands to Kotlin 2017-06-16 23:08:55 +03:00
Cube 7df948e12f Convert ::item command to Kotlin 2017-06-16 23:04:28 +03:00
Cube b99ee9ba31 Convert ::animate command to Kotlin 2017-06-03 18:55:40 +03:00
Cube 8e8e2d0991 Simplify on_command arguments 2017-06-03 15:23:03 +03:00
Cube 30fc810d61 Add base for Kotlin commands 2017-06-03 15:17:46 +03:00
Gary Tierney ce3150082d Fix builds on other platforms (non-Unix) 2017-06-02 22:30:39 +01:00
Jesse 35ab034f3d Port location NPC spawns from Ruby to Kotlin 2017-06-01 23:43:48 +01:00
Jesse 8d00dcc7c8 Add height and direction params to npc_spawn 2017-06-01 23:23:49 +01:00
Gary Tierney 7ecc2e3158 Clean up plugin script compilation 2017-06-01 23:09:24 +01:00
Gary Tierney 42fdaee8b8 Make run task depend on plugin scripts 2017-06-01 22:47:50 +01:00
Gary Tierney eed32efcf9 Move stub.kt to main game module 2017-05-31 21:05:35 +01:00
Gary Tierney 258fc6c97b Add stub to plugin compile-time classpath 2017-05-31 10:55:12 +01:00
Gary Tierney 9353daabc3 Add plugin tests to the game build 2017-05-30 21:11:40 +01:00
Gary Tierney 3fb6d3f792 Treat each plugin as an individual source set
Adds separate build tasks for each plugin by auto-discovering plugin meta
files in the build script.  Each plugin will automatically have its
main sources and tests compiled, and then it's output added to the game
modules classpath.

This enables support for incremental compilation of scripts, as well as
unit testing using Gradle's test framework.
2017-05-30 21:06:37 +01:00
Major 57a648674f Fix contributing link 2017-05-29 09:14:26 +01:00
Gary Tierney 4ee123a59d Add private messaging plugin 2017-05-28 23:20:07 +01:00
Gary Tierney ad72036853 Add port of the 'dummys' plugin from Ruby 2017-05-28 23:09:36 +01:00
Gary Tierney 48e1726bc0 Remove 'world' object from global script scope 2017-05-28 23:07:05 +01:00
Gary Tierney 05e20d9d51 Reorganize project sources from src/main to src/main/java 2017-05-28 22:04:34 +01:00
Gary Tierney 7ffef28117 Compile plugins at build-time instead of runtime
Adds gradle tasks to build all plugin scripts under data/plugins with
the KotlinPluginCompiler implementation previously used for runtime code
generation.  In addition to .plugin.kts files, scripts can also declare
API code in .kt files which will also be included on the classpath and
made available to other plugins.
2017-05-28 01:43:35 +01:00
Gary Tierney 79f79cd15c Add a 'plugins' source set to the game module
Creates a new sourceset for server plugins to support IDE integration
with plugin code.  Additionally moves plugins to game/data/plugins and
contains some gradle related fixes (remove java plugin from root project
and fix exec task dependency).
2017-05-27 18:58:05 +01:00
Gary Tierney 3403c0a2d1 First draft of KotlinPluginEnvironment 2017-05-27 18:57:39 +01:00
Promises 3ae6a1b290 Use current_level in Magic plugin. (#320) 2017-05-27 17:54:14 +01:00
Major 0402c8310c Merge pull request #336 from Major-/daction
Make immutable DistancedAction fields visible to subclasses
2017-05-26 17:44:15 +01:00
Major 6bced4868f Make immutable DistancedAction fields visible to subclasses 2017-05-26 14:42:25 +01:00
Major 9bbfebcfb1 Merge pull request #334 from Major-/magic-npc
Register MagicOnNpcMessageDecoder in 317
2017-05-25 15:40:55 +01:00
Major 3c9b214134 Register MagicOnNpcMessageDecoder in 317 2017-05-25 15:39:52 +01:00
Gary Tierney 93df5c8546 Merge pull request #333 from Major-/hit-bug
Fix 317 HitUpdateBlock encoding
2017-05-25 15:32:27 +01:00
Lmctruck30 4802fba081 Fix 317 HitUpdateBlock encoding 2017-05-25 15:28:22 +01:00
Gary Tierney 7456a43e4f Merge pull request #332 from Major-/report
Add support for decoding Report Abuse messages
2017-05-25 15:23:15 +01:00
Lmctruck30 57680aec3e Add Report Abuse Message 2017-05-25 15:19:08 +01:00
Gary Tierney 85587bd9d1 Merge pull request #331 from Major-/npc-item
Add support for decoding Item on Npc messages
2017-05-25 15:15:17 +01:00