Build 1.1.7 released!

Talk about creating mods for Druidstone here.

Moderator: Sir Tawmis

Post Reply
User avatar
petri
Posts: 117
Joined: Thu Apr 11, 2019 10:07 am

Build 1.1.7 released!

Post by petri » Wed Jun 19, 2019 2:54 pm

Changes in 1.1.7:
- Mod manager: implemented disabling/enabled mods
- Mod manager: visualize duplicated mods and mods with conflicting guids
- Added namespace system for avoiding conflicts with other mods and built-in assets (see testmod project for example)
- It's now possible to access global variables and functions defined in mod_main.lua (and imported scripts) from level scripts
- Bug fix: starting Deathtrap Dungeon mission crashes the game

*** IMPORTANT ***

Custom assets defined in mods should use a special namespace to avoid conflicts with other mods and built-in assets. For example, consider that two mods both define an object called "test_obj". When the object is used in scripts or placed in a level, the game would not know which of these two objects the name refers to. Therefore, asset names should be prefixed with an *unique namespace*. To make this easier to do (less typing) and less error prone build 1.1.7 adds support for a namespace system for mods.

The namespace of a mod should be the first thing in mod's mod_main.lua file. For example, the testmod in Github starts with:

Code: Select all

namespace "ctrl_alt_ninja_testmod"
All asset names start with a special "$mod" symbol which will be automatically converted to the namespace name. For example,

Code: Select all

def_object{
	name = "$mod.test_sphere",
	model = "mod_data/models/sphere.fbx",
}
When the mod is loaded into memory at startup, the name of the object will become "ctrl_alt_ninja_testmod". The "$mod" symbol works in level files, level scripts and other Lua files inside mods, as long as the namespace is defined in the mod_main.lua.

See the testmod project in Github for more examples.

Post Reply