Modding: Difference between revisions

From APICO Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
 
(116 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div class="aw">
This is a WIP page that I'm using to document the game's modding API as I go


<div class="aw-panel">
Dictionary
Info here


<div class="aw-panel--left">
<div class="aw-code">{{Method|method=api_log|param1=mod_name|param2=func|param3=message|desc=this allows you to log a message directly to the Modding Console}}{{Parameter|param=mod_name|datatype=String|desc=the name of your mod, the same as your mod folder, i.e. "sample_mod"}}{{Parameter|param=func|datatype=String|desc=the name of the method calling this log, shown in the console}}{{Parameter|param=message|datatype=String|desc=the message to show in the console}}
<p>In APICO, you can add mods to expand your game and add new mechanics and features not available in the base game! If you're interested, you can even [[Modding Guide | start modding the game]] yourself!</p>
</div>
<p>Here you can find all the general information and resources around mods and modding.<br/>You can find a list of all mods on the [[Mod List]] page.</p>
</div>


<div class="aw-panel--right">
<h1></h1>
<div class="aw-info">
<p class="h"><i>Modding</i></p>
<p class="sh">Mods for APICO!</p>
</div>
</div>


</div>
<h2 class="aw-code--ref" id="api_define_item"><div class="aw-code"><span class="cx">@method</span> <span class="cf">api_define_item</span>(<span class="cp">mod_name</span>, <span class="cp">definition</span>, <span class="cp">sprite_image</span>)</div></h2>


<h1 id="Downloading Mods">[[File:Microscope_Item.png|32px]]Downloading Mods</h1>
<p>
<p>If you're playing APICO and want to download mods, you can do it right from inside the game! From the home screen you can click on "Mods" and the game will retrieve all the approved mods that are available. Once downloaded you can choose to activate or deactivate any of your mods before starting your game. Mods are not available in the [[Demo]].<br/><br/>[[File:Mods_Page_2.png|600px]]<br/><br/>You can also install mods not from the approved list by downloading them from the main [[Mod List]], and using the [[Mod Sideloading|Sideloader]].<br/><b>We cannot recommend these mods for security reasons so install unapproved mods at your own risk!</b></p>
This allows you to define a new item for the game and add it to the Dictionary.
<br/><br/>
This is needed before you can spawn the item in, add it to recipes, or use it with machines.
<br><br>
The sprite you use needs to be a 60x16px image within your mods resources, made up of 4 frames (normal, highlighted, undiscovered, undiscovered + highlighted). The sprite will be loaded virtually and used automatically when drawing your item.
<br/><br/>
Once you've created an item with this method you'll be able to access your sprite reference with <span class="aw-inline--code">TODO</span> if you need it during a custom draw call. You'll also be able to directly get the definition from the dictionary with <span class="aw-inline">TODO</span>
</p>


<h1 id="Creating Mods">[[File:Stone_Hammer_Item.png|32px]]Creating Mods</h1>
<div class="aw-code"><span class="cx">@parameter</span> <span class="cp">mod_name</span> <span class="cd">{String}</span> - the name of your mod, the same as your mod folder, i.e. "sample_mod"<br/><br/><span class="cx">@parameter</span> <span class="cp">definition</span> <span class="cd">{Table}</span> - the item definition with the following keys:<p><span class="ca">id</span> <span class="cd">{String}</span> - a unique identifier for the item. This will be prepended with "mod_name_" <span class="ce">[required]</span><br/><span class="ca">name</span> <span class="cd">{String}</span> - a name for the item that will be shown in tooltips <span class="ce">[required]</span><br/><span class="ca">category</span> <span class="cd">{String}</span> - a category for the item that will be shown in tooltips <span class="ce">[required]</span><br/><span class="ca">tooltip</span> <span class="cd">{String}</span> - a tooltip description for the item that will be shown in tooltips <span class="ce">[required]</span><br/><span class="ca">shop_buy</span> <span class="cd">{Decimal}</span> - a buying price for the item if this item was to be bought <span class="ce">[required]</span><br/><span class="ca">shop_sell</span> <span class="cd">{Decimal}</span> - a selling price for item if this item was to be sold <span class="ce">[required]</span><br/><span class="ca">shop_key</span> <span class="cd">{Boolean}</span> - whether this is a key item which means it can't be sold <span class="ce">[required]</span><br/><span class="ca">machines</span> <span class="cd">{Array}</span> - a list of machine IDs that this item can be used in, shown in tooltips<br/><span class="ca">durability</span> <span class="cd">{Integer}</span> - if this item is a tool that gets used up you can specify a total durability here<br/><span class="ca">singular</span> <span class="cd">{Boolean}</span> - if true then this item will not be able to be stacked<br/><span class="ca">placeable</span> <span class="cd">{Boolean}</span> - whether this item can be placed - if specified you must also give an "obj" key<br/><span class="ca">place_grass</span> <span class="cd">{Boolean}</span> - if placeable, this specifies the item can only be placed on grass only<br/><span class="ca">place_water</span> <span class="cd">{Boolean}</span> - if placeable, this specifies the item can be placed on shallow water<br/><span class="ca">place_deep</span> <span class="cd">{Boolean}</span> - if placeable, this specifies the item can be placed on deep water<br/><span class="ca">obj</span> <span class="cd">{String}</span> - if placeable, this specifies the object that will be created when the item is placed<br/><span class="ca">honeycore</span> <span class="cd">{Boolean}</span> - specifies whether this item will buy/sell for Honeycore instead of Rubees</p><br/><span class="cx">@parameter</span> <span class="cp">sprite_image</span> <span class="cd">{String}</span> - the path of the sprite to be used, relative to your mods' root folder<br/><br/><span class="cx">@return</span> <span class="cd">{String}</span> - either your new item's id (i.e. "sample_mod_item_name") or nil if there was an error</div>
<p>If you want to start creating mods, you can read our [[Modding Guide | Getting Started]] and get stuck in!<br/> To make your mod "official" you will need to upload it to [https://apico.mod.io/ mod.io] via our [https://apico-modloader.herokuapp.com/ APICO Modloader] tool and get it approved. Although players can choose to side-load APICO with any mod they download, they will get shown a warning around the mod when activated.</p>


<h1 id="Modding API">[[File:Book1_Item.png|32px]]Modding API</h1>
<p>If there are any errors while trying to define an item you'll see one of the following codes logged in the [[Modding Console]]</p>
<p>If you've read out [[Modding Guide | Getting Started]] guide and are eager to get modding, check out our [[Modding API | API Reference]] which details all API methods along with example LUA code for a bunch of different use-cases.</p>
<p>You can also check out our [https://github.com/APICO-Modders APICO Modders Github] for ideas and inspiration!</p>


</div>
<div class="aw-code"><span class="ce">Error: Missing Required Key (KEY)</span><br/>This means one of the required keys above was missing from your definition parameter<br/><span class="ce">Error: ID Already Defined</span><br/>This means the id key provided is already in the Dictionary, either it's already used or you defined the item twice.<br/><span class="ce">Error: Failed To Map Keys</span><br/>This means one of your keys couldn't be mapped properly - possible a null value.<br/><span class="ce">Error: Failed To Add Sprite</span><br/>This means your sprite couldn't be added, either an incorrect format or file not found</div>

Latest revision as of 07:27, 22 June 2022

In APICO, you can add mods to expand your game and add new mechanics and features not available in the base game! If you're interested, you can even start modding the game yourself!

Here you can find all the general information and resources around mods and modding.
You can find a list of all mods on the Mod List page.

Modding

Mods for APICO!

Downloading Mods

If you're playing APICO and want to download mods, you can do it right from inside the game! From the home screen you can click on "Mods" and the game will retrieve all the approved mods that are available. Once downloaded you can choose to activate or deactivate any of your mods before starting your game. Mods are not available in the Demo.



You can also install mods not from the approved list by downloading them from the main Mod List, and using the Sideloader.
We cannot recommend these mods for security reasons so install unapproved mods at your own risk!

Creating Mods

If you want to start creating mods, you can read our Getting Started and get stuck in!
To make your mod "official" you will need to upload it to mod.io via our APICO Modloader tool and get it approved. Although players can choose to side-load APICO with any mod they download, they will get shown a warning around the mod when activated.

Modding API

If you've read out Getting Started guide and are eager to get modding, check out our API Reference which details all API methods along with example LUA code for a bunch of different use-cases.

You can also check out our APICO Modders Github for ideas and inspiration!