WorldGen

From Vintage Story Wiki
Revision as of 00:17, 19 February 2017 by Chapp007 (talk | contribs) (→‎Intro)

Intro

We will be walking through how plug in and add your own features to the world generation code of Vintage Story by looking at a demo mod called VSTreasureChest. The code for this project can be found here [1] but we are going to walk through coding it from scratch.

VSTreasureChest

This mod places treasure chests around the world for the user to find. Each treasure chest has a random number of ingots in them. The mod only places treasure chests beside trees. It also adds a server command that can be run in the chat window called /treasure that places a treasure chest in front of the player. This can be useful for testing in case you want to change what items are in the chest and you don't want to bother looking for the chest for verification.


Getting started

Please follow the instructions <a href="http://wiki.vintagestory.at/index.php?title=Setting_up_a_dev_environment">here</a> for setting up your development environment. We named our project VSTreasureChest but you can choose any name you like.


The /treasure command

First we are going to add the /treasure command. TODO:


Hooking in to the world gen API

The IServerEventAPI has a method called ChunkColumnGeneration that allows you to pass a delegate just like we did for our /treasure command. However, the method signature for this is different. TODO: