Updates the testing infrastructure to use the latest relesae of junit and
leverages the new extension mechanism to create an easy to use testing
framework. Also adds additional test coverage for several plugins.
Removes the dependency on legacy script compilation and now relies on script
discovery. In addition, the Gradle build scripts were refactored and updated
to be compatible with Gradle 5.0 and make use of the new java-library
configurations.
Adds named arguments to enum declarations along with lookup functions, fixes
continuation indent, and replaces Map<Player, ArrayList<Prayer>> with a
SetMultimap<Player, Prayer>.
This is a large change that significantly simplifies the plugin build system by
having the kotlinc handle everything related to script compilation. Since we
no longer use package name rewriting, the "packageName" option has been dropped
from the gradle script API and has been removed from existing plugins.
In addition to simplifying the build system, it should also significantly speed
up build times. Previously we ran 2 build processes for every plugin and
didn't have fully working incremental compilation for scripts compared to 1
build process with built-in incremental compilation.
There were also some random pieces of code that referenced kotlinc directly, so
those have either been removed or refactored out.
Adds custom coroutines specifically for use within Actions. This
implements all features of the previous system, however, does not rely
on a separate executor to wake up continuations.
Note: since Actions are still ran by an executor and a small chance of
overlap exists the ActionCoroutine implementation uses atomic counters
and references.
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.
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.
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.
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.
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.
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.
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).
Ports the Maven build POMs to Gradle build scripts, which are a bit
friendlier to use. Instead of using the exec:java Maven goal to run the
server now, the gradle run task should be used.
Implements a new MobExtension plugin which adds 'follow', and 'chase'
mixins that allow the mob to follow behind another mob, and chase them
while keeping at a safe distance to fire projectiles. Also adds a new
public method 'raycast' to CollisionManager, for drawing a line through
the world using bresenham's line algorithm whille checking for any impenetrable
objects.
Adds a new mob extension plugin which creates a walk_to() method on
Mobs to allow walking to another entity (accounting for the size of the
entity) with an optional facing position.
Adds a mob-extension plugin, which allows creating modules as mixins to
be monkey-patched into the Mob class. Having a standard method of doing
this prevents confusing problems with mixin name conflicts, by allowing
the plugin to raise an error that 2 mixins with the same name exist.
Adds tests for the CollisionManager which makes sure that collision
matrices are correctly built for the following object types:
* Interactables
* Walls
* Corners
Missing from these tests are tests for blocked / bridged tiles, and
large corner walls, which can be added later. Additionally, the test
cases include ASCII illustrations of the collision grid and how it is
built / checked for a particular object or movement.