Jump to content

[MOD] Custom Craft Orders


Hammelpilaw

Recommended Posts

Custom Craft Orders

 

This mod is a resource for modders to add custom ship orders to the game. The new ship orders will be available in the order menu when interacting with a ship by pressing `F`.

 

Installation

Add the following lines to the very bottom of the file `data/scripts/entity/craftorders.lua`:

 

CraftOrders.removeSpecialOrders = removeSpecialOrders
CraftOrders.checkCaptain = checkCaptain
local status, CCO = pcall(require, 'mods.CustomCraftOrders.scripts.entity.craftorders')
if not status then print('Mod: CustomCraftOrders - failed to extend craftorders.lua!') print(CCO) end

 

Then copy the content of mods `Avorion` directory into your local `Avorion` directory.

 

Usage

Open the file `mods/CustomCraftOrders/config/CCOConfig.lua`. There are 3 tables to modify the game:

 

Config.Settings

Some mod settings only affecting this mod itself (not implemented yet).

Config.CustomOrders

Add informations about your custom script. The example in the config file will help you. The mod needs the following three informations for each order:

 

  • `title` - The ingame title of the mod. Do not translate yet, the mod will do it for you.
  • `mod` - The directory of your mod. When the path is `mods/YourMod` you have to set this to `YourMod`.
  • `fnc` - The function to execute the related order. Must start with CCO

Create your script containing functions to execute when the player presses an order button. The script name and path must be: `mods/YourMod/data/scripts/entity/craftorders.lua`. Do not forget the `data` subdirectory, watch FAQ for more information.

 

The content of this file could be something like (function name must match `Config.CustomOrders.fnc`):

   

function CCOYourExampleOrder ()
    -- Add custom order script to ship
    if onServer() then
        Entity():addScriptOnce("mods/YourMod/data/scripts/entity/ai/yourExampleOrder.lua")
    end

    -- Or do anything else... more docs coming soon
end

 

Scripts you add to the craft must be in the directory `mods/YourMod/data/scripts/entity/ai/`.

 

Always replace `YourMod` by the directory of your mod.

Config.DisabledOrders

You may want to disable some of the vanilla orders. May be useful when modifiying a vanilla order, you can create a new one and simply hide the vanilla one, so you must not modify any game file.

 

 

FAQ

Why must my order mod be in a data subdirectory (mods/YourMod/data)?

This is beacause some vanilla functions expect every order to be in a `data/scripts/entity/ai` subdirectory.

 

Are the new orders also available on map?

No, these orders are currently only available via ship interaction menu (F). (Watch roadmap)

 

 

Roadmap

  • Make orders available on map
  • Add order chain support
  • Implement sorting of orders in menu

Changelog

 

0.2.1

- Support Avorion 0.21.x

 

0.2.0

Initial release

 

CustomCraftOrders-0.2.0.zip

CustomCraftOrders-0.2.1.zip

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...