Commit Graph

126 Commits

Author SHA1 Message Date
Gary Tierney 5d77ed5e4b Remove plugin script stub 2018-03-27 22:35:12 +01:00
Gary Tierney d8116478d4 Remove dependency on embedded kotlin compiler
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.
2018-03-27 22:35:05 +01:00
Trevor Flynn 97896a34a4 Add implementation of runecrafting skill 2018-01-17 22:25:21 +00:00
Major cb9e6f353d Let plugins intercept Events
Support for PlayerEvents already exists, but general event
support wasn't included in the original KotlinPluginScript.
2017-09-24 18:13:17 +01:00
Major 52c25946b9 Add shops plugin
Thanks to tlf30 for a lot of work on this.
2017-09-23 04:12:08 +01:00
Gary Tierney 76dd8ba192 Refactor asynchronous actions to avoid thread usage
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.
2017-09-19 01:52:10 +01:00
Gary Tierney 169d89ffc0 Clear static object REMOVE messages when re-adding 2017-09-17 20:27:50 +01:00
Gary Tierney cf0e3331e0 Add API plugin with common functionality 2017-09-17 03:11:02 +01:00
Gary Tierney 3a9e435189 Add an await function to the AsyncActionRunner trait 2017-09-17 03:11:02 +01:00
Gary Tierney 36282cf81e Remove plugins.gradle and factor into common extension 2017-09-16 18:49:06 +01:00
Gary Tierney e605241893 Add on_button method to plugin scripts 2017-06-25 02:38:56 +01:00
Gary Tierney 9a8ed0d7a9 Port the walkto and following plugins to Kotlin 2017-06-24 18:24:13 +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 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
Cube 72c0be8ac6 Convert punishment commands to Kotlin 2017-06-16 23:10:06 +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
Gary Tierney eed32efcf9 Move stub.kt to main game module 2017-05-31 21:05:35 +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
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
Major 6bced4868f Make immutable DistancedAction fields visible to subclasses 2017-05-26 14:42:25 +01:00
Major 3c9b214134 Register MagicOnNpcMessageDecoder in 317 2017-05-25 15:39:52 +01:00
Lmctruck30 4802fba081 Fix 317 HitUpdateBlock encoding 2017-05-25 15:28:22 +01:00
Lmctruck30 57680aec3e Add Report Abuse Message 2017-05-25 15:19:08 +01:00
Lmctruck30 cb0d7e369a Add Item on Npc 2017-05-25 15:08:15 +01:00
Major f4c08995b5 Condense some unnecessarily-long variable names 2017-05-25 02:32:20 +01:00
Gary Tierney 0559c4093c Fix argument order of tile item message ctor call
Rearrange the arguments passed to the SendTileItemUpdateMessage
constructor when recording a ground item RegionUpdate.  Fixes #316.
2017-05-23 01:40:31 +01:00
Gary Tierney e5a6638e2f Add support for player / npc following
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.
2017-01-02 04:11:13 +00:00
Gary Tierney baa12ca446 Add a mob extension plugin for walking to entities
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.
2017-01-02 03:39:02 +00:00
Gary Tierney 6188c2e751 Add support for dynamic collision detection
This commit implements collision detection using the map files loaded
from the cache, and adds support for modifying the collision matrices at
runtime when the game world is updated.

All checks to see if a tile is reachable should now be done via.
World#traversable, instead of Region#traversable, as the World object
can handle checking tiles across multiple regions.  These are done for
the WalkingQueue and Pathfinder implementations.
2016-12-31 05:14:19 +00:00
Gary Tierney 0672fa2ea0 Fix bitwise negation in CollisionMatrix#clear()
Adds the missing bitwise AND to the clear() method in CollisionMatrix,
so any flags besides the one given are retained.
2016-12-31 02:09:42 +00:00
Gary Tierney 376d36871a Allow registering region listeners globally
Adds the ability to register region listeners with the
RegionRepository, which will register the listener with any existing
regions and cache it for any newly created regions later.
2016-12-31 02:09:42 +00:00
Gary Tierney 6a4625cb32 Refactor map loading code
Refactors the map file loading code by importing existing code from the
Vicis cache editor project.  Adds classes for decoding objects and tiles
for a given map file index. Only the new MapIndex decoder code is used
when loading GameObjects at the moment , which will later be updated.
2016-12-31 02:08:58 +00:00
AymericDu a8cada6f9e Template method on ChatMessage 2016-03-19 15:37:28 +01:00
Jesse Woolsey 6cf2fb0a5c Fix Distance check
Before:

http://recordit.co/qFCM2jaox2

After:

http://recordit.co/Jre4B5s1zT
2016-03-18 19:52:06 -04:00
Major a59bbe68f6 Merge pull request #252 from CharlesVaneenoo/RefactorHandle
refactor method handle in EquipItemHandler.java
2016-03-13 09:28:05 +00:00
Gary Tierney f2aced1bca Add support for projectiles
* Adds support for short-lived entities, which are never added to the
  entity sets of the region they belong in.

* Adds support for checking the number of tiles a Mob occupies.

* Adds a ProjectileBuilder class to simplify creating projectiles.
2016-03-11 20:03:33 +00:00
munggs 5aa7e0f90d Refactor add method in Inventory 2016-03-11 16:26:53 +01:00
Hequette Pierre 172e347912 refactor method handle in EquipItemHandler.java 2016-03-08 22:24:58 +01:00
CharlesVaneenoo 5fd8640d62 new PR after bad rebase 2016-02-26 21:25:20 +01:00
Jesse Woolsey ddaa505c6a * Fix Several Items that were glitched when worn.
* Fix items that were not able to be worn due to the name.
* Added prayer check in due to one of the items using it during 377
2016-02-15 21:47:25 -05:00
Major- d3c5417403 Fix #218 2016-02-15 17:32:00 +00:00
Jesse Woolsey fd855263a4 * Fix messages that were wrong 2016-02-15 09:23:51 -05:00
Jesse Woolsey 08d797d907 Fixed beards for helmets. 2016-02-14 20:59:22 -05:00